How To: Instantiate docker containers using docker run (sys-admin nomination required)

How To: Deploy a MySQL Server application with Run docker

Author:Alessandro Costantini
Version:2
Copyright:This document has been placed in the public domain.

1. Prerequisites

The user has to be registered in the IAM system for INFN-CLOUD https://iam.cloud.infn.it/login. Only registered users can login into the INFN-CLOUD dashboard https://my.cloud.infn.it/login.

The access to the INFN-CLOUD dashboard enable the user to instantiate the Run docker application.

2. User responsabilities

Important

The solution described in this guide consists of running users’ own containers on top of the Virtual Machine instantiated on INFN-CLOUD infrastructure. The instantiation of a VM comes with the responsibility of maintaining it and all the services it hosts.

Please read the INFN Cloud AUP in order to understand the responsabilities you have in managing this service.

3. How to deploy a MySQL Server with Run docker

Run docker is an implementation of Docker aimed to deploy docker containers.

Step 1 - Connecting and authenticating to the INFN-CLOUD dashboard

Connecting to the INFN-CLOUD dashboard (https://my.cloud.infn.it/, see Fig. 1), the user can authenticate with the credentials used for the IAM account (https://iam.cloud.infn.it/login, see Fig. 2) in order to access the dashboard.

Figure 1: INFN-CLOUD welcome dashboard

Figure 1: INFN-CLOUD welcome dashboard

Figure 2: INFN-CLOUD IAM login

Figure 2: INFN-CLOUD IAM login

Step 2 - Select and Configure the Run docker deployment

Note

Before to continue user has to upload the public (asimmetric) SSH key into the dashboard. The pair public_key and IAM_username will be used to login into the VM. Alternatively, you can generate your own public-private key pair. For more detail visit the section Getting started.

Note

If you belong to multiple projects, aka multiple IAM-groups, after login into the dashboard, from the upper right corner, select the one to be used for the deployment you intend to perform. Not all solutions are available for all projects. The resources used for the deployment will be accounted to the respective project, and impact on their available quota. See Figure 3-1 (upper panel) for detail.

Figure 3-1: INFN-CLOUD Dashboard: Selection of IAM group (upper panel)

Figure 3-1: INFN-CLOUD Dashboard: Selection of IAM group (upper panel)

Figure 3-2: INFN-CLOUD Dashboard: Selection of "Run docker" application

Figure 3-2: INFN-CLOUD Dashboard: Selection of “Run docker” application

After login into the dashboard, the user can select “Run docker” application from the list of applications (as shown in Fig. 3-2) and he/she will be redirected to the deployment setting window (see Fig. 4), where the user has to fill the different parameter fileds to submit the deployment. All deployments have a mandatory field Description that needs to be defined before submitting the deployment. The other fields are briefly explained hereafter.

“General” TAB

Here one need to fill the following required mandatory fields:

  • num_cpus: number of virtual cpus for the VM
  • mem_size: amount of memory for the VM
  • docker_appname: name to be assigned to the container
  • docker_image: name of the image used to create the container
  • docker_tag: tag of the image used to create the container
  • ports_mapping: list of ports to publish from the container to the host. Use docker CLI syntax: 8000, or 9000:8000, where 8000 is a container port, 9000 is a host port
  • docker_command: command to execute when the container starts (facoltative)
  • service_ports: ports to open on the VM to access the service(s). By default only SSH port (22) is opened. Please consult INFN Cloud Rules of participation the “Networking” section in order to see what are the ports that you can specify in this field. If the port you intend to use is in the list of closed-ports, you have to formally request its opening and motivate the request by following the How To: Request to open ports on deployed VMs guide.
  • environment_variables: environment variables (key,value pairs)

Note

Fig. 4 shown a set of configuration parameters used as example to deploy the MySQL Server. In particular, the following values have been used:

  • num_cpus: 1
  • mem_size: 1
  • docker_appname: mysql1
  • docker_image: mysql/mysql-server
  • docker_tag: latest
  • ports_mapping: 3306:3306
  • service_ports: TCP, 3306
  • environment_variables: “MYSQL_ROOT_HOST: %”, “MYSQL_ROOT_PASSWORD: ChangeMe”
Figure 4: Run docker deployment settings – Configuration parameters used as example to deploy the MySQL Server

Figure 4: Run docker deployment settings – Configuration parameters used as example to deploy the MySQL Server

“Advanced” TAB

Some advanced parameters can be configured here:

  • Scheduling: set automatic (recommended) or manual (perform a direct submission towards one of the providers available) scheduling
  • Creation timeout (minutes): amount of time to wait until the deployment should be considered failed
  • Failure policy: delete, or not, the deployment in case of failure
  • E-mail: send, or not, a confirmation email when deployment is complete

Step 3 - Submitting the Run docker Deployment

After submitting the deployment, by pressing the green button in Fig. 4, the user is redirected to the deployment list (as shown in Fig. 5) where he or she can follow the evolution of the deployment. Once successful deployment completion (indicated by the “CREATE_COMPLETE” as in Fig. 5), the user can reach the deployed Run docker application by using the links made available in the deployment list:

  • by clicking to the Deployment identifier
  • by clicking to the Details button at the end of the row
Figure 5: User deployment list

Figure 5: User deployment list

Step 4 - Operate with the deployed MySQL-Server application

Following the above mentioned links (Deployment Identifier or Details) the user is redirected to the deployment information as shown in Fig. 6.

Figure 6: Deployment details

Figure 6: Deployment details

Inspecting the tabs, the user can collect all the needed information to access the MySQL-Server DB (e.g the Host IP). As a test, the user can contact the remote MySQL Server from his location:

$ mysql -h <IP_HOST> -u root -p -e "show databases;";
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

At this step, the user can enjoy the deployed application!