在docker中运行carla

参考carla文档
ubuntu18.04
carla0.9.9
docker19.03.12

Docker Installation

Docker CE

For our tests we used the Docker CE version. To install Docker CE we recommend using this tutorial

NVIDIA-Docker2

To install nvidia-docker-2 we recommend using the “Quick Start” section from the nvidia-dockers github.
转到nvidia-dockers github后可以发现已经不推荐安装NVIDIA-Docker2了,变为NVIDIA Container Toolkit了。
在docker中运行carla_第1张图片

对于ubuntu18.04:

Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

这里失败很多次,因为网络问题。建议多尝试几次,更换一下网络。
安装成功:
在这里插入图片描述
在docker中运行carla_第2张图片

Running CARLA container

Pull the CARLA image.

docker pull carlasim/carla:0.9.9

Running CARLA under docker.

docker run -p 2000-2002:2000-2002 --runtime=nvidia --gpus all carlasim/carla:0.8.4

The -p 2000-2002:2000-2002 argument is to redirect host ports for the docker container. Use --gpus ‘“device=,”’ to specify which GPUs should run CARLA. Take a look at this NVIDIA documentation to learn other syntax options.

You can also pass parameters to the CARLA executable. With this you can chose the town and select the port that is going to be used.

docker run -p 2000-2002:2000-2002 --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 carlasim/carla:0.8.4 /bin/bash CarlaUE4.sh  < Your list of parameters >

At the list of parameters do not forget to add -world-port= so that CARLA runs on server mode listening to the .

你可能感兴趣的:(carla,docker,docker,ubuntu)