linuxserver / docker-chromium

Web accessible Chromium inside an Debian Container
GNU General Public License v3.0
122 stars 40 forks source link

VNC does not work when multiple containers are run same container network #17

Closed engageub closed 1 year ago

engageub commented 1 year ago

Is there an existing issue for this?

Current Behavior

Hi Support Team,

I see that chromium container listens on port 6900 which is part of kclient (kasm) apart from default http and https custom ports. Could you please provide support to run multiple containers on same container network. The following error is being shown while running the second container.

Please find below the error messages in the container.

Error messages in the container: Node.js v18.17.1 Obt-Message: Xinerama extension is not present on the server Openbox-Message: A window manager is already running on screen 0 _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: server already running (EE) Fatal server error: (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) node:events:492 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE: address already in use :::6900 at Server.setupListenHandle [as _listen2] (node:net:1751:16) at listenInCluster (node:net:1799:12) at Server.listen (node:net:1887:7) at Object. (/kclient/index.js:184:6) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1778:8) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'EADDRINUSE', errno: -98, syscall: 'listen', address: '::', port: 6900 }

Thank you

Expected Behavior

Should run the same as first container without errors and should have unique port numbers or an option where all internal port numbers of KASM can be changed.

Steps To Reproduce

sudo docker run --name tuncontainer  --restart=always -e PROXY="127.0.0.1:2345" -v '/dev/net/tun:/dev/net/tun' --cap-add=NET_ADMIN  -d xjasonlyu/tun2socks:v2.5.0
sudo docker run  -d --name chromecontainer1 --network=container:tuncontainer  -e TZ=Etc/UTC  -e CHROME_CLI="https://yahoo.com" --security-opt seccomp=unconfined --shm-size="1gb" lscr.io/linuxserver/chromium:latest
sudo docker run  -d --name chromecontainer2 --network=container:tuncontainer  -e TZ=Etc/UTC -e CUSTOM_PORT=3500  -e CUSTOM_HTTPS_PORT=3501 -e CHROME_CLI="https://google.com" --security-opt seccomp=unconfined --shm-size="1gb" lscr.io/linuxserver/chromium:latest

After running the above three commands, look into the logs of container1 and container2.

sudo docker container logs chromecontainer1
sudo docker container logs chromecontainer2

You will find that container2 does not start due to conflicting ports and display numbers.

Thank you

Environment

Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1

CPU architecture

x86-64

Docker creation

sudo docker run --name tuncontainer  --restart=always -e PROXY="127.0.0.1:2345" -v '/dev/net/tun:/dev/net/tun' --cap-add=NET_ADMIN  -d xjasonlyu/tun2socks:v2.5.0
sudo docker run  -d --name chromecontainer1 --network=container:tuncontainer  -e TZ=Etc/UTC  -e CHROME_CLI="https://yahoo.com" --security-opt seccomp=unconfined --shm-size="1gb" lscr.io/linuxserver/chromium:latest
sudo docker run  -d --name chromecontainer2 --network=container:tuncontainer  -e TZ=Etc/UTC -e CUSTOM_PORT=3500  -e CUSTOM_HTTPS_PORT=3501 -e CHROME_CLI="https://google.com" --security-opt seccomp=unconfined --shm-size="1gb" lscr.io/linuxserver/chromium:latest

After running the above three commands, look into the logs of container1 and container2.

sudo docker container logs chromecontainer1
sudo docker container logs chromecontainer2

You will find that container2 does not start due to conflicting ports and display numbers.

Thank you


### Container logs

```bash
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
Obt-Message: Xinerama extension is not present on the server
Openbox-Message: A window manager is already running on screen 0
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
Obt-Message: Xinerama extension is not present on the server
Openbox-Message: A window manager is already running on screen 0
Obt-Message: Xinerama extension is not present on the server
Openbox-Message: A window manager is already running on screen 0
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
Obt-Message: Xinerama extension is not present on the server
Openbox-Message: A window manager is already running on screen 0
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::6900
    at Server.setupListenHandle [as _listen2] (node:net:1751:16)
    at listenInCluster (node:net:1799:12)
    at Server.listen (node:net:1887:7)
    at Object.<anonymous> (/kclient/index.js:184:6)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1778:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 6900
}

Node.js v18.17.1
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
Obt-Message: Xinerama extension is not present on the server
Openbox-Message: A window manager is already running on screen 0
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

j0nnymoe commented 1 year ago

As you were told on discord, this isn't a supported usecase.

engageub commented 1 year ago

Hi @j0nnymoe , There is no issue with firefox docker since VNC port option is available. Could you please add vnc ports similarly through kasm vnc.

Docker Firefox: https://github.com/jlesage/docker-firefox

Thank you

j0nnymoe commented 1 year ago

You're comparing an apple to an orange.

engageub commented 1 year ago

I had a look into the docker container. The port 6900 is hardcoded in the following path /kclient/index.js If there is something that can be done further it has to be followed up with kasmvnc team.

// Spin up application on 6900
app.use(SUBFOLDER, baseRouter);
http.listen(6900);

Thank you

aptalca commented 1 year ago

https://www.linuxserver.io/blog/2019-09-14-customizing-our-containers

https://www.linuxserver.io/blog/routing-docker-host-and-container-traffic-through-wireguard#routing-a-containers-traffic-through-the-wireguard-container-via