skip to Main Content

I have a FROM python:3.8-slim-buster Dockerfile and I want to make a small change to the entrypoint.sh file. Unfortunately it seems there are no editors, neither vi or ed. Moreover, it is not possible to do apt-get update 🙁

What is the best way to have at least an editor?

3

Answers


  1. I had the same issue with alpine images.

    I solved the problem using Multi-Stage Builds in the Dockerfile.

    https://docs.docker.com/develop/develop-images/multistage-build/

    Login or Signup to reply.
  2. At the very least apt-get should be available.

    I ended up just doing apt-get install nano.

    Login or Signup to reply.
  3. If the change is small, sed might be an option. For instance,

    sed -i 's/foo/bar/g' myfile
    

    will change all occurences of foo by bar. The -i option means means in-place, so the file will be overwritten.

    Here’s a nice cheatsheet of sed: https://quickref.me/sed.html#sed-examples

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search