Managing Docker containers is made easier with Docker Desktop. Once you have started a container, you can use Docker Desktop to perform various tasks and monitor its status.
To access the container management features in Docker Desktop, click the Docker icon in the toolbar and choose Dashboard. The Docker Desktop dashboard will display a list of containers you have running.
When you hover over a container in the list, you will see five buttons that allow you to perform different actions:
- Open in browser: Clicking this button will open the container’s website in your default browser.
- CLI: Clicking this button will open a new terminal window connected to the Docker container, with the
root
user. - Stop: Clicking this button will stop the container.
- Restart: Clicking this button will restart the container.
- Delete: Clicking this button will delete the container.
Clicking on the name of a container in the list will reveal more information about the container, such as logs, container details, and statistics about CPU, memory, network, and disk usage.
For example, you can view logs generated by the container, inspect the container to see useful information, and monitor resource usage.
To demonstrate the container’s functionality, you can click the “Open in browser” button for a container that provides a sample website. Docker Desktop will open the URL associated with the container (e.g., http://localhost/tutorial
).
To stop the container, click the “Stop” button in Docker Desktop. You will notice that if you refresh the page, the website will no longer be accessible. To make it work again, simply click the “Start” button in Docker Desktop.
Similarly, you can use the “CLI” button to open a terminal window connected to the Docker container. This allows you to execute commands within the container, such as checking the current user with the whoami
command.
Using Docker Desktop to manage containers provides an intuitive interface for controlling and monitoring container lifecycles. It simplifies the process of interacting with containers and allows you to easily access container-specific features and information.