docker / volumes-backup-extension

Back up, clone, restore, and share Docker volumes effortlessly.
Apache License 2.0
87 stars 19 forks source link

MacOS export to import on Linux needs `--platform linux/amd64` #105

Open IORoot opened 1 year ago

IORoot commented 1 year ago

Describe the bug I've exported a backup to my repository (to keep a version-history of data) on dockerhub successfully from a MacOS laptop . I'm now pulling that image down onto a production linux machine (that doesn't have docker-desktop) via a docker pull. I was going to use Bret's vackup tool at this point to get the data into a volume on the linux machine. Unfortunately, I can't access the image that I've pulled because the Mac has built the image as platform linux/arm64/v8 and the linux machine is expecting linux/arm64.

I've tried to set the DOCKER_DEFAULT_PLATFORM=linux/amd64 environment variable, but docker desktop or the plugin doesn't seem to read that.

Is there a way to build the image with a --platform linux/amd64 or docker buildx build --platform linux/amd64 to enable compatibility between hosts?

The error:

# on target linux host
docker pull username/image_1
docker run -it username/image_1

WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
exec /bin/sh: exec format error

or

docker run --platform linux/amd64 -it username/image_1 /bin/sh 
Unable to find image 'username/image_1:latest' locally
latest: Pulling from username/image_1
Digest: sha256:d43c98efcb5429dff9f8053bd43eff6ce2c2710b73978da28c72bf49aae7a3de
Status: Image is up to date for username/image_1:latest
WARNING: image with reference username/image_1 was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8
docker: Error response from daemon: image with reference username/image_1 was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8.
See 'docker run --help'.

Describe the expected behavior Expect the volume to be readable on a linux host, when the backup is made from a MacOS host.

Output of docker extension version:

docker extension version
Client Version: v0.2.16
Server API Version: 0.3.0

Output of docker version:

Client:
 Cloud integration: v1.0.29
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:18 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.15.0 (93002)
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:41 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.10
  GitCommit:        770bd0108c32f3fb5c73ae1264f7e503fe7b2661
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
felipecruz91 commented 1 year ago

Hi @IORoot, thank you very much for opening this issue. As of today, the extension will push the volume to Hub in the shape of an image whose platform matches the host's platform.

I'll discuss this with the team internally and will come back to you.