Skip to content

Docker

Docker

Run bash in running container

Run this to get container IDs:

docker ps

Then run this to execute a shell inside the running container:

docker exec -it containerid bash

Find the docker compose file, given a container name

For when you lose your docker-compose.yaml file:

docker inspect --format='{{ index .Config.Labels "com.docker.compose.project.working_dir" }}'

Tidy up

Docker eats disk for breakfast. Tidy up with these:

docker image prune

docker image prune -a

docker container prune

docker volume prune

For the brave:

docker system prune --volumes