Generic x86 Docker - autowarefoundation/autoware_ai_documentation GitHub Wiki
This page guides you on how to install and run Autoware on x86_64-based processors (Intel / AMD) using Docker. For other platforms, such as NVIDIA DRIVE, please check the Docker page to determine whether they are supported. To use the Autoware Docker containers, you must complete 3 steps:
Install Docker
For instructions on installing Docker for use with Autoware, see the Docker Installation page.
Optional: Install the NVIDIA Docker Runtime
NOTE: If you are using a recent version of Docker (19.03 or later), then you do not need to install the NVIDIA Docker Runtime because GPUs are supported natively in the Docker engine with the --gpus
flag. See the instructions on the Docker Website for enabling this feature.
If you are using an older version of the Docker runtime (<19.03) and wish to use an NVIDIA GPU from within a Docker container, you must install the NVIDIA Docker Runtime. To do this, see the official installation instructions. Please note that NVIDIA Runtime 1.0 is no longer supported.
Run an Autoware Docker Container
There are three ways to run Autoware in a Docker container: You can run one of the Docker containers from Autoware which includes the source code and pre-compiled binaries, you can run one of the "base" Docker containers from Autoware in which you provide your own source code on the host machine (your computer), or you can modify the Dockerfiles in the repository and build and run your own, custom container.
Note on file locations: Docker containers older than version 1.12.0-beta.1 do not use the new installation method utilizing autoware.ai.repos
so all source code and pre-built binaries can be found in the /home/autoware/Autoware/ros
folder. Containers for 1.12.0-beta.1 and newer will have their source code and pre-built binaries in /home/autoware/Autoware
.
Note on file permissions: By default, logging in to one of these docker containers using the run.sh
script attempts to set the permissions of all of the files in the Docker container to be the same as the user running the run.sh
script so files can be easily copied back and forth between host and container. However, doing this correctly can cause logging in to the containers to take an unacceptable amount of time (>5 minutes). To alleviate this, you can add the -s
or --skip-uid-fix
flag which will skip setting the permissions and instead use the default autoware
user in the container. As a result, copying files from the container to the host or vice versa may create files with permission problems. To fix this you can do the following:
- Copy the files into the shared folder (
$HOME/shared_dir
on the host or/home/autoware/shared_dir
in the container). - In the environment which is the target of the copy (host or container),
cd
to the shared directory and runsudo chown -R $(id -u):$(id -g) *
. This will correctly set all of the files in the shared directory to be owned by the current user. - Copy the files out of the shared directory in the target environment (host or container).
Case 1: Using Autoware Docker Containers with Pre-Built Source Code Included
The pre-built Autoware containers include all of the necessary prerequisites for a given release of Autoware.ai and also contain the Autoware.ai source code for that release, pre-compiled. To run one of these containers:
-
Clone the
docker
repository and move into thegeneric
docker folder.$ git clone https://github.com/autowarefoundation/autoware_ai_docker.git $ cd docker/generic
-
Use the
run.sh
script to start and enter the Docker container.$ ./run.sh
Note 1: By default, the above script will run a Docker container which is pre-compiled, based on Ubuntu 18.04 / ROS Melodic, with CUDA / NVidia Docker support enabled, using the latest official release of Autoware. Several flags can be passed to the
./run.sh
script to change this behavior. Run./run.sh -h
to see all available flags.Note 2: By default, the container will use the
latest-
Docker tag which will run the most recently-released version of Autoware. To change to an older version of Autoware, use the-t
or--tag-prefix
flag with the version (e.g../run.sh -t 1.10.0
for v1.10.0).
Case 2: Using Autoware Docker Containers without Source Code Included
The "base" Autoware containers include a supported version of Ubuntu with all Autoware.ai dependencies and basic development tools pre-installed. However, they do not contain the actual Autoware.ai source code. These containers are useful for modifying the Autoware.ai source code which is stored on the host machine (your computer) instead of inside the container and providing a build environment which is isolated from the host. This also allows changes you make to the code to be saved between Docker instances.
- Instructions coming soon.
Case 3: Creating a Custom Autoware Docker Container
-
Clone the
docker
repository and move into thegeneric
docker folder.$ git clone https://github.com/autowarefoundation/autoware_ai_docker.git $ cd docker/generic
-
Before building the container, you can modify the Dockerfile files in the
generic
folder to change the generated container. Once you have modified them to your liking, build the docker container using thebuild.sh
script:$ ./build.sh
Note: Passing command-line flags to the build.sh
script will change which Dockerfiles are used, what is included in the container, which version of ROS is used, and the name of the generated container. For more information, type: ./build.sh --help
.
- By default, the
build.sh
script creates a container prefixed withlocal-
. To run and enter the container that you just built using the default options, use the following command:$ ./run.sh -t local
Note: Several command-line options are available to change the default behavior of this script. To see them, type: ./run.sh --help
.