Skip to content

Commit 50fd3c9

Browse files
authored
Merge pull request #38 from udzuki/fix-29-jhub-permission-error
fix: JupyterHubの起動失敗(PermissionError: [Errno 13] Permission denied: '/home/jupyter/.local')
2 parents 2908c8c + 922559d commit 50fd3c9

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

README.adoc

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:lang: ja
33
:source-highlighter: rouge
44
:author: 国立情報学研究所
5-
:revdate: 2022年7月27日
5+
:revdate: 2022年8月17日
66
:revnumber: 3.1-SNAPSHOT版
77
:doctype: book
88
:version-label:
@@ -18,6 +18,13 @@
1818
:sectnums:
1919
:imagesdir: images
2020
:icons: font
21+
ifdef::env-github[]
22+
:tip-caption: :bulb:
23+
:note-caption: :information_source:
24+
:important-caption: :heavy_exclamation_mark:
25+
:caution-caption: :fire:
26+
:warning-caption: :warning:
27+
endif::[]
2128

2229
= ラーニングアナリティクス基盤システム Docker 環境構築手順書
2330

@@ -480,6 +487,27 @@ image::jupyterhub/signin.png[align=center, scaledwidth=50%]
480487

481488
image::jupyterhub/notebooks.png[align=center]
482489

490+
[WARNING]
491+
====
492+
Linux環境において、マウントしたホームディレクトリ( `/home/jupyter` )の所有者が適切に設定されず、権限エラーが発生する場合がある。
493+
494+
----
495+
PermissionError: [Errno 13] Permission denied: '/home/jupyter/.local'
496+
----
497+
498+
本問題が生じた場合には、実行ユーザのUID/GIDを以下の環境変数で指定し、コンテナを再起動すること。
499+
500+
.docker-compose.yml
501+
[source, diff]
502+
----
503+
jupyterhub:
504+
...
505+
environment:
506+
- LOCAL_UID=<uid> # id -u
507+
- LOCAL_GID=<gid> # id -g
508+
----
509+
====
510+
483511
<<<
484512
==== Learning Lockerからステートメントを取得
485513
ノートブック「link:jupyterhub/notebooks/get_statements_from_learninglocker.ipynb[get_statements_from_learninglocker]」を活用し、Learning LockerのAPIを使用したステートメント取得が可能であることを確認する。 +

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)