Accelerate your learning of Docker configuration with GUI tools
By: Brian Dart
Tags: DevOps, Learning, Tech, Software Development, Docker

You can speed up your learning of Docker configuration files, like docker-compose.yml, by making use of a GUI tool, like Rancher.

Learning Docker configuration is difficult. I have never been the type that can scan through vast amounts of documentation and piece everything together. If there isn’t a tutorial or an example that I can use for reference, I will struggle to cobble things together. One method I have found that is useful is to make use of GUI tools that walk you through the process step-by-step and then allow you to view the output and learn from it.

For this exercise, I am going to be using Rancher from Rancher Labs. The same style of workflow should work for most GUIs that handle Docker configuration. For example, I am currently using this method to learn more about Kubernetes configuration with the Kubernetes Dashboard.

Let’s get started! The first step is to open Rancher and click on the ‘Add Stack’ button near the top.

On the next screen, add some text to the ‘Name’ field, along with an optional ‘Description’, and then click the ‘Create’ button at the bottom.

We now have our application stack created, but there are no services in our application.

We can look at our current docker-compose.yml file (and rancher-compose.yml file) by clicking on the ‘More actions’ menu (three vertical dots) and selecting ‘View Config.’

As you can see, there isn’t much to look at. The only configuration in our files at this point is the version identifier.

Now that we have a baseline for our docker-compose.yml file, let’s go ahead and create a new service and see what changes.

Click the ‘Add Service’ button (not the dropdown arrow) to open the ‘Add Service’ screen.

On the ‘Add Service’ screen, enter some text for the service ‘Name’ and optional ‘Description’ fields. Then enter the Docker image you want to use for this service (my test Docker image is available here). We will leave the ‘Scale’ options at the default of ‘Run 1 container’ and the ‘Always pull image…’ checkbox checked.

Scroll down to the bottom of the page and you will see a number of options and tabs to add more configuration to your service. We are going to leave the defaults (note the ‘Console’ and ‘Auto Restart’ values) and click the ‘Create’ button at the bottom.

Now we can see that our first service has been added. Click on the ‘More actions’ button again to see what changes have been made to the configuration files. Note: You want to click on the ‘More actions’ button on the Stack level, not the service level (see arrow below).

Now we are getting somewhere! Remember the last time we looked at these files, all we had was version: '2' . Now we see that we have added a services section to both files and we can see how the configuration has been spread between the two files. The docker-compose.yml file defines the image, stdin_open, tty and the label for ‘Always pull image.’ Meanwhile, the rancher-compose.yml file handles the scale options and start_on_create. You can start to see how the changes made in the GUI alter the .yml files.

From here you can add new services or alter existing services like adding volumes, environment variables, port mappings, etc. through the GUI and then checking to see how that changes the .yml configuration files.

Note: To alter existing services in Rancher, you will want to click on the ‘Upgrade’ button (up arrow icon in screen below) and not the ‘Edit’ option in the ‘More actions’ menu.

Learning Docker configuration can be tricky, but making use of the tools available will give you a leg up in the process. Have fun and let me know in the comments below if you have any tools or tips that you find useful for learning and implementing Docker configuration in your environments.