I have installed the latest Docker Compose as a non-sudo user on Ubuntu Server 20.04 along with docker-rootless daemon in the non-sudo user's directory, using the following:
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
And verified successful installation with:
$ docker compose version
Docker Compose version v2.2.3
However, whenever I try to execute docker-compose up -d
for a .yml
file that I have created, I get the following output:
$ docker-compose up -d
WARNING:root:could not open file '/etc/apt/sources.list.d/mongodb-org-5.0.list'
Command 'docker-compose' not found, but can be installed with:
snap install docker # version 20.10.11, or
apt install docker-compose # version 1.25.0-1
See 'snap info docker' for additional versions.
Docker Compose is not finding the correct docker.sock
file although my non-root user's ~/.bashrc
file contains:
export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///run/user/1007/docker.sock
How can I make Docker Compose recognize the correct docker.sock
file?
docker-compose
is that the command is not found in your $PATH and not related to the docker.sock issue – Dan Mar 09 '22 at 12:32docker compose
instead ofdocker-compose
when using V2. – Artur Meinild Mar 09 '22 at 12:33