1. Jupyter Notebook 설치
docker run --user root --name jupyter -p 8888:8888 -p 9999:9999 -d jupyter/tensorflow-notebook
# 해당 로그에서 token 값 확인 가능
# http://localhost:8888 접속
docker logs jupyter
2. Python2 코드 테스트 환경 추가 설치
docker exec -it jupyter /bin/bash
conda deactivate
apt update
apt -y install python2 python2.7-dev
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o /tmp/get-pip.py
python2 /tmp/get-pip.py
pip2 --version
pip2 install ipykernel
cd /opt/conda/share/jupyter/kernels/
cp -r /opt/conda/share/jupyter/kernels/python3 /opt/conda/share/jupyter/kernels/python2
cat <<SET_PYTHON2_KERNEL > /opt/conda/share/jupyter/kernels/python2/kernel.json
{
"argv": [
"/usr/bin/python2",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 2 (ipykernel)",
"language": "python",
"metadata": {
"debugger": true
}
}
SET_PYTHON2_KERNEL
jupyter notebook
# 확인 URL로 접속
echo http://localhost:8888?token=`jupyter notebook list | grep token | awk '{print $1}' | awk -F "=" '{print $2}'`
pip2 install numpy
'Development Tools > Docker' 카테고리의 다른 글
[ Docker ] Nexus 저장소 설치 (0) | 2024.05.21 |
---|---|
[ Docker ] Nginx 헤더 취약점 방지 (0) | 2024.05.10 |
[ Docker ] Docker Compose 작성 (0) | 2024.01.22 |
[ Docker ] Dockerfile 작성 (0) | 2024.01.21 |
[ Docker ] Docker 명령어 활용 (0) | 2024.01.07 |