autowarefoundation/autoware

Missing environment variables in devel Docker container

amadeuszsz opened this issue · 2 comments

Checklist

  • I've read the contribution guidelines.
  • I've searched other issues and no duplicate issues were found.
  • I'm convinced that this is not my fault but a bug.

Description

After running development container, environment variables set via ansible script doesn't exist.

Expected behavior

All the environment variables set via ansible script are reflected for user while running Docker image with --devel flag.

Actual behavior

/home/${USER}/.bashrc doesn't contain environment variables. The missing variables are:

export PATH="$PATH:/root/.local/bin"
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CCACHE_DIR="/var/tmp/ccache"
export CC="/usr/lib/ccache/gcc"
export CXX="/usr/lib/ccache/g++"
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"

It causes multiple issues, e.g. running ROS 2 daemon with rmw_fastrtps_cpp DDS.

Steps to reproduce

./docker/run.sh --devel
cat $HOME/.bashrc
sudo su
cat $HOME/.bashrc

Versions

No response

Possible causes

Command exec /usr/sbin/gosu "$USER_NAME" "$@" from docker/etc/ros_entrypoint.sh run bash as user with default .bashrc file. We can fix this two ways:

  • Handle /etc/skel/.bashrc in ansible scripts. That means push all environment variables to two .bashrc files at the same time. In that case we will need to change export PATH="$PATH:/root/.local/bin" to export PATH="$PATH:\$HOME/.local/bin". I'm not sure if \ will keep $ in scripts as a special sign here. It has to be validated.
  • Add variables to $HOME/.bashrc via ros_entrypoint.sh. Copying /root/.bashrc is also possible if we modify export PATH="$PATH:/root/.local/bin" as described previously.

Additional context

No response

Hi @amadeuszsz could you resolve the failed checks on the PR ?

Hi @amadeuszsz could you resolve the failed checks on the PR ?

Hi @oguzkaganozt
Done!