Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
Jupyter Docker Stacks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Jupyter Docker Stacks
Commits
c1380704
Commit
c1380704
authored
Sep 04, 2017
by
Peter Parente
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix working directory problems with custom NB_USER
Improve start.sh logging along the way
parent
16e6d72c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
base-notebook/start.sh
base-notebook/start.sh
+13
-5
No files found.
base-notebook/start.sh
View file @
c1380704
...
...
@@ -6,18 +6,23 @@ set -e
# Handle special flags if we're root
if
[
$(
id
-u
)
==
0
]
;
then
# Switch to the root of the container in case we start adjusting paths
# that impact the default working directory
cd
/
# Handle username change. Since this is cheap, do this unconditionally
usermod
-d
/home/
$NB_USER
-l
$NB_USER
jovyan
echo
"Set username to:
$NB_USER
"
usermod
-m
-d
/home/
$NB_USER
-l
$NB_USER
jovyan
# Change UID of NB_USER to NB_UID if it does not match
if
[
"
$NB_UID
"
!=
$(
id
-u
$NB_USER
)
]
;
then
echo
"Set
user
UID to:
$NB_UID
"
echo
"Set
$NB_USER
UID to:
$NB_UID
"
usermod
-u
$NB_UID
$NB_USER
fi
# Change GID of NB_USER to NB_GID if NB_GID is passed as a parameter
if
[
"
$NB_GID
"
]
;
then
echo
"
Change GID to
$NB_GID
"
echo
"
Set
$NB_USER
GID to:
$NB_GID
"
groupmod
-g
$NB_GID
-o
$(
id
-g
-n
$NB_USER
)
fi
...
...
@@ -27,8 +32,11 @@ if [ $(id -u) == 0 ] ; then
echo
"
$NB_USER
ALL=(ALL) NOPASSWD:ALL"
>
/etc/sudoers.d/notebook
fi
# Switch to the user's home directory after adjusting any paths
cd
/home/
$NB_USER
# Exec the command as NB_USER
echo
"Execute the command
as
$NB_USER
"
echo
"Execute the command
:
$*
"
exec
su
$NB_USER
-c
"env PATH=
$PATH
$*
"
else
if
[[
!
-z
"
$NB_UID
"
&&
"
$NB_UID
"
!=
"
$(
id
-u
)
"
]]
;
then
...
...
@@ -41,6 +49,6 @@ else
echo
'Container must be run as root to grant sudo permissions'
fi
# Exec the command
echo
"Execute the command"
echo
"Execute the command
:
$*
"
exec
$*
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment