Skip to content

Instantly share code, notes, and snippets.

Last active Mar 5, 2019
What would you like to do?
Important docker commands

Command to initialize docker container as non-root user

This command also demonstrates "bind volume mount", transferring webcam device to container, port transfer and x11 linux graphic server.

nvidia-docker run -it --device=/dev/video0:/dev/video0 --user=$(id -u $USER):$(id -g $USER) -p=5000:5000 -v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -v /etc/shadow:/etc/shadow -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/jyotendra/project/DeepStream/sample-scripts:/root/ -e DISPLAY=$DISPLAY -w /root 94a 

The following volumes are mounted so as to help with initiating container as non-root user:

  • /etc/passwd
  • /etc/group
  • /etc/shadow

Rest parameters are pretty well documented on docker run docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment