jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Running multiple containers access via vnc is not possible #6

Closed Shinoby1992 closed 2 years ago

Shinoby1992 commented 6 years ago

Thank you for your good and easy to customize base image with a nice gui I use your base image and customized it with running custom code now i have following problem when i run more then 1 replicas on my vm in swarm mode i can just access the latest created replica via http://hostdns:5800

i cannot use a port range in my docker compose file as its not allowed in swarm mode currently my stack looks like that `version: '3' services: worker: image: vnc-docker:1.0 shm_size: 2g privileged: true volumes:

i tried different things out, like creating a custom network and use it

something like `ports:

jlesage commented 6 years ago

What are you trying to achieve exactly? You want to create multiple instances of the container to access them separately?

Shinoby1992 commented 6 years ago

I running multiple instances of my containers and i want that each of them to be visible via vnc instance 1 = http://vmhost:5800 instance 2 = http://vmhost:5801 Instance 3 = http://vmhost:5802

when i create multiple instances they are all instance 1 = http://vmhost:5800 instance 2 = http://vmhost:5800 instance 3 = http://vmhost:5800 if i connect via vnc, i have access to instance 3 but 2 and 1 are not reachable...

oh and btw i can't install chrome browser to your ubuntu base image...because seems like you have the base image in 32bit version, how can i change it and use the 64bit ubuntu image

jlesage commented 6 years ago

I'm not an expert with the swarm mode, but I think that the goal of swarm is to have multiple containers exposing all the same service to increase availability or for load balancing. So what you are describing is what I would expect.

It seems that what you want is something different. Maybe you could achieve it by using a docker compose file, where you define multiple services (on different ports).

jlesage commented 6 years ago

As for the ubuntu baseimage, you are right: It is not expected to be 32-bit. It should be 64-bit. I will fix this.

Shinoby1992 commented 6 years ago

thank you i have to look into it, and another bug or maybe a way to handle it would be nice im running multiple containers and some of them get after a while s6-supervise app: warning: finish script lifetime reached maximum value - sending it a SIGKILL some of them not, don't know why, and then the container stays healthy but the script is not running anymore, i can handle it now because i can change my python script in rerunning after crash. but is this possible through the container? i mean settings like: -> when scripts finish container finishes (then docker could restart the service automatically) or -> in the image as -e something like, run script forever if it crash the script restarts (im doin this right now via my python script to restart itself if its crash only problem is, that i will only see whats happening reading its log file, the docker container always looks healthy from outside while it could crash always inside i would not see it till i watch log files

better way for me would be that when scripts finished the whole container goes down. and of course some way to customize s6-supervise app the "script"lifteime because i need my script runned 24/7

jlesage commented 6 years ago

What you are describing is the actual behavior of the image: When the app service terminates, the container shuts down. To have the app service automatically restarted, you can pass the KEEP_APP_RUNNING=1 environment variable.

When are you getting the "lifetime reached maximum value" error? When app terminates or when you shutdown the container? What do you have in startapp.sh?

Shinoby1992 commented 6 years ago

a python script is running thats the only thing written in the startapp.sh my script does handle exceptions and print them but i cannot see any exception in the log, maybe there is a exception or some other error that accours after random time, does this KEEP_APP_RUNNING=1 restarts/rerun the startapp.sh if its finished (careless if its finished due to exception of the script ) ? or what ecsactly does it do

for info if anyone else want to have multiple containers running with accessibility to all of them seems like using a docker compose with port ranging does ONLY work on a NOT Swarm mode Docker server

version: '3'
services:
 worker:
  stdin_open: true
  tty: true
  restart: always
  image: mycustomimage:1.0
  shm_size: 2g
  privileged: true
  volumes:
   - ~/Desktop/docker/appdata/firefox:/config:rw
  ports:
   - '5800-5900:5800

this does create automatically each one with a different port vor vnc in range 5801-5900 if using with docker-compose up --scale worker=5

jlesage commented 6 years ago

When KEEP_APP_RUNNING=1, startapp.sh is re-executed when it terminates.

The way your script is invoked in startapp.sh can make a difference. Make sure you invoke with with exec.

jlesage commented 2 years ago

Closing this issue, please re-open if needed.