Created
March 23, 2021 18:54
-
-
Save igor-egorov/02ce85ff5eb52bce261f155afb63b92e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# runs on host mac | |
echo $UID # prints your id | |
whoami # prints your username | |
docker pull ubuntu:18.04 | |
cd to/your/cpp/projects/dir | |
docker run -it --name u18 -v "$PWD":/cpp:delegated --cap-add=SYS_PTRACE ubuntu:18.04 | |
# get into container as root | |
docker exec -u 0 -it u18 bash | |
# inside docker as root | |
adduser --disabled-password --gecos "" -u <your uid from line 2> <your username from line 3> | |
# get into docker as your user | |
docker exec -u $(whoami) -it u18 bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment