Skip to content

Commit

Permalink
Fix Docker/Podman in rootless mode
Browse files Browse the repository at this point in the history
  • Loading branch information
benz0li committed Nov 22, 2023
1 parent c4ccdad commit 946b3fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ current value of `${NB_UID}` and `${NB_GID}`.
The server logs appear in the terminal.
#### Using Podman (rootless mode, 3.11.5+)
#### Using Podman (rootless mode, 3.11.6+)
Create an empty home directory:
Expand Down
5 changes: 3 additions & 2 deletions base/scripts/usr/local/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if [ "$(id -u)" == 0 ] ; then
# Update the home directory if the desired user (NB_USER) is root and the
# desired user id (NB_UID) is 0 and the desired group id (NB_GID) is 0.
if [ "${NB_USER}" = "root" ] && [ "${NB_UID}" = "$(id -u "${NB_USER}")" ] && [ "${NB_GID}" = "$(id -g "${NB_USER}")" ]; then
sed -i 's|/root|/home/root|g' /etc/passwd
sed -i "s|/root|/home/root|g" /etc/passwd
# Do not preserve ownership in rootless mode
CP_OPTS="-a --no-preserve=ownership"
# Pip: Install packages to the user site
Expand All @@ -98,7 +98,8 @@ if [ "$(id -u)" == 0 ] ; then
if [[ ! -e "/home/${NB_USER}" ]]; then
_log "Attempting to copy /home/jovyan to /home/${NB_USER}..."
mkdir "/home/${NB_USER}"
if cp -a /home/jovyan/. "/home/${NB_USER}/"; then
# shellcheck disable=SC2086
if cp ${CP_OPTS:--a} /home/jovyan/. "/home/${NB_USER}/"; then
_log "Success!"
else
_log "Failed to copy data from /home/jovyan to /home/${NB_USER}!"
Expand Down

0 comments on commit 946b3fe

Please sign in to comment.