Getting to be root in a Ubuntu image in Docker

I am using a Jupyter notebook image from Jupyterhub. The operating system is Ubuntu. I want to make changes in it and install some new software.

This requires the use of sudo and sudo requires a password.

I do not know it.

I know this question has been asked before probably. It is just everytime, I find an answer on the internet its is different from all the other answer that I find.

I am stuck. I need root privileges in Jupyter notebook and I am jovyan, not root.

So what is the secret of getting to be root user? Any help appreciated.

Respectfully,

Lou Reed

Common usecase, wrong approach.

Make yourself aquainted with Dockerfiles, learn how to extend an existing image and how to build a new image based on your Dockerfile. You can switch users in the Dockerfile as required. This is how it is ment do be done.