In this article, we’ll discuss how to deploy Docker containers using the built-in stack in Cycleops. The steps involved in this process are simple and easy to follow. However, it’s important to note that Docker requires a 64-bit architecture for your OS, Centos, or Ubuntu. Therefore, ensure that you verify your OS version before you go on with the process. After completing the steps outlined here, you’ll have an NGINX Docker container up and running on your server.
So, let’s take it from the top.
Prerequisites to fulfill, beforehand
Before getting started, it’s essential to have access to a server that you’ll use as your deployment target. This server can be a cloud instance, a virtual machine, or a bare-metal machine. Regardless of its location (on the cloud or on-premises), you need to have your server connected to the Internet; and, also, allow SSH connection. Additionally, you must have the necessary credentials to provide access to your server from the Cycleops platform.
Using Cycleops stack templates for seamless Docker Engine installation and configuration
As you probably already know, the Docker Engine is the main service for running Docker containers. Using this service, you can install the necessary packages and get the containers running on your server.
With Cycleops, the installation and configuration of the Docker Engine are streamlined through a pre-defined template we refer to as “stack”. To access the list of available stacks, navigate to the “Stacks” item in the left sidebar of your Cycleops interface. When you get there, select “docker-containers” to view the details of your stack.
For your information, the stack is composed of the following units:
- Docker-container, and
- Docker-ce
These units contain all the necessary steps to install and configure the components required for a successful deployment.
Pre-configured service settings for ease of use
For the sake of simplicity, we’ll use the default configuration for both the ‘docker-container’ and ‘docker-ce’ units. After all, both units support Centos and Ubuntu and have baked-in sane configuration settings in their default modes. Therefore, you don’t have to search for the appropriate package repository and package list to ensure the proper functioning of Docker.
At this point, it’s worth noting that the Cycleops team adheres to the industry’s best practices and vendor guidelines to prepare these units for you.
Now, to access the list of services from your Cycelops account, navigate to the “Services” option in the main menu.
Units used in Cycleops
Let’s examine the units in the ‘default-containers’ stack in more detail. The “docker-ce” unit is responsible for the installation and configuration of the Docker Engine. This is accomplished using the community edition (CE) provided by Docker vendors. Cycleops comes with a predefined “docker-ce-default” service, which includes the necessary configuration settings.
Take a moment to review these settings by selecting the “docker-ce-default” service from the list. Keep in mind that you’ll use this service later on, to define the setup for your Docker deployment.
Next, you can check on the configuration settings specified in the ‘docker-container-default’ service. In this part of the stack, you’re going to use the ‘docker-containers’ unit, which is responsible for the equivalent of “docker run” command with the configuration of the service in place. Upon inspecting the configuration settings of this service, you will see a “Containers” table with one row, which defines the following settings:
- Name: ‘nginx-docker’ — this is the name of the container
- Image: ‘nginx’ — the image to be used from the Docker hub
- Tag: ‘latest’ — the tag to be used
- Ports: This setting defines the port mapping from the container to the host
- Volumes: This defines some arbitrary values that can be used to mount host directories to container directories
- Env vars: This setting outlines some arbitrary values that can be used to set the container’s environment variables.
Essentially, with the above default configuration settings you get to specify the latest tag of the NGINX docker image.
Taking care of the details before deployment
This is going to be the last step of your deployment setup! To complete the task, click on the “+SETUP” button next to the “default-containers” stack in the “Stacks” list. Doing so will open a form where you need to fill in the details of your setup.
Selecting a server as your deployment target
In the first field of the form, select the server you want to use as your deployment target. The available displayed options are based on the hosts that you’ve already connected to Cycleops. If you haven’t connected your hosts yet, please read the “How to register your Hosts in Cycleops” article for instructions. Essentially, you’ll need to provide the public IP address of the server and complete the registration process to use the server as the deployment target.
Employing the pre-configured services
In the next field of the form, you’re called to employ the services we discussed earlier. To do this, simply select ‘docker-container-default’ and ‘docker-ce-default’ from the available options.
Assign a name for your setup (e.g., ‘docker-app’), and click “Create”. You’ll be redirected to the setup list, where you can see your newly created setup with a ‘DEPLOY’ button next to it.
Click ‘DEPLOY’ and then the ‘>_’ button that connects to the automation engine console output. From there, you can see the tasks the built-in automation engine performs in Cycleops to deploy your container.
The deployment process is complete after a few minutes, and the status changes to “Deployed”. This means that everything is set up on your server!
Finally, you can use your web browser to navigate to the IP address of your server, where you should see displayed the default NGINX page.
That’s the end of it! Ideally, following these steps, you were able to quickly and effortlessly deploy your Docker containers with Cycleops! Apart from what we discussed in this guide, you can always perform your own tests to modify the configuration settings and deploy to several servers at once; and, in this way, make the most of Cycleops’ capabilities!