Last active
September 17, 2020 07:07
-
-
Save Subangkar/955049e7823bf6600fe59aa74b9f0eae to your computer and use it in GitHub Desktop.
Useful Docker Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-compose build | |
docker-compose up | |
docker-compose down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker images -a | |
docker ps -a | |
docker build | |
docker start container-id | |
docker pause <ID or name> | |
docker unpause <ID or name> | |
# start a new container | |
docker run image-id | |
# runs the command in an already-running container | |
docker exec -it container-id /bin/bash | |
docker run -it image-id | |
docker run -it image-id -p 3000:3000 | |
docker run -it image-id bash | |
docker container stop container_id | |
# stop all containers | |
docker system prune | |
# Remove container | |
docker container rm container_id | |
# Remove all stopped containers | |
docker rm $(docker ps -a -q) | |
# delete all containers including its volumes use | |
docker rm -vf $(docker ps -a -q) | |
# Remove image | |
docker image rm image_id1 image_id2 | |
# delete all the images | |
docker rmi -f $(docker images -a -q) | |
# see processes/logs running on a container | |
docker top <ID> | |
docker logs <ID> | |
# build and push local image | |
docker build -t <localimagename> -f Dockerfile . | |
docker tag <localimagename> <user>/<repo>:<tag> | |
docker push <user>/<repo>:<tag> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment