You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/setup/install/container.md
+20-24Lines changed: 20 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -15,32 +15,25 @@ should not work with alternatives like [Podman](https://podman.io). The containe
15
15
16
16
## Configure and run headscale
17
17
18
-
1.Prepare a directory on the host Docker node in your directory of choice, used to hold headscaleconfiguration and the [SQLite](https://www.sqlite.org/) database:
18
+
1.Create a directory on the Docker host to store headscale's [configuration](../../ref/configuration.md) and the [SQLite](https://www.sqlite.org/) database:
19
19
20
20
```shell
21
-
mkdir -p ./headscale/config
21
+
mkdir -p ./headscale/{config,lib,run}
22
22
cd ./headscale
23
23
```
24
24
25
-
1. Download the example configuration for your chosen version and save it as: `/etc/headscale/config.yaml`. Adjust the
25
+
1. Download the example configuration for your chosen version and save it as: `$(pwd)/config/config.yaml`. Adjust the
26
26
configuration to suit your local environment. See [Configuration](../../ref/configuration.md) for details.
27
27
28
-
```shell
29
-
sudo mkdir -p /etc/headscale
30
-
sudo nano /etc/headscale/config.yaml
31
-
```
32
-
33
-
Alternatively, you can mount `/var/lib` and `/var/run` from your host system by adding
34
-
`--volume $(pwd)/lib:/var/lib/headscale` and `--volume $(pwd)/run:/var/run/headscale`
35
-
in the next step.
36
-
37
-
1. Start the headscale server while working in the host headscale directory:
28
+
1. Start headscale from within the previously created `./headscale` directory:
38
29
39
30
```shell
40
31
docker run \
41
32
--name headscale \
42
33
--detach \
43
-
--volume $(pwd)/config:/etc/headscale/ \
34
+
--volume $(pwd)/config:/etc/headscale \
35
+
--volume $(pwd)/lib:/var/lib/headscale \
36
+
--volume $(pwd)/run:/var/run/headscale \
44
37
--publish 127.0.0.1:8080:8080 \
45
38
--publish 127.0.0.1:9090:9090 \
46
39
headscale/headscale:<VERSION> \
@@ -49,12 +42,12 @@ should not work with alternatives like [Podman](https://podman.io). The containe
49
42
50
43
Note: use `0.0.0.0:8080:8080` instead of `127.0.0.1:8080:8080`if you want to expose the container externally.
51
44
52
-
This commandwill mount `config/` under `/etc/headscale`, forward port 8080 out of the container so the
53
-
headscale instance becomes available and thendetach so headscale runs in the background.
45
+
This commandmounts the local directories inside the container, forwards port 8080 and 9090 out of the container so
46
+
the headscale instance becomes available and thendetaches so headscale runs in the background.
54
47
55
-
Example `docker-compose.yaml`
48
+
A similar configuration for`docker-compose`:
56
49
57
-
```yaml
50
+
```yaml title="docker-compose.yaml"
58
51
version: "3.7"
59
52
60
53
services:
@@ -66,8 +59,11 @@ should not work with alternatives like [Podman](https://podman.io). The containe
66
59
- "127.0.0.1:8080:8080"
67
60
- "127.0.0.1:9090:9090"
68
61
volumes:
69
-
# Please change <CONFIG_PATH> to the fullpath of the config folder just created
70
-
- <CONFIG_PATH>:/etc/headscale
62
+
# Please set <HEADSCALE_PATH> to the absolute path
63
+
# of the previously created headscale directory.
64
+
- <HEADSCALE_PATH>/config:/etc/headscale
65
+
- <HEADSCALE_PATH>/lib:/var/lib/headscale
66
+
- <HEADSCALE_PATH>/run:/var/run/headscale
71
67
command: serve
72
68
```
73
69
@@ -100,7 +96,7 @@ should not work with alternatives like [Podman](https://podman.io). The containe
100
96
101
97
### Register a machine (normal login)
102
98
103
-
On a client machine, execute the `tailscale` login command:
99
+
On a client machine, execute the `tailscale up`command to login:
This will return a pre-authenticated key that can be used to connect a node to headscale during the `tailscale` command:
121
+
This will return a pre-authenticated key that can be used to connect a node to headscale with the `tailscale up` command:
126
122
127
123
```shell
128
124
tailscale up --login-server <YOUR_HEADSCALE_URL> --authkey <YOUR_AUTH_KEY>
129
125
```
130
126
131
127
## Debugging headscale running in Docker
132
128
133
-
The `headscale/headscale` Docker container is based on a "distroless" image that does not contain a shell or any other debug tools. If you need to debug your application running in the Docker container, you can use the `-debug` variant, for example `headscale/headscale:x.x.x-debug`.
129
+
The `headscale/headscale` Docker container is based on a "distroless" image that does not contain a shell or any other debug tools. If you need to debug headscale running in the Docker container, you can use the `-debug` variant, for example `headscale/headscale:x.x.x-debug`.
0 commit comments