Docker commands
docker
cli
04/27/2020
Commands I use frequently:
- If you've updated your code, you can do the build and reload in a single step with:
docker-compose up --detach --build {service-name}
docker-compose restart worker
- Stop all containers:
docker kill $(docker ps -q)
- Remove all containers
docker rm $(docker ps -a -q)
- Remove all docker images
docker rmi $(docker images -q)
- Run interactive shell to explore containers:
docker run -it image_name sh
- Or following for images with an entrypoint
docker run -it --entrypoint sh image_name
- If you want to see how the image was build, meaning the steps in its dockerfile, you can:
docker image history --no-trunc image_name > image_history