Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Editable ROS Docker Development

Prerequisites

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.

How to use ( two methods )

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>=....

Running Options

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)
export CUDA=1              # To cancel CUDA: unset CUDA

Method 1: Enter Container with Scripts

In the repository folder, run

./enterpoint.sh

Here 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

Method 2: Enter Container without CLI

Build Image:

docker build --tag <image tag> --file <dockerfile> --no-cache .     # --no-cache means install dependencies with no cache

Run 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>

How To Rebuild Image:

source env.sh
docker build --tag "${IMAGE_TAG}" --file "ros-${ROS_DISTRO}.Dockerfile" --no-cache .

In ROS Humble

Source environment. These lines can be added to ~/.bashrc or ~/.zshrc for convenience. The following commands have been added to humble dockerfile and will be added to .bashrc.

source /opt/ros/humble/setup.bash
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash

After compiling, don't forget to source setup file

colcon build --symlink-install
source install/setup.bash

About

Docker

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages