Read on:
Beginners’ Guide for Microsoft Hyper-V: Overview of Hyper-V – Part 1
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V Using Server Manager – Part 2
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V with PowerShell – Part 3
Read More
When working with the Docker containers, there are many essential commands that Hyper-V administrators need to know when running Docker containers on their Windows container hosts. The Docker command line is fully featured and allows Hyper-V administrators to gain valuable insights and information about the container host and the containers they are running. Let’s look at basic Docker commands for beginners and which commands they need to know.
Why not use a GUI tool?
Many GUI Docker tools can be downloaded and provide “dashboard” type functionality for Docker containers running on Windows or Linux. Additionally, for Windows environments, Microsoft is continuing to enhance the functionality and capabilities of Windows Admin Center. So why not use these GUI-based tools instead of worrying about the command line?
While it is true that these tools provide a lot of value and allow admins to accomplish many tasks quickly, Admins should not underestimate the importance of learning the Docker command line. Why? Learning the Docker command line helps establish the basics of how Docker works and the technology’s underlying concepts. Jumping straight into a GUI tool may provide immediate benefits but can also slow down learning the more complex and underlying concepts.
GUI tools are generally not the best approach for containers when digging deep to troubleshoot issues. Instead, admins can normally view low-level logs and best troubleshoot container issues with the command line. With Docker, the command line is always available on the container host, whereas GUI tools may need to be installed or configured before using these in the environment.
Basic Docker commands
Let’s look at a list of basic Docker commands to empower admins with general information about the Docker environment and aid in troubleshooting.
- docker info
- docker stats
- docker image
- docker ps
- docker network
- docker logs
- docker events
- docker history
Let’s look at each of these in more detail and see how administrators can use these to manage a Docker environment effectively.
Docker info
Docker info is a basic command that provides a global view of your Docker environment, including the Docker installation (kernel version, number of containers, and images). It can also display information about the pool name, data file, metadata file, space information, etc.
The Docker info command yields beneficial information about your container host, including the Docker version, plugins, CPUs, memory, etc.
Docker stats
The Docker stats command allows streaming live performance metrics and statistics from your running containers. You can also specify the name of a specific container.
Docker image
The Docker image command allows working with Docker images, listing these, deleting, adding, building, inspecting, and other operations.
Docker ps
The Docker ps command is arguably the most used from the Docker command line. It enables viewing of running and stopped containers in the environment. It is most commonly used to verify your containers are up and running and in a healthy state.
Below, we issued the –help switch to show the parameters and the command to see the output.
Docker network
Docker networking is essential to understand, view, and configure. The Docker network command allows managing, configuring, adding, and deleting Docker networks.
Docker logs
The Docker logs command is essential when troubleshooting. You can view logs for specific containers in the environment using the Docker logs command. If you have an issue with a container, such as a crash loop, you can pull up the logs for the container to investigate the underlying problem.
Docker events
The Docker events command allows admins to get real time events from their container host, including different event types with different event scopes depending on the objects displayed in the event logs. In addition, the Docker events command allows filtering the logs based on timestamps and specific metadata.
When you issue the docker events command, it “listens” for new events. Therefore, you will need two terminals open—one to initiate the Docker action you want to monitor and another with the Docker events command. You should see the new event entries appear in the docker events terminal.
Docker history
The Docker history command is an excellent command to understand the history of a container, including when it was created, how it was created, the size, and any comments added to the image. The command only needs the image name to give you the history.
Below, we are getting a list of images using the docker image ls command. Next, we issue the docker history command, passing in the name of a container image.
Basic Docker commands FAQs
Is it required to know Docker commands?
Knowing at least a few basic commands is necessary to work with Docker effectively. Most GUI interfaces are for “day 2” operations, including managing, monitoring, and configuring existing containers.
Why should you use Docker commands instead of a GUI?
Docker commands provide the most robust management of your Docker containers. As with many other solutions, the command line is often the most powerful for management, configuration, and automation.
What is the most important Docker command?
There is no single most important command. Instead, you need to know the basics of a few commands. The commands listed in this post are a great start to understanding the basics of Docker container administration.
Wrapping up
Docker is the de facto standard for running containers in the enterprise. Understanding basic Docker commands allow working with Docker effectively and troubleshoot when you have issues with a specific container. It also enables effective auditing and information gathering in the environment for documentation purposes.
Learning a few basic Docker commands is not difficult. It will provide many benefits in managing and administering your containerized applications in the enterprise data center. In addition, you can still use GUI management tools along with the Docker command line when needed.
Beginners Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V in Windows Server Core – Part 4
Beginners Guide for Microsoft Hyper-V: Remote Management of Hyper-V – Part 5
Beginners Guide for Microsoft Hyper-V: How to Install Hyper-V Server – Part 6
Beginner’s Guide for Microsoft Hyper-V: What is Azure Stack HCI – Part 7
Beginner’s Guide for Microsoft Hyper-V: Windows Admin Center Hyper-V Management – Part 8
Beginner’s Guide for Microsoft Hyper-V: Configuration of Hyper-V Networking Best Practices – Part 9
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Storage Best Practices and Configuration – Part 10
Beginner’s Guide for Microsoft Hyper-V: How to build a Virtual Lab with Hyper-V – Part 11
Beginner’s Guide for Microsoft Hyper-V: Top 10 PowerShell Commands for Hyper-V – Part 12
Beginner’s Guide for Microsoft Hyper-V: How to Create a Hyper-V Virtual Machine – Part 13
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Shared Storage for Beginners – Part 14
Beginner’s Guide for Microsoft Hyper-V: How to Create Hyper-V Cluster – Part 15
Beginner’s Guide for Microsoft Hyper-V: What is Non-Uniform Memory Access (NUMA) – Part 16
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Dynamic Memory – Part 17
Beginner’s Guide for Microsoft Hyper-V: Cluster Aware Updating (CAU) – Part 18
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Containers – Part 19
Beginner’s Guide for Microsoft Hyper-V: Managing Windows Server Containers with Windows Admin Center – Part 20
Beginner’s Guide for Microsoft Hyper-V: What are Hyper-V Checkpoints – Part 21
Beginners Guide for Microsoft Hyper-V: How to Create Cluster Shared Volumes (CSVs) – Part 22
Beginners’ Guide for Microsoft Hyper-V: VHD vs VHDX Vs AVHD/AVHDX: Overview of Virtual Disk Formats – Part 23
Beginners’ Guide for Microsoft Hyper-V: Hyper-V Live Migration – Part 24
Beginners’ Guide for Microsoft Hyper-V: Hyper-V High Availability – Part 25
Beginners’ Guide for Microsoft Hyper-V: How to Export and Import Hyper-V VM’s – Part 26
Beginners’ Guide for Microsoft Hyper-V: How To Install Docker Container on Windows Server – Part 27
Beginners’ Guide for Microsoft Hyper-V: How to Run Linux Containers on Hyper-V – Part 28
Beginners’ Guide for Microsoft Hyper-V: Containers vs Virtual Machines – Part 29
Beginners’ Guide for Microsoft Hyper-V: What is Azure Arc VM Management – Part 30
Beginners’ Guide for Microsoft Hyper-V: Azure Features in Windows Admin Center – Part 31
Beginners’ Guide for Microsoft Hyper-V: What is Microsoft Azure Arc – Part 32
Beginners Guide for Microsoft Hyper-V: How to Create a Virtual Switch in Hyper-V using Windows Admin Center – Part 33
Beginners Guide for Microsoft Hyper-V: Managing Hyper-V Server with Azure Arc – Part 34
Beginners Guide for Microsoft Hyper-V: Learn How to Install MicroK8s on Windows Kubernetes – Part 35
Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.