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

How to edit files?

Jul 25, 2018 in Docker by Hannah
• 18,410 points
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
• 51,970 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

0 votes
2 answers

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

Instead of using docker run you could ...READ MORE

answered Aug 13, 2019 in Docker by Sirajul
• 58,210 points
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 in Docker by MD
• 80,590 points
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 27 in Docker by MD
• 80,590 points
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,100 points
+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
• 57,700 points
+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 18,228 views
+3 votes
18 answers