docker-cheatSheet

  1. docker –version

This command is used to get the currently installed version of docker

  1. docker pull

Usage: docker pull

This command is used to pull images from the docker repository(hub.docker.com)

  1. docker run

Usage: docker run -it -d

This command is used to create a container from an image

  1. docker ps

This command is used to list the running containers

  1. docker ps -a

This command is used to show all the running and exited containers

  1. docker exec

Usage: docker exec -it bash

This command is used to access the running container

  1. docker stop

Usage: docker stop

This command stops a running container

  1. docker kill

Usage: docker kill

This command kills the container by stopping its execution immediately. The difference between ‘docker kill’ and ‘docker stop’ is that ‘docker stop’ gives the container time to shutdown gracefully, in situations when it is taking too much time for getting the container to stop, one can opt to kill it

  1. docker commit

Usage: docker commit <username/imagename>

This command creates a new image of an edited container on the local system

  1. docker login

This command is used to login to the docker hub repository

  1. docker push

Usage: docker push <username/image name>

This command is used to push an image to the docker hub repository

  1. docker images

This command lists all the locally stored docker images

  1. docker rm

Usage: docker rm

This command is used to delete a stopped container

  1. docker rmi

Usage: docker rmi

This command is used to delete an image from local storage

  1. docker build

Usage: docker build

This command is used to build an image from a specified docker file

docker inspect [container ID] -> Get more info about running container docker volume -> create a docker volume docker network -> create a docker network docker build -> build a new image from dockerfile docker login -> Login to docker account