How to Manage and Monitor Docker Containers Using Dry

By Hitesh Jethva, Alibaba Cloud Community Blog author. The Blog is a community-driven platform whose main aim is to demonstrate Alibaba Cloud’s technical capabilities, brand message, and thought leadership through relevant, compelling content.

Dry is a simple terminal application to manage and monitor Docker containers, which gives detailed information about Nodes, Service, Stacks and Swarm constructs. You can easily start and stop Docker containers, remove Docker images, and monitor real-time container processes by using Dry.

In this tutorial, we will learn how to install Dry on an Alibaba Cloud Elastic Compute Service (ECS) instance that is installed with Ubuntu 16.04. We will also learn how to use Dry to manage and monitor Docker containers, images, and networks.

Requirements

  • A newly created ECS instance installed with Ubuntu 16.04.
  • The static IP address 192.168.43.192 is set up for your instance.
  • A root password is set up for your instance.

Procedure

To manage and monitor Docker containers with Dry, follow these steps:

Launch Alibaba Cloud ECS Instance

First, log on to your Alibaba Cloud ECS Console. Then, create a new ECS instance with Ubuntu 16.04 as the operating system and with at least 2GB RAM. Last, connect to your ECS instance and log on as the root user.

After you are logged on to your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install Docker

Before you continue to the next steps, you will need to install Docker CE and Docker compose on your instance. By default, the latest version of Docker is not available in the Ubuntu 16.04 default repository. So you will need to add the PPA for that. You can do this by running the following command:

Next, update the repository and install Docker CE and Docker compose by running the following command:

After the installation is complete, you can check the status of Docker service with the following command:

The output is as follows:

Install Wordpress and PhpMyAdmin with Docker Compose

You will also need to setup some Docker containers to test Dry. Here, we will setup Wordpress and PhpMyAdmin containers using Docker compose. First, create a directory to store your container’s data and docker-compose.yml to run your container.

Next, create a docker-compose.yml to setup Wordpress and PhpMyAdmin container:

Add the following lines:

Save and close the file. Now, run the following command to download Wordpress and PhpMyAdmin images, then run both containers in the background:

After the setup is complete, the Wordpress container is listening on port 8080, and PhpMyAdmin container is listening on port 8181.

Access the Wordpress Container

Open your web browser and type the address http://192.168.43.192:8080. You will be redirected to the Wordpress installation page:

Select your language and click on the Continue button. You should see the following page:

Provide your Sitename, admin username, and password. Then, click the Install Wordpress button. After the installation is complete, you will see the following page:

Now, provide your admin username and password. Then, click the Log on button. You will see the Wordpress dashboard in the following page:

Access the PhpMyAdmin Container

Open your web browser and type the address http://192.168.43.192:8181. You will be redirected to the following page:

Now, provide your root username and password. Then, click the Go button. You will see the PhpMyAdmin dashboard in the following page:

Install Dry

Both containers are now configured and running. Next, you will need to install Dry to your instance. You can download the latest version of Dry with the following command:

After the download is complete, copy the downloaded binary file to the /usr/local/bin/ directory:

Next, give permission to the dry binary file:

Now, check the Dry version by running the following command:

The output is as follows:

Working with Dry

Now, simply run the dry command from your terminal window to launch the dry utility:

This will open up a prompt loaded with all the useful information about the docker daemon and the containers that are running:

Now, use up/down arrow key to select the PhpMyAdmin container and press Enter. You should see the information about the container in the following page:

Here, you can use up/down arrow keys to restart, stop, remove and kill the container.

Press the ESC key to return to the main dashboard. Next, press 3 to access the Network section as shown below:

Here, you can see the network IP address and MAC address of the container. Press the ESC key again to return to the main dashboard. Press 2 to access the Image section as shown below:

Here, you should see the images of your running containers. You can also remove images and show the history of image.

Original Source

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store