I have a weird issue trying to run the container on a QNAP NAS. QNAP has its own implementation of docker called Container Station. It provides a (poor) web interface to create and manage containers. I have read in a couple of places (including the README here) that it is better to start the container via the command line interface, which also saves time when debugging issues by testing different settings. Therefore, I start the container thus:
docker run --cap-add=NET_ADMIN -d \
-v /share/Download/transmission:/data \
-v /etc/localtime:/etc/localtime:ro \
-e CREATE_TUN_DEVICE=true \
-e OPENVPN_PROVIDER=SURFSHARK \
-e OPENVPN_CONFIG=fr-mrs_udp \
-e OPENVPN_USERNAME=<my user ID> \
-e OPENVPN_PASSWORD=<my password> \
-e WEBPROXY_ENABLED=false \
-e LOCAL_NETWORK=192.168.1.0/24 \
--log-driver json-file \
--log-opt max-size=10m \
-p 9091:9091 \
haugene/transmission-openvpn
The container starts and seems to work, but stops after 20 seconds or so. Once, it actually did not stop and I even managed to run one download that completed successfully. Since then, I haven't got past the first 20 seconds.
The log file I can see through the QNAP Container Station web interface reads:
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: route options modified
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: route-related options modified
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: peer-id set
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: adjusting link_mtu to 1656
Sun Sep 20 09:34:57 2020 OPTIONS IMPORT: data channel crypto options modified
Sun Sep 20 09:34:57 2020 Data Channel: using negotiated cipher 'AES-256-GCM'
Sun Sep 20 09:34:57 2020 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Sun Sep 20 09:34:57 2020 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Sun Sep 20 09:34:57 2020 ROUTE_GATEWAY 10.0.3.1/255.255.255.0 IFACE=eth0 HWADDR=02:42:0a:00:03:02
Sun Sep 20 09:34:57 2020 TUN/TAP device tun0 opened
Sun Sep 20 09:34:57 2020 TUN/TAP TX queue length set to 100
Sun Sep 20 09:34:57 2020 /sbin/ip link set dev tun0 up mtu 1500
Sun Sep 20 09:34:57 2020 /sbin/ip addr add dev tun0 10.8.8.2/24 broadcast 10.8.8.255
Sun Sep 20 09:34:57 2020 /etc/openvpn/tunnelUp.sh tun0 1500 1584 10.8.8.2 255.255.255.0 init
Up script executed with tun0 1500 1584 10.8.8.2 255.255.255.0 init
Updating TRANSMISSION_BIND_ADDRESS_IPV4 to the ip of tun0 : 10.8.8.2
Generating transmission settings.json from env variables
sed'ing True to true
-------------------------------------
Transmission will run as
-------------------------------------
User name: root
User uid: 0
User gid: 0
-------------------------------------
STARTING TRANSMISSION
NO PORT UPDATER FOR THIS PROVIDER
Transmission startup script complete.
Sun Sep 20 09:34:57 2020 /sbin/ip route add 185.166.84.91/32 via 10.0.3.1
Sun Sep 20 09:34:57 2020 /sbin/ip route add 0.0.0.0/1 via 10.8.8.1
Sun Sep 20 09:34:57 2020 /sbin/ip route add 128.0.0.0/1 via 10.8.8.1
Sun Sep 20 09:34:57 2020 Initialization Sequence Completed
I am not familiar enough with Docker to know if there are places on the QNAP I could look for further log files - if anyone has tips, please let me know. But, primarily I assume that there is some environment variable or similar that I need to add/change - I just need some ideas as to what exactly...any help would be much appreciated.
It seems that (unsurprisingly) the culprit of this issue is (yet again) QNAP devs.
For some obscure reason, only understandable by their mighty minds, they decided
to include an instruction that automatically kills any OpenVPN process that starts
in any QNAP device, even if it is inside a container. So, transmission-vpn is
killed as soon as it starts.
It seems this behavior can be disabled by editing daemon_mgr.conf. You can have
more information here:
https://reddit.com/r/qnap/comments/gsa3tn/haugenetransmissionopenvpn/
https://github.com/binhex/documentation/blob/master/docker/faq/vpn.md
(question number 13)
https://www.reddit.com/r/qnap/comments/e2nmxl/guide_torrent_downloading_behind_vpn_using/
Excellent, thanks!
@ilike2burnthing Thank you so much. This was driving me insane.
Most helpful comment
https://www.reddit.com/r/qnap/comments/e2nmxl/guide_torrent_downloading_behind_vpn_using/