Sorry, this is an issue that doesn't seem to die. I would like to add some JARs via sudo. Perhaps there is a better way to do that but sudo would come in handy for other tasks.
(1)
docker run -d -v $PWD:/home/jovyan/work -e GRANT_SUDO=yes -p 8888:8888 jupyter/all-spark-notebook
(2)
Get the container id via:
docker ps
(3)
docker exec -it __containerid__ bash
(4)
sudo ls
Prompts for password for user jovyan
Try adding --user root to your run command. The doc for GRANT_SUDO explains why (https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html). Maybe we can make it clearer since it seems to trip a lot of people up.
Thanks. An example would be sufficient rather than adding more prose to the docs. Does this look correct? (yes, it works)
docker run -d -v $PWD:/home/jovyan/work -e GRANT_SUDO=yes --user root -p 8888:8888 jupyter/all-spark-notebook
Not sure why anyone would want to do this, but if you want to run a shell in the container as jovyan instead of root and use sudo when needed: docker exec --user jovyan -it _container_id_ bash
Most helpful comment
Thanks. An example would be sufficient rather than adding more prose to the docs. Does this look correct? (yes, it works)
docker run -d -v $PWD:/home/jovyan/work -e GRANT_SUDO=yes --user root -p 8888:8888 jupyter/all-spark-notebookNot sure why anyone would want to do this, but if you want to run a shell in the container as jovyan instead of root and use sudo when needed:
docker exec --user jovyan -it _container_id_ bash