From 88e2b447c71e6c267662c66e8d06b8bc87fbbb4a Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 07:58:19 +0000
Subject: [PATCH 1/7] configure newer pip versions to avoid ubuntu24 errors
https://stackoverflow.com/questions/75602063/pip-install-r-requirements-txt-is-failing-this-environment-is-externally-mana
---
docker/Dockerfile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 5156887..0a9abfe 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -187,6 +187,10 @@ RUN apt-get update && \
ros-${ROS_DISTRO}-ros-core \
&& rm -rf /var/lib/apt/lists/*
+# configure pip
+RUN mkdir -p ~/.config/pip && \
+ echo -e "[global]\nbreak-system-packages = true" >> ~/.config/pip/pip.conf
+
# copy install script from dependencies stage
COPY --from=dependencies $WORKSPACE/.install-dependencies.sh $WORKSPACE/.install-dependencies.sh
From 0198c47bea506c2fb173a4b54bdb82d4d99affd5 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 09:12:17 +0000
Subject: [PATCH 2/7] add ros distro badges to readme
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 731e295..79eb79a 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,8 @@
+
+
*docker-ros* automatically builds minimal container images of ROS applications.
@@ -14,10 +16,8 @@
> [!IMPORTANT]
> This repository is open-sourced and maintained by the [**Institute for Automotive Engineering (ika) at RWTH Aachen University**](https://www.ika.rwth-aachen.de/).
> **DevOps, Containerization and Orchestration of Software-Defined Vehicles** are some of many research topics within our [*Vehicle Intelligence & Automated Driving*](https://www.ika.rwth-aachen.de/en/competences/fields-of-research/vehicle-intelligence-automated-driving.html) domain.
-> If you would like to learn more about how we can support your DevOps or automated driving efforts, feel free to reach out to us!
-> *Timo Woopen - Manager Research Area Vehicle Intelligence & Automated Driving*
-> *+49 241 80 23549*
-> *timo.woopen@ika.rwth-aachen.de*
+> If you would like to learn more about how we can support your advanced driver assistance and automated driving efforts, feel free to reach out to us!
+> :email: ***opensource@ika.rwth-aachen.de***
- [About](#about)
- [Prerequisites](#prerequisites)
From 131a231a20c79163f212df2a6c626cd330860216 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 09:13:20 +0000
Subject: [PATCH 3/7] update license to 2024
---
LICENSE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index 33d1c83..b579e18 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2023 Institute for Automotive Engineering (ika), RWTH Aachen University
+Copyright (c) 2023-2024 Institute for Automotive Engineering (ika), RWTH Aachen University
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
From a17b5c803136fb4168af20ec3d4d4ef9a6b8b670 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 09:17:19 +0000
Subject: [PATCH 4/7] check if new user/group exists in entrypoint
related to https://github.com/ika-rwth-aachen/docker-ros-ml-images/pull/5
---
docker/entrypoint.sh | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 2456281..028121e 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -8,20 +8,24 @@ source /opt/ros/$ROS_DISTRO/setup.bash
# exec as dockeruser with configured UID/GID
if [[ $DOCKER_UID && $DOCKER_GID ]]; then
- groupadd -g $DOCKER_GID $DOCKER_USER
- useradd -s /bin/bash \
- -u $DOCKER_UID \
- -g $DOCKER_USER \
- --create-home \
- --home-dir /home/$DOCKER_USER \
- --groups sudo,video \
- --password "$(openssl passwd -1 $DOCKER_USER)" \
- $DOCKER_USER && \
- touch /home/$DOCKER_USER/.sudo_as_admin_successful
- cp /root/.bashrc /home/$DOCKER_USER
- ln -s $WORKSPACE /home/$DOCKER_USER/ws
- chown -R $DOCKER_USER:$DOCKER_USER $WORKSPACE
- chown -R $DOCKER_USER:$DOCKER_USER /home/$DOCKER_USER
+ if ! getent group $DOCKER_GID > /dev/null 2>&1; then
+ groupadd -g $DOCKER_GID $DOCKER_USER
+ fi
+ if ! getent passwd $DOCKER_UID > /dev/null 2>&1; then
+ useradd -s /bin/bash \
+ -u $DOCKER_UID \
+ -g $DOCKER_GID \
+ --create-home \
+ --home-dir /home/$DOCKER_USER \
+ --groups sudo,video \
+ --password "$(openssl passwd -1 $DOCKER_USER)" \
+ $DOCKER_USER && \
+ touch /home/$DOCKER_USER/.sudo_as_admin_successful
+ cp /root/.bashrc /home/$DOCKER_USER
+ ln -s $WORKSPACE /home/$DOCKER_USER/ws
+ chown -R $DOCKER_UID:$DOCKER_GID $WORKSPACE
+ chown -R $DOCKER_UID:$DOCKER_GID /home/$DOCKER_USER
+ fi
[[ $(pwd) == "$WORKSPACE" ]] && cd /home/$DOCKER_USER/ws
exec gosu $DOCKER_USER "$@"
else
From 01db5bae004a977a2280f992f7422a89fe9dfba7 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 09:47:07 +0000
Subject: [PATCH 5/7] avoid duplicate actions on pr/push by only running on
push to main
https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/
---
.github/workflows/github.yml | 8 +++++++-
.github/workflows/gitlab.yml | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml
index 472329c..e99880f 100644
--- a/.github/workflows/github.yml
+++ b/.github/workflows/github.yml
@@ -1,6 +1,12 @@
name: GitHub
-on: [push, pull_request]
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
jobs:
diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml
index f2bb271..9cf1ea9 100644
--- a/.github/workflows/gitlab.yml
+++ b/.github/workflows/gitlab.yml
@@ -1,6 +1,12 @@
name: GitLab
-on: [push, pull_request]
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
jobs:
From 8f2a004afb6b93d119f83f88a4d6228aa79945d5 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 13:33:04 +0200
Subject: [PATCH 6/7] speed up container start in run image
it's not necessary to chown the install space in the run image; this can easily save a couple of seconds when starting the container
closes #27
---
docker/entrypoint.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 028121e..5b30c74 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -23,8 +23,10 @@ if [[ $DOCKER_UID && $DOCKER_GID ]]; then
touch /home/$DOCKER_USER/.sudo_as_admin_successful
cp /root/.bashrc /home/$DOCKER_USER
ln -s $WORKSPACE /home/$DOCKER_USER/ws
- chown -R $DOCKER_UID:$DOCKER_GID $WORKSPACE
- chown -R $DOCKER_UID:$DOCKER_GID /home/$DOCKER_USER
+ chown -h $DOCKER_UID:$DOCKER_GID $WORKSPACE /home/$DOCKER_USER/ws /home/$DOCKER_USER/.sudo_as_admin_successful
+ if [[ -d $WORKSPACE/src ]]; then
+ chown -R $DOCKER_USER:$DOCKER_USER $WORKSPACE/src
+ fi
fi
[[ $(pwd) == "$WORKSPACE" ]] && cd /home/$DOCKER_USER/ws
exec gosu $DOCKER_USER "$@"
From f1633097a59a192fe628ad562b749420babb6874 Mon Sep 17 00:00:00 2001
From: Lennart Reiher
Date: Fri, 5 Jul 2024 14:28:29 +0200
Subject: [PATCH 7/7] add information about user setup to readme
---
README.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/README.md b/README.md
index 79eb79a..41dcfb1 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,8 @@
- [Extra System Dependencies (*pip*)](#extra-system-dependencies-pip)
- [Custom Installation Script](#custom-installation-script)
- [Extra Image Files](#extra-image-files)
+- [Additional Information](#additional-information)
+ - [User Setup](#user-setup)
- [Configuration Variables](#configuration-variables)
We recommend to use *docker-ros* in combination with our other tools for Docker and ROS.
@@ -332,6 +334,19 @@ If you need to have additional files present in the deployment image, you can us
Create a folder `additional-files` in your `docker` folder (or configure a different `ADDITIONAL_FILES_DIR`) and place any files or directories in it. The contents will be copied to `/docker-ros/additional-files` in the image.
+## Additional Information
+
+### User Setup
+
+Containers of the provided images start with `root` user by default. If the two environment variables `DOCKER_UID` and `DOCKER_GID` are passed, a new user with the corresponding UID/GID is created on the fly. Most importantly, this features allows to mount and edit files of the host user in the container without having to deal with permission issues.
+
+```bash
+docker run --rm -it -e DOCKER_UID=$(id -u) -e DOCKER_GID=$(id -g) -e DOCKER_USER=$(id -un) rwthika/ros:latest
+```
+
+The password of the custom user is set to its username (`dockeruser:dockeruser` by default).
+
+
## Configuration Variables
> **Note**