天天看點

Docker學習系列(四):Docker下安裝Jupyter

該過程與直接利用dockerfile相比,不是很友善,但也是一種方法,是以記錄在此(有了上面提到的dockerfile方法,完全可以抛棄本方法)

(1)安裝docker

(2) pull一個caffe的image

直接在docekr hub中搜尋caffe,下載下傳image kaixhin/caffe(Ubuntu Core 14.04 + Caffe. Includes Python interface.)

sudo docker pull kaixhin/caffe

(3)利用該image運作一個container

sudo docker run -it kaixhin/caffe bash

(4)在該container中安裝jupyter notebook

pip install jupyter notebookyter
           

notebook是jupyter的名字

(5)commit安裝好jupyter的image,重新命名

sudo docker commit --change='CMD jupyter notebook' serene_carson tingtingNew
           
  • serene_carson:正在運作的container的名字
  • tingtingNew:想要儲存的新的image的名字

(6)利用新的image生成新的container

注:tingtingNew為剛剛安裝了jupyter notebook的image

(7)打開jupyter

利用浏覽器輸入網址:localhost:8888

注:不知道為什麼,本機安裝的jupyter位址沒法擷取,是以這裡使用了localhost

如何擷取localhost的位址?

打開一個新的terminal,檢視container的位址:

sudo docker inspect clever_bohr | grep IPAddress
           

這裡的clever_bohr為該正在運作的container的名字,例子如下

Docker學習系列(四):Docker下安裝Jupyter

在浏覽器中輸入:172.17.0.6:8888