This dockerfile is used to build a docker image running Ubuntu 18.04, with ROS Melodic, Unreal Engine 4.25, AirSim 1.4, and GPU support.
- docker installed on host (https://docs.docker.com/engine/install/ubuntu/)
- Optional for QOL: remove need for sudo for docker (https://docs.docker.com/engine/install/linux-postinstall/)
- nvidia-docker installed on host (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-on-ubuntu-and-debian).
- > 120GB in directory where docker images are built. This is typically in "/", recommend to shift to "/home" or other directory with larger storage (https://www.guguweb.com/2019/02/07/how-to-move-docker-data-directory-to-another-location-on-ubuntu/)
- *After Steps 2 & 3,
/etc/docker/daemon.json
should look similar to below. Key parameters are "data-root", "runtimes", and "default-runtime".{ "data-root": "/home/jonyktan/docker", "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } }, "default-runtime": "nvidia" }
- git clone https://github.com/Amigoshan/tartanair into same directory as dockerfile. Rename the git folder to "/tartanair/".
- Ensure docker image directory has "defaults" options or NO "nosuid" option. Check this using
nano /etc/fstab
.
cd /directory/containing/dockerfile/
docker build -t <IMAGE_NAME>:<IMAGE_TAG> --build-arg GITHUB_PAT=<PAT> .
- E.g. IMAGE_NAME = ue4, IMAGE_TAG = Tartan will build a docker image "ue4:Tartan".
<PAT>
is your Github personal access token. (See here for steps on creating a PAT and using it: https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)- Make sure Github account has access rights to UnrealEngine repo. (See Section 1 - Required Setup at https://docs.unrealengine.com/4.26/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/)
- Use
docker container ls -a
to view the built/incomplete image.
xhost +local:docker && docker run --rm -it -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" -v "/path/to/your/UE_env:/workspace/UnrealProj" -e "DISPLAY=${DISPLAY}" --ipc="host" <IMAGE_NAME>:<IMAGE_TAG>
- Enables GUI display on host.
- Mounts a directory from host into the docker container (Unreal project is mounted in "/workspace/UnrealProj" inside the container).
- More info here: https://docs.docker.com/engine/reference/commandline/run/.
- Find the CONTAINER_NAME using
docker container ls
docker commit <CONTAINER_NAME> <IMAGE_NAME>:<IMAGE_TAG>
- Without GUI support
docker exec -it <CONTAINER_NAME> bash
- With GUI support
xhost +local:docker && docker exec -it -e "DISPLAY=${DISPLAY}" <CONTAINER_NAME> bash
(https://microsoft.github.io/AirSim/unreal_custenv.html)
The folder AirSim/Unreal/Plugins/ needs to be inside the Unreal project folder.
-
- Create new project with custom environment of choice. Copy Unreal project folder to Linux machine
-
- If AirSim is built on the Linux machine, copy "Plugins/" from "AirSim/Unreal/" into the Unreal project folder. (This will be done in Step 1 of "Launch Unreal Engine inside Docker Container".)
- Copy AirSim plugins to Unreal Project.
cp /workspace/AirSim/Unreal/Plugins/ /path/to/Unreal/Project/
(E.g. for "/path/to/Unreal/Project/", use "/workspace/UnrealProj/".)
/workspace/UnrealEngine/Engine/Binaries/Linux/UE4Editor /path/to/Unreal/Project/<PROJECT_NAME>.uproject
- Unreal Engine will prompt to rebuild AirSim. Click "Yes". First compile will take awhile.