Not able to install octave while creating docker

I get below error when i try to install octave in docker. How to resolve this and install octave? Pls let me know.

Step 8/18 : RUN apt install octave
—> Running in ee2ef8b179c2

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
The command ‘/bin/sh -c apt install octave’ returned a non-zero code: 100

The message says it all:
are you root?

I am not root. But should not I be root, when I am creating my own container.

If I am not root, how can I create a container with required linux packages?

Then you’ll have to add sudo in front of the apt command in the dockerfile. Though I’m still puzzled what this has to do with the nvidia linux driver.