Skip to content

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 13 commits into from
May 28, 2025
Merged

Conversation

j-rivero
Copy link
Collaborator

Refactor de Docker support to provide the base for using different docker images in different use cases. This PR targets only the development container support for the users building and running VRX code.

Instructions are provided in the README.md. Subsequent PRs should use the docker images for implementing releasing and CI.

j-rivero added 3 commits May 14, 2025 12:31
Signed-off-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Jose Luis Rivero <[email protected]>
gz-harmonic from packages.osrfoundation.org repostiory and
the VRX dependencies using rosdep.

* `Dockerfile.builder`: built on top of `vrx-base`. Compiles the vrx packages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should explain what is vrx-base.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include the image names in ad84a95

docker/README.md Outdated
* `Dockerfile.builder`: built on top of `vrx-base`. Compiles the vrx packages
using colcon.

* `Dockerfile.devel`: built on top of `vrx-base`. development image with extra ROS 2 development packages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: There's a newline here and extra indentation in Dockerfile.builder and Dockerfile.devel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lines are broken at 80 chars to faciitate diffs. Leaving one empty line between items:


 * `Dockerfile.base`: built on top of osrf desktop-full. Install
   gz-harmonic from packages.osrfoundation.org repostiory and
   the VRX dependencies using rosdep. Generates the `vrx-base` image.

   * `Dockerfile.builder`: built on top of `vrx-base`. Compiles the vrx packages
     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.

docker/README.md Outdated
$ ubuntu@locashot:/ws$ export ROS_DISTRO=jazzy
# compile vrx code
$ ubuntu@localhost:/ws$ . /opt/ros/${ROS_DISTRO}/setup.sh \
&& apt update \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo? What about the password?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch be539d3

docker/README.md Outdated
...
...
# docker building and return a shell inside the container
$ ubuntu@locashot:/ws$ export ROS_DISTRO=jazzy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to have this command exported, the VRX dependencies installed, and sourcing the setup.bash from ROS already configured?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep we can add an entrypoint 85cd5cd

@@ -0,0 +1,61 @@
# VRX Docker support
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@j-rivero j-rivero requested a review from caguero May 16, 2025 12:26
Copy link
Collaborator

@caguero caguero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two suggestions:

  • Omit the README file and update the wiki accordingly for not having to maintain two sources of installation instructions.
  • Reduce the number of Dockerfile flavors to just the ones we have a use case (either described in the tutorial or used by our CI).

@j-rivero
Copy link
Collaborator Author

Reduce the number of Dockerfile flavors to just the ones we have a use case (either described in the tutorial or used by our CI).

The three flavours in this PR are all expected to be used: base, builder (to be used by the CI) and devel. The main change is that we are not going to produce a release one but use the devel one for the users.

Omit the README file and update the wiki accordingly for not having to maintain two sources of installation instructions.

Changed the docker install in https://github.com/osrf/vrx/wiki/docker_install_tutorial/_compare/1f54d2ec84fc7959b7139f738224c77fb76db48f and reduced the README file to only explain the Dockerfiles in f4a1124 .

@j-rivero j-rivero requested a review from caguero May 20, 2025 16:23
@caguero
Copy link
Collaborator

caguero commented May 21, 2025

Changed the docker install in https://github.com/osrf/vrx/wiki/docker_install_tutorial/_compare/1f54d2ec84fc7959b7139f738224c77fb76db48f and reduced the README file to only explain the Dockerfiles in f4a1124 .

Can we also pass an argument to rocker for being able to use /dev/input/js0? This is typically the device attached to the keypad we use for teleoperating within VRX.

This step talks about run.bash. Could you please update the text to the updated instructions?

Copy link
Collaborator

@caguero caguero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the new Docker installation instructions in my laptop and the problem I'm experiencing is that I'm not getting GPU acceleration. Using dockwater I'm getting around 0.85, 0.9 RTF but following our instructions I'm getting 0.05 RTF.

@@ -0,0 +1,51 @@
version: '3.2'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this warning when running docker compose build devel --with-dependencies:

WARN[0000] /home/caguero/vrx_ws/src/vrx/docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
Compose can now delegate builds to bake for better performance.

I also saw these other three warning messages:

 => WARN: UndefinedVar: Usage of undefined variable '$NVIDIA_VISIBLE_DEVICES' (li  0.0s
 => WARN: UndefinedVar: Usage of undefined variable '$NVIDIA_DRIVER_CAPABILITIES'  0.0s
 => WARN: UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' (line 68)   0.0s

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the first warning 92bad35. Second warning about the undefined variable should be harmless.

Although I added support to run the thing without rocker the fact that rocker can manage the user and home directory easily is making the instructions now not to use it. We can potentially remove it.

j-rivero added 2 commits May 22, 2025 12:34
Signed-off-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Jose Luis Rivero <[email protected]>
@j-rivero
Copy link
Collaborator Author

I tested the new Docker installation instructions in my laptop and the problem I'm experiencing is that I'm not getting GPU acceleration. Using dockwater I'm getting around 0.85, 0.9 RTF but following our instructions I'm getting 0.05 RTF.

I just re-run the build + run pipeline and seems to work fine here:

image

Could you check inside the container:

grep -A5 "RenderSystem capabilities" ~/.gazebo/ogre.log
sudo apt-get update && sudo apt-get install mesa-utils && glxinfo | head -n 5

@caguero
Copy link
Collaborator

caguero commented May 26, 2025

sudo apt-get update && sudo apt-get install mesa-utils && glxinfo | head -n 5

Did you try it in your laptop? This is a problem in my laptop that doesn't happen with the previous Docker setup.

caguero@06ad9bb4dfc9:~$ grep -A5 "RenderSystem capabilities" ~/.gazebo/ogre.log
17:14:05: RenderSystem capabilities
17:14:05: -------------------------
17:14:05: RenderSystem Name: OpenGL Rendering Subsystem
17:14:05: GPU Vendor: intel
17:14:05: Device Name: Mesa Intel(R) HD Graphics P630 (KBL GT2)
17:14:05: Driver Version: 4.6.0.0
caguero@ade7bb5d0cbd:~$ glxinfo | head -n 5
glx: failed to create dri3 screen
failed to load driver: nouveau
glx: failed to create dri3 screen
failed to load driver: nouveau
name of display: :1
display: :1  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4

I don't see this block when running it using dockwater:

failed to load driver: nouveau
glx: failed to create dri3 screen
failed to load driver: nouveau

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the instructions updated? I'm following this link. There is no documentation about how to run the docker compose.

I tried

docker compose up

then I join the docker container

docker exec -it docker-devel-1 bash

and try to run the example:

ros2 launch vrx_gz competition.launch.py world:=sydney_regatta

But I'm getting an error related with the display:

[gazebo-1] Authorization required, but no authorization protocol specified
[gazebo-1] 
[gazebo-1] qt.qpa.xcb: could not connect to display unix:1
[gazebo-1] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
[gazebo-1] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[gazebo-1] 
[gazebo-1] Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

@j-rivero
Copy link
Collaborator Author

are the instructions updated? I'm following this link. There is no documentation about how to run the docker compose.

https://github.com/osrf/vrx/wiki/docker_install_tutorial#step-3-run-your-container .

image

@j-rivero j-rivero force-pushed the jrivero/dockerfiles branch from de9ec3d to ac38e42 Compare May 26, 2025 20:52
Signed-off-by: Jose Luis Rivero <[email protected]>
@j-rivero
Copy link
Collaborator Author

Removed some configurations and the ubuntu user in 26c4549 . @caguero this should approach it to the dockwater style, can you give another try?

@j-rivero j-rivero requested a review from ahcorde May 27, 2025 09:24
@j-rivero
Copy link
Collaborator Author

https://github.com/osrf/vrx/wiki/docker_install_tutorial#step-3-run-your-container .

@ahcorde you will need that rocker command in the image or the wiki to make the GPU / X configuration setup to work properly.

@caguero
Copy link
Collaborator

caguero commented May 27, 2025

sudo apt-get update && sudo apt-get install mesa-utils && glxinfo | head -n 5

glxinfo returns something better:

caguero@68f2dc79b5bf:~/vrx_ws$ glxinfo | head -n 5
name of display: :1
display: :1  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4

But I still get 20% RTF compared with 85-90% using dockwater.

Signed-off-by: Jose Luis Rivero <[email protected]>
@j-rivero
Copy link
Collaborator Author

Removed comments and unused file. good to go

@j-rivero j-rivero merged commit 7adf2c1 into jazzy May 28, 2025
2 checks passed
@caguero caguero deleted the jrivero/dockerfiles branch June 5, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants