Pre-built docker images are available at https://hub.docker.com/r/dmlc/mxnet/
-
First pull the pre-built image
docker pull dmlc/mxnet
-
Then we can run the python shell in the docker
docker run -ti dmlc/mxnet python
For example
$ docker run -ti dmlc/mxnet python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mxnet as mx import mxnet as mx >>> quit() quit()
Note: One may get the error message
libdc1394 error: Failed to initialize libdc1394
, which is due to opencv and can be ignored. -
Train a model on MNIST to check everything works
docker run dmlc/mxnet python /mxnet/example/image-classification/train_mnist.py
If the host machine has Nvidia GPUs, we can use dmlc/mxnet:cuda
, which has both CUDA and CUDNN installed.
To launch the docker, we need to install nvidia-docker first.
-
Pull the image
docker pull dmlc/mxnet:cuda
-
Train MNIST on GPU 0
nvidia-docker run dmlc/mxnet:cuda python /mxnet/example/image-classification/train_mnist.py --gpus 0
docker build -t dmlc/mxnet:cpu cpu
docker build -t dmlc/mxnet:cuda cuda