NICE DCV - DOCKER CONTAINER

0

So i currently have nice dcv running in my docker container on EC2, in running my docker, i am using --network=host which works on one container, i can then open the IP:PORT of my ec2 instance and i see the dcv, but if i lunch another container, the dcvserver in the container won't start,

root@ip-172-31-88-61:/# systemctl status dcvserver
● dcvserver.service - NICE DCV server daemon
     Loaded: loaded (/lib/systemd/system/dcvserver.service; enabled; vendor preset: enabled)
     Active: failed (Result: start-limit-hit) since Mon 2024-08-26 04:36:50 UTC; 1min 46s ago
   Main PID: 816 (code=killed, signal=TERM)
        CPU: 68ms

Aug 26 04:36:50 ip-172-31-88-61 systemd[1]: dcvserver.service: Scheduled restart job, restart counter is at 5.
Aug 26 04:36:50 ip-172-31-88-61 systemd[1]: Stopped NICE DCV server daemon.
Aug 26 04:36:50 ip-172-31-88-61 systemd[1]: dcvserver.service: Start request repeated too quickly.
Aug 26 04:36:50 ip-172-31-88-61 systemd[1]: dcvserver.service: Failed with result 'start-limit-hit'.
Aug 26 04:36:50 ip-172-31

but if is top the first one, and then come back to the second container and start it, this works. Almost like you can only run one at a time since i am using host network. But if i try to do a port mapping. while the dcvserver is active, this won't open up the dcv if i visit the IP and Port.

My end goal, is to have one EC2 instance, with up to 3 docker container running nice dcv.

Is there any work-around this to get it to set up as intended ?

Thanks

Elliot
asked 24 days ago53 views
1 Answer
0

When using --network=host, the container shares the host’s network stack, meaning that the container’s applications bind directly to the host’s IP address and ports. If multiple containers try to bind to the same port, it causes conflicts, and the second DCV server cannot start.

Instead of using --network=host, use Docker's port mapping feature with the -p option. This way, each container will bind to a different port on the host, avoiding conflicts.

Example:

docker run -d --name dcv_container1 -p 8080:8443 your_dcv_image
docker run -d --name dcv_container2 -p 8081:8443 your_dcv_image
docker run -d --name dcv_container3 -p 8082:8443 your_dcv_image

You could also deploy a reverse proxy like Nginx or HAProxy on your EC2 instance to route traffic to different containers based on subdomains or URL paths. This method allows you to manage the routing more flexibly without changing the port numbers.

profile pictureAWS
EXPERT
Deeksha
answered 24 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions