/bonito

a wrapper of docker for academic laboratories.

Primary LanguageShell

bonito

a docker wrapper for academic laboratories.

who should use bonito?

  • those who want to give your student a root permission of the server.
  • those who do not want your students change server settings.

alternatives you should consider before installing bonito

  • kubeflow (provide jupyter env to your student.)
  • Rancher (provide web gui to control containers.)

Quick Start (stand alone mode)

(tested on Ubuntu16.04.)

  1. install docker server
  2. install nvidia-docker2
  3. download bonito
% cd /share
% git clone https://github.com/AtsushiHashimoto/bonito.git bonito
% cd bonito
% cp bonito.conf{.example,}
% cp volume/home/default{.example,}

(note: for multi-node setting, /share should be shared through NFS etc.)

  1. (multinode mode only) install and run docker registry.
  • set registry server ip address to 'BONITO_REGIS_SERVER' in bonito.conf
  • exec following command at registry server machine
% /share/bonito/sbin/bonito_adm start_registry
  • exec following command at non-registry server machine (this command enables the machine to access your docker images remotely.)
% /share/bonito/sbin/bonito_adm init
  1. download/set default image
% docker pull nvidia/cuda:9.2-cudnn7-runtime-ubuntu16.04 #adjust cuda/cudnn/ubuntu versions to your env.
% bonito create -u default -b nvidia/cuda:9.2-cudnn7-runtime-ubuntu16.04
  1. edit default docker image
% bonito run -u default
(edit)
% bonito snapshot -u default

(you can directly put files to '/share/bonito/volume/home/default/', where is mounted as /root/ in docker container)

  1. create your virtual machine, and run it. (once you have done 1-5 steps, you only need step 6 for every new user.
    • as a root (after creating an account for the new user)
# /share/bonito/sbin/bonito_adm add_user <<username>>
# systemctl daemon-reload
# systemctl restart docker
- as the new user
% echo export PATH="$PATH:/share/bonito/bin"
% bonito create
% bonito run

Now, you should be able to run your virtual machine.

bonito virtual machine lifecycle

% bonito create (only once)
% bonito run 
% bonito shutdown (when you want to stop the container)
% bonito delete (when you want to delete the image)

USE CASE

run jupyter-notebook as a daemon for each user, which is accesible via port 18888 of the host machine.

% bonito run -c /root/jupyter.sh -o "-d --restart=always -p 18888:8888"

Problems & Future Possibilities

  1. You need to restart docker server whenever you add a new user.
  2. You need to find an available gpu resource manually. Better to integrate this with k8s. (But, I don't succeed to run a insecure docker registry in a k8s pod. I also afraid to loose visibility of gpu resource usage for each user.)
  3. kubeflow has possibility to cover the functionality of bonito in future, and I hope so =)