admin管理员组

文章数量:1399971

localhost {
        root * /testDir
        file_server
        reverse_proxy /api/* localhost:3000
}
// And dockerfile
FROM caddy:2.7.6-alpine

EXPOSE 80

EXPOSE 443

COPY Caddyfile /etc/caddy/Caddyfile

COPY testDir /testDir

CMD ["caddy", "run"]

Checked 10 times and yes the Caddyfile is in the container in the path and yes, testDir is also there.

And of course, I build it with:

docker build -t testcaddy .

and run it with:

docker run -p 80:80 -p 443:443 -d testcaddy

And nothing happens when I type localhost in browser I get:

The site can't be reached.

localhost {
        root * /testDir
        file_server
        reverse_proxy /api/* localhost:3000
}
// And dockerfile
FROM caddy:2.7.6-alpine

EXPOSE 80

EXPOSE 443

COPY Caddyfile /etc/caddy/Caddyfile

COPY testDir /testDir

CMD ["caddy", "run"]

Checked 10 times and yes the Caddyfile is in the container in the path and yes, testDir is also there.

And of course, I build it with:

docker build -t testcaddy .

and run it with:

docker run -p 80:80 -p 443:443 -d testcaddy

And nothing happens when I type localhost in browser I get:

The site can't be reached.

Share Improve this question edited Mar 25 at 18:24 CupOfGreenTea asked Mar 25 at 18:04 CupOfGreenTeaCupOfGreenTea 4271 gold badge5 silver badges17 bronze badges 1
  • What does "nothing happens" mean? Use "curl -v" and post the output. – Hamish Moffatt Commented Mar 25 at 18:45
Add a comment  | 

1 Answer 1

Reset to default 1

You have to give caddy a config file to use:

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

or load it using HTTP: https://caddyserver/docs/getting-started

本文标签: dockerWhy does this simple Dockerfile fail for Caddy containerStack Overflow