Merge pull request #946 from tonistiigi/arm64-detect

binfmt_misc: detect arm64 properly
docker-19.03
Tibor Vass 2019-04-18 20:16:04 -07:00 committed by GitHub
commit 6085a25a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,7 @@ var arr []string
func SupportedPlatforms() []string { func SupportedPlatforms() []string {
once.Do(func() { once.Do(func() {
def := platforms.DefaultString() def := defaultPlatform()
arr = append(arr, def) arr = append(arr, def)
if p := "linux/amd64"; def != p && amd64Supported() == nil { if p := "linux/amd64"; def != p && amd64Supported() == nil {
arr = append(arr, p) arr = append(arr, p)
@ -34,7 +34,7 @@ func SupportedPlatforms() []string {
//the end user could fix the issue based on those warning, and thus no need to drop //the end user could fix the issue based on those warning, and thus no need to drop
//the platform from the candidates. //the platform from the candidates.
func WarnIfUnsupported(pfs []string) { func WarnIfUnsupported(pfs []string) {
def := platforms.DefaultString() def := defaultPlatform()
for _, p := range pfs { for _, p := range pfs {
if p != def { if p != def {
if p == "linux/amd64" { if p == "linux/amd64" {
@ -56,6 +56,10 @@ func WarnIfUnsupported(pfs []string) {
} }
} }
func defaultPlatform() string {
return platforms.Format(platforms.Normalize(platforms.DefaultSpec()))
}
func printPlatfromWarning(p string, err error) { func printPlatfromWarning(p string, err error) {
if strings.Contains(err.Error(), "exec format error") { if strings.Contains(err.Error(), "exec format error") {
logrus.Warnf("platform %s cannot pass the validation, kernel support for miscellaneous binary may have not enabled.", p) logrus.Warnf("platform %s cannot pass the validation, kernel support for miscellaneous binary may have not enabled.", p)