Docker-compose in a VM (Parallels) on a M1 mac

Viewed 1296

currently I'm trying to get docker-compose running in my VM (Ubuntu 20.04) on my mac with the M1 processor. I already installed docker and docker machine via curl on my VM. Docker-compose I try to install as follows:

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

The installation seems to work out but if I try to check the version via "sudo docker-compose --version", it says: "/usr/local/bin/docker-compose: 1: Not: not found".

In ubuntu it say it is an aarch64 due to my M1.

Does anyone know how to solve this? Thanks in advance.

2 Answers

I think you need to do chmod 744 /usr/local/bin/docker-compose for it to be executable by it's owner only, readable by everyone else. chown root /usr/local/bin/docker-compose will make it's owner root (so you can only run it with sudo).

/usr/local/bin also might not be in your path. Check this by typing echo $PATH. If it's not in there, you can either symlink docker-compose to a recognized path (sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose) or doing export $PATH="/usr/local/bin:$PATH" to add it to your path. It should then show up if you do which docker-compose (shows the path to the program).

You see "/usr/local/bin/docker-compose: 1: Not: not found" because that is the content of the file - curl received 404 response and wrote the status message to the target file. There are a couple of options of installing docker-compose on arm64 ubuntu:

  1. Using python:
sudo apt update
sudo apt install -y python3-pip libffi-dev
sudo pip3 install docker-compose
  1. Installing beta v2 docker-compose beta (on mac or linux):
sudo curl -L https://github.com/docker/compose-cli/releases/download/v2.0.0-beta.3/docker-compose-`uname -s`-arm64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Or download it manually from https://github.com/docker/compose-cli/releases/tag/v2.0.0-beta.3. The API of that tool will be different.

You can also track this discussion for proper resolution - https://github.com/docker/compose/issues/6831.

Related