carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.05k stars 3.56k forks source link

CARLA simulator container using Docker #7898

Open pennyfea opened 1 month ago

pennyfea commented 1 month ago

CARLA version: 0.9.15 Platform/OS: Windows 11 Home Problem You Have Experienced: When running the CARLA simulator container using Docker, the container exits with the following error:

[+] Running 1/0
✔ Container carla-vss-carla-1  Created 0.0s 
Attaching to carla-1
carla-1  | 4.26.2-0+++UE4+Release-4.26 522 0
carla-1  | Disabling core dumps.
carla-1  | sh: 1: xdg-user-dir: not found
carla-1 exited with code 1

What You Expected to Happen: The container should start and run the CARLA simulator without errors.

Steps to Reproduce:

  1. Compose.yaml
    services:
    carla:
    image: carlasim/carla:0.9.15
    command: ["/bin/bash", "./CarlaUE4.sh", "-vulkan"]
    runtime: nvidia
    ports:
      - "2000-2002:2000-2002"
    environment:
      - DISPLAY=:0
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
      - SDL_VIDEODRIVER=x11
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
      - ${HOME}/.Xauthority:/root/.Xauthority:rw
      - /usr/share/vulkan/icd.d:/usr/share/vulkan/icd.d:ro
    privileged: true
    network_mode: "host"
    stdin_open: true
    tty: true
Apoorvgarg-creator commented 1 month ago

@pennyfea @joel-mb Is there a solution already here to run Carla Simulator using Docker ?

pennyfea commented 1 month ago

@joel-mb No, sorry I couldn't figure it out and abandoned this approach.

PatrickPromitzer commented 1 month ago

Hi, there are some parts that doesn't look right.

"/tmp/.X11unit" u"/usr/share/vulkan/icd.d" looks like linux paths and not a windows path.

Do you use a x11 server on your windows machine? If you try to use X11 on widows, you need a software to show a window (or you use "-RenderOffScreen" for no window)

On an ubuntu system, it looks like this

sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
xhost +
sudo docker run --privileged --gpus all --net=host -e DISPLAY=$DISPLAY -e SDL_VIDEODRIVER=x11 -v /tmp/.X11-unix:/tmp/.X11-unix:rw carlasim/carla:0.9.13 /bin/bash ./CarlaUE4.sh -vulkan