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,080 points
1,995 views
If not found, install them

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 36,870 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,470 points
1,127 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,330 points
247 views
0 votes
1 answer

How to execute docker exec commande inside a docker container ?

If your containers are running on the ...READ MORE

answered Jul 19, 2018 in Docker by Kalgi
• 2,620 points
146 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,330 points
55 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,140 points
81 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,100 points

edited Oct 16, 2018 by lina 2,655 views
+2 votes
11 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.