suessmann / intelligent_traffic_lights

Traffic Lights Control with Deep Learning
MIT License
68 stars 14 forks source link

Could not connect to TraCI server using port 56213 #7

Open KlaasTilman opened 2 years ago

KlaasTilman commented 2 years ago

Hello!

I am currently trying to run your project via docker. The dockerfile also installs sumo in the environment.

However currently it isn't quite working because it is throwing the following two errors repeatedly:

FXApp::openDisplay: unable to open display :1

/usr/local/lib/python3.6/dist-packages/traci/main.py:175: UserWarning: Could not connect to TraCI server using port "some port x" (TraCI server already finished). Retrying with different port.

Would you know how to fix this issue ?

suessmann commented 2 years ago

Hi Klaas!

SUMo is not a very friendly tool tbh. As your question is not directly connected with the code I wrote, I suggest to try googling something on the topic of SUMo + Docker.

However, my assumption is that there's a problem with closed ports inside your docker container. As far as I remember, SUMo starts a server on your local machine, but it might be not accessible for some Docker-ish reasons. Since I never used SUMo in Docker, I can't really tell you more. My suggestion would be to try pre-configured docker with SUMo (https://github.com/bogaotory/docker-sumo maybe this is what you need).

KlaasTilman commented 2 years ago

Thanks for the reply! We will further investigate.

sjoukedv commented 2 years ago

We managed to find a working solution.

Dockerfile

FROM ubuntu:bionic
....
RUN apt-get install -y \
    xserver-xorg-video-dummy \
    x11-apps
.....

docker-compose.yml

services:
  intelligent_traffic_lights:
    build: .
    volumes:
      ....
      - /tmp/.X11-unix/:/tmp/.X11-unix/
    environment:
      - DISPLAY=$DISPLAY