Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sandeepkumar-skb/43642f3682e7404bb8adb862c2c7ef72 to your computer and use it in GitHub Desktop.

Select an option

Save sandeepkumar-skb/43642f3682e7404bb8adb862c2c7ef72 to your computer and use it in GitHub Desktop.
docker run -it --ipc=host --gpus all --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v `pwd`:/host <docker_image>
@sandeepkumar-skb

Copy link
Copy Markdown
Author

--user $(id -u):$(id -g) -> maps user's user_id and group_id
-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -> This is a hack since docker containers /etc/passwd and /etc/group doesn't container the user's user_id and group_id so if you don't provide this then docker container won't be able to identify the username

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