How to Install a Text editor on Docker Container

Almost all docker containers do not have a text editor by default. But most of the time you will need a command line text editor for edit files inside a docker container.

Install Vim on Docker Container

Most docker containers are based on Debian and Ubuntu Linux. So you should able install vim on docker with apt-get command.

apt-get update
apt-get install vim

If the docker container is a redhat based distribution, use the yum install command.

yum install vim

Install nano Text Editor on Docker

On debian based containers, install nano editor with apt-get command.

apt-get update
apt-get install nano

On a Redhat/CentOS based container, Type:

yum install nano

To use the nano text editor you will also need to set 'TERM' environment variable.

export TERM=xterm