DEV Community

Manthan Ankolekar
Manthan Ankolekar

Posted on

Docker Cheatsheet

Check Docker Version :

docker version
Enter fullscreen mode Exit fullscreen mode

Login into Docker :

docker login
or
docker login -u <username>
Enter fullscreen mode Exit fullscreen mode

Search Hub for an image

docker search <image_name>
Enter fullscreen mode Exit fullscreen mode

Publish an image to Docker Hub

docker push <username>/<image_name>
Enter fullscreen mode Exit fullscreen mode

List all images :

docker image ls
Enter fullscreen mode Exit fullscreen mode

Build an Image :

docker build -t <image-name> .
Enter fullscreen mode Exit fullscreen mode

Run an Image :

docker run <image-name>
Enter fullscreen mode Exit fullscreen mode

Start or stop an existing container :

docker start|stop <container_name> (or <container-id>)
Enter fullscreen mode Exit fullscreen mode

To inspect a running container :

docker inspect <container_name> (or <container_id>)
Enter fullscreen mode Exit fullscreen mode

Pull Image :

docker pull manthanank/<image-name>
Enter fullscreen mode Exit fullscreen mode

List all containers :

docker ps -a
or
docker ps -all
Enter fullscreen mode Exit fullscreen mode

Running containers :

docker ps
Enter fullscreen mode Exit fullscreen mode

Stop an image :

docker stop <container-id>
Enter fullscreen mode Exit fullscreen mode

Delete container :

docker rm <container-id>
Enter fullscreen mode Exit fullscreen mode

Delete an Image :

docker rmi <image-name>
Enter fullscreen mode Exit fullscreen mode

Remove all unused images :

docker image prune
Enter fullscreen mode Exit fullscreen mode

Top comments (0)