lucas
lucas

Reputation: 111

Problem using docker, no command works, "sudo". How to solve?

I'm trying to install nano , and when using the apt-get install nano command inside the docker, it asks to use the super user:

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

And when trying to use sudo he says it doesn't exist

bash: sudo: command not found

Upvotes: 0

Views: 972

Answers (3)

GrayMonk
GrayMonk

Reputation: 11

Try this: docker exec -u root -it <your_container_name> bash and then apt-get install nano.

Upvotes: 1

Shaqil Ismail
Shaqil Ismail

Reputation: 1951

For docker you need to test each command as running on the local host machine, you have many tools already installed, and the Docker images you have the minimum required usually, so only what is required is installed, and the docker image size can be small also.

Either have a look at what software is installed on the Docker image already using the command compgen -c and then install the software you would require which is not installed, or run your software and see if you receive errors or software not being found, and then install the software required.

Upvotes: 0

Sergey K.
Sergey K.

Reputation: 111

Most docker containers doesn't provide sudo util. If you need some software in your container you may create your images based on another that you need with installing necessary software by describing in dockerfile. Also you may install sudo in your custom image.

Upvotes: 1

Related Questions