Ubuntu 20.04 installation of docker-compose w. docker-rootless

Hi all,

Bit of noob question. I am running a docker-rootless daemon on ubuntu server 20.04 as a non-sudo user. Setting up the daemen went perfectly. However, none of the Docker Compose documentation shows how to install the docker-compose script as a non-root user within a local home directory.

I’m an intermediate linux user teaching myself as I go along. I’d greatly appreciate helping hand with this.

UPDATE

I have manage to install docker-compose as the non-sudo user 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, I have one more hurdle. 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

Any tips?

I figured out the problem. The installation instructions that I am using makes use of docker-compose up -d which doesn’t work as of Version 2… the command to run the .yml file should be docker compose -d (no hyphen). Now everything works as expected.