Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JonasProgrammer/docker-machine-driver-hetzner

Docker machine driver for the new hetzner cloud API
https://github.com/JonasProgrammer/docker-machine-driver-hetzner

docker docker-machine driver hetzner machine

Last synced: 4 days ago
JSON representation

Docker machine driver for the new hetzner cloud API

Awesome Lists containing this project

README

        

# Hetzner Cloud Docker machine driver

[![Go Report Card](https://goreportcard.com/badge/github.com/JonasProgrammer/docker-machine-driver-hetzner)](https://goreportcard.com/report/github.com/JonasProgrammer/docker-machine-driver-hetzner)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Go-CI](https://github.com/JonasProgrammer/docker-machine-driver-hetzner/actions/workflows/go.yml/badge.svg)](https://github.com/JonasProgrammer/docker-machine-driver-hetzner/actions/workflows/go.yml)

> This library adds the support for creating [Docker machines](https://github.com/docker/machine) hosted on the [Hetzner Cloud](https://www.hetzner.de/cloud).

You need to create a project-specific access token under `Access` > `API Tokens` in the project control panel
and pass that to `docker-machine create` with the `--hetzner-api-token` option.

## Installation

You can find sources and pre-compiled binaries [here](https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases).

```bash
# Download the binary (this example downloads the binary for linux amd64)
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/5.0.0/docker-machine-driver-hetzner_5.0.0_linux_amd64.tar.gz
$ tar -xvf docker-machine-driver-hetzner_5.0.0_linux_amd64.tar.gz

# Make it executable and copy the binary in a directory accessible with your $PATH
$ chmod +x docker-machine-driver-hetzner
$ cp docker-machine-driver-hetzner /usr/local/bin/
```

## Usage

```bash
$ docker-machine create \
--driver hetzner \
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
some-machine
```

### Using environment variables

```bash
$ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
&& HETZNER_IMAGE=centos-7 \
&& docker-machine create \
--driver hetzner \
some-machine
```

### Dealing with kernels without aufs

If you use an image without aufs, like the one currently supplied with the
debian-9 image, you can try specifying another storage driver, such as
overlay2. Like so:

```bash
$ docker-machine create \
--engine-storage-driver overlay2 \
--driver hetzner \
--hetzner-image debian-9 \
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
some-machine
```

### Using Cloud-init

```bash
$ CLOUD_INIT_USER_DATA=`cat </docker-machine-driver-hetzner`.

```shell
# Get the sources of your fork and build it locally
$ go get github.com//docker-machine-driver-hetzner

# * This integrates your fork into the $GOPATH (typically pointing at ~/go)
# * Your sources are at $GOPATH/src/github.com//docker-machine-driver-hetzner
# * That folder is a local Git repository. You can pull, commit and push from there.
# * The binary will typically be at $GOPATH/bin/docker-machine-driver-hetzner
# * In the source directory $GOPATH/src/github.com//docker-machine-driver-hetzner
# you may use go get to re-build the binary.
# * Note: when you build the driver from different repositories, e.g. from your fork
# as well as github.com/jonasprogrammer/docker-machine-driver-hetzner,
# the binary files generated by these builds are all called the same
# and will hence override each other.

# Make the binary accessible to docker-machine
$ export GOPATH=$(go env GOPATH)
$ export GOBIN=$GOPATH/bin
$ export PATH="$PATH:$GOBIN"

# Make docker-machine output help including hetzner-specific options
$ docker-machine create --driver hetzner
```

## Upcoming breaking changes

### 4.0.0

* **check log output for BREAKING-V6** (previously *BREAKING-V5*)
* `--hetzner-user-data-from-file` will be fully deprecated and its flag description will only read 'DEPRECATED, legacy'; current fallback behaviour will be retained. `--hetzner-flag-user-data-file` should be used instead.
* `--hetzner-disable-public-4`/`--hetzner-disable-public-6` will be fully deprecated and its flag description will only read 'DEPRECATED, legacy'; current fallback behaviour will be retained. `--hetzner-disable-public-ipv4`/`--hetzner-disable-public-ipv6` should be used instead.

### 5.0.0

* major update due to #108 ([hetznercloud/hcloud-go#263](https://github.com/hetznercloud/hcloud-go/v2/issues/263))
* new `hcloud-go` v2 requiring int64 IDs is used for interaction with Hetzner cloud
* old configs should be forward-compatible
* newly created machines may now use 64-bit integers in all stored and transmitted data, potentially breaking existing tools supporting 32-bit only
- this includes anything interacting with the flags CLI via RPC, as `mcnflags` lacks an int64 flag type, so `StringFlag` and parsing are used now
* previous changes were moved one version (i.e. 5 -> 6, 6 -> 7)

### 6.0.0

* *moved from 5.0.0*
* `--hetzner-user-data-from-file` will be removed entirely, including its fallback behavior
* `--hetzner-disable-public-4`/`--hetzner-disable-public-6` ill be removed entirely, including their fallback behavior
* not specifying `--hetzner-image` will generate a warning stating 'use of default image is DEPRECATED'

### 7.0.0

* *moved from 6.0.0*
* specifying `--hetzner-image` will be mandatory, and a default image will no longer be provided