How to edit file after I shell to a docker container?

0 votes

I successfully shelled to a docker container using

docker exec -i -t 69f1711a205e bash

Now I need to edit file and I don't have any editors inside

root@69f1711a205e:/# nano
bash: nano: command not found
root@69f1711a205e:/# pico
bash: pico: command not found
root@69f1711a205e:/# vi
bash: vi: command not found
root@69f1711a205e:/# vim
bash: vim: command not found
root@69f1711a205e:/# emacs
bash: emacs: command not found
root@69f1711a205e:/#

How to edit files?

Jul 25, 2018 in Docker by Hannah
• 14,090 points
2,796 views
If not found, install them

2 answers to this question.

0 votes

$EDITOR env variable is empty. You can login into container with:

docker exec -it <container> bash

and run:

apt-get update
apt-get install vim
answered Jul 25, 2018 by Kalgi
• 40,540 points
0 votes

You can even install it using a Dockerfile:

FROM  confluent/postgres-bw:0.1
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "vim"]
answered Apr 23 by Ashish

Related Questions In Docker

0 votes
1 answer

How do I copy a file from docker container to host?

Here is a way which you can ...READ MORE

answered Aug 27, 2018 in Docker by Damon Salvatore
• 5,510 points
2,536 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 9,530 points
328 views
0 votes
2 answers

How to execute docker exec commande inside a docker container ?

You need to get inside the container ...READ MORE

answered Aug 13 in Docker by Sirajul
• 26,400 points
283 views
0 votes
1 answer

How to continue running a docker container which is already exited?

Restart an existing container after you exited ...READ MORE

answered Jul 19, 2018 in Docker by Sophie may
• 9,530 points
97 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,540 points
162 views
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,110 points

edited Oct 16, 2018 by lina 4,337 views
+1 vote
11 answers