Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCKER_DEFAULT_PLATFORM not working for docker compose #9889

Closed
userlerueda opened this issue Sep 29, 2022 · 8 comments · Fixed by #9999
Closed

DOCKER_DEFAULT_PLATFORM not working for docker compose #9889

userlerueda opened this issue Sep 29, 2022 · 8 comments · Fixed by #9999
Assignees

Comments

@userlerueda
Copy link

Description

DOKCER_DEFAULT_PLATFORM is being ignored by the docker compose command.

Steps to reproduce the issue:

  1. DOCKER_DEFAULT_PLATFORM=linux/amd64 docker compose up --build
  2. Observe the error

Describe the results you received:

docker-compose up --build                                                                                                                                  
[+] Running 0/1
 ⠇ db Pulling                                                                                                                                                                                                 3.8s
no matching manifest for linux/arm64/v8 in the manifest list entries

Describe the results you expected:

The image should be pulled like it is done, for instance with a docker pull mysql:5.7

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.10.2

I installed docker-compose v2.11.2 also, but it only replaces the version for docker-compose -v

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.10.2)
  extension: Manages Docker extensions (Docker Inc., v0.2.9)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.19.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 63
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.124-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 5
 Total Memory: 5.785GiB
 Name: docker-desktop
 ID: DLSG:X5DC:AYNC:RWO6:XDP5:GCNB:PY32:MLOF:IMN2:S5BR:PP3C:G55Q
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 51
  Goroutines: 56
  System Time: 2022-09-29T23:21:25.49214843Z
  EventsListeners: 6
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false 

Additional environment details:

@laurazard
Copy link
Contributor

laurazard commented Sep 29, 2022

Hiya @userlerueda, thanks for the report. I believe this was addressed in #9854, could you try this again with the latest release (v2.11.2) and confirm it's still an issue?

@laurazard laurazard self-assigned this Sep 29, 2022
@userlerueda
Copy link
Author

We tried, but how do we replace the docker compose command? It comes as part of Docker Desktop.

@jaileon
Copy link

jaileon commented Sep 29, 2022

$ docker-compose -v
Docker Compose version v2.11.2

$ DOCKER_DEFAULT_PLATFORM=linux/amd64 docker-compose up --build
[+] Running 0/1
⠸ db Pulling
no matching manifest for linux/arm64/v8 in the manifest list entries

@glours
Copy link
Contributor

glours commented Sep 30, 2022

@userlerueda @jaileon can you provide a compose file to reproduce the issue please? What happens if you use the one defined in this issue?

@userlerueda
Copy link
Author

Hi @glours, @jaileon will send the one we are using. Looking at the one in #9853 I see they are setting the platform. Our intention is exactly not to set the platform in the docker-compose.yml file but leave it default, and set the DOCKER_DEFAULT_PLATFORM variable for people using macs with Apple Silicon chip which will by default try to pull arm image.

@jaileon
Copy link

jaileon commented Sep 30, 2022

Hi @glours, following the compose file content:

services:
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: "db"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "pass"
      MYSQL_ROOT_PASSWORD: "password"

The command executed:

$ DOCKER_DEFAULT_PLATFORM=linux/amd64 docker-compose up --build          
[+] Running 0/1
 ⠏ db Pulling                                                                                                              
no matching manifest for linux/arm64/v8 in the manifest list entries

Using docker pull command to download the same image:

$ DOCKER_DEFAULT_PLATFORM=linux/amd64 docker pull mysql:5.7       
5.7: Pulling from library/mysql
a2a00260331c: Pull complete 
6d8167f2fcbe: Pull complete 
32454e9854ca: Pull complete 
473e2917b0d5: Pull complete 
5173f8104ec8: Pull complete 
32e218351f9a: Pull complete 
fc9e1a82359a: Pull complete 
c602a3ea2ce7: Pull complete 
3c9ea9927039: Pull complete 
dfb1b236c7fc: Pull complete 
e2ad62bd72a7: Pull complete 
Digest: sha256:94fe67a04001e9841f68f114c8e9b5231c1d012e6b00d3b8ade42c0c5e239a0f
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7

@jean-pasqualini
Copy link

Hi @glours, I have the same problem. Is this issue planned to be fixed 😀 ?
Docker desktop
macOS Monterey 12.6.1
MacBook Air (M1, 2020)
docker-compose version v2.12.1

Client:
Cloud integration: v1.0.29
Version: 20.10.20
API version: 1.41
Go version: go1.18.7
Git commit: 9fdeb9c
Built: Tue Oct 18 18:20:35 2022
OS/Arch: darwin/arm64
Context: default
Experimental: true

Server: Docker Desktop 4.13.1 (90346)
Engine:
Version: 20.10.20
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 03df974
Built: Tue Oct 18 18:18:16 2022
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

@yellowsoar
Copy link

Well, for anyone who is stuck here, try this to see if it's the right architecture.

docker image inspect mysql:5.7 | grep -i Architecture

If it's not, then rmi and re-pull with DOCKER_DEFAULT_PLATFORM=linux/amd64

docker rmi mysql:5.7 && DOCKER_DEFAULT_PLATFORM=linux/amd64 docker pull mysql:5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants