Here's how you do it.
If you can use Homebrew, do
Copybrew install docker-compose
and pay heed to the notes after the installer runs. They tell you to add
Copy "cliPluginsExtraDirs": [
"/opt/homebrew/lib/docker/cli-plugins"
]
to your ~/.docker/config.json file.
I don't know if Homebrew also installs Credentials Helper with Compose, so you might have to do:
Copybrew install docker-credential-helper
If you can't use Homebrew, I think you'll have to do the following.
Install Credentials Helper using Docker's instructions here.
Go into ~/.docker/config.json and make sure the value for credsStore is osxkeychain. My file looks like:
Copy{
"auths": {},
"credsStore": "osxkeychain",
"currentContext": "colima",
"plugins": {
"debug": {
"hooks": "exec"
},
"scout": {
"hooks": "pull,buildx build"
}
},
"features": {
"hooks": "true"
}
}
Download latest Docker Compose from here for your architecture (aarch64 for Apple Silicon): https://github.com/docker/compose/releases/latest
Copy the executable to /usr/local/bin, naming it docker-compose.
From there, make sure it's executable:
Copysudo chmod +x docker-compose
Clear Apple's scareware:
Copysudo xattr -d com.apple.quarantine docker-compose
As in the Homebrew case, add
Copy "cliPluginsExtraDirs": [
"/opt/homebrew/lib/docker/cli-plugins"
]
to your ~/.docker/config.json file.
Open a new terminal session and try
Copydocker compose version
If that doesn't work, try
Copydocker-compose version
If that works, the cliPluginsExtraDirs entry in the config.json file isn't working.
How to install docker-engine in macOS without docker desktop? - Unix & Linux Stack Exchange
Docker for Mac Without Docker Desktop
[MacOS] Can I get away with just docker CLI and Docker-compose CLI?
macos - docker-compose command not available for mac - Stack Overflow
How to install Docker Compose on Mac Terminal?
How do I install Docker on my Mac?
Where is the Docker file on Mac?
Videos
On my Macbook, I've installed docker via homebrew with
brew install docker docker-compose docker-machine xhyve docker-machine-driver-xhyve
(though this was way before docker desktop became non-free, but I'd assume it'd still work)
This uses xhyve as a virtual machine, so are basically running a Linux distro in xhyve, and then Docker in this Linux distro.
You need to do a bit of configuration, I followed this article.
My commandline for creating the VM was
docker-machine create default --driver xhyve --xhyve-experimental-nfs-share=true --xhyve-disk-size "40000"
There is an alternative to docker, it is podman.
- Install:
brew install podman - Download and prepare the VM:
podman machine init - Turn on the VM:
podman machine start - Uses as a docker:
podman run -d -p 8000:80 nginx - Verify container:
podman ps - Interact with it:
curl localhost:8000
It uses QEMU for virtualization underneath, and set a machine with Fedora CoreOS by default.
To access details of default machine and the virtualization environment after installation:
cat ~/.config/containers/podman/machine/qemu/podman-machine-default.json
- Checkout the documentation to Getting Started with Podman.
- Consult this article 10 Best Docker Alternatives 2021 to have options.
I thought the r/docker subreddit might be interested in this project I just found!
https://github.com/stenh0use/docker-machine-for-mac
Hello everyone,
I am a long-time Windows user, but I am finally making the switch to a MacBook Pro M1 Pro for development. I tried switching a year ago but couldn't make the transition at that time. For my daily tasks, I need to use Docker.
I believe that I can accomplish what I need with just the Docker CLI and Docker Compose CLI. However, since I am not very familiar with the macOS ecosystem, there might be some options I am overlooking.
Here is what I need:
-
Build and run Docker containers
-
Orchestration via Docker Compose
-
ARM native support
-
Kubernetes would be nice, but it's not a requirement
On Windows, I have been using Docker Desktop. Since I am transitioning to a completely new ecosystem, I wanted to explore the available options. Here is what I have found:
-
Podman
-
Rancher Desktop
-
Colima
-
Orbstack
-
And of course, Docker Desktop
I prefer CLI tools for the most part, as long as they are robust and easy to use. While I am not opposed to GUIs, I spend most of my time in the terminal. As long as the software is well-built, fast, and does not consume excessive resources, I am fine.
Any input or advice you might have would be greatly appreciated.
Thanks a lot!
docker-compose is a utility that is now a parameter in mac docker
so instead of docker-compose up, its now docker compose up
I ran into the same issue on macOS today. Turned out that you need to run the installed app once, it does some additional downloading and setup. That setup includes setting up your path variables.