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 version.
docker compose version
Create 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 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 vi /etc/group sudo gedit /etc/group etc |
Edit the file |
| docker:x:988:YOUR-USER | Add your user at the end of the docker command |
| sudo systemctl restart docker | Restart the docker service |
| sudo usermod -aG docker YOUR-USER | Update your user attributes |
| exit | Exit to the ubuntu session |
| login | Log in into your docker session |
| docker ps | Confirm that you do not need to use sudo with a docker command |