You should firstly install Docker Engine on your Ubuntu. Then manage docker as a non-root user, to enable docker instead of sudo docker.
- NOTE: Do not install Docker Desktop. It is different from the Docker Engine and not so friendly to docker development.
This is the cleaned up version. All Options should be defined in config file env.sh and enterpoint.sh as Environment Variables or by using export <VAR>=....
Env override options:
- ROS_DISTRO: choose ROS distribution.
export ROS_DISTRO=humble # options: humble(default), noetic- VOLUME_DIR: volume a folder into container dir
/workspace.
export VOLUME_DIR=<path> # options: $(pwd)- CUDA: Follow these links to use Nvidia Cuda in container and solve potential problems.
export CUDA=1 # To cancel CUDA: unset CUDAIn the repository folder, run
./enterpoint.shHere is env variables in the env.sh. Define those in the env.sh or your env variable will be override by the env.sh.
- GIT_LABEL
- IMAGE_TAG
- CONTAINER_NAME
- HOME_PATH
- WORKSPACE_PATH
Build Image:
docker build --tag <image tag> --file <dockerfile> --no-cache . # --no-cache means install dependencies with no cacheRun Container:
docker run --rm -it --name=<CONTAINER_NAME> --network=<net> --privileged --volume="<host path>:<path>" --device=="<host path>:<path>" --env="<var=host var>"Execute cmd:
docker build -it <CONTAINER_NAME> <CMD/SHELL>source env.sh
docker build --tag "${IMAGE_TAG}" --file "ros-${ROS_DISTRO}.Dockerfile" --no-cache .Source environment. These lines can be added to
The following commands have been added to humble dockerfile and will be added to ~/.bashrc or ~/.zshrc for convenience..bashrc.
source /opt/ros/humble/setup.bash
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bashAfter compiling, don't forget to source setup file
colcon build --symlink-install
source install/setup.bash