jlesage / docker-firefox

Docker container for Firefox
MIT License
1.61k stars 288 forks source link

gluetun issues with 2 docker #159

Closed 0xN0BADC0FF33 closed 1 year ago

0xN0BADC0FF33 commented 1 year ago

I use gluetun to connect docker containers to VPN.

If i add 2 docker instances from you. firefox and jdownloader2 only one is available on the exposed ports.

This is my docker compose which doesnt work only jdownloader2 will be exposed on the port.

gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    restart: unless-stopped
    # line above must be uncommented to allow external containers to connect. See https://github.com/qdm12/gluetun/wiki/Connect-a-container-to-gluetun#external-container-to-gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 8888:8888/tcp # HTTP proxy
      - 8388:8388/tcp # Shadowsocks
      - 8388:8388/udp # Shadowsocks
      - 7800:7800
      - 5800:5800

    volumes:
      - ${APPDATA}gluetun:/gluetun:rw
    environment:
      # See https://github.com/qdm12/gluetun/wiki
      - VPN_SERVICE_PROVIDER=mullvad
      - VPN_TYPE=openvpn
      # OpenVPN:
      - OPENVPN_USER=xxxx
      - OPENVPN_PASSWORD=
      - OPENVPN_CIPHERS=aes-256-gcm
      - SERVER_HOSTNAMES=ch-zrh-001,ch-zrh-002,ch-zrh-003,ch-zrh-004,ch-zrh-201,ch-zrh-202
      - FIREWALL_VPN_INPUT_PORTS=55886
      # Wireguard:
      # - WIREGUARD_PRIVATE_KEY=wOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=
      # - WIREGUARD_ADDRESSES=10.64.222.21/32
      # Timezone for accurate log times
      - TZ=${TZ}

firefox:
    image: jlesage/firefox
    container_name: ff
    shm_size: 4g
    restart: unless-stopped
    network_mode: "service:gluetun"
    volumes:
      - ${APPDATA}ff:/config:rw
      - ${FF}
    environment:
      - USER_ID=${PUID}
      - GROUP_ID=${PGID}
      - TZ=${TZ}
      - SECURE_CONNECTION=1
      - VNC_PASSWORD=xxx

  jdownloader-2:
    image: jlesage/jdownloader-2
    container_name: jd2
    network_mode: "service:gluetun"
    restart: unless-stopped
    volumes:
      - ${APPDATA}jd2:/config:rw
      - ${JD}
    environment:
      - USER_ID=${PUID}
      - GROUP_ID=${PGID}
      - TZ=${TZ}
      - SECURE_CONNECTION=1
      - WEB_LISTENING_PORT=7800

How to fix this?

Thanks in advance!

jlesage commented 1 year ago

Does the Firefox container work if you don't have the JD one ?

0xN0BADC0FF33 commented 1 year ago

Yes, the firefox container works flawlessly if i remove the network_mode from JD. I can access then JD with the 7800:7800 port mapping... Firefox and JD works well together but only if i dont use gluetun as their network mode. If i add 1 of the container they work. If I add both, only one of them works.

jlesage commented 1 year ago

When FF is used with gluetun, do you access it via port 5800 ?

0xN0BADC0FF33 commented 1 year ago

Yes, i played around every possibility. Tried also adding - WEB_LISTENING_PORT=6800 to the FF docker container and mapping in gluetun with 6800:6800 and try to access it but if jd is also in gluetun with port 7800 or 5800 the FF container is not reachable.

jlesage commented 1 year ago

Can you share the log of the non-functioning container: docker logs <container name>

0xN0BADC0FF33 commented 1 year ago

Oh, sorry didnt't know about the logs... It was a conflict with the VNC Port which stopped the nginx server. I added now - VNC_LISTENING_PORT=6000 to the ff container to avoid the conflict with JD 5900 automatically set VNC port. Now it works! This was the output from the log:

[init        ] container is starting...
[cont-env    ] loading container environment variables...
[cont-env    ] APP_NAME: loading...
[cont-env    ] APP_VERSION: loading...
[cont-env    ] DISPLAY: executing...
[cont-env    ] DISPLAY: terminated successfully.
[cont-env    ] DISPLAY: loading...
[cont-env    ] DOCKER_IMAGE_PLATFORM: loading...
[cont-env    ] DOCKER_IMAGE_VERSION: loading...
[cont-env    ] GTK_THEME: executing...
[cont-env    ] GTK_THEME: terminated successfully.
[cont-env    ] GTK_THEME: loading...
[cont-env    ] HOME: loading...
[cont-env    ] QT_STYLE_OVERRIDE: executing...
[cont-env    ] QT_STYLE_OVERRIDE: terminated successfully.
[cont-env    ] QT_STYLE_OVERRIDE: loading...
[cont-env    ] TAKE_CONFIG_OWNERSHIP: loading...
[cont-env    ] XDG_CACHE_HOME: loading...
[cont-env    ] XDG_CONFIG_HOME: loading...
[cont-env    ] XDG_DATA_HOME: loading...
[cont-env    ] XDG_RUNTIME_DIR: loading...
[cont-env    ] XDG_STATE_HOME: loading...
[cont-env    ] container environment variables initialized.
[cont-secrets] loading container secrets...
[cont-secrets] container secrets loaded.
[cont-init   ] executing container initialization scripts...
[cont-init   ] 10-certs.sh: executing...
[cont-init   ] 10-certs.sh: terminated successfully.
[cont-init   ] 10-check-app-niceness.sh: executing...
[cont-init   ] 10-check-app-niceness.sh: terminated successfully.
[cont-init   ] 10-cjk-font.sh: executing...
[cont-init   ] 10-cjk-font.sh: terminated successfully.
[cont-init   ] 10-clean-logmonitor-states.sh: executing...
[cont-init   ] 10-clean-logmonitor-states.sh: terminated successfully.
[cont-init   ] 10-clean-tmp-dir.sh: executing...
[cont-init   ] 10-clean-tmp-dir.sh: terminated successfully.
[cont-init   ] 10-fontconfig-cache-dir.sh: executing...
[cont-init   ] 10-fontconfig-cache-dir.sh: terminated successfully.
[cont-init   ] 10-init-users.sh: executing...
[cont-init   ] 10-init-users.sh: terminated successfully.
[cont-init   ] 10-nginx.sh: executing...
[cont-init   ] 10-nginx.sh: terminated successfully.
[cont-init   ] 10-openbox.sh: executing...
[cont-init   ] 10-openbox.sh: terminated successfully.
[cont-init   ] 10-set-tmp-dir-perms.sh: executing...
[cont-init   ] 10-set-tmp-dir-perms.sh: terminated successfully.
[cont-init   ] 10-vnc-password.sh: executing...
[cont-init   ] 10-vnc-password.sh: creating VNC password file from environment variable...
[cont-init   ] 10-vnc-password.sh: terminated successfully.
[cont-init   ] 10-web-data.sh: executing...
[cont-init   ] 10-web-data.sh: terminated successfully.
[cont-init   ] 10-x11-unix.sh: executing...
[cont-init   ] 10-x11-unix.sh: terminated successfully.
[cont-init   ] 10-xdg-runtime-dir.sh: executing...
[cont-init   ] 10-xdg-runtime-dir.sh: terminated successfully.
[cont-init   ] 15-install-pkgs.sh: executing...
[cont-init   ] 15-install-pkgs.sh: terminated successfully.
[cont-init   ] 55-check-snd.sh: executing...
[cont-init   ] 55-check-snd.sh: sound not supported: device /dev/snd not exposed to the container.
[cont-init   ] 55-check-snd.sh: terminated successfully.
[cont-init   ] 55-firefox.sh: executing...
[cont-init   ] 55-firefox.sh: fixed display size in /config/profile/sessionstore-backups/recovery.jsonlz4.
[cont-init   ] 55-firefox.sh: terminated successfully.
[cont-init   ] 56-firefox-set-prefs-from-env.sh: executing...
[cont-init   ] 56-firefox-set-prefs-from-env.sh: terminated successfully.
[cont-init   ] 85-take-config-ownership.sh: executing...
[cont-init   ] 85-take-config-ownership.sh: terminated successfully.
[cont-init   ] 89-info.sh: executing...
    ╭――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╮
    │                                                                      │
    │ Application:           Firefox                                       │
    │ Application Version:   108.0.1-r1                                    │
    │ Docker Image Version:  23.01.1                                       │
    │ Docker Image Platform: linux/amd64                                   │
    │                                                                      │
    ╰――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――╯
[cont-init   ] 89-info.sh: terminated successfully.
[cont-init   ] all container initialization scripts executed.
[init        ] giving control to process supervisor.
[supervisor  ] loading services...
[supervisor  ] loading service 'default'...
[supervisor  ] loading service 'app'...
[supervisor  ] loading service 'gui'...
[supervisor  ] loading service 'certsmonitor'...
[supervisor  ] loading service 'nginx'...
[supervisor  ] loading service 'xvnc'...
[supervisor  ] loading service 'openbox'...
[supervisor  ] loading service 'logmonitor'...
[supervisor  ] service 'logmonitor' is disabled.
[supervisor  ] loading service 'logrotate'...
[supervisor  ] all services loaded.
[supervisor  ] starting services...
[supervisor  ] starting service 'xvnc'...
[xvnc        ] Xvnc TigerVNC 1.12.0 - built Jan  3 2023 01:38:16
[xvnc        ] Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
[xvnc        ] See https://www.tigervnc.org for information on TigerVNC.
[xvnc        ] Underlying X server release 12013000, The X.Org Foundation
[xvnc        ] Fri Feb  3 15:08:46 2023
[xvnc        ]  vncext:      VNC extension running!
[xvnc        ]  vncext:      Listening for VNC connections on /tmp/vnc.sock (mode 0660)
[xvnc        ]  vncext:      created VNC server for screen 0
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[supervisor  ] starting service 'openbox'...
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[supervisor  ] starting service 'app'...
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[app         ] Mozilla Firefox 108.0.1
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[supervisor  ] all services started.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] still could not bind()
[supervisor  ] service 'nginx' exited (with status 1).
[supervisor  ] restarting service 'nginx'.
[supervisor  ] starting service 'nginx'...
[nginx       ] Listening for HTTPs connections on port 5800.
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
[nginx       ] nginx: [emerg] bind() to 0.0.0.0:5900 failed (98: Address in use)
jlesage commented 1 year ago

Great! BTW, if you don't use the VNC port, you can just set VNC_LISTENING_PORT to -1 (for both containers).