no editor found (editor path = /usr/bin/editor) running visudo

I created a ubuntu docker container and when I try to edit the sudoers file I get the following message.

root@8c8a8ff68234:~# sudo visudo
visudo: no editor found (editor path = /usr/bin/editor)

Create command and run command:-

  • Docker container change behaviour on different hosts
  • Docker how to report phpunit test that run inside container
  • Configuring nginx in a single docker container environment (AWS ElasticBeanstalk)
  • Docker Compose - Image name
  • Mount a Host Directory as a Data Volume in docker?
  • Puppet container wont start automatically
  • docker run -id ubuntu
    docker exec -ti 8c8a8ff68234 /bin/bash

  • SBT: Slow resolution and failures when doing builds within Docker containers
  • How to mimic Travis CI locally?
  • Updating jar in docker image
  • Docker hanging requiring reboot
  • Stopping docker container from inside
  • Exploring Docker container's file system
  • One Solution collect form web for “no editor found (editor path = /usr/bin/editor) running visudo”

    You are already root, so no need to use sudo.

    Also, you have not vim pre-installed in ubuntu base image. So you need to install it with apt-get install vim. Or in Dockerfile:

    RUN apt-get install vim

    That will set the editor properly. To use visudo

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.