Docker is a containerization system which packages and runs the application with its dependencies inside a container. In this article, I mentioned about 18 Docker Commands you need to know while working with Docker.
1. docker --version
One of the first things we all want to know is how to find the installed docker version.
2. docker pull
The 'docker pull' is a Docker command to download a Docker image or a repository locally on the host from a public or private registry.
3. docker images
List all the docker images pulled on the system with image details such as TAG/IMAGE ID/SIZE etc.
4. docker run
The docker run command creates a container from a given image and starts the container using a given command. It is one of the first commands you should become familiar with when starting to work with Docker.
If the image is not present locally, docker first pulls the image from the repository and runs it.
docker ps command lists all the docker containers are running with container details. To list all the docker containers running/exited/stopped with container details, we use docker ps -a
command
6. docker start/ stop/restart
docker start command in docker starts the docker container with container id mentioned in the command.
docker stop stops a container with container id mentioned in the command.
To restart the docker container, we use docker restart.
Remove the docker container with container id mentioned in the command.
Remove the docker image with the docker image id mentioned in the command
9. docker commit
Create a new image from a container’s changes. It can be useful to commit a container’s file changes or settings into a new image.
Login into docker hub. You will be asked your docker hub credentials to log in.
I already had my credentials setup, so it didn't ask me to enter login id and password.
11. docker push
Upload a docker image with the image name mentioned in the command on the dockerhub.
Once it is successful, you would be able to see the docker image in your docker hub repo.
Get detailed information about docker installed on the system including the kernel version, number of containers and images, etc.
Shows the history of a docker image with the image name mentioned in the command.
14. docker search
Search for a docker image on dockerhub with the name mentioned in the command.
15. docker logout
Logging out from dockerhub.
Top comments (0)