I am struggling with networks and Docker/docker-compose. Use case :
- I am using Transmission as a client Torrent, in network_mode with a wireguard VPN for privacy.
- Next to it, I have a Jackett container and a Sonarr container for automatisation. The problem is my local ip of my Wireguard container(showing itself in the VPN container) keep changing every time I reboot, but I need it to be permanent for Jackett/Sonarr. The think is I am using network_mode: service:container to use my VPN with my Transmission client, and I have no idea how to make both of my container (VPN and Transmission) with static IP.
I am doing a bridge between Jackett, Sonarr and VPN to let them able to communicate between them.
Do you have any idea how to make their IP statics ? Or, in a first half, VPN with a static local ip ?
version: "2.1"
services:
plex:
image: plexinc/pms-docker
container_name: plex
environment:
- TZ=Europe/X
- PLEX_CLAIM=X
volumes:
- /home/X/docker/plex_config:/config
- /home/X/docker/plex_transcode:/transcode
- /media/data:/data
ports:
- 3240:32400
transmission:
image: ghcr.io/linuxserver/transmission
container_name: transmission
depends_on:
- vpn
network_mode: service:vpn
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/X
- TRANSMISSION_WEB_HOME=/flood-for-transmission/
volumes:
- /home/X/docker/trans_config:/config
- /media/data:/downloads
- /media/data/watchTorrent:/watch
# ports:
# - 9091:9091
# - 51413:51413
# - 51413:51413/udp
restart: unless-stopped
vpn:
privileged: true
image: cmulk/wireguard-docker:buster
volumes:
- /etc/wireguard/conf:/etc/wireguard
networks:
- net
- linked
ports:
- 5555:5555/udp
- 9091:9091
- 51413:51413
- 51413:51413/udp
restart: unless-stopped
devices:
- /dev/net/tun
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
cap_add:
- NET_ADMIN
- SYS_MODULE
sonarr:
image: ghcr.io/linuxserver/sonarr
networks:
- linked
container_name: sonarr
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
volumes:
- /home/X/docker/sonarr/data:/config
- /media/data/Series:/tv #optional
- /media/data/:/downloads
ports:
- 8989:8989
restart: unless-stopped
jackett:
image: ghcr.io/linuxserver/jackett
container_name: jackett
networks:
- linked
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
- AUTO_UPDATE=true #optional
- RUN_OPTS=<run options here> #optional
volumes:
- /home/X/docker/jack/conf:/config
- /media/data/:/downloads
ports:
- 9117:9117
restart: unless-stopped
networks:
net:
linked:
driver: bridge
Plus, when I am looking for the IP inside Tranmission with this command :
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_id
it returns nothing. But with the VPN container, it returns me 2 local IPs. Exemple : 192.168.224.2192.168.208.2
Thank you for your time !