1

I installed the docker-engine in macOS from
https://docs.docker.com/desktop/install/mac-install/
which says,

The Docker Desktop installation includes Docker Engine, Docker CLI client, Docker Compose, Notary, Kubernetes, and Credential Helper.

But when using docker-compose, I'm getting:

docker: 'compose' is not a docker command.

What's wrong please?

Full log:

$ /Applications/Docker.app/Contents/Resources/bin/docker -v
Docker version 24.0.7, build afdd53b

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

$ sw_vers
ProductName:            macOS
ProductVersion:         14.2.1
BuildVersion:           23C71

UPDATE:

It's an invalid question -- the problem is else where:

$ type docker
docker is /usr/local/bin/docker

$ ls -l /usr/local/bin/docker*
ls: cannot read symbolic link '/usr/local/bin/docker': Permission denied
ls: cannot read symbolic link '/usr/local/bin/docker-credential-desktop': Permission denied
ls: cannot read symbolic link '/usr/local/bin/docker-credential-ecr-login': Permission denied
ls: cannot read symbolic link '/usr/local/bin/docker-credential-osxkeychain': Permission denied
ls: cannot read symbolic link '/usr/local/bin/docker-index': Permission denied
lrwxr-x--x 1 root wheel 54 Feb  2 13:46 /usr/local/bin/docker
lrwxr-x--x 1 root wheel 73 Feb  2 13:46 /usr/local/bin/docker-credential-desktop
lrwxr-x--x 1 root wheel 75 Feb  2 13:46 /usr/local/bin/docker-credential-ecr-login
lrwxr-x--x 1 root wheel 77 Feb  2 13:46 /usr/local/bin/docker-credential-osxkeychain
lrwxr-x--x 1 root wheel 60 Feb  2 13:46 /usr/local/bin/docker-index

I.e., I symlink docker apps into /usr/local/bin/ but somehow they failed:

$ sudo rm /usr/local/bin/docker*

$ ls -l /usr/local/bin/docker*
ls: cannot access '/usr/local/bin/docker*': No such file or directory

$ sudo ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin

$ ls -l /usr/local/bin/docker*
ls: cannot read symbolic link '/usr/local/bin/docker': Permission denied
lrwxr-x--x 1 root wheel 54 Feb  3 15:09 /usr/local/bin/docker

However, I don't know how, but after I tried it several times, it is suddenly working:

$ ls -l /usr/local/bin/docker*
lrwxr-xr-x 1 root wheel 54 Feb  3 15:15 /usr/local/bin/docker -> /Applications/Docker.app/Contents/Resources/bin/docker
lrwxr-xr-x 1 root wheel 62 Feb  3 15:15 /usr/local/bin/docker-compose -> /Applications/Docker.app/Contents/Resources/bin/docker-compose
lrwxr-xr-x 1 root wheel 73 Feb  3 15:15 /usr/local/bin/docker-credential-desktop -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-desktop
lrwxr-xr-x 1 root wheel 75 Feb  3 15:15 /usr/local/bin/docker-credential-ecr-login -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-ecr-login
lrwxr-xr-x 1 root wheel 77 Feb  3 15:15 /usr/local/bin/docker-credential-osxkeychain -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-osxkeychain
lrwxr-xr-x 1 root wheel 60 Feb  3 15:15 /usr/local/bin/docker-index -> /Applications/Docker.app/Contents/Resources/bin/docker-index

$ docker-compose -v
Docker Compose version v2.23.3-desktop.2

I don't know why it didn't work and, I don't know how it works again, so I'm accepting whatever answer I have and move on.

4
  • Instead of editing the question, can you please add the solution as an answer and upvote/accept it?
    – nohillside
    Feb 3 at 20:35
  • It's an invalid question @nohillside, my update is not the solution but an explanation why it is, moreover, as put into the update, "I don't know why it didn't work and, I don't know how it works again", i.e., all in all, there is no solution.
    – xpt
    Feb 3 at 22:11
  • There are no invalid questions ;-) Even if your solution has some gaps, it may help future visitors. But it would be easier to find if you post it as an answer.
    – nohillside
    Feb 4 at 8:59
  • PS: You could even turn it into a full answer by describing how /usr/local/bin must look and how to fix a botched docker install.
    – nohillside
    Feb 4 at 9:00

3 Answers 3

2

Installing "Docker Desktop" adds the CLI commands to /usr/local/bin, so you should never need to call the binaries in /Applications/Docker.app/Contents/Resources/bin directly.

$ ls -l /usr/local/bin/docker*
lrwxr-xr-x  1 root  admin  54 Feb  6  2022 /usr/local/bin/docker@ -> /Applications/Docker.app/Contents/Resources/bin/docker
lrwxr-xr-x  1 root  admin  62 Feb  6  2022 /usr/local/bin/docker-compose@ -> /Applications/Docker.app/Contents/Resources/bin/docker-compose
lrwxr-xr-x  1 root  admin  80 Feb  6  2022 /usr/local/bin/docker-compose-v1@ -> /Applications/Docker.app/Contents/Resources/bin/docker-compose-v1/docker-compose
lrwxr-xr-x  1 root  admin  73 Feb  6  2022 /usr/local/bin/docker-credential-desktop@ -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-desktop
lrwxr-xr-x  1 root  admin  75 Feb  6  2022 /usr/local/bin/docker-credential-ecr-login@ -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-ecr-login
lrwxr-xr-x  1 root  admin  77 Feb  6  2022 /usr/local/bin/docker-credential-osxkeychain@ -> /Applications/Docker.app/Contents/Resources/bin/docker-credential-osxkeychain

If docker-compose fails as in the question, you can verify the actual commands called with type docker and type docker-compose, and the existance of the symlinks with ls -l /usr/local/bin/docker*.

If something seems off, you can then either delete and reinstall "Docker Desktop" or run sudo ln -fs /Applications/Docker.app/Contents/Resources/bin/* /usr/local/bin/ to fix the symlinks.

2

It appears your syntax is incorrect, as the "-" between "docker" and "compose" is not correct. Try:

~ ➤ docker compose version
Docker Compose version v2.24.3-desktop.1

The help command shows Usage: docker [OPTIONS] COMMAND.

-2
  1. check your docker-compose installed correctly with: docker-compose version

  2. if you install it correctly, check if docker daemon is running

1
  • 3
    The user gets an error message running docker-compose
    – nohillside
    Apr 17 at 5:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .