Closed Suika closed 3 years ago
@Suika
Start two containers of qbittorrent with the same
network_mode: "container:*"
Why merge service with the network of an existing container and not using the default bridge of your stack? That's not a really good practice as you can see exposed ports can conflict.
You can also already map port 8080 in the container to any port on the Docker host with -p 9000:8080
.
See also https://docs.docker.com/config/containers/container-networking/#published-ports
Strangely the way the backslash is escaped in the entrypoint does not work. Please check it for yourself in the container that you started.
I've tested and it works as expected. Can you post the generated config?
Why merge service with the network of an existing container and not using the default bridge of your stack? That's not a really good practice as you can see exposed ports can conflict.
VPN Containers? Because I don't want to mess with my host system network when I can have VPN in the container and easily attach other containers to the VPN container and have them use it's network. It's less pain to do it this way than most other ways. Believe me on this one.
I've tested and it works as expected. Can you post the generated config?
Just restarted the container using your image crazymax/qbittorrent@sha256:8d172a2cfe3a689527748cc7f0a62c02a0dfdf65d59c0e74fd03d0589f50896b
```yaml qbittorrent: image: crazymax/qbittorrent container_name: qbittorrent network_mode: "container:SomeOtherContainer" labels: - "traefik.frontend.rule=Host:qb.host.lan" - "traefik.frontend.entryPoints=http,https" - "traefik.frontend.headers.SSLRedirect=true" - "traefik.port=3265" - "com.centurylinklabs.watchtower.enable=true" environment: - PUID=1000 - PGID=1000 - TZ=Europe/Berlin - WEBUI_PORT=3265 - ALT_WEBUI=/someotherplace volumes: - /snapraid/storage_c1/docker/qbittorrent/data:/data restart: unless-stopped ```
The qBittorrent.conf
after the restart, where the sed should have changed the webport to 8080 and ALT_WEBUI, but it didn't.
``` $ stat qBittorrent.conf File: qBittorrent.conf Size: 9209 Blocks: 24 IO Block: 4096 regular file Device: 3fh/63d Inode: 310195435 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ suika) Gid: ( 1000/ suika) Access: 2021-01-15 22:36:25.302502238 +0100 Modify: 2021-01-15 22:36:25.306502201 +0100 Change: 2021-01-15 22:36:25.306502201 +0100 Birth: - ``` ```conf [General] ported_to_new_savepath_system=true [Application] FileLogger\Enabled=true FileLogger\Path=/var/log/qbittorrent [AutoRun] enabled=false program= [LegalNotice] Accepted=true [Network] Cookies=@Invalid() [Preferences] Advanced\RecheckOnCompletion=false Advanced\trackerPort=9000 Bittorrent\AddTrackers=true Bittorrent\TrackersList= Connection\InetAddress=185.156.174.27 Connection\InterfaceListenIPv6=false Connection\PortRangeMin=33646 Connection\ResolvePeerCountries=true Connection\UPnP=false Connection\UseUPnP=false Downloads\FinishedTorrentExportDir=/data/torrents Downloads\PreAllocation=false Downloads\SavePath=/data/downloads Downloads\ScanDirsV2=@Variant(Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()x1cDownloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()x1Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()x16Downloads\ScanDirsV2=@Invalid()/Downloads\ScanDirsV2=@Invalid()x64Downloads\ScanDirsV2=@Invalid()x61Downloads\ScanDirsV2=@Invalid()tDownloads\ScanDirsV2=@Invalid()x61Downloads\ScanDirsV2=@Invalid()/Downloads\ScanDirsV2=@Invalid()wDownloads\ScanDirsV2=@Invalid()x61Downloads\ScanDirsV2=@Invalid()tDownloads\ScanDirsV2=@Invalid()x63Downloads\ScanDirsV2=@Invalid()hDownloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()x2Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()Downloads\ScanDirsV2=@Invalid()x1) Downloads\StartInPause=false Downloads\TempPath=/data/temp DynDNS\DomainName=changeme.dyndns.org DynDNS\Enabled=false DynDNS\Password= DynDNS\Service=0 DynDNS\Username= General\Locale=en General\UseRandomPort=false IPFilter\Enabled=true IPFilter\File=/data/ipfilter.dat MailNotification\email= MailNotification\enabled=false MailNotification\password= MailNotification\req_auth=true MailNotification\req_ssl=false MailNotification\sender=qBittorrent_notification@example.com MailNotification\smtp_server=smtp.changeme.com MailNotification\username= Queueing\QueueingEnabled=true WebUI\Address=0.0.0.0 WebUI\AlternativeUIEnabled=false WebUI\AuthSubnetWhitelist=@Invalid() WebUI\AuthSubnetWhitelistEnabled=false WebUI\BanDuration=3600 WebUI\CSRFProtection=true WebUI\ClickjackingProtection=true WebUI\CustomHTTPHeaders= WebUI\CustomHTTPHeadersEnabled=false WebUI\Enabled=true WebUI\HTTPS\CertificatePath= WebUI\HTTPS\Enabled=false WebUI\HTTPS\KeyPath= WebUI\HostHeaderValidation=true WebUI\LocalHostAuth=false WebUI\MaxAuthenticationFailCount=5 WebUI\Password_PBKDF2= WebUI\Port=3265 WebUI\RootFolder==/data/webui WebUI\SecureCookie=true WebUI\ServerDomains=* WebUI\SessionTimeout=3600 WebUI\UseUPnP=true WebUI\Username= ```
@Suika
webport to 8080
There is no such thing called WEBUI_PORT
in this image.
...and ALT_WEBUI, but it didn't.
ALT_WEBUI
is a boolean to enable or disable alternative webui. Not a string.
WebUI\RootFolder==/data/webui
The ==
has been fixed in the latest release of this image.
sed \ will not work, \\ will
And about #18, sed works as expected. The configuration must have only one backslash. See https://github.com/qbittorrent/qBittorrent/wiki/Alternate-WebUI-usage.
There is no such thing called WEBUI_PORT in this image.
Doesn't matter. Because https://github.com/crazy-max/docker-qbittorrent/blob/master/entrypoint.sh#L85 should've overwritten the port in the config.
ALT_WEBUI is a boolean to enable or disable alternative webui. Not a string.
Fucked up on that one, let me redo the test again.
The == has been fixed in the latest release of this image.
Will delete the conf and let it redo the config from scratch.
Doesn't matter. Because https://github.com/crazy-max/docker-qbittorrent/blob/master/entrypoint.sh#L85 should've overwritten the port in the config.
It does:
$ docker-compose exec qbittorrent cat /data/config/qBittorrent.conf
[General]
ported_to_new_savepath_system=true
[Application]
FileLogger\Enabled=true
FileLogger\Path=/var/log/qbittorrent
[LegalNotice]
Accepted=true
[Preferences]
Bittorrent\AddTrackers=false
Connection\InetAddress=90.101.64.158
Connection\InterfaceListenIPv6=false
Connection\PortRangeMin=6881
Connection\UseUPnP=false
Downloads\FinishedTorrentExportDir=/data/torrents
Downloads\PreAllocation=true
Downloads\SavePath=/data/downloads
Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)
Downloads\StartInPause=false
Downloads\TempPath=/data/temp
Downloads\TempPathEnabled=true
General\Locale=en
General\UseRandomPort=false
Queueing\QueueingEnabled=true
WebUI\Address=0.0.0.0
WebUI\AlternativeUIEnabled=false
WebUI\Enabled=true
WebUI\HTTPS\Enabled=false
WebUI\LocalHostAuth=false
WebUI\Port=8080
WebUI\RootFolder=/data/webui
@crazy-max It does't, please see the video. Basically:
https://user-images.githubusercontent.com/2320837/104785208-e63bab80-5781-11eb-804a-3c367e93e487.mp4
Oh man, gotta love the different results. Also the compose is now as follows:
qbittorrent:
image: crazymax/qbittorrent
container_name: qbittorrent
network_mode: "container:SomeContainer"
labels:
- "traefik.frontend.rule=Host:qb.suika.lan"
- "traefik.frontend.entryPoints=http,https"
- "traefik.frontend.headers.SSLRedirect=true"
- "traefik.port=8080"
- "com.centurylinklabs.watchtower.enable=true"
environment:
- PUID=1000
- PGID=1000
volumes:
- /snapraid/storage_c1/docker/qbittorrent/data:/data
restart: unless-stopped
@Suika Oh yes good point the value is not affected by sed. Can you split your PR with one to fix the sed and another for your dynamic webui port please? Thanks.
I don't know how, but I did it. Either way, please check on your side if it works as expected. The ENV and the sed. It worked on my side, so it should technically work on yours, too. But I've also see containers fail partially by simply running on something like FreeNAS. It's a strange world out there.
GDI, wait. I'll create a new PR once I've re-tested everything using the latest changes from this repo.
@crazy-max Do you need a WEBUI_PORT=${WEBUI_PORT:-8080}
in your entrypoint? My guess is no, since I'm adding the WEBUI_PORT to the Dockerfile ENV.,
Tested the changes, #20 has the fixes.
Can you merge the first PR? Second will come later, reason is inside the PR comments.
What about #21?
Will be available on next release, thanks for your contrib
Behaviour
Web port of the container clashes with other container ports when using the network of a VPN. Start r(u)torrent container and this qbittorrent container with the same
network_mode: "container:*"
and one the of the containers will fail. And the config is overwritten on every start of the container, so editing the config file doesn't do anything.Steps to reproduce this issue
network_mode: "container:*"
Expected behaviour
Ability to change the port in the config or via ENV and have both containers running without problems.
Actual behaviour
Two containers can't stat because ports clash. Port configuration in file can't be changed, because it will be overwritten on every start. Forcing RO on the config file will cause the healthcheck to fail.
Extra
Strangely the way the backslash is escaped in the entrypoint does not work. Please check it for yourself in the container that you started. Either way, #18 is meant to fix it.
Configuration
docker --version
) :Docker version 19.03.14, build 5eb3275d40
docker-compose --version
) :docker-compose version 1.26.0, build d4451659
Debian 9
uname -a
) :Linux 4.15.18-10-pve #1 SMP PVE 4.15.18-32 (Sat, 19 Jan 2019 10:09:37 +0100) x86_64 GNU/Linux
Docker info
Logs
Was ages ago, already dropped that container.