Transmission in a Docker container with OpenVPN
As I'd moved from TrueNAS to Ubuntu, I was moving most everything to a Docker container, and Transmission (using OpenVPN) was no different.
Under TrueNAS, I'd used a jail (https://www.nodinrogers.com/posts/2020-11-07-freenas-transmission-jail-with-openvpn/), but jails don't exist in Ubuntu, so Docker is the way to go.
The files I want to share are located in /mnt/files2share/, and I want to limit access to the Docker container to the 192.168.1.x/24 network.
Resulting transmission.yaml file:
version: '3.3'
services:
transmission-openvpn:
container_name: tranmission
cap_add:
- NET_ADMIN
volumes:
- '/mnt/file2share/:/data'
- '/your/config/path/:/config'
environment:
- OPENVPN_PROVIDER=PIA
- OPENVPN_CONFIG=denver
- OPENVPN_USERNAME=p1234567
- OPENVPN_PASSWORD=SuperSecretPW?
- LOCAL_NETWORK=192.168.1.0/24
- TZ=America/Denver
logging:
driver: json-file
options:
max-size: 10m
ports:
- '9091:9091'
image: haugene/transmission-openvpn
Creating the Docker container:
docker-compose -f ./transmission.yaml up -d
Verify the image is running:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e6e6b8827b5 haugene/transmission-openvpn "dumb-init /etc/open…" 3 days ago Up 3 days (healthy) 8118/tcp, 0.0.0.0:9091->9091/tcp, :::9091->9091/tcp tranmission
Once running, I was able to connect to the Transmission web GUI at https://< Docker host IP >:9091
References
dockerhub - haugene/transmission-openvpn https://hub.docker.com/r/haugene/transmission-openvpn