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,570 points
17,467 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,360 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,148 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,440 points
9,934 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,440 points
409 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,610 points
3,253 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,090 points
2,435 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 32,900 views
+14 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,225,426 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