Docker compose for docker for current user

Docker-compose allow to start/ manage containers more easily with yaml files.

But his plugin is not installed by default… Standard installation allow to use it for all acount but sometimes you want only for one account.

Prerequisite

Install docker with apt / yum

Beware you should also add docker group to your standard account – don’t forget to log after modifiying your account.

This allow to manage docker without a root account

Installation

mkdir -p ~/.docker/cli-plugins

Retrieve the latest version of docker compose on:

Releases · docker/compose · GitHub

Launch a curl command on your system adapted release. For example, on my server it is (docker-compose-linux-x86_64 ) but there are some for RPI…

curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

Do not forget to give it execution rights with chmod

chmod +x ~/.docker/cli-plugins/docker-compose

You can try the command with

docker compose version

Usage

Create a temporary folder, and retrieve a docker-compose.yml file on this folder.

Then launch an Xterm go to your folder and then launch this command

docker compose up -d

You can stop this composer from this folder

docker compose stop

Or delete container volume

docker compose down

BTW, for deleting image, you should used the standard command “docker image rm X”