carla/Docs/build_docker_unreal.md

4.3 KiB

Build Unreal Engine and CARLA in Docker

This guide explains how Unreal Engine and CARLA can be built from scratch using Docker. The resulting image can then used to create CARLA packages or to prepare assets for use in a CARLA package. This process should not be confused with the pre-built CARLA Docker image used to run CARLA on multiple servers or without a display. The documentation for that can be found here.


Before you begin

System Requirements

You will need to meet the following system requirements:

  • 64-bit version of Docker is Ubuntu 16.04+
  • Minimum 8GB of RAM
  • Minimum 600GB available disk space for the initial container build process
Software requirements

Docker:

Install Docker by following the installation instructions here.

Python:

You will need to have Python 3.6 or higher installed and properly set in your system Path. For installation instructions and Python documentation, check here.

Unreal Engine GitHub Access:

Starting with version 0.9.12, CARLA uses a modified fork of Unreal Engine 4.26. This fork contains patches specific to CARLA. This will be downloaded during the Docker build process. For this download, you need to have a GitHub account linked to Unreal Engine's account. If you don't have this set up, please follow this guide before going any further. You will need to log in to your account during the build process.

CARLA:

The Dockerfiles and tools needed to build Unreal Engine for CARLA and CARLA itself are located in the Util/Docker directory of the CARLA source repository.

If you don't already have it, download the repository using the following command:

git clone https://github.com/carla-simulator/carla

Building the images

The following steps will each take a long time.

1. Build the CARLA prerequisites image.

The following command will build an image called carla-prerequisites using Prerequisites.Dockerfile. In this build we install the compiler and required tools, download the Unreal Engine 4.26 fork and compile it. You will need to provide your login details (use a Github Personal Access Token instead of a password) as build arguments for the download of Unreal Engine to be successful:

docker build --build-arg EPIC_USER=<GitHubUserName> --build-arg EPIC_PASS=<GitHubAccessTokend> -t carla-prerequisites -f Prerequisites.Dockerfile .

2. Build the final CARLA image.

The following command will use the image created in the previous step to build the final CARLA image based on the current master branch (latest release) of the CARLA repository:

docker build -t carla -f Carla.Dockerfile .

If you would like to build a specific branch or tag of the CARLA repository, run the following command:

docker build -t carla -f Carla.Dockerfile . --build-arg GIT_BRANCH=<branch_or_tag_name>

Next Steps: Packages

The CARLA image created in this guide is used to create standalone CARLA packages or to package assets such as maps or meshes so they can be used in a CARLA package. This is achieved through the use of the docker_tools.py script found in Util/Docker. This script uses docker-py to work with the Docker image.

The docker_tools.py script can be used to:

  • Create a CARLA package: Find the tutorial here
  • Cook assets to be consumed in a CARLA package: Find the tutorial here
  • Prepare a map so it's ready for use in a CARLA package: Find the tutorial here

Any issues or doubts related with this topic can be posted in the CARLA forum.