Skip to content

Instantly share code, notes, and snippets.

@Subangkar
Last active September 17, 2020 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Subangkar/955049e7823bf6600fe59aa74b9f0eae to your computer and use it in GitHub Desktop.
Save Subangkar/955049e7823bf6600fe59aa74b9f0eae to your computer and use it in GitHub Desktop.
Useful Docker Commands
docker-compose build
docker-compose up
docker-compose down
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