docker ros catkin_make user failed but not root – _setup_util.py not executable?

In docker run, catkin_make

  • with ros melodic doesn’t work using user account
  • with ros melodic work but with root account

Explanation

# In Bash Linux
mkdir essai
cd essai
docker run --rm -it --user $(id -u):$(id -g) "etc." "melodic" /bin/bash

OK, start docker now.

# In Docker Bash Linux
pwd --> /home/"user"
mkdir -p ros_ws/src
source /opt/ros/melodic/setup.bash
cd ros_ws/src
catkin_init_workspace
cd ..
catkin_make

–> Error
And If we check this folder, we have that result:

[email protected]:/home/koala/ros_ws$ ls devel/
total 80
-rw-r--r-- 1 koala koala   270 Mar 14 06:54 setup.zsh
-rw-r--r-- 1 koala koala  2712 Mar 14 06:54 setup.sh
-rw-r--r-- 1 koala koala   260 Mar 14 06:54 setup.bash
-rw-r--r-- 1 koala koala   506 Mar 14 06:54 env.sh
-rw-r--r-- 1 koala koala 12411 Mar 14 06:54 _setup_util.py

Check _setup_util.py.
It’s wrong because it’s not executable !

Try with root

# In Linux bash
rm -rf essai
mkdir essai
cd essai
docker run --rm -it "etc." "melodic" /bin/bash

OK, start docker now with root account

# In Docker Bash Linux
mkdir -p ros_ws/src
cd ros_ws/src
source /opt/ros/melodic/setup.bash
catkin_init_workspace
cd ..
catkin_make

It works ! 🙁
And If we check this folder we have that result:

[email protected]:~/ros_ws# ls devel/
total 36
-rwxr-xr-x 1 root root 12411 Mar 14 06:59 _setup_util.py
-rw-r--r-- 1 root root   270 Mar 14 06:59 setup.zsh
-rw-r--r-- 1 root root  2713 Mar 14 06:59 setup.sh
-rw-r--r-- 1 root root   260 Mar 14 06:59 setup.bash
-rwxr-xr-x 1 root root   506 Mar 14 06:59 env.sh
drwxr-xr-x 2 root root  4096 Mar 14 06:59 lib

How to have the same result with user account ?

Thanks a lot

Source: StackOverflow