• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mynameisvinn/Docker-for-Data-Scientists: containerizing jupyter notebooks

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

mynameisvinn/Docker-for-Data-Scientists

开源软件地址:

https://github.com/mynameisvinn/Docker-for-Data-Scientists

开源编程语言:

Jupyter Notebook 94.6%

开源软件介绍:

what's this?

this is the simplest example of sharing notebooks with docker.

lets get started

get it

clone this repo with git clone https://github.com/mynameisvinn/Docker-for-Data-Scientists.

start docker daemon

do systemctl start docker.service

building da container

do docker build -t mynameisvinn/ds . which tells docker to build the container.

it does so by executing a sequence of commands specified by the dockerfile including (a) fetching a base python 3.6 layer; (b) copying requirements.txt and the notebooks folder into the container; (c) executing shell commands such as pip install, setting the working directory to home, exposing port 8888, and finally launching a notebook.

FROM python:3.6-slim

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY notebooks /home
WORKDIR /home

# Exposing ports
EXPOSE 8888

# Running jupyter notebook
# --NotebookApp.token ='demo' is the password
CMD ["jupyter", "notebook", "--no-browser", "--ip 0.0.0.0", "--allow-root", "--NotebookApp.token='demo'"]

running da container

now that we've built the container, we can run it.

we run with docker run -d -p 8887:8888 mynameisvinn/ds. this container launches a notebook at localhost:8887 (password: demo).

running it on ec2 - why not?

assuming youve enabled traffic to port 8887, you could do everything above in an ec2 instance, and then access the notebook from your local machine by pointing your browser to $EC2_IP:8887.

syncing files between local and container

we could also do docker run -d -p 8887:8888 -v /Users/vincent1/dropbox/temp/Docker-for-Data-Scientists/shared_data:/home mynameisvinn/ds, which maps local's shared_data folder with the container's home folder.

other helpful commands:

  • ssh into container do docker run -it mynameisvinn/ds
  • stop all containers. do docker stop $(docker ps -a -q).
  • remove images. do docker rmi $(docker images -a -q). this will delete all images from local disk.
  • removing dangling images do docker system prune will purge intermediate unnamed images. Depending on the sizes of containers you're using, this can save a considerable amount of disk space.

docker compose

alternatively, assuming the image can be pulled from dockerhub, you can run docker-compose up.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap