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
• 18,520 points
17,843 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
• 52,350 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, 2019 by Ashish

Related Questions In Docker

+1 vote
2 answers

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

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

answered Aug 28, 2018 in Docker by Damon Salvatore
• 5,980 points
28,576 views
0 votes
1 answer

How can I connect a docker container to two docker networks that I have created?

Hi@akhtar, It's correct that the network argument of ...READ MORE

answered Mar 23, 2020 in Docker by MD
• 95,460 points
10,844 views
0 votes
1 answer

How to get into a Docker container shell?

Hi@akhtar, The docker exec command is probably what you are ...READ MORE

answered Sep 28, 2020 in Docker by MD
• 95,460 points
595 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
• 10,620 points
3,517 views
+2 votes
1 answer
+2 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
• 58,020 points
2,714 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,220 points

edited Oct 16, 2018 by lina 34,134 views
+15 votes
19 answers

How can I run a ‘docker exec’ command inside a docker container?

you can run any command in a ...READ MORE

answered Dec 10, 2018 in Docker by Pramiti
1,229,556 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP