From 63f44b0137712d15cc8f428554a9103c336a9007 Mon Sep 17 00:00:00 2001 From: Benjamin Aarsen Date: Fri, 5 Sep 2025 16:02:52 +0200 Subject: [PATCH 1/2] fix default user --- Dockerfile | 3 ++- devcontainer.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e3a68c3..5f1c076 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM osrf/ros:jazzy-desktop-full-noble SHELL [ "/bin/bash" , "-c" ] -# Add sourcing ROS setup.bash to .bashrc +USER ubuntu + RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc RUN echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc diff --git a/devcontainer.json b/devcontainer.json index f0a188b..3eac583 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -3,6 +3,7 @@ "build": { "dockerfile": "Dockerfile" }, + "remoteUser": "ubuntu", "runArgs": [ // "--cap-add=SYS_PTRACE", // Allows the container to trace processes using ptrace system call // "--security-opt=seccomp=unconfined", // Disables seccomp security profiles for the container From e23d4202c7ec4c086fc1b8f03a2ac63526d78851 Mon Sep 17 00:00:00 2001 From: Benjamin Aarsen Date: Fri, 5 Sep 2025 16:12:15 +0200 Subject: [PATCH 2/2] more devcontainer fixes --- Dockerfile | 8 ++++++-- devcontainer.json | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5f1c076..9b9454c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM osrf/ros:jazzy-desktop-full-noble -SHELL [ "/bin/bash" , "-c" ] + +RUN apt-get update && apt-get install -y libsecret-1-0 libsecret-1-dev USER ubuntu + RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc RUN echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc -RUN echo "export _colcon_cd_root=/opt/ros/jazzy/" >> ~/.bashrc \ No newline at end of file +RUN echo "export _colcon_cd_root=/opt/ros/jazzy/" >> ~/.bashrc + +SHELL [ "/bin/bash" , "-c" ] diff --git a/devcontainer.json b/devcontainer.json index 3eac583..7a49d31 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -14,11 +14,11 @@ ], "workspaceMount": "source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind", "workspaceFolder": "/${localWorkspaceFolderBasename}", - // for linux - "containerEnv": { - // Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools - "DISPLAY": "${localEnv:DISPLAY}", - "TZ": "Europe/Amsterdam" + "remoteEnv": { + "DISPLAY": "${localEnv:DISPLAY}", + "TZ": "Europe/Amsterdam", + "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus", + "XDG_RUNTIME_DIR": "/run/user/1000" }, "mounts": [ // Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools @@ -38,6 +38,11 @@ "source": "/dev/dri", "target": "/dev/dri", "type": "bind" + }, + { + "source": "/run/user/1000/bus", + "target": "/run/user/1000/bus", + "type": "bind" } ], "customizations": {