Run your docker with a specific executable and then shut down: sudo nvidia-docker run --rm nvidia/cuda nvidia-smi
Keep running your docker with bash access: sudo nvidia-docker run -ti --rm nvidia/cuda /bin/bash
- Start by creating a
Dockerfile
inside a folder where you want to build your docker image - Go to NVIDIA docker hub: https://hub.docker.com/r/nvidia/cuda/ and select yourself a useful configuration
- Open up your
Dockerfile
to the one side and a terminal on the other side - In the
Dockerfile
, start by
- Adding the first line:
FROM nvidia/cuda:8.0-cudnn5-devel
where you replace the flavour after:
with your choice - Make sure it ends with:
CMD /bin/bash
- Each command that works in your terminal (see below), can be added, with
RUN
before it - The
cd
-command is replaced byWORKDIR
prefix
- Start up a basis docker in your terminal using the command above, starting from an NVIDIA config
- Experiment and fill in your
Dockerfile
- Once you are done, run in the folder with your file:
sudo docker build . -t name:flavour
- Create a shell script
#!/bin/bash
sudo nvidia-docker run -ti --rm \
-v /home/eavise-3frog/Desktop/test/data:/data \
name:flavor /bin/bash
- Make sure that the
-v
option links an external location to an internal mount point where you can edit with sudo rights
Removing specific docker images
- See all images:
sudo docker images
- Remove images:
sudo docker rmi imageID
Look at the running containers
sudo docker ps -a
sudo docker rm containerID
Delete all containers that have been exited
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
sudo addgroup eavise-3frog docker
Make a bash script that containts the following lines of code
#!/bin/bash
xhost +SI:localuser:root
nvidia-docker run -ti --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
container:flavor /bin/bash
xhost -SI:localuser:root
And then all graphical output will not render issues.
For the OpenCV docker I am creating
-WITH_TBB=ON -CUDA_ARCH_BIN=6.1 -CUDA_ARCH_PTX=6.1 -ENABLE_IMPL_COLLECTION=ON