Docker
Start an app
docker-compose up -d
# -d, --detach Detached mode: Run containers in the background, print new container names.
Stop an app
docker-compose down
List running containers
docker ps --no-trunc
Run commands inside a container
docker exec -it <container-id> bash
# Retrieve container id from command 'docker ps'
Search for a running container with specific name
docker ps -f 'name=<string-in-container-name>'
# Only output the container id
docker ps -f 'name=<string-in-container-name>' --quiet
Objective
Command
Start an app
docker-compose up -d
# -d, --detach Detached mode: Run containers in the background, print new container names.
Stop an app
docker-compose down
List running containers
docker ps --no-trunc
Run commands inside a container
docker exec -it <container-id> bash
# Retrieve container id from command 'docker ps'
Search for a running container with specific name
docker ps -f 'name=<string-in-container-name>'
# Only output the container id
docker ps -f 'name=<string-in-container-name>' --quiet
Last updated
Was this helpful?