Is there a sneaky way to run a command before the entrypoint (in a k8s deployment manifest) without having to modify the dockerfile/image?

9/20/2019

This is the dockerfile for the image im working with: https://github.com/runatlantis/atlantis/blob/master/Dockerfile

I want to install a utility in that image, but I don't want to have to keep my own dockerfile and image. If I can just add a command to the existing image it means I don't have to maintain my own copy and I'd get upstream changes, etc. (If I was making considerable changes I'd make my own copy but I was wondering if it is possible to sneak in a command.)

I'm deploying this with k8s.

Is there a way I can run an additional command in the entrypoint? For example this is the current entrypoint:

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server"]

I'd like to do something like this in my deployment manifest:

command: ["go get -u github.com/dmlittle/scenery && docker-entrypoint.sh"]
args: ["server"]

I don't believe the above will work correctly. Is there a supported way or an actual k8s feature to do this?

-- red888
docker
dockerfile
kubernetes

0 Answers