Skip to content

Commit e42c999

Browse files
authored
Added example for using Cloud-init
1 parent 0c82f2b commit e42c999

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

README.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and pass that to `docker-machine create` with the `--hetzner-api-token` option.
1313

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

16-
```shell
16+
```bash
1717
# Download the binary (this example downloads the binary for linux amd64)
1818
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/1.0.0/docker-machine-driver-hetzner_1.0.0_linux_amd64.tar.gz
1919
$ tar -xvf docker-machine-driver-hetzner_1.0.0_linux_amd64.tar.gz
@@ -25,19 +25,42 @@ $ cp docker-machine-driver-hetzner /usr/local/bin/
2525

2626
## Usage
2727

28-
$ docker-machine create \
29-
--driver hetzner \
30-
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
31-
some-machine
32-
28+
```bash
29+
$ docker-machine create \
30+
--driver hetzner \
31+
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
32+
some-machine
33+
```
34+
3335
### Using environment variables
3436

35-
$ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
36-
&& HETZNER_IMAGE=centos-7 \
37-
&& docker-machine create \
38-
--driver hetzner \
39-
some-machine
40-
37+
```bash
38+
$ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
39+
&& HETZNER_IMAGE=centos-7 \
40+
&& docker-machine create \
41+
--driver hetzner \
42+
some-machine
43+
```
44+
45+
### Using Cloud-init
46+
47+
```bash
48+
$ CLOUD_INIT_USER_DATA=`cat <<EOF
49+
#cloud-config
50+
write_files:
51+
- path: /test.txt
52+
content: |
53+
Here is a line.
54+
Another line is here.
55+
EOF
56+
`
57+
58+
$ docker-machine create \
59+
--driver hetzner \
60+
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
61+
--hetzner-user-data="${CLOUD_INIT_USER_DATA}" \
62+
some-machine
63+
```
4164

4265
## Options
4366

0 commit comments

Comments
 (0)