Docker Commands
Docker run command
The docker run command is used to run the Docker container using Docker images.
Example:
docker run hello-world
Docker inspect command
docker inspect command gives us all the details about the docker container.
In simple terms, the docker inspect command provides all the details of a container.
let's see it with an example,
docker inspect <containerID>
Here, after hitting the docker inspect command we got lots of container details like
Container ID
Container Created Time
Path
State ( Status, running, paused )
and many more.
Docker port command
docker port command lists all the port mappings for a container.
Example:
docker port <containerID>
Docker stats command
docker stats command is used to check the statistics of one or more docker containers like CPU, Memory Usage, PID etc.
Example:
docker stats <containerID>
Docker top command
The docker top command is used to list all the processes running inside the container.
Example:
top <ContainerID>
As we can see, I am running python inside the docker container, so it is showing python3.
Docker save command
The docker save command is used to save docker image to tar archive file
Example:
docker save -o <tarfilename>.tar <dockerimagename>
Here, the python:3.6.0.tar file is created using the docker save command
Docker load command
The docker load command is used to load docker image from tar archive file which was created using docker save command.
Example:
docker load -i <tarfilename>
In the above screenshot, we have loaded python3.6 image from tar archive file using docker load command
Subscribe to my newsletter
Read articles from Deepesh Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Deepesh Gupta
Deepesh Gupta
DevOps & Cloud Enthusiast | Open Source Contributor | Driving Technological Excellence in DevOps and Cloud Solutions