Skip to content

[BUG] 'compose' is not a docker command. #6932

@ryanlambert-wk

Description

@ryanlambert-wk

Description

After fresh install of Docker Desktop (either via .dmg or homebrew cask) attempting to use docker-compose or docker compose results in the following error.

% docker-compose
docker: 'compose' is not a docker command.
See 'docker --help'

% docker compose
docker: 'compose' is not a docker command.
See 'docker --help'

It seems that the application installs to the /Applications/Docker.app/Contents/Resources/bin/ directory then creates symlinks to the appropriate binaries in /usr/local/bin (seen below).

lrwxr-xr-x@  1 root  wheel      54 Jul  2 17:14 docker -> /Applications/Docker.app/Contents/Resources/bin/docker
lrwxr-xr-x@  1 root  wheel      62 Jul  2 18:32 docker-compose -> /Applications/Docker.app/Contents/Resources/bin/docker-compose
lrwxr-xr-x@  1 root  wheel      80 Jul  2 17:14 docker-compose-v1 -> /Applications/Docker.app/Contents/Resources/bin/docker-compose-v1/docker-compose

The docker and docker-compose-v1 commands seem to work fine as seen below:

 % which docker-compose-v1
/usr/local/bin//docker-compose-v1

% /Applications/Docker.app/Contents/Resources/bin/docker-compose-v1/docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020

 % docker-compose-v1
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [--profile <name>...] [options] [--] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  --profile NAME              Specify a profile to enable
  -c, --context NAME          Specify a context name
        ... truncated ...

However, even when going directly to the source binary, docker-compose doesn't seem to work. which shows the correct location of the symlink to the binary, but the binary itself seems non-functional. Instead, the functional v2 binary seems to now exist in ~/.docker/cli-plugins/ by default.

% which docker-compose
/usr/local/bin//docker-compose

% /Applications/Docker.app/Contents/Resources/bin/docker-compose
docker: 'compose' is not a docker command.
See 'docker --help'

% ~/.docker/cli-plugins/docker-compose version
Docker Compose version v2.19.0

% ~/.docker/cli-plugins/docker-compose        

Usage:  docker compose [OPTIONS] COMMAND

Define and run multi-container applications with Docker.
     ... truncated ...

I can fix this issue by running the following commands to replace the broken symlink.

sudo rm /usr/local/bin/docker-compose
sudo ln -s ~/.docker/cli-plugins/docker-compose /usr/local/bin/docker-compose

While this works, it unfortunately causes docker to complain about modified configurations, and if at any point you select Re-apply configurations it will reset the symlink to point to the non-functioning binary.
image

Steps To Reproduce

  1. Install the apple silicon version of docker desktop on an M2 Max MacBook Pro running macOS Ventura 13.4.1.
  2. Attempt to use the docker-compose command.

Compose Version

% docker-compose version
docker: 'compose' is not a docker command.
See 'docker --help'

% ~/.docker/cli-plugins/docker-compose version
Docker Compose version v2.19.0

Docker Environment

% docker info
Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
WARNING: Plugin "/Users/ryanlambert/.wk/config/docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /Users/ryanlambert/.wk/config/docker/cli-plugins/docker-compose: exec format error

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 8
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  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 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 6
 Total Memory: 7.667GiB
 Name: docker-desktop
 ID: 5346f842-3a33-43f2-a6e2-b4b7dde691be
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

OS Version: macOS Ventura 13.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions