FYI: Some of the stuff you described above is done in phusion/baseimage (based on the official Ubuntu image), e.g. providing a proper init(-like) system incl. cron etc. You might want to check this out.
Without having analyzed the Docker file in detail, I suppose many of the “powerful” features you need can be done by copying a script into the image and executing it on every docker run
, doing some checks if bootstrapping is needed and just going ahead and run the app if everything is set up. This will incure a cost on every launch of the container but that should not happen too often.
The bootstrap process would detect if the container has not been set up yet (i.e. default / missing config files) and immediately shutdown the container in that case. The “proper” config can then be loaded into the container via volumes or a custom, user-generated Dockerfile (based on the discourse image) so deployments are easier and do not require packaging and shipping a full image.
Some of the preliminary checks (like for system ressources) can still be performed within the launcher
script (or moved to the bootstrap process within the container, I don’t see a problem with that) – disk size checks are IMHO unnecessary (at least before launching the container) since docker would complain if there is not enough disk space to download the image itself. But I would move most of the other checks into the container and have the launcher
script be a simple entry point for beginners or lazies (like myself).