오늘의 인기 글
최근 글
최근 댓글
Today
Total
05-10 06:27
관리 메뉴

우노

[Docker] Docker 를 이용한 Jupyter Notebook 사용 본문

DevOps/Docker

[Docker] Docker 를 이용한 Jupyter Notebook 사용

운호(Noah) 2021. 7. 17. 02:48

Docker 설치

Jupyter notebook Image Pull

Jupyter notebook Container 생성

docker run \
--name jupyter-notebook-container \
-e GRANT_SUDO=yes \
--user root \
-p 8800:8888 \
-d \
-it \
jupyter/datascience-notebook
  • --name
    • 컨테이너 이름
  • -e
    • jupyter notebook 에 root 권한 할당
  • --user
    • 컨테이너에 root 권한 할당
  • -p
    • 호스트 포트 번호 : 컨테이너 포트 번호
  • -d
    • 백그라운드 실행
  • -it
    • 컨테이너 생성 시, 명령어 실행

Jupyter notebook Container 실행

docker exec -it jupyter-notebook-container bash

Jupyter notebook 비밀번호 생성

ipython
>> from notebook.auth import passwd
>> passwd()
>> 비밀번호 입력
>> 비밀번호 재입력
# 출력된 비밀번호를 따로 저장 
>> exit

Jupyter notebook 비밀번호 설정

sudo apt-get update
sudo apt-get install vim -y
sudo vim ~/.jupyter/jupyter_notebook_config.py
# c.NotebookApp.password_required 을 True 로 수정한 뒤, 주석을 제거한다.
c.NotebookApp.password_required = True

# c.NotebookApp.password 의 '' 부분에, 위에서 생성한 passwd 를 입력한 뒤, 주석을 제거한다.
c.NotebookApp.password = ''
exit

Jupyter notebook Container 재실행

docker restart jupyter-notebook-container

Jupyter notebook 웹 접속 후, 비밀번호 입력

서버IP주소:포트번호

참고

Comments