So I’m new to Docker. I’ve figured out how to create containers and how to create images, but I’ve been reading that I should be using Docker files. So far though, I haven’t really been able to figure out why.
I get the theoretical advantage: You have a list of commands that you can review and edit at any time, making it very clear how the container has been created (as long as I’m correct that you actually use Docker files to create containers), but in practice, I’m just not getting it.
Let’s use an example: I want to have a Docker container running Apache (httpd), nothing else, at least not that I’ve thought of so far. If I’m not mistaken, the Docker file for this container would contain just one line:
FROM httpd:latest. I don’t quite see how that’s different from just typing
run ... httpd:latest on the CLI. I’m guessing it’s not different?
So when should I use a Docker file? Is it only really useful for a setup where I’d want (for example) Apache, NodeJS and an MQTT broker in the same container? I guess there’s no pre-existing image that would create such a container, so a Docker file would then be a consistent way of creating that image in exactly the same way every time?