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
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/
At the very least
apt-get
should be available.I ended up just doing
apt-get install nano
.If the change is small,
sed
might be an option. For instance,will change all occurences of
foo
bybar
. 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