Docker compose commands
Docker compose commands
Go to the folder where the docker-compose.yaml file is located, where you can execute the docker compose commands.
cd soffid4compose
In this tutorial, all commands are without sudo, if you need sudo do the Use docker without sudo.
Check the the version.
docker compose version
Create or or upgrade the containers, you must do it every time you modify the docker-compose.yaml file.
docker compose up -d
Check containers.
docker compose ps
Start, restart and stop a container
docker compose stop console
docker compose start console
docker compose restart console
Start, restart or stop all containers
docker compose stop
docker compose start
docker compose restart
View the console logs.
docker compose logs -f console
Destroy the containers
docker compose down
Enter into a container
docker compose exec -it console bash
Copy a file into a container
docker compose cp /soffid/mariadb-backup.sql mariadb:/tmp
Use docker without sudo
Follow the next steps.
| Command | Comment |
|
sudo gedit /etc/group |
Edit the file with your editor (gedit for this example) |
| docker:x:988:YOUR-USER | Add YOUR-USER at the end of the docker command without : at the end |
| logout | Log out from the ubuntu session |
| login | Log in into the ubuntu session |
| docker ps | Confirm that you do not need to use sudo with a docker command |