Vi or Vim not found on Ubuntu docker container
A vi
command that behaves as per the POSIX specification is mandatory for an OS to call itself Unix.
Ubuntu and other Linux-based operating systems are not certified and being certified is not exactly a goal so all they do is follow the specification as closely as they want/need/can. Therefore, it is unreasonable to expect vi to "always be on a linux machine" or that vi
command to be provided by Vim. There is simply no guarantee.
Moreover, it is customary to make Docker images meant for production as lightweight (and secure) as possible by removing as much cruft as possible. You don't need vi
to run your Ingress Controller so it isn't there.
How do I edit a file after I shell to a Docker container?
As in the comments, there's no default editor set - strange - the $EDITOR
environment variable is empty. You can log in into a container with:
docker exec -it <container> bash
And run:
apt-get update
apt-get install vim
Or use the following Dockerfile:
FROM confluent/postgres-bw:0.1
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "vim"]
Docker images are delivered trimmed to the bare minimum - so no editor is installed with the shipped container. That's why there's a need to install it manually.
EDIT
I also encourage you to read my post about the topic.
Unable to install vim or nano inside docker container
The solution is to run docker with:
docker run --net=host
How to install vim in a docker image based on mysql version 8?
If you take a look at the Tag for 8.0 you can see that the base uses a different version of Oracle linux (8 vs 7). Yum is not installed in 8. Instead, there's a minimal installer (microdnf). So this substitution should work for you:
microdnf install -y vim
Install vim in node Docker image
You are only using a single ampersand (&
) in your RUN
directive, which runs a command in the background in bash. Change it to include two ampersands (&&
). Please also notice the -y
(automatic yes to prompts) I have added to the apt-get
statement, without which your docker build
command will fail:
RUN apt-get update && apt-get install -y vim
Related Topics
How to Run a Mips Binary on X86 Platform
Ansible Inside Script Command Not Found
Looking for Files Not Owned by a Specific User
Difference Between Unix Domain Stream and Datagram Sockets
How to Make Vim Play Typewriter Sound When I Write a Letter
How to Check That Two Folders Are the Same in Linux
How to Check Internet Access Using a Bash Script on Linux
Linux Directory Permissions for Different Groups
Linux Makefile Structure and Documentation
Changing Contents of a File Through Shell Script
About Process Control Block in Os
Count the Number of Executable Files in Bash
Check Free Disk Space for Current Partition in Bash
Preserve Colouring After Piping Grep to Grep
How to Extract Files Without Folder Structure Using Tar
Shared Libraries: Windows VS Linux Method
On Linux - Set Maximum Open Files to Unlimited. Possible
Ps Utility in Linux (Procps), How to Check Which CPU Is Used