This repository provides Docker- and Podman-compatible containers for running end-to-end autonomous driving simulations. The setup leverages Carla for simulation, ROS for robotics middleware, and Jupyter for interactive development and visualization.
The repository includes three main containers, each serving a distinct purpose in the simulation pipeline:
- Carla: Runs the Carla simulator, a leading open-source simulator for autonomous driving research.
- Runner: Hosts a Jupyter Notebook server configured with PyTorch, Scenario Runner, and Leaderboard modules to support development and evaluation of driving algorithms.
- ROS: Contains ROS, a version of the Robot Operating System, including the ROS Bridge to facilitate communication between Carla and ROS nodes.
Follow these steps to set up and run the simulation environment:
- Docker with Docker Compose, or Podman with a Compose provider
- An NVIDIA driver and the NVIDIA Container Toolkit
- Enough free disk space for the base images and the 6.9 GB additional-map archive
Podman GPU access uses CDI. Confirm that the toolkit exposes the GPUs before building the stack:
nvidia-ctk cdi listThe output should include device names such as nvidia.com/gpu=0.
Create a .env file in the repository root to configure Compose:
# .env file
UID=1000 # User ID of the current user (`id -u`)
CARLA_GPU_DEVICES=0 # GPU devices assigned to the Carla container
CARLA_RPC_PORT=2000 # Port number for Carla clients to connect (default: 2000)
CARLA_STREAMING_PORT=2001 # Carla streaming port (default: 2001)
JUPYTER_GPU_DEVICES=0 # GPU device assigned to the Jupyter container
JUPYTER_PORT=8888 # Port number for the Jupyter server (default: 8888)
JUPYTER_TOKEN=letmein # Authentication token for the Jupyter serverTo set the Carla version, modify every CARLA_VER build argument in
compose.yml. Keep the value consistent across all containers. The default
version is 0.9.15.
# Example: compose.yml
args:
- CARLA_VER=0.9.15The Carla image build requires the additional-map archive. Download it from Carla's releases page and place it in the repository root using this exact name:
AdditionalMaps_<CARLA_VER>.tar.gz
For the default version, the expected file is
AdditionalMaps_0.9.15.tar.gz. The archive is approximately 6.9 GB, so the
first build and final image-layer creation can take several minutes. Subsequent
builds reuse the package, Python, and image-layer caches when their inputs have
not changed.
-
Build Containers:
docker compose build
-
Start Containers: Launch the containers using:
docker compose up
This command will start the Carla simulator, Jupyter Notebook server, and ROS environment, connecting all components as configured.
-
Access Jupyter Notebooks: Open your web browser and go to
http://localhost:8888(or the port specified in your.envfile). Use the token specified inJUPYTER_TOKENto log in.
Podman uses its CDI interface for NVIDIA GPU access, so include the Podman override file:
podman compose -f compose.yml -f compose.podman.yml build
podman compose -f compose.yml -f compose.podman.yml upThe NVIDIA Container Toolkit must provide the requested devices as CDI names. Verify them before starting the stack:
nvidia-ctk cdi listIf your distribution does not install a Compose provider for podman compose, install podman-compose and use the same -f arguments with that command.
For example:
podman-compose -f compose.yml -f compose.podman.yml build
podman-compose -f compose.yml -f compose.podman.yml upAfter building, these commands verify the Runner Python environment, CDI GPU access, and the ROS bridge installation:
podman compose -f compose.yml -f compose.podman.yml run --rm runner python -c \
"import carla, cv2, numba, numpy, torch; print(numpy.__version__, cv2.__version__); print(torch.from_numpy(numpy.array([1])).tolist())"
podman compose -f compose.yml -f compose.podman.yml run --rm runner python -c \
"import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0))"
podman compose -f compose.yml -f compose.podman.yml run --rm ros /bin/bash -lc \
"source /opt/ros/humble/setup.bash && source /opt/carla-ros-bridge/install/setup.bash && ros2 pkg prefix carla_ros_bridge"Replace podman compose with podman-compose if that is your installed
Compose provider.
- Carla Simulator: The simulator is accessible on the port specified by
CARLA_RPC_PORTand can be interacted with using Carla clients. - Jupyter Notebooks: Use Jupyter Notebooks for running experiments, analyzing data, and visualizing simulation results. The setup includes PyTorch support for deep learning model development.
- ROS Integration: Leverage ROS nodes to create complex robotic systems and test autonomous driving algorithms in simulated environments.
- GPU Configuration: Ensure that the NVIDIA Container Toolkit is installed. Docker uses the device reservations in
compose.yml; Podman uses the CDI devices incompose.podman.yml. - Missing additional maps: If the Carla image fails at the
COPY AdditionalMaps_...step, verify that the archive is in the repository root and that its version matches everyCARLA_VERbuild argument. - Stale Podman CDI configuration: If Podman reports a missing NVIDIA library after a driver update, regenerate the CDI specification with
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml, then retry the stack. Podman 4.9 cannot parse CDI 0.7 specifications produced by recent NVIDIA Container Toolkit releases; upgrade Podman or convert the generated specification to CDI 0.6 and remove itsadditionalGidsentries. - X11 Authentication: The Compose configuration mounts
${HOME}/.Xauthority. If your desktop session uses a different authentication file, create or update${HOME}/.Xauthoritybefore starting the containers. - Networking Issues: If containers cannot communicate, check the network settings in your
compose.ymland ensure that the correct ports are open and not blocked by firewalls.
Contributions are welcome! Please open an issue or submit a pull request to contribute to this project.
The original configuration files and code in this repository are licensed under the MIT License. See LICENSE for details.
Third-party software, container images, and assets used or downloaded by this project remain subject to their respective licenses and terms.