Hi, I would like to run some commands inside a builder to debug the generated Docker image, is it possible?
Not exactly what you are asking for, but may be what you need.
The way I generally debug Dockerfiles is to copy the Dockerfile into a new file (say, Dockerfile.test
), delete the RUN
statement that I want to debug and everything after that, and then run:
fly console --dockerfile Dockerfile.test -C /bin/bash
Then I can run commands, see results. If needed, I can restart at the same point by simply existing and re-running the fly console
command above. Once I get something working, I insert it into the original Dockerfile.
Give it a try with the following Dockerfile.test
:
FROM ubuntu
This is a great tip – this should be more prominently visible to people who are looking to debug (sorry I don’t have an immediate suggestion for where that is)
Thanks! Obviously, I work here, but ephemeral machines are my personal favorite feature of fly.io.
To draw an analogy, my house is well insulated and I have programmable thermostats installed, but I don’t think twice about flipping on a light switch or turning on a faucet. The same thing is true about fly machines - it is prudent to take some care in designing your production app, but launching ephemeral machines with a custom configuration is something I do casually and routinely.