|
1 | | ---- |
2 | | -description: Hetzner Cloud driver for machine |
3 | | -keywords: machine, hetzner, Hetzner Cloud, driver |
4 | | -title: Hetzner Cloud |
5 | | ---- |
| 1 | +# Hetzner Cloud Docker machine driver |
6 | 2 |
|
7 | | -Create Docker machines on [Hetzner Cloud](https://docs.hetzner.cloud/). |
| 3 | +[](https://goreportcard.com/report/github.com/JonasProgrammer/docker-machine-driver-hetzner) |
| 4 | +[](https://opensource.org/licenses/MIT) |
| 5 | + |
| 6 | +> This library adds the support for creating [Docker machines](https://github.com/docker/machine) hosted on the [Hetzner Cloud](hetzner.de/cloud). |
8 | 7 |
|
9 | 8 | You need to create a project-sepcific access token under `Access` > `API Tokens` in the project control panel |
10 | 9 | and pass that to `docker-machine create` with the `--hetzner-api-token` option. |
11 | 10 |
|
| 11 | + |
| 12 | +## Building |
| 13 | + |
| 14 | +Use an up-to-date version of [go](https://golang.org/dl) |
| 15 | + |
| 16 | +To use the driver, you can download the sources and build it locally: |
| 17 | + |
| 18 | + # Get sources and build the binary at ~/go/bin/docker-machine-driver-hetzner |
| 19 | + go get github.com/jonasprogrammer/docker-machine-driver-hetzner |
| 20 | + |
| 21 | + # Make the binary accessible to docker-machine |
| 22 | + export GOPATH=$(go env GOPATH) |
| 23 | + export GOBIN=$GOPATH/bin |
| 24 | + export PATH="$PATH:$GOBIN" |
| 25 | + |
| 26 | + |
12 | 27 | ## Usage |
13 | 28 |
|
14 | | - $ docker-machine create --driver hetzner --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy some-machine |
| 29 | + $ docker-machine create \ |
| 30 | + --driver hetzner \ |
| 31 | + --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \ |
| 32 | + some-machine |
15 | 33 |
|
16 | 34 | ### Using environment variables |
17 | 35 |
|
18 | | - $ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy HETZNER_IMAGE=centos-7 docker-machine create --driver hetzner some-machine |
| 36 | + $ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \ |
| 37 | + && HETZNER_IMAGE=centos-7 \ |
| 38 | + && docker-machine create \ |
| 39 | + --driver hetzner \ |
| 40 | + some-machine |
19 | 41 |
|
20 | 42 |
|
21 | 43 | ## Options |
@@ -57,3 +79,30 @@ was used during creation. |
57 | 79 | | `--hetzner-server-location` | `HETZNER_LOCATION` | - *(let Hetzner choose)* | |
58 | 80 | | `--hetzner-existing-key-path` | `HETZNER_EXISTING_KEY_PATH` | - *(generate new keypair)* | |
59 | 81 | | `--hetzner-existing-key-id` | `HETZNER_EXISTING_KEY_ID` | 0 *(upload new key)* | |
| 82 | + |
| 83 | + |
| 84 | +## Development |
| 85 | + |
| 86 | +Fork this repository, yielding `github.com/<yourAccount>/docker-machine-driver-hetzner`. |
| 87 | + |
| 88 | + # Get the sources of your fork and build it locally |
| 89 | + go get github.com/<yourAccount>/docker-machine-driver-hetzner |
| 90 | + |
| 91 | + # * This integrates your fork into the $GOPATH (typically pointing at ~/go) |
| 92 | + # * Your sources are at $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner |
| 93 | + # * That folder is a local Git repository. You can pull, commit and push from there. |
| 94 | + # * The binary will typically be at $GOPATH/bin/docker-machine-driver-hetzner |
| 95 | + # * In the source directory $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner |
| 96 | + # you may use go get to re-build the binary. |
| 97 | + # * Note: when you build the driver from different repositories, e.g. from your fork |
| 98 | + # as well as github.com/jonasprogrammer/docker-machine-driver-hetzner, |
| 99 | + # the binary files generated by these builds are all called the same |
| 100 | + # and will hence override each other. |
| 101 | + |
| 102 | + # Make the binary accessible to docker-machine |
| 103 | + export GOPATH=$(go env GOPATH) |
| 104 | + export GOBIN=$GOPATH/bin |
| 105 | + export PATH="$PATH:$GOBIN" |
| 106 | + |
| 107 | + # Make docker-machine output help including hetzner-specific options |
| 108 | + docker-machine create --driver hetzner |
0 commit comments