Skip to content

docker image import does not seem to respect --platform #6361

Closed
@mikesep

Description

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

When using docker image import --platform, I expect the resulting image to be of the specified platform.

Actual behavior

docker image import seems to always produce an image with the architecture of the platform. On an Intel MacBook, I get Architecture: amd64; on an Apple Silicon MacBook, I get Architecture: arm64.

Information / Steps to reproduce the behavior

Here's a simple test script to reproduce the issue:

#!/bin/sh

set -eux

docker version

echo hello > hello
tar -cf filesystem.tar hello

for arch in arm64 amd64 ; do
  docker image import --platform linux/$arch filesystem.tar import_test:$arch
  docker image inspect --format '{{.Architecture}}' import_test:$arch
done

Resulting output on my primary machine:

$ ls
TEST*

$ ./TEST
+ docker version
Client:
 Cloud integration: v1.0.25
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:20:34 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.9.0 (80466)
 Engine:
  Version:          20.10.16
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.10
  Git commit:       f756502
  Built:            Thu May 12 09:14:19 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
+ echo hello
+ tar -cf filesystem.tar hello
+ for arch in arm64 amd64
+ docker image import --platform linux/arm64 filesystem.tar import_test:arm64
sha256:34ac07c56e0cc823a2879f046bdbae96ea53c5ec24e9587c49b22754ff3c9de5
+ docker image inspect --format '{{.Architecture}}' import_test:arm64
arm64
+ for arch in arm64 amd64
+ docker image import --platform linux/amd64 filesystem.tar import_test:amd64
sha256:7fc985350d8e38a7a8834ec212aae1eb993bfcce9f66bca414c457212cdc4241
+ docker image inspect --format '{{.Architecture}}' import_test:amd64
arm64

Using Docker Desktop 4.9.0 (80466) or Docker Desktop 4.8.2 (79419) on an Apple Silicon system (OS/Arch: linux/arm64) gives me two arm64 images. Using Docker Desktop 4.6.1 (76265) on a Intel system (OS/Arch: linux/amd64) gives me two amd64 images. (I haven't tried newer Docker Desktop versions on Intel, but I can if needed).

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

$ /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0031: does the Docker API work?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0001: is the application running?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0017: can a VM be started?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0007: is the backend responding?
[PASS] DD0014: are the backend processes running?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0012: is the VM networking working?
[PASS] DD0032: do Docker networks overlap with host IPs?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0019: is the com.docker.vmnetd process responding?
[PASS] DD0033: does the host have Internet access?
No fatal errors detected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions