ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Best practice for the correct user setup within a ROS docker container?

asked 2020-08-03 04:07:23 -0500

bgraysea gravatar image

updated 2020-08-03 04:07:51 -0500

docker ros states: By default, the container runs as the root user

http://wiki.ros.org/rosdep states: Do NOT run rosdep update with sudo. It is not required and will result in permission errors later on.

Trying to follow http://docs.ros.org/melodic/api/movei..., running in osrf/ros:melodic-desktop-full I am getting to Warning: running 'rosdep update' as root is not recommended. as below

Is there a recommended best practice for the correct user setup within a ROS docker container?

docker run -it -v ~/catkin_wses:/root osrf/ros:melodic-desktop-full

root@0ebd9e5101b5:/# cd /root/ws_moveit-tuts/src/

root@0ebd9e5101b5:~/ws_moveit-tuts/src# rosdep update

reading in sources list data from /etc/ros/rosdep/sources.list.d Warning: running 'rosdep update' as root is not recommended.

edit retag flag offensive close merge delete

Comments

On the same topic, is it possible to init and update rosdep at the creation of the docker so it is available and ready for the user (regular account) ? I can do it but then the user has to use sudo before for intance 'rosdep install'. Anyway to do it without sudo, i.e. init and update rosdep in the Dockerfile as a regular user ?

doisyg gravatar image doisyg  ( 2022-10-06 05:04:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-08-03 04:13:09 -0500

gvdhoorn gravatar image

http://wiki.ros.org/rosdep states: Do NOT run rosdep update with sudo. It is not required and will result in permission errors later on.

What that page writes is good advice, for normal usage scenarios.

Setting up a Docker image is "not" normal usage, in the sense that typically, everything in a Docker container runs as root (by default).

The potential issues wiki/rosdep is warning about are what you can run into when first running things as root and then switching to a regular account. But as I wrote above, that's typically not how Dockerfiles are written.

So I believe what you are doing is OK -- inside a Docker image.

edit flag offensive delete link more

Comments

1

But of course: if you later switch to another user in a Docker container, then you should be mindful of the recommended usage of rosdep.

gvdhoorn gravatar image gvdhoorn  ( 2020-08-03 04:13:59 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-03 04:07:23 -0500

Seen: 573 times

Last updated: Oct 06 '22