How should an official Docker image work?

Well, we choose the standard plugins carefully so as to serve the widest number of users (predicted) without bloating the code base or introducing a maintenance burden. It’s a delicate balance.

It’s tricky to get statistics on how many users have Caddy with add-ons or without, but the new build server in the future will give us a better idea.

Anyway, the 6 or so Docker images that are already produced are split about 50/50. 3 of them do not include add-ons, 3 of them do. Of the 3 which do, 2 of them only include the git add-on, and 1 of them includes all of them (but goes out of date very easily).

If there is to be an “official” image, it probably should be without any third-party add-ons; just Caddy core and its standard plugins.

@andrewhamon suggested something really cool: ONBUILD.

ONBUILD would allow us to create a base Caddy image that would include everything needed to build Caddy+plugins. Then a consumer would make a new Dockerfile to use it like this:

FROM caddy/caddy:base

ENV PLUGINS git,hugo

// Entrypoint & CMD

That way users get to easily choose their plugins without having to wait for compilation whenever they run the image.

Actually, NGINX recently added support for dynamic modules in 1.9.11 so now, at least for some third-party and native modules, you don’t have to recompile NGINX to add new features.

That’s cool! Probably is really nice for people who use Nginx, as it compiles pretty slowly.

I’ve realized an image that builds when run wouldn’t work well at all. I find myself recreating containers all the time with docker-compose, so fast startup time is a must.

2 Likes

I think it would look more like:

# Dockerfile
FROM caddy/caddy:onbuild
# Nothing else in this file

And then the user would have to have a file called plugins in the same directory, that the onbuild directives would derive the requisite information from. This is more or less how the Rails onbuild image works.

git,hugo

I’ll try and whip up a proof of concept this weekend. :slight_smile:

That sounds awesome!

Although I disagree about having a file just to contain plugin names. It’s simpler to just use ENV since all we need is a short comma delimited list.

It would be ideal to do it your way, what I’m saying is I’m pretty sure it won’t work. All of the onbuild instructions would happen before ENV PLUGINS git,hugo was set properly.

Oh my bad, I didn’t realize that.
I’d call it Pluginfile or Pluginsfile to keep the naming consistent.

Any updates? A official image would add a lot of credibility / trust.

Have you seen Docker Hub ?
abiosoft is the #2 contributor to Caddy. I’d say that’s as close to official as needed.

Absolutely, I think Abiosoft’s container is basically official at this stage.

But one day I’d like to see Docker Hub.