This is the official Docker Machine driver for use with the IONOS Cloud.
Before you begin you will need to have signed-up for a IONOS account. The credentials you establish during sign-up will be used to authenticate when using the Docker Machine driver..
This IONOS plugin will only work with Docker Machine. Before we continue, you will need to install Docker Machine. Docker Machine is included as part of Docker Toolbox. You can gain access to
docker-machine by installing Docker Toolbox on Mac OS X or Windows. It is also possible to install just Docker Machine without the rest of the components of Docker Toolbox.
The ProfitBricks Docker Machine Driver is written in the Go programming language. Your system will need to have Go installed. Please refer to the Go Install Documentation if you do not have Go installed and configured for your system.
Remember to set
$GOPATH and update
$PATH. The following are just examples using the
export command, you will need to adjust the paths for your particular installation.
export GOPATH=/usr/local/go export PATH=$PATH:/usr/local/go/bin
With those prerequisites taken care of, we will need to run the following commands to install the ProfitBricks Docker Machine driver:
go get github.com/profitbricks/docker-machine-driver-profitbricks
If you just installed Go, you may get an error indicating the need to configure the
$GOPATH environment variable. Once
$GOPATH is set properly, the command should complete successfully.
Next we need to build and install the driver itself.
cd $GOPATH/src/github.com/profitbricks/docker-machine-driver-profitbricks make install
When successful, we will end up with a newly created
docker-machine-driver-profitbricks binary in
Before you create a ProfitBricks machine you will need to set two environment variables containing your ProfitBricks credentials. These would be the same username and password that you use to log into the ProfitBricks DCD (Data Center Designer):
export PROFITBRICKS_USERNAME="profitbricks_username" export PROFITBRICKS_PASSWORD="profitbricks_password"
It is possible to pass your credentials on the command-line using
--profitbricks-password if you prefer.
docker-machine create with the relevant parameters. This example will use mostly default values and will therefore be created in the
docker-machine create --driver profitbricks test-machine
It should produce results similar to this:
Running pre-create checks... Creating machine... (test-machine) Datacenter Created (test-machine) Server Created (test-machine) Volume Created (test-machine) Attached a volume to a server. (test-machine) LAN Created (test-machine) NIC created (test-machine) Updated server's boot image Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with ubuntu(systemd)... Installing Docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env test-machine
To get detailed information about the possible options, run the command:
docker-machine create --help --driver profitbricks
This section describes the available options that can be set. Many of these options can also be set using environment variables. Several of the standard Docker Machine options may be specified multiple times if desired. The ProfitBricks specific options are prefixed with
--profitbricks- and the corresponding environment variables have
$PROFITBRICKS_ as the prefix.
|Option Name(s)||Description including [ENV variable]|
|--driver, -d "profitbricks"||The driver to create a new machine with. Set this to "profitbricks" in order to use Docker Machine with ProfitBricks resources. [$MACHINE_DRIVER]|
|--engine-env "opt"||Specify one or more environment variables to set in the engine.|
|--engine-insecure-registry "opt"||Specify which insecure registries to allow with the created engine.|
|--engine-install-url "https://get.docker.com"||Custom URL to use for engine installation. [$MACHINE_DOCKER_INSTALL_URL]|
|--engine-label "opt"||Specify labels for the created engine.|
|--engine-opt "opt"||Specify arbitrary flags to include with the created engine in the form "flag=value".|
|--engine-registry-mirror "opt"||Specify registry mirrors to use. [$ENGINE_REGISTRY_MIRROR]|
|--engine-storage-driver "opt"||Specify a storage driver to use with the engine.|
|--profitbricks-cores "4"||Set the number of ProfitBricks CPU cores. (2, 3, 4, etc.) [$PROFITBRICKS_CORES]|
|--profitbricks-cpu-family "AMD_OPTERON"||Specify the ProfitBricks CPU type. Two CPU families are available. (AMD_OPTERON, INTEL_XEON) [$PROFITBRICKS_CPU_FAMILY]|
|--profitbricks-datacenter-id "8fc590c3-4cfb-4702-8bd6-XXXXXXXXXX"||The ProfitBricks Virtual Data Center Id. If you want to use an existing ProfitBricks Virtual Data Center (VDC), then you can specify a UUID with this option. If you don't specify one, then a new VDC is created.|
|--profitbricks-disk-size "50"||The ProfitBricks volume/disk size in GB. (10, 50, 100, 200, 400) [$PROFITBRICKS_DISK_SIZE]|
|--profitbricks-disk-type "HDD"||The ProfitBricks disk type. You have two choices, either spinning hard disk drive (HDD) storage, or solid state drive (SSD) storage. (HDD, SSD) [$PROFITBRICKS_DISK_TYPE]|
|--profitbricks-endpoint "https://api.profitbricks.com/cloudapi/v4"||The ProfitBricks Cloud API endpoint. [$PROFITBRICKS_ENDPOINT]|
|--profitbricks-image "Ubuntu-16.04"||A ProfitBricks image name. You have the option to use an image alias such as: "Ubuntu:latest" or a partial image name such as: "Ubuntu-16.04". [$PROFITBRICKS_IMAGE]|
|--profitbricks-location "us/las"||A ProfitBricks regional location. This specifies a physical data center regional location where your VDC exists or will be provisioned. There are currently four available locations: (us/las, us/ewr, de/fkb, and de/fra) [$PROFITBRICKS_LOCATION]|
|--profitbricks-username "firstname.lastname@example.org"||This can be used to pass in the username part of your ProfitBricks credentials. The username is generally in an "email address" format. [$PROFITBRICKS_USERNAME]|
|--profitbricks-password "password"||This can be used to pass in the password part of your ProfitBricks credentials. [$PROFITBRICKS_PASSWORD]|
|--profitbricks-ram "2048"||The amount of RAM in MB. This should be a multiple of 256. (1024, 2048, 3072, 4096, etc.) [$PROFITBRICKS_RAM]|
|--profitbricks-server-availability-zone "AUTO"||The ProfitBricks server availability zone. You can specify one of the two compute availability zones, or leave it set to "AUTO". (AUTO, ZONE_1, ZONE_2)|
|--profitbricks-volume-availability-zone "AUTO"||The ProfitBricks volume availability zone. You can specify one of the three storage availability zones, or leave it set to "AUTO". (AUTO, ZONE_1, ZONE_2, ZONE_3)|
|--swarm||Configure Machine to join a Swarm cluster.|
|--swarm-addr "opt"||The address to advertise for Swarm. (Default: Detect and use the machine IP.)|
|--swarm-discovery||A discovery service to use with Swarm.|
|--swarm-experimental||Enable Swarm experimental features.|
|--swarm-host "tcp://0.0.0.0:3376"||The IP/socket to listen on for the Swarm master.|
|--swarm-image "swarm:latest"||Specify a Docker image to use for Swarm. [$MACHINE_SWARM_IMAGE]|
|--swarm-join-opt "opt"||Define arbitrary flags for Swarm join.|
|--swarm-master||Configure Machine to be a Swarm master.|
|--swarm-opt "opt"||Define arbitrary flags for Swarm master.|
|--swarm-strategy "spread"||Define a default scheduling strategy for Swarm.|
|--tls-san "opt"||Support extra SANs for TLS certs.|
To list the machines you have created, use the command:
It will return information about your machines, similar to this:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default - virtualbox Running tcp://192.168.99.100:2376 v1.10.2 test-machine - profitbricks Running tcp://184.108.40.206:2376 v1.10.3
Before you create a swarm of ProfitBricks machines, run this command:
docker run --rm swarm create
Then use the output to create the swarm and set a swarm master:
docker-machine create -d profitbricks --swarm --swarm-master --swarm-discovery token://f3a75db19a03589ac28550834457bfc3 swarm-master-test
To create a swarm child, use the command:
docker-machine create -d profitbricks --swarm --swarm-discovery token://f3a75db19a03589ac28550834457bfc3 swarm-child-test