chainer-docker is a template for a typical machine learning project using chainer, docker, and docker-compose.
- docker >= 17.12.0
- docker-compose >= 1.19.0
- nvidia-docker2 >= 2.0.2
Register the required environment variables to your .bashrc
:
export UID
export GID=`id -g`
Register the required environment variables to .env
:
- IMAGENAME: Name of docker image for this project (default: chainer-docker)
And set the name of this package in setup.py:
...
setup(
name='name of package',
...
$ docker-compose build cpu
You can run a command in a new container:
$ docker-compose run cpu [COMMAND]
$ docker-compose build gpu
Check if a GPU is available in the container by running nvidia-smi
:
$ docker-compose run gpu nvidia-smi
And then you can run a command in a new container:
$ docker-compose run gpu [COMMAND]
Start up Jupyter Lab using:
$ docker-compose up jupyter
You will get the response as follows:
...
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8888/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
...
Then you can access jupyter lab from the follwing URL:
http://0.0.0.0:8888/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Note that you can change the port using environment variable as below:
$ PORT=9999 docker-compose up jupyter