Skip to content

Commit 255444e

Browse files
committed
Allow specifying UID/GID of jupyter user
1 parent 2908c8c commit 255444e

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ services:
128128
jupyterhub:
129129
build: jupyterhub
130130
container_name: jupyterhub
131+
#environment:
132+
# - LOCAL_UID=9001
133+
# - LOCAL_GID=9001
131134
ports:
132135
- "8001:8000"
133136
volumes:

jupyterhub/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# See https://docs.anaconda.com/anaconda/reference/release-notes/#anaconda-2019-10-october-15-2019
22
FROM continuumio/anaconda3:2019.10
33

4-
LABEL version="2.2.0"
4+
LABEL version="2.2.1"
55

66
RUN conda install -y -c conda-forge jupyterhub=0.9.6
77
RUN conda install -y -c r r-irkernel=0.8.15 # Install R
88
RUN conda install -y psycopg2=2.8.4
9-
RUN useradd -m -p $(echo "jupyter" | openssl passwd -1 -stdin) -s /bin/bash jupyter
109

11-
# Copy sample notebooks
12-
COPY notebooks/*.ipynb /home/jupyter/
13-
RUN chown jupyter:jupyter /home/jupyter/*.ipynb
10+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
11+
RUN chmod +x /usr/local/bin/entrypoint.sh
1412

1513
EXPOSE 8000
1614

17-
CMD jupyterhub --no-ssl --Spawner.args="['--NotebookApp.iopub_data_rate_limit=1.0e10']"
15+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

jupyterhub/entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
USER_ID=${LOCAL_UID:-9001}
4+
GROUP_ID=${LOCAL_GID:-9001}
5+
6+
useradd -u $USER_ID -o -m -p $(echo "jupyter" | openssl passwd -1 -stdin) -s /bin/bash jupyter
7+
groupmod -g $GROUP_ID jupyter
8+
9+
jupyterhub --no-ssl --Spawner.args="['--NotebookApp.iopub_data_rate_limit=1.0e10']"

0 commit comments

Comments
 (0)