Install Anon in Docker

Docker Setup and Deployment

This instruction will guide you how to install a Relay in Docker for different Linux distributions. The instructions are applicable to both amd64 and arm64 architectures, including devices such as the Raspberry Pi.

Type all the commands in a terminal window. Each code block can be pasted in full.

1. Add Docker repository

sudo apt-get install ca-certificates curl gnupg -y 
sudo install -m 0755 -d /etc/apt/keyrings
. /etc/os-release
sudo curl -fsSL https://download.docker.com/linux/$ID/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$ID \
  $(. /etc/os-release && sudo echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

2. Install the Docker packages

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

3. Prepare directories and fetch files

sudo mkdir /opt/compose-files/
sudo mkdir -p /opt/anon/etc/anon/
sudo mkdir -p /opt/anon/run/anon/
sudo mkdir -p /root/.nyx/
sudo chmod -R 700 /opt/anon/run/anon/
sudo chown -R 100:101 /opt/anon/run/anon/
sudo touch /opt/anon/etc/anon/notices.log
sudo chown 100:101 /opt/anon/etc/anon/notices.log
sudo useradd -M anond
sudo wget -O /opt/compose-files/relay.yaml https://raw.githubusercontent.com/ATOR-Development/anon-install/main/docker/anon-relay/relay.yaml
sudo wget -O /opt/anon/etc/anon/anonrc https://raw.githubusercontent.com/ATOR-Development/anon-install/main/docker/anon-relay/anonrc
sudo wget -O /root/.nyx/config https://raw.githubusercontent.com/ATOR-Development/anon-install/main/docker/anon-relay/config

4. Create and start the Docker container

sudo docker compose -f /opt/compose-files/relay.yaml up -d

Done!


Commands for updating, testing and monitoring:

Edit relay configuration

sudo nano /opt/anon/etc/anon/anonrc

Update relay to run latest version

sudo docker container rm --force anon-relay
sudo docker pull svforte/anon:latest
sudo docker compose -f /opt/compose-files/relay.yaml up -d

Install Nyx monitor

sudo apt-get install nyx

Monitor relay with Nyx

sudo nyx -s /opt/anon/run/anon/control

Check status for containers

sudo docker ps

Start, stop and restart the relay container

sudo docker start anon-relay
sudo docker restart anon-relay
sudo docker stop anon-relay

Check systemctl logs for anon service

sudo docker logs anon-relay

Monitor anon log

sudo tail -f /opt/anon/etc/anon/notices.log

Remove the relay container

sudo docker rm anon-relay --force

Last updated