- 지금 현 단계는 외부컴퓨터에서 연결이 가능하게 ssh와 포트포워딩 까지 전부 세팅되어있는 상태이다.
- 여기에서 부터 외부환경에서 주피터노트북을 실행하도록 딥러닝 PC 환경을 구축을 해본다.
- 현 상태는 연구실 맥북에서 연구실에 있는 딥러닝 PC 접속화면
- docker ps -a 를 눌러서 종료된 컨테이너 까지 확인해서
(base) smmc-dl@smmcdl:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
111111111111 ubuntu:20.04 "bash" 20 minutes ago Exited (0) 20 minutes ago flamboyant_tesla
111111111114 nvidia/cuda:10.0-cudnn7-runtime-ubuntu16.04 "/bin/bash" 13 months ago Exited (1) 10 minutes ago base_container
111111111116 google/cadvisor:latest "/usr/bin/cadvisor -…" 13 months ago Exited (255) 13 months ago 0.0.0.0:55553->8080/tcp cadvisor
111111111117 nvidia/cuda:10.2-cudnn7-runtime-ubuntu16.04 "/bin/bash" 13 months ago Exited (0) 4 months ago basic_container
111111111115 hello-world "/hello" 14 months ago Exited (0) 14 months ago beautiful_mendeleev
(base) smmc-dl@smmcdl:~$
- 나는 여기서 base_container란 이름을 가진 도커 환경을 복사하려고 한다
- base_container 는 종료된 컨테이너이니 sudo docker start basic_container 를 먼저 실행하도록 하자
(base) smmc-dl@smmcdl:~$ sudo docker start basic_container
basic_container
(base) smmc-dl@smmcdl:~$
- docker ps 명령어를 통해 실행되었는지 확인하자
(base) smmc-dl@smmcdl:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
111111111117 nvidia/cuda:10.2-cudnn7-runtime-ubuntu16.04 "/bin/bash" 13 months ago Up 2 minutes 0.0.0.0:55555->22/tcp, 0.0.0.0:55554->8888/tcp basic_container
(base) smmc-dl@smmcdl:~$
- docker commit basic_container glory 명령어를 통해 이미지를 압축하자
- docker commit 압축할컨테이너명 새로운컨테이너명
(base) smmc-dl@smmcdl:~$ docker commit basic_container glory
sha256:5~~~~~~~~~~~~49
(base) smmc-dl@smmcdl:~$
- docker image 검색해서 잘 되었는지 체크하자
(base) smmc-dl@smmcdl:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
glory latest 511111111111 5 minutes ago 8.64GB
ubuntu 20.04 b11111111111 4 weeks ago 72.8MB
nvidia/cuda 10.0-cudnn7-runtime-ubuntu16.04 f11111111111 14 months ago 1.33GB
nvidia/cuda 10.2-base 111111111111 15 months ago 108MB
nvidia/cuda 10.2-cudnn7-runtime-ubuntu16.04 b11111111111 15 months ago 1.81GB
hello-world latest b11111111111 22 months ago 13.3kB
google/cadvisor latest e11111111111 3 years ago 69.6MB
(base) smmc-dl@smmcdl:~$
- 그러면 다시 docker run을 활용해서 실행(glory는 컨테이너를 압축한 파일 이름, glory_container는 glory압축을 푼 컨테이너 이름
(base) smmc-dl@smmcdl:~$ docker run -it --name glory_container glory bash
root@ea018e05387e:/#
- 마지막으로 jupyter notebook --ip=0.0.0.0 --allow-root --no-browser 명령어 실행
root@ea018e05387e:/# jupyter notebook --ip=0.0.0.0 --allow-root --no-browser
[I 03:58:13.523 NotebookApp] Serving notebooks from local directory: /
[I 03:58:13.523 NotebookApp] Jupyter Notebook 6.1.4 is running at:
[I 03:58:13.523 NotebookApp] <http://ea0187e:8888/?token=bc5222>
[I 03:58:13.523 NotebookApp] or <http://127.0.0.1:8888/?token=bc521152>
[I 03:58:13.523 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 03:58:13.526 NotebookApp]
To access the notebook, open this file in a browser:
file:///root/.local/share/jupyter/runtime/nbserver-21-open.html
Or copy and paste one of these URLs:
<http://ea2387e:8888/?token=bc5fec1>
or <http://127.0.0.1:8888/?token=bc52>
- 용무가 다 끝나면 exit 명령어 입력해서 종료하기