In this post, basically, I don’t put options. If you think this command is lacking something important, you will need to check Docker Doc(


pull command is almost same as git pull. Get an image to local from Docker hub.

$ docker pull kojikno/conda_docker


push command is also the same as git push. This command uploads your Docker image to Docker Hub. This allows others to use your image or you can use the image from any machines. For example, you can use the image for CI. I’m using my own image for Circle CI to run the test.
The free plan allows us to have one private repo. You can make your image secure. The following: python3.7 is a tag. Generally, a community organization provides multiple versions of images.

For example, node:latest, node:11, node:10 etc.

$ docker push kojikno/conda_docker:python3.7


This command is to create an image from Dockerfile. You can see what Docker file is in the following post.

ml_conda_docker is an image name & tag.

$ docker build -t ml_conda_docker:latest .


This command shows you images you have. I think I have used this command so many times lol

$ docker images

REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
arm64v8/ubuntu              latest              56c6cce7dd32        7 days ago          57.7MB
circleci/picard             latest              7d0931871af3        2 weeks ago         103MB
arm64v8/node                10.16.0-stretch     3583429b1ae9        3 weeks ago         853MB
rwmodel/runway/densedepth   cpu                 186943877dd5        8 weeks ago         1.85GB


This command is to remove an images. Sometimes images are huge, so need to delete images especially when I create an image from container which is based on an image from Docker Hub.

$ docker rmi image_id/image_name

$ docker rmi $(docker images -q --filter "dangling=true") <-- remove images which is named none


This command creates a container but doesn’t start a container.

$ docker create image_name


This command is to run a container or start a container.
You should check the options.
Also you can check my post about container(

$ docker run -it image_name/image_id bash


ps could be your best friend when you use Docker.
This command shows you running containers’ information. If you want to see stopped containers, you can add -a.

$ docker ps

$ docker ps -a


This command allows us to create an image from a container. We can pull an image and add/install anything we need then do commit. After that, we can start run/create a container the image we committed.
One thing you should know is that commit creates a new image from the image you pulled and the size of the new one could be bigger than the based one. So, you need care about your storage if you don’t have enough storage on your machine.

$ docker commit container_id iamge_name:tag


This command is to start running a container.

$ docker start container_id/container_name


This command is to stop a running container.

$ docker stop container_id/container_name


When you are in Docker container, you can use exit to get out there.

$ exit


This command to attach local standard input, output, and error streams to a running container.

$ docker attach container_id/container_name


This command deletes a container which is not running. You can remove multiple containers if you put multiple container_ids

$ docker rm container_id/container_name

# This commands remove all exited containers.
$ docker rm $(docker ps -qa --no-trunc --filter "status=exited")

system prune

This command is to remove unused data.
If you really want to clean up your Docker environment, you can use -aoption. However, this option removes all unused data so be careful when you use this option.

$ docker system prune OPTIONS


This command allows us to exec another process in a running container.

$ docker exec option container_id/container_name

Actually, there are so many commands you can use/should know, but I guess for a beginner like me these commands are kind of enough to learn the basics of Docker.

Hope this is useful for someone!

If something wrong or missing something important, please leave a comment!!!(I’m still learning Docker ?)

Docker Doc

Docker cheat sheet

If you don’t like to use CLI, you can use Docker with GUI like kitematic(, but probably CLI could be helpful to understand Docker since we will need to write Dockerfile, docker-compose.yml.


Would love your thoughts, please comment.x