-
Notifications
You must be signed in to change notification settings - Fork 229
Development container support using docker-compose #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1c6934f
Development container support using docker-compose
j-rivero 154140e
Code does not belong to base
j-rivero 8ebfffa
Fix image name
j-rivero ad84a95
Include what images are generated by the dockerfiles
j-rivero be539d3
sudo for the ubuntu user
j-rivero 85cd5cd
sudo for ubuntu user and entrypoint
j-rivero f4a1124
Move instructions to install tutorial
j-rivero 92bad35
Remove version in docker-compose
j-rivero 455fbe1
Typo
j-rivero 0cb0c23
Disable ubuntu user and gpu configuration
j-rivero ac38e42
Merge remote-tracking branch 'origin' into jrivero/dockerfiles
j-rivero 26c4549
Do not need var
j-rivero 3c227c3
Clean-up comments in Dockerfiles
j-rivero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"file_format_version" : "1.0.0", | ||
"ICD" : { | ||
"library_path" : "libEGL_nvidia.so.0" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Ubuntu 24.04 | ||
FROM osrf/ros:jazzy-desktop-full AS vrx-base | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Setup timezone | ||
ENV TZ=Etc/UTC | ||
RUN echo $TZ > /etc/timezone && \ | ||
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \ | ||
apt update && \ | ||
apt install -y locales && \ | ||
locale-gen en_US en_US.UTF-8 && \ | ||
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
|
||
# Set up repo to install Gazebo | ||
RUN curl -s https://packages.osrfoundation.org/gazebo.gpg -o /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg && \ | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null | ||
|
||
# Install some 'standard' ROS packages and utilities. | ||
RUN apt update \ | ||
&& apt install -y --no-install-recommends \ | ||
gz-harmonic \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt clean -qq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM vrx-base AS vrx-builder | ||
|
||
COPY . /ws/src/ | ||
|
||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh \ | ||
&& apt update \ | ||
&& rosdep install -r \ | ||
--from-paths /ws/src/ \ | ||
--ignore-src \ | ||
--rosdistro ${ROS_DISTRO} -y | ||
|
||
# Build the project | ||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh \ | ||
&& cd /ws \ | ||
&& colcon build --symlink-install --merge-install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
FROM vrx-base AS vrx-devel | ||
|
||
# Install some 'standard' ROS packages and utilities. | ||
RUN apt update \ | ||
&& apt install -y --no-install-recommends \ | ||
ros-${ROS_DISTRO}-ackermann-msgs \ | ||
ros-${ROS_DISTRO}-actuator-msgs \ | ||
ros-${ROS_DISTRO}-ament-cmake-pycodestyle \ | ||
ros-${ROS_DISTRO}-image-transport \ | ||
ros-${ROS_DISTRO}-image-transport-plugins \ | ||
ros-${ROS_DISTRO}-joy-teleop \ | ||
ros-${ROS_DISTRO}-joy-linux \ | ||
ros-${ROS_DISTRO}-mavros-msgs \ | ||
ros-${ROS_DISTRO}-navigation2 \ | ||
ros-${ROS_DISTRO}-nav2-bringup \ | ||
ros-${ROS_DISTRO}-nav2-minimal-tb3-sim \ | ||
ros-${ROS_DISTRO}-nav2-minimal-tb4-description\ | ||
ros-${ROS_DISTRO}-nav2-minimal-tb4-sim \ | ||
ros-${ROS_DISTRO}-radar-msgs \ | ||
ros-${ROS_DISTRO}-ros-gz-sim\ | ||
ros-${ROS_DISTRO}-vision-msgs \ | ||
ros-${ROS_DISTRO}-xacro \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt clean -qq | ||
|
||
# Tools necessary and useful during development | ||
RUN apt update && \ | ||
apt install --no-install-recommends -y \ | ||
atop \ | ||
expect \ | ||
gdb \ | ||
iputils-ping \ | ||
gnutls-bin \ | ||
libbluetooth-dev \ | ||
libcwiid-dev \ | ||
net-tools \ | ||
python3-dbg \ | ||
python3-pip \ | ||
python3-venv \ | ||
vim \ | ||
wget \ | ||
xvfb \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt clean -qq | ||
|
||
# Nvidia setup | ||
RUN dpkg --add-architecture i386 && \ | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
libxau6 libxau6:i386 \ | ||
libxdmcp6 libxdmcp6:i386 \ | ||
libxcb1 libxcb1:i386 \ | ||
libxext6 libxext6:i386 \ | ||
libx11-6 libx11-6:i386 \ | ||
libglvnd0 libglvnd0:i386 \ | ||
libgl1 libgl1:i386 \ | ||
libglx0 libglx0:i386 \ | ||
libegl1 libegl1:i386 \ | ||
libgles2 libgles2:i386 \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt clean -qq | ||
# COPY 10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json | ||
# # nvidia-container-runtime | ||
# ENV NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES:-all} | ||
# ENV NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,compat32,utility | ||
# RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ | ||
# echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf | ||
# # Required for non-glvnd setups. | ||
# ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 | ||
|
||
# Add passworless for sudo for the ubuntu user | ||
# RUN echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
WORKDIR /ws | ||
|
||
COPY entrypoint-ros.sh /entrypoint-ros.sh | ||
RUN chmod +x /entrypoint-ros.sh | ||
|
||
# USER ubuntu | ||
|
||
ENTRYPOINT ["/entrypoint-ros.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# VRX Docker support | ||
|
||
For running VRX using the docker support please refer to the instructions | ||
in https://github.com/osrf/vrx/wiki/docker_install_tutorial. | ||
|
||
## Dockerfiles in this directory | ||
|
||
The directory contains a series of Dockerfiles designed to serve different setups | ||
for VRX. The usage is mainly controlled by `docker-compose` although docker files | ||
can be used independently if desired: | ||
|
||
* `Dockerfile.base`: built on top of osrf desktop-full. Install | ||
gz-harmonic from packages.osrfoundation.org repository and | ||
the VRX dependencies using rosdep. Generates the `vrx-base` image. | ||
|
||
* `Dockerfile.builder`: built on top of `vrx-base`. Compiles the vrx packages | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should explain what is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include the image names in ad84a95 |
||
using colcon. Generates the `vrx-builder` image. | ||
|
||
* `Dockerfile.devel`: built on top of `vrx-base`. development image with | ||
extra ROS 2 development packages and other dev utilities. It configures | ||
the GPU support and a development user. Runs a shell into the container | ||
with local sources mapped in /ws. Generates the `vrx-devel` image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
services: | ||
base: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.base | ||
image: vrx-base | ||
|
||
builder: | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile.builder | ||
depends_on: | ||
- base | ||
image: vrx-builder:latest | ||
|
||
devel: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.devel | ||
depends_on: | ||
- base | ||
image: vrx-devel:latest | ||
network_mode: host | ||
stdin_open: true | ||
tty: true | ||
user: ubuntu | ||
group_add: | ||
- video | ||
- sudo | ||
# TODO: support for intel by enabling /dev/dri | ||
# devices: # for intel dri | ||
# - /dev/dri | ||
environment: | ||
- DISPLAY=unix${DISPLAY} | ||
- TERM=xterm-256color | ||
volumes: | ||
- ..:/ws/src | ||
- /sys:/sys:ro | ||
- /tmp/.X11-unix:/tmp/.X11-unix:rw | ||
- /dev/log:/dev/log:ro | ||
- /run/log:/run/log:ro | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
count: 1 | ||
capabilities: [gpu] | ||
command: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Setup ROS environment | ||
source /opt/ros/${ROS_DISTRO}/setup.bash | ||
|
||
exec "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this file play with the Docker installation instructions from the wiki?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prerequisites are the same. No need to clone dockwater repository anymore, just run the
docker compose
command.