Skip to content

Commit

Permalink
Merge pull request #60 in SRR/franka_ros2 from fix/devcontainer-termi…
Browse files Browse the repository at this point in the history
…nal-crashing to humble

* commit '0c6f824ee6ce122056fcfed5e8040b1a2e76ec9e':
  fix: devcontainer terminal crashing
  • Loading branch information
BarisYazici committed May 17, 2024
2 parents e25e36f + 0c6f824 commit 2c1be4d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
15 changes: 8 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ WORKDIR /workspaces

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& mkdir -p -m 0700 /run/user/"${USER_UID}" \
&& mkdir -p -m 0700 /run/user/"${USER_UID}"/gdm \
&& chown user:user /run/user/"${USER_UID}" \
&& chown user:user /workspaces \
&& chown user:user /run/user/"${USER_UID}"/gdm \
&& mkdir -p -m 0700 /run/$USERNAME/"${USER_UID}" \
&& mkdir -p -m 0700 /run/$USERNAME/"${USER_UID}"/gdm \
&& chown $USERNAME:$USERNAME /run/$USERNAME/"${USER_UID}" \
&& chown $USERNAME:$USERNAME /workspaces \
&& chown $USERNAME:$USERNAME /run/$USERNAME/"${USER_UID}"/gdm \
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
Expand Down Expand Up @@ -68,10 +68,11 @@ RUN cd ~/source_code && git clone https://github.com/frankaemika/libfranka.git \
RUN addgroup realtime
RUN usermod -a -G realtime $USERNAME

ENV SHELL "/bin/bash"
ENV XDG_RUNTIME_DIR=/run/user/"${USER_UID}"

# set the default user to the newly created user
USER $USERNAME
CMD ["/bin/bash"]

RUN echo "source /ros_entrypoint.sh" >>~/.bashrc
RUN echo "export ROS_DOMAIN_ID=100" >>~/.bashrc
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
56 changes: 33 additions & 23 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "ROS2 Humble",
"dockerComposeFile": "./docker-compose.yml",
"service": "ros2_control",
"workspaceFolder": "/workspaces",
"remoteUser": "user",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"bungcip.better-toml",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cmake-tools",
"xaver.clang-format",
"josetr.cmake-language-support-vscode",
"twxs.cmake",
"cheshirekow.cmake-format"
]
}
}
}
"name": "ROS 2 Development Container",
"privileged": true,
"remoteUser": "user",
"dockerComposeFile": "./docker-compose.yml",
"service": "ros2_control",
"workspaceFolder": "/workspaces",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"bungcip.better-toml",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cmake-tools",
"xaver.clang-format",
"josetr.cmake-language-support-vscode",
"twxs.cmake",
"cheshirekow.cmake-format"
]
}
},
"containerEnv": {
"DISPLAY": "unix:0",
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
"ROS_DOMAIN_ID": "100"
},
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=/dev/dri,target=/dev/dri,type=bind,consistency=cached",
],
"postCreateCommand": "rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R user /workspaces"
}
3 changes: 2 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
version: '2'
version: '3'

services:
ros2_control:
build: .
container_name: franka_ros2
network_mode: "host"
privileged: true
command: /bin/bash
Expand Down

0 comments on commit 2c1be4d

Please sign in to comment.