Knot Docker#
IMPORTANT This is a community maintained repository, support is not guaranteed.
Docker container and compose setup to run a Tangled knot and host your own repository data.
Pre-built Images#
There is a repository of pre-built images
for tags starting at v1.13.0-alpha if you prefer.
docker pull atcr.io/tangled.org/knot:latest
Note that these are not official images, you use them at your own risk.
Building The Image#
By default the Dockerfile will build the latest tag, but you can change it
with the TAG build argument.
docker build -t knot:latest --build-arg TAG=master .
The command above for example will build the latest commit on the master
branch.
By default it will also create a git user with user and group ID 1000:1000,
but you can change it with the UID and GID build arguments.
docker build -t knot:latest --build-arg UID=$(id -u) GID=$(id -g)
The command above for example will create a user with the host user's UID and GID.
This is useful if you are bind mounting the repositories and app folder on the host,
as in the provided docker-compose.yml file.
When using compose, these can be specified as build arguments which will be passed to the builder.
build:
context: .
args:
TAG: master
UID: 1000
GID: 1000
This will for example tell docker to build it using the master branch like
the command.
Setting Up The Image#
The simplest way to set up your own knot is to use the provided compose file and run the following:
First, create directories that will be used as docker volumes:
mkdir keys repositories server
chown -R 1000:1000 keys repositories server
Replace the 1000:1000 ids if you built your docker image with different ids.
Then start the knot container using:
export KNOT_SERVER_HOSTNAME=example.com
export KNOT_SERVER_OWNER=did:plc:yourdidgoeshere
export KNOT_SERVER_PORT=443
docker compose up -d
If you also want to setup a reverse proxy with TLS termination, use the caddy profile of the in the compose file:
docker compose --profile caddy up -d
The knot server will then be exposed on the given port.
Pushing code using SSH#
When starting a knot in a docker container, the knot listens to a SSH port that is not the same as the host.
The docker-compose.yml file uses port 2222 as an example:
services:
knot:
image: atcr.io/tangled.org/knot:latest
ports:
- "5555:5555"
- "2222:22"
By default, when you push code to a remote, such as git@knot.example.com/someRepo, Git will use port 22, which will resolve to your docker host's SSH daemon, not the container.
To connect to the knot container over Git with SSH, configure your SSH client to use the port exposed by the container in ~/.ssh/config.
Host knot.example.com
Port 2222
You can then test your configuration using ssh -T git@knot.example.com.