10 Lesser-Known Docker Commands Every DevOps Engineer Should Know

10 Lesser-Known Docker Commands Every DevOps Engineer Should Know

Docker is a top-notch platform that provides the ability to streamline and automate the deployment process of applications in containers. Docker commands provide significant features to manage containers, images, and networks.

Here are ten lesser-known Docker commands that every DevOps engineer should know:

1. docker network create

This command is used to create a new Docker network. Docker networks are a type of virtual network where connections and data can be transmitted between Docker containers.

Syntax:

docker network create [OPTIONS] NETWORK

Example:

docker network create my_network

2. docker network ls

The docker network ls command is used to list all the Docker networks that exist on your system.

Syntax:

docker network ls [OPTIONS]

Example:

docker network ls

3. docker network inspect

This command is used to inspect the details of a Docker network.

Syntax:

docker network inspect [OPTIONS] NETWORK

Example:

docker network inspect my_network

4. docker system df

This command produces a disk usage report, aggregating information on the storage usage for the Docker daemon. It is useful to know the amount of disk space that your Docker resources are occupying.

Syntax:

docker system df

Example:

docker system df

5. docker stats

This command provides real-time CPU, memory, and network stats for Docker containers running on a host. It is useful to monitor the resources consumption of Docker containers.

Syntax:

docker stats [OPTIONS] [CONTAINER...]

Example:

docker stats my_container

6. docker top

The docker top command is used to display the running processes of a Docker container.

Syntax:

docker top [OPTIONS] CONTAINER [ps OPTIONS]

Example:

docker top my_container

7. docker secret create

This command is used to create a new Docker secret. Docker secrets provide the ability to manage confidential data like passwords, tokens, and SSH keys securely.

Syntax:

docker secret create my_secret my_secret_file

Example:

docker secret create my_secret /run/secrets/my_secret.txt

8. docker secret list

The docker secret list command is used to list all the Docker secrets that are present in your Swarm.

Syntax:

docker secret list

Example:

docker secret list

9. docker secret inspect

This command is used to inspect the details of a Docker secret.

Syntax:

docker secret inspect SECRET

Example:

docker secret inspect my_secret

10. docker secret rm

The docker secret rm command is used to remove the specified Docker secret.

Syntax:

docker secret rm SECRET

Example:

docker secret rm my_secret

Conclusion

Docker is a powerful platform with several useful commands that help with building and deploying applications. The above ten lesser-known Docker commands will help DevOps engineers manage and maintain Docker containers and resources more efficiently.