Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build caddy-docke-proxy/[email protected] on custom caddy docker build #694

Open
Rizary opened this issue Jan 27, 2025 · 7 comments

Comments

@Rizary
Copy link

Rizary commented Jan 27, 2025

Here's the error:

152.0 # github.com/lucaslorentz/caddy-docker-proxy/v2/docker
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client.go:14:51: undefined: types.ContainerListOptions
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client.go:17:35: undefined: types.Info
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client.go:37:80: undefined: types.ContainerListOptions
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client.go:53:64: undefined: types.Info
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client_mock.go:18:29: undefined: types.Info
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client_mock.go:26:74: undefined: types.ContainerListOptions
152.0 /go/pkg/mod/github.com/lucaslorentz/caddy-docker-proxy/[email protected]/docker/client_mock.go:61:58: undefined: types.Info
152.5 2025/01/27 00:18:37 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2025-01-27-0016.414000893
[+] Running 0/17 00:18:37 [FATAL] exit status 1

Here's my custom build:

FROM caddy:builder AS builder
 
RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/v2 \
    --with github.com/mholt/caddy-ratelimit \
    --with github.com/caddy-dns/cloudflare \
    --with github.com/WeidiDeng/caddy-cloudflare-ip \
    --with github.com/porech/caddy-maxmind-geolocation \
    --with github.com/caddyserver/transform-encoder \
    --with github.com/hslatman/caddy-crowdsec-bouncer/http@main \
    --with github.com/hslatman/caddy-crowdsec-bouncer/layer4@main \
    --with github.com/mholt/caddy-l4
 
FROM caddy:latest
 
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

when I remove the caddy-docker-proxy, everything is good. Last time I use 2.8.4 is working fine. Buti when I upgrade to 2.9.1, i got this error. I use every image tag (builder, builder-alpine, 2.9.1-builder, etc) on docker hub and the result was the same.

@Rizary Rizary closed this as completed Jan 27, 2025
@Rizary
Copy link
Author

Rizary commented Jan 27, 2025

false alarm

@LeVraiRoiDHyrule
Copy link

false alarm

I am having exactly the same error, I too am trying to install docker proxy + crowdsec bouncer modules. Can you tell how you fixed it ?

@mihakrumpestar
Copy link

I am getting the same error.

Using:

RUN xcaddy build \
    --with github.com/yroc92/postgres-storage \
    --with github.com/caddy-dns/desec \
    --with github.com/lucaslorentz/caddy-docker-proxy/v2 \
    --with github.com/sablierapp/sablier/plugins/caddy=/sablier/plugins/caddy \
    --with github.com/fabriziosalmi/caddy-waf=/caddy-waf \
    --with github.com/hslatman/caddy-crowdsec-bouncer/http

@Rizary
Copy link
Author

Rizary commented Jan 31, 2025

false alarm

I am having exactly the same error, I too am trying to install docker proxy + crowdsec bouncer modules. Can you tell how you fixed it ?

You can see it in my PR #696

@jpbaril
Copy link

jpbaril commented Feb 9, 2025

I'm puzzled. The above PR has been merged into main yet I still have that exact same error message when I try to create my custom image.

My Dockerfile is almost identical:

FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/v2 \
    --with github.com/hslatman/caddy-crowdsec-bouncer/http \
    --with github.com/sablierapp/sablier/plugins/caddy \
    --with github.com/caddy-dns/cloudflare

FROM caddy:latest

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

CMD ["caddy", "docker-proxy"]

So, what's wrong and how can I diagnose in more details?

@jpbaril
Copy link

jpbaril commented Feb 9, 2025

Replying to myself.
It looks like the default behavior of the build process is not to use the latest code (commit) of the main branch but rather to use the code of the last officially released version, so 2.9.1, which released back in June 2024. Well, that's logical but I did not know that.
So to get the corrective code of last week's PR I had to specify the commit hash of that commit I wanted to include.
--with github.com/lucaslorentz/caddy-docker-proxy/v2@7c489f0e193efaf57aaaed07da9cc713c55054d1

@mihakrumpestar
Copy link

Could we then make a new release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants