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

Issue while installing caddy #2241

Closed
jacoboospina opened this issue Aug 20, 2019 · 6 comments
Closed

Issue while installing caddy #2241

jacoboospina opened this issue Aug 20, 2019 · 6 comments

Comments

@jacoboospina
Copy link

jacoboospina commented Aug 20, 2019

Info:

  • Docker version ($ docker --version): 19.03.1
  • Laradock commit ($ git rev-parse HEAD): 71372ef12bccd4fc9af5175739e84b52aeffd3e9
  • System info (Mac, PC, Linux): PC
  • System info disto/version:

Issue:

It runs step 1,2,3/7, but in step 4 it stops at github.com/go-acme/lego (download) download it seems that it doesnt find the package: package github.com/go-acme/lego/v3/acme: cannot find package "github.com/go-acme/lego/v3/acme" in any of:...


Expected behavior:

Success on step 4 I guess?


Reproduce:

with ./docker-start.sh


Relevant Code:

the log output


$ ./docker-start.sh
Building caddy
Step 1/7 : FROM zuohuadong/caddy:alpine
 ---> 737043e11080
Step 2/7 : LABEL maintainer="Huadong Zuo <admin@zuohuadong.cn>"
 ---> Using cache
 ---> 844a1b76b9e0
Step 3/7 : ARG plugins="cors"
 ---> Using cache
 ---> 717aa7ad9107
Step 4/7 : RUN caddyplug install ${plugins}
 ---> Running in a6b5550ef7ae
installing cors...
github.com/captncraig/cors (download)
github.com/caddyserver/caddy (download)
github.com/google/uuid (download)
github.com/flynn/go-shlex (download)
github.com/mholt/certmagic (download)
github.com/go-acme/lego (download)
Fetching https://golang.org/x/crypto/ocsp?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ocsp?go-get=1 (status code 200)
get "golang.org/x/crypto/ocsp": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ocsp?go-get=1
get "golang.org/x/crypto/ocsp": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
golang.org/x/crypto (download)
package github.com/go-acme/lego/v3/acme: cannot find package "github.com/go-acme/lego/v3/acme" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/acme (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/acme (from $GOPATH)
package github.com/go-acme/lego/v3/acme/api: cannot find package "github.com/go-acme/lego/v3/acme/api" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/acme/api (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/acme/api (from $GOPATH)
package github.com/go-acme/lego/v3/certcrypto: cannot find package "github.com/go-acme/lego/v3/certcrypto" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/certcrypto (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/certcrypto (from $GOPATH)
package github.com/go-acme/lego/v3/challenge: cannot find package "github.com/go-acme/lego/v3/challenge" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/challenge (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/challenge (from $GOPATH)
package github.com/go-acme/lego/v3/log: cannot find package "github.com/go-acme/lego/v3/log" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/log (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/log (from $GOPATH)
package github.com/go-acme/lego/v3/platform/wait: cannot find package "github.com/go-acme/lego/v3/platform/wait" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/platform/wait (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/platform/wait (from $GOPATH)
Fetching https://golang.org/x/net/idna?go-get=1
Parsing meta tags from https://golang.org/x/net/idna?go-get=1 (status code 200)
get "golang.org/x/net/idna": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/idna?go-get=1
get "golang.org/x/net/idna": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
Fetching https://golang.org/x/text/secure/bidirule?go-get=1
Parsing meta tags from https://golang.org/x/text/secure/bidirule?go-get=1 (status code 200)
get "golang.org/x/text/secure/bidirule": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/secure/bidirule?go-get=1
get "golang.org/x/text/secure/bidirule": verifying non-authoritative meta tag
Fetching https://golang.org/x/text?go-get=1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
golang.org/x/text (download)
Fetching https://golang.org/x/text/unicode/bidi?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/bidi?go-get=1 (status code 200)
get "golang.org/x/text/unicode/bidi": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/bidi?go-get=1
get "golang.org/x/text/unicode/bidi": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/unicode/norm?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/norm?go-get=1 (status code 200)
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
package github.com/go-acme/lego/v3/certificate: cannot find package "github.com/go-acme/lego/v3/certificate" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/certificate (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/certificate (from $GOPATH)
package github.com/go-acme/lego/v3/challenge/resolver: cannot find package "github.com/go-acme/lego/v3/challenge/resolver" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/challenge/resolver (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/challenge/resolver (from $GOPATH)
package github.com/go-acme/lego/v3/registration: cannot find package "github.com/go-acme/lego/v3/registration" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/registration (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/registration (from $GOPATH)
github.com/klauspost/cpuid (download)
github.com/hashicorp/go-syslog (download)
github.com/lucas-clemente/quic-go (download)
package github.com/lucas-clemente/quic-go/h2quic: cannot find package "github.com/lucas-clemente/quic-go/h2quic" in any of:
        /usr/local/go/src/github.com/lucas-clemente/quic-go/h2quic (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/lucas-clemente/quic-go/h2quic (from $GOPATH)
github.com/russross/blackfriday (download)
Fetching https://gopkg.in/natefinch/lumberjack.v2?go-get=1
Parsing meta tags from https://gopkg.in/natefinch/lumberjack.v2?go-get=1 (status code 200)
get "gopkg.in/natefinch/lumberjack.v2": found meta tag get.metaImport{Prefix:"gopkg.in/natefinch/lumberjack.v2", VCS:"git", RepoRoot:"https://gopkg.in/natefinch/lumberjack.v2"} at https://gopkg.in/natefinch/lumberjack.v2?go-get=1
gopkg.in/natefinch/lumberjack.v2 (download)
exit status 1
 ✗ cors
ERROR: Service 'caddy' failed to build: The command '/bin/sh -c caddyplug install ${plugins}' returned a non-zero code: 1
@ahkui
Copy link
Contributor

ahkui commented Aug 20, 2019

Hi @jacoboospina

because the base image is outdated

You can update your Dockerfile to latest version if you not required to install plugin

@jacoboospina
Copy link
Author

Hello... @ahkui
so you mean my caddy->Dockerfile is outdated? Should I replace with the code you referenced this issue?

@ahkui
Copy link
Contributor

ahkui commented Aug 21, 2019

Hi @jacoboospina

so you mean my caddy->Dockerfile is outdated? Should I replace with the code you referenced this issue?

If you need install extra plugin then use my reference, otherwise use this

@jacoboospina
Copy link
Author

I only need cors plugin... so this is my Dockerfile:

FROM zuohuadong/caddy:alpine

LABEL maintainer="Huadong Zuo <admin@zuohuadong.cn>"

ARG plugins="cors"

## ARG plugins="cors cgi cloudflare azure linode"


RUN caddyplug install ${plugins}
    

EXPOSE 80 443 2015

WORKDIR /var/www/public

CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile","-agree"]

Still doesnt work I'm having same mistake:

$ docker-compose build caddy
Building caddy
Step 1/7 : FROM zuohuadong/caddy:alpine
 ---> 737043e11080
Step 2/7 : LABEL maintainer="Huadong Zuo <admin@zuohuadong.cn>"
 ---> Using cache
 ---> 03857a4aa5e1
Step 3/7 : ARG plugins="cors"
 ---> Using cache
 ---> e681a094ad8d
Step 4/7 : RUN caddyplug install ${plugins}
 ---> Running in f29655fbce63
installing cors...
github.com/captncraig/cors (download)
github.com/caddyserver/caddy (download)
github.com/google/uuid (download)
github.com/flynn/go-shlex (download)
github.com/mholt/certmagic (download)
github.com/go-acme/lego (download)
Fetching https://golang.org/x/crypto/ocsp?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ocsp?go-get=1 (status code 200)
get "golang.org/x/crypto/ocsp": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ocsp?go-get=1
get "golang.org/x/crypto/ocsp": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
golang.org/x/crypto (download)
package github.com/go-acme/lego/v3/acme: cannot find package "github.com/go-acme/lego/v3/acme" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/acme (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/acme (from $GOPATH)
package github.com/go-acme/lego/v3/acme/api: cannot find package "github.com/go-acme/lego/v3/acme/api" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/acme/api (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/acme/api (from $GOPATH)
package github.com/go-acme/lego/v3/certcrypto: cannot find package "github.com/go-acme/lego/v3/certcrypto" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/certcrypto (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/certcrypto (from $GOPATH)
package github.com/go-acme/lego/v3/challenge: cannot find package "github.com/go-acme/lego/v3/challenge" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/challenge (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/challenge (from $GOPATH)
package github.com/go-acme/lego/v3/log: cannot find package "github.com/go-acme/lego/v3/log" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/log (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/log (from $GOPATH)
package github.com/go-acme/lego/v3/platform/wait: cannot find package "github.com/go-acme/lego/v3/platform/wait" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/platform/wait (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/platform/wait (from $GOPATH)
Fetching https://golang.org/x/net/idna?go-get=1
Parsing meta tags from https://golang.org/x/net/idna?go-get=1 (status code 200)
get "golang.org/x/net/idna": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/idna?go-get=1
get "golang.org/x/net/idna": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
Fetching https://golang.org/x/text/secure/bidirule?go-get=1
Parsing meta tags from https://golang.org/x/text/secure/bidirule?go-get=1 (status code 200)
get "golang.org/x/text/secure/bidirule": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/secure/bidirule?go-get=1
get "golang.org/x/text/secure/bidirule": verifying non-authoritative meta tag
Fetching https://golang.org/x/text?go-get=1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
golang.org/x/text (download)
Fetching https://golang.org/x/text/unicode/bidi?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/bidi?go-get=1 (status code 200)
get "golang.org/x/text/unicode/bidi": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/bidi?go-get=1
get "golang.org/x/text/unicode/bidi": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/unicode/norm?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/norm?go-get=1 (status code 200)
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
package github.com/go-acme/lego/v3/certificate: cannot find package "github.com/go-acme/lego/v3/certificate" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/certificate (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/certificate (from $GOPATH)
package github.com/go-acme/lego/v3/challenge/resolver: cannot find package "github.com/go-acme/lego/v3/challenge/resolver" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/challenge/resolver (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/challenge/resolver (from $GOPATH)
package github.com/go-acme/lego/v3/registration: cannot find package "github.com/go-acme/lego/v3/registration" in any of:
        /usr/local/go/src/github.com/go-acme/lego/v3/registration (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/go-acme/lego/v3/registration (from $GOPATH)
github.com/klauspost/cpuid (download)
github.com/hashicorp/go-syslog (download)
github.com/lucas-clemente/quic-go (download)
package github.com/lucas-clemente/quic-go/h2quic: cannot find package "github.com/lucas-clemente/quic-go/h2quic" in any of:
        /usr/local/go/src/github.com/lucas-clemente/quic-go/h2quic (from $GOROOT)
        /root/lib/caddy/gopath/src/github.com/lucas-clemente/quic-go/h2quic (from $GOPATH)
github.com/russross/blackfriday (download)
Fetching https://gopkg.in/natefinch/lumberjack.v2?go-get=1
Parsing meta tags from https://gopkg.in/natefinch/lumberjack.v2?go-get=1 (status code 200)
get "gopkg.in/natefinch/lumberjack.v2": found meta tag get.metaImport{Prefix:"gopkg.in/natefinch/lumberjack.v2", VCS:"git", RepoRoot:"https://gopkg.in/natefinch/lumberjack.v2"} at https://gopkg.in/natefinch/lumberjack.v2?go-get=1    
gopkg.in/natefinch/lumberjack.v2 (download)
exit status 1
 ✗ cors
ERROR: Service 'caddy' failed to build: The command '/bin/sh -c caddyplug install ${plugins}' returned a non-zero code: 1

@ahkui
Copy link
Contributor

ahkui commented Aug 21, 2019

This base image(zuohuadong/caddy:alpine) outdated, because the author don't have update.

Use this if you need fully customize

#
# Builder
#
FROM abiosoft/caddy:builder as builder

ARG version="1.0.3"
ARG plugins="cors"
# ARG plugins="git,cors,realip,expires,cache,cloudflare"
ARG enable_telemetry="true"

# process wrapper
RUN go get -v github.com/abiosoft/parent

RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh

#
# Final stage
#
FROM alpine:3.10
LABEL maintainer "Abiola Ibrahim <abiola89@gmail.com>"

ARG version="1.0.3"
LABEL caddy_version="$version"

# Telemetry Stats
ENV ENABLE_TELEMETRY="$enable_telemetry"

RUN apk add --no-cache \
    ca-certificates \
    git \
    mailcap \
    openssh-client \
    tzdata

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

# validate install
RUN /usr/bin/caddy -version
RUN /usr/bin/caddy -plugins

RUN mkdir -p /etc/caddy/ && \
    echo "0.0.0.0" >> /etc/caddy/Caddyfile && \
    echo "browse" >> /etc/caddy/Caddyfile && \
    echo "log stdout" >> /etc/caddy/Caddyfile && \
    echo "errors stdout" >> /etc/caddy/Caddyfile && \
    echo "Hi" >> /srv/index.html

EXPOSE 80 443 2015
VOLUME /root/.caddy /srv
WORKDIR /srv

# install process wrapper
COPY --from=builder /go/bin/parent /bin/parent

ENTRYPOINT ["/bin/parent", "caddy"]
CMD ["--conf", "/etc/caddy/Caddyfile", "--log", "stdout", "--agree=true"]

Copy from here and modify

@jacoboospina
Copy link
Author

Thank you, it worked! I'm closing this issue.

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

2 participants