Based on the instruction here https://github.com/gw0/docker-keras with a few modification on how to run on GPU:
The original snippet:
$ docker run -it --rm $(ls /dev/nvidia* | xargs -I{} echo '--device={}') $(ls /usr/lib/*-linux-gnu/{libcuda,libnvidia}* | xargs -I{} echo '-v {}:{}:ro') -v $(pwd):/srv gw000/keras:2.1.4-py2-tf-gpu /srv/run.py
The idea is to map local NVIDIA devices(/dev/nvidia*
) to container environment, and map local NVIDIA drivers and libraries to proper container's /usr/lib/ directories. With NVIDIA driver 387.34(latest when written), this is snippet is no longer sufficient.
Modified snippet: