1# Knot Docker
2
3> **IMPORTANT**
4> This is a community maintained repository, support is not guaranteed.
5
6Docker container and compose setup to run a [Tangled](https://tangled.sh) knot
7and host your own repository data.
8
9## Pre-built Images
10
11There is a [repository](https://hub.docker.com/r/hqnna/knot) of pre-built images
12for tags starting at `v1.4.0-alpha` if you prefer.
13
14```
15docker pull hqnna/knot:v1.4.0-alpha
16```
17
18Note that these are *not* official images, you use them at your own risk.
19
20## Building The Image
21
22By default the `Dockerfile` will build the latest tag, but you can change it
23with the `TAG` build argument.
24
25```sh
26docker build -t knot:latest --build-arg TAG=master .
27```
28
29The command above for example will build the latest commit on the `master`
30branch.
31
32By default it will also create a `git` user with user and group ID 1000:1000,
33but you can change it with the `UID` and `GID` build arguments.
34
35```sh
36docker build -t knot:latest --build-arg UID=$(id -u) GID=$(id -g)
37```
38
39The command above for example will create a user with the host user's UID and GID.
40This is useful if you are bind mounting the repositories and app folder on the host,
41as in the provided `docker-compose.yml` file.
42
43<hr style="margin-bottom: 20px; margin-top: 10px" />
44
45When using compose, these can be specified as build arguments which will be
46passed to the builder.
47
48```yaml
49build:
50 context: .
51 args:
52 TAG: master
53 UID: 1000
54 GID: 1000
55```
56
57This will for example tell docker to build it using the `master` branch like
58the command.
59
60## Setting Up The Image
61
62The simplest way to set up your own knot is to use the provided compose file
63and run the following:
64
65```sh
66export KNOT_SERVER_HOSTNAME=example.com
67export KNOT_SERVER_OWNER=did:plc:yourdidgoeshere
68export KNOT_SERVER_PORT=443
69docker compose up -d
70```
71
72This will setup everything for you including a reverse proxy.