List all running containers
docker ps -a
Stop the container which is running
docker stop <container-id>
Start the container which is stopped
docker start <container-id>
Restart the container which is running
docker restart <container-id>
List port mappings of a specific container
docker port <container-id>
Remove the stopped container
docker rm container-id
services:
<namespace>:
image: <image>
volumes:
- <host_path>:<docker_path>
restart: <rule>
environment:
<name>: <value>
ports:
- <host_port>:<docker_port>
services:
db:
platform: linux/x86_64
image: mysql
volumes:
- ./db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: yourdb
MYSQL_PASSWORD: password
phpmyadmin:
depends_on:
- db
image: phpmyadmin
restart: always
ports:
- "8090:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password