How to use pluggins with docker?

Hello.

I already wrote about my problem that my LetsEncrypt limit is used, and I’m now trying to use TLS Cloudflare.

This is my Caddyfile:

www.{$DOMAIN_NAME} {
    redir https://domain.com
}

{$DOMAIN_NAME} {
    proxy / myapp:5000 {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Proto {scheme}
    }
    tls {
    	dns cloudflare
	}
    log stdout
    errors stdout
    gzip
}

But, if I run docker-compose -f production.yml up --build, got error:

caddy_1 | 2018/01/15 13:59:07 /etc/Caddyfile:12 - Parse error: Unsupported DNS provider ‘cloudflare’

In the Dockerfile I added:

ARG plugins="git, cloudflare"

And now it looks like this:

FROM abiosoft/caddy:0.10.6
ARG plugins="git, cloudflare"
COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile

But I keep getting the same mistake.
What am I doing wrong?

Based on the example from the Docker Hub page, I’m guessing the space in the middle of the variable is the problem. Try just comma-delimited, rather than comma-space-delimited.

From Docker Hub

docker build --build-arg \
    plugins=filemanager,git,linode \
    github.com/abiosoft/caddy-docker.git

I saw your example, but I do not understand how to use it in my case.
I’m using docker-compose, and I’m not writing the docker build command.

I gave an example of Dockerfile

And here is part of my production.yml file:

  caddy:
    build:
      context: .
      dockerfile: ./compose/production/caddy/Dockerfile
    depends_on:
      - myapp
    volumes:
      - caddy:/root/.caddy
    env_file: .env
    ports:
      - "0.0.0.0:80:80"
      - "0.0.0.0:443:443"

The example I provided wasn’t for use, it was for comparison. Specifically, note the format of the arg from the example I linked to:

filemanager,git,linode

Now compare with the example you provided:

git, cloudflare

Which led to the suggestion that perhaps you should try without a space:

No changes occurred, and still I get the error “Parse error: Unsupported DNS provider 'cloudflare'”, regardless of whether a space is used after the comma.

Hmm. Did you do another docker build after making changes?

If you want to select plugins in your Dockerfile, you need to use abiosoft/caddy:builder in a multi-stage build. Pulling from abiosoft/caddy does not recompile Caddy.

The other option you have is to specify the git repo as the build context like it is done here.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.