Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install vim or nano inside docker container

Trying to install inside a docker, either vim or nano but I only get this:

0% [Connecting to archive.ubuntu.com (91.189.88.152)] 

Exit docker and do ping archive.ubuntu.com and I get reply, do the same time inside docker it does not respond.

What could be the problem?

like image 393
quarks Avatar asked May 11 '16 07:05

quarks


People also ask

Can I SSH into a container?

The SSH method works fine for Docker containers, too. That said, you can SSH into a Docker container using Docker's built-in docker exec . If you do not need an interactive shell, you can also use the docker attach command to connect the host's stdin and stdout to the running container and execute remote commands.

Can I install Docker inside a container?

Yes, we can run docker in docker, we'll need to attach the unix socket /var/run/docker. sock on which the docker daemon listens by default as volume to the parent docker using -v /var/run/docker. sock:/var/run/docker.

Does Docker have vim?

It's almost certain that the Linux distribution you are running in a Docker container doesn't have Vim or any other text editor installed by default. And then use the package manager of the distribution to install it. It should allow you to run and use Vim in the currently running container.


1 Answers

First I create the docker:

sudo docker run -t -i ubuntu /bin/bash 

Instead of this you can enter in a running docker with his number or name:

sudo docker exec -it be8aa338d656 bash 

Then inside the docker run this code:

apt-get update apt-get install vim nano 
like image 168
Troncador Avatar answered Oct 04 '22 14:10

Troncador