The documentation on running a dockerd relay seems scant at best. I run this docker.
With a Dockerfile:
FROM ubuntu:jammy
LABEL maintainer="Wollomatic <gh2022@wollomatic.de>"
LABEL maintainer="theking2 <theking2@king.ma>"
LABEL org.opencontainers.image.source=https://github.com/theking2/torrelay
LABEL org.opencontainers.image.description="Tor relay in a ubuntu docker image"
LABEL org.opencontainers.image.licenses=MIT
LABEL securitytxt="https://wollomatic.de/.well-known/security.txt"
VOLUME ["/etc/tor", "/var/lib/tor"]
ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "/usr/sbin/tor", "-f", "/etc/tor/torrc" ]
ARG TARGETARCH
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
apt-transport-https \
wget \
gpg \
gpg-agent \
ca-certificates \
tini \
--no-install-recommends \
&& wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org jammy main" >> /etc/apt/sources.list.d/tor.list \
&& apt-get update \
&& apt-get install -y \
tor \
tor-geoipdb \
--no-install-recommends \
&& apt-get purge -y \
wget \
curl \
gpg \
gpg-agent \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& chown debian-tor:debian-tor /etc/tor
USER debian-tor
and a compose.yaml
```
volumes:
torrelay_data:
external: true
name: torrelay
services:
torrelay:
container_name: torrelay
build: torrelay
image: torrelay
restart: unless-stopped
logging:
options:
max-size: "100K"
max-file: "1"
cpus: 2
security_opt:
- no-new-privileges:true
read_only: true
stop_grace_period: 2m
volumes:
- /pool0/storage/compose/torrelay/torrc:/etc/tor/torrc:ro
- torrelay_data:/var/lib/tor
network_mode: host # check if you want this
Is this correct?