1&1 IONOS Docker Machine Driver

2 Replies • Leave your reply

The 1&1 IONOS Cloud Driver is a plugin for Docker Machine which allows you to automate the provisioning of Docker hosts on Cloud Servers. The plugin is based on the 1&1 IONOS CloudServer Go SDK and Cloud API.

To acquire 1&1 IONOS Cloud API credentials visit https://www.ionos.com.

Features

The 1&1 IONOS Docker Machine driver can be installed either from source or from the GitHub Releases page. The driver allows you to create Docker hosts. You can specify the IP address, data center, firewall ID, and more. For more information on using Docker Machine, consult the official documentation.

Supported Versions

The 1&1 IONOS Cloud Driver supports Docker Machine version 0.5.1 or newer. Mac OSX and Windows users can install the Docker Toolbox package, which includes the latest version of Docker Machine.

Requirements

Windows and Mac OS X users may install Docker Toolbox package that includes the latest version of the Docker Machine.

Installation

From a Release

The latest version of the docker-machine-driver-oneandone binary is available on the GithHub Releases page. Download the tar archive and extract it into a directory residing in your PATH. Select the binary that corresponds to your OS and according to the file name prefix:

  • Linux: docker-machine-driver-oneandone-linux
  • Mac OS X: docker-machine-driver-oneandone-darwin
  • Windows: docker-machine-driver-oneandone-windows

To extract and install the binary, Linux and Mac users can use the Terminal and the following commands:

sudo tar -C /usr/local/bin -xvzf docker-machine-driver-oneandone*.tar.gz

If required, modify the permissions to make the plugin executable:

sudo chmod +x /usr/local/bin/docker-machine-driver-oneandone

Windows users may run the above commands without sudo in Docker Quickstart Terminal that is installed with Docker Toolbox.

From Source

Make sure you have installed Go and configured GOPATH properly.

To download the repository and build the driver run the following:

go get -d -u github.com/1and1/docker-machine-driver-oneandone
cd $GOPATH/src/github.com/1and1/docker-machine-driver-oneandone
make build

To use the driver run:

make install

This command will install the driver into /usr/local/bin.

Otherwise, set your PATH environment variable correctly. For example:

export PATH=$GOPATH/src/github.com/1and1/docker-machine-driver-oneandone/bin:$PATH

If you are running Windows, you may also need to install GNU Make, Bash shell and a few other Bash utilities available with Cygwin.

Usage

You may want to refer to the Docker Machine official documentation before using the driver.

Verify that Docker Machine can see the 1&1 IONOS driver:

docker-machine create -d oneandone --help

To create a Docker host, provide your API access token and a firewall policy ID. Make sure that the policy has opened the ports required by Docker.

If you do not supply a firewall policy ID, the driver will create a new firewall policy with a prefix of Docker-Driver-Required-Policy_. The policy will open the following TCP ports:

  • 22
  • 80
  • 2375-2376
  • 3375-3376

You may further customize the policy according to your needs and Docker's requirements. Before creating a new policy, the plugin will search for an existing policy with the Docker-Driver-Required-Policy_ prefix and the required ports.

docker-machine create -d oneandone \
--oneandone-api-key [API-TOKEN-KEY] \
--oneandone-firewall-id [FIREWALL-POLICY-ID] \
MyHostName

Available Options

  • --oneandone-api-key: 1&1 IONOS Cloud API key.
  • --oneandone-datacenter: 1&1 IONOS data center location.
  • --oneandone-firewall-id: 1&1 IONOS firewall policy ID.
  • --oneandone-size: Cloud Server size.
  • --oneandone-ip-address: Unassigned 1&1 IONOS public IP address.
  • --oneandone-loadbalancer-id: 1&1 IONOS load balancer ID.
  • --oneandone-monitor-policy-id: 1&1 IONOS monitoring policy ID.
  • --oneandone-os: 1&1 IONOS server appliance OS.
  • --oneandone-server-description: Cloud Server description.
  • --oneandone-ssh-pass: SSH password.
CLI OptionDefault ValueEnvironment VariableRequired
--oneandone-api-keyONEANDONE_API_KEYyes
--oneandone-datacenterUSONEANDONE_DATACENTERyes
--oneandone-firewall-idONEANDONE_FIREWALLno
--oneandone-sizeMONEANDONE_SIZEyes
--oneandone-ip-addressONEANDONE_IP_ADDRESSno
--oneandone-loadbalancer-idONEANDONE_LOADBALANCERno
--oneandone-monitor-policy-idONEANDONE_MONITOR_POLICYno
--oneandone-osubuntu1404-64stdONEANDONE_OSyes
--oneandone-server-descriptionONEANDONE_SERVER_DESCRIPTIONno
--oneandone-ssh-passONEANDONE_SSH_PASSWORDno

Valid values for --oneandone-size are M, L, XL, XXL, 3XL, 4XL and 5XL.

Available parameters for --oneandone-datacenter are shown in the next table.

ParameterData Center Location
DEGermany
ESSpain
GBUnited Kingdom of Great Britain and Northern Ireland
USUnited States of America

Supported values for --oneandone-os are listed below.

Parameter
centos7-64min
centos7-64std
centos7-64std+cpanel
centos7-64std+Plesk12unlimited
centos7-64std+Plesk12.5unlimited
ubuntu1204-64min
ubuntu1204-64std
ubuntu1204-64std+Plesk12.5unlimited
ubuntu1204-64std+Plesk12unlimited
ubuntu1404-64std
ubuntu1404-64min
ubuntu1404-64std+Plesk12unlimited
ubuntu1404-64std+Plesk12.5unlimited

Example

docker-machine --debug create --driver oneandone \
 --oneandone-api-key              b92bd5bb3dc909cfd48b6370d3bf560c \
 --oneandone-datacenter           GB \
 --oneandone-firewall-id          D8D6964A24D9A709941064AFD5FA83BC \
 --oneandone-size                 XXL \
 --oneandone-ip-address           109.228.51.239 \
 --oneandone-loadbalancer-id      F78677C1364BE21973E530FB7E7D805E \
 --oneandone-monitor-policy-id    6027B730256C9585B269DAA8B1788DEC \
 --oneandone-os                   centos7-64std \
 --oneandone-server-description   My-Docker-host-description \
 --oneandone-ssh-pass             MyPassSecret.170 \   
MyDockerHostName

Note: When creating a new machine, if you provide an IP address and a load balancer ID make sure that they belong to the same data center as the machine being created. Also, all OS appliances may not be available in all data centers.

License

This code is released under the Apache 2.0 License.

Copyright (c) 2016 1&1 IONOS Internet SE