Skip to main content

Command Palette

Search for a command to run...

Day 16: Working with Docker Commands for Containers and Images

Updated
3 min read

Today, We have several docker commands to run as tasks. Let's start

Task 1 : Use the docker run command to start a new container and interact with it through the command line.

The docker run command is used to start a new container from an image. To demonstrate this command, we used the following command:

This command starts a new container with the hello-world image. It will download an image from the server if it is not available locally.

Task 2 : Use the docker inspect command to view detailed information about a container or image.

The docker inspect command is used to view detailed information about a container or image. To demonstrate this command, we used the following command:

This command displays detailed information about the specified container or image, including metadata, configuration, and networking details.

Task 3 : Use the docker port command to list the port mappings for a container.

The docker port command is used to list the port mappings for a container. To demonstrate this command, we used the following command:

docker port <container-id>

This command lists the port mappings for the specified container, including the internal and external ports.

Task 4 : Use the docker stats command to view resource usage statistics for one or more containers.

The docker stats command is used to view resource usage statistics for one or more containers. To demonstrate this command, we used the following command:

This command displays resource usage statistics for the specified container, including CPU, memory, and network usage.

Task 5 : Use the docker top command to view the processes running inside a container.

The docker top command is used to view the processes running inside a container. To demonstrate this command, we used the following command:

This command displays the list of processes running inside the specified container.

Task 6: Use the docker save command to save an image to a tar archive.

The docker save is used to save to a tar archive. To demonstrate this command, we used the following commands:

Task 7 : Use the docker load command to load an image from a tar archive.

The docker load command is used to load images from a tar archive. To demonstrate this command, we used the following commands:

This will load the image from myimage.tar that is piped through cat command.

Keep in mind that the docker load command only loads the image into the local Docker registry. If you want to push the image to a remote registry, you'll need to use the docker push command.

We hope that you found this blog post helpful. If you have any questions or comments, please feel free to leave them below. Thanks for reading, and happy Dockerizing!

More from this blog

Ajay Patel

116 posts