5

Any ideas?

This service was starting before but now I get this '/etc/Caddyfile: is a directory' message and the service Exits.

$ docker-compose -f docker-compose-linux.yml up caddy
Starting server_applications_1 ... done
server_workspace_1 is up-to-date
server_php-fpm_1 is up-to-date
Starting server_caddy_1        ... done
Attaching to server_caddy_1
caddy_1         | http plugins loaded: git
caddy_1         | 2020/06/22 06:22:18 loading Caddyfile via flag: read /etc/Caddyfile: is a directory
server_caddy_1 exited with code 1

the caddy service dockerfile:

FROM zuohuadong/caddy:alpine
MAINTAINER Huadong Zuo <admin@zuohuadong.cn>
ARG plugins="cors"
WORKDIR /var/www/platform/public
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]

the Caddy service container yml: where CADDY_CUSTOM_CADDYFILE=./caddy/Caddyfile

      volumes:
        - ${CADDY_CUSTOM_CADDYFILE}:/etc/Caddyfile

and the Caddyfile is there in the right directory

...server/caddy$ ll
total 16
drwxrwxr-x  2 ubuntu ubuntu 4096 Jun 22 17:44 ./
drwxrwxr-x 11 ubuntu ubuntu 4096 Jun 22 15:55 ../
-rw-r--r--  1 ubuntu ubuntu 1452 Jun 11 10:54 Caddyfile
-rw-r--r--  1 ubuntu ubuntu  268 Jun 22 18:13 Dockerfile

$ docker-compose -f docker-compose-linux.yml up caddy

Starting server_applications_1 ... done server_workspace_1 is up-to-date server_php-fpm_1 is up-to-date Starting server_caddy_1 ... done Attaching to server_caddy_1 caddy_1 | http plugins loaded: git caddy_1 | 2020/06/22 06:22:18 loading Caddyfile via flag: read /etc/Caddyfile: is a directory server_caddy_1 exited with code 1

Simon P
  • 337
  • 3
  • 8
  • Most often when docker creates a directory, it's the source file that's just missing. I'd replace the variable in your volume definition by an absolute path and try again then. Also take care about file ownership and permissions. If I understand correctly you are executing this as user ubuntu? – olidem Jun 22 '20 at 08:12

1 Answers1

0

Can you try to mount directory instead of file in your docker compose.

      volumes:
        - ${CADDY_CUSTOM_CADDYFILE}:/etc

where CADDY_CUSTOM_CADDYFILE=full_Path_to/caddy/

you will still be able to use

CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]
Taybur Rahman
  • 1,347
  • 8
  • 20
  • thanks. tried that. same result: the docker-compose config reports: – Simon P Jun 22 '20 at 22:03
  • thanks. I did that. and removed and rebuilt. curiously it doesn't seem to respect the yml/env: docker-compose config: ... caddy: context: /home/ubuntu/Development/platform/server/caddy - /home/ubuntu/Development/platform/server/caddy:/etc/Caddyfile:rw - /home/ubuntu/.laradock/data:/root/.caddy:rw – Simon P Jun 22 '20 at 22:09
  • also tried normal style file name:volumes: docker-compose config - /home/ubuntu/Development/platform/server/caddy/caddyfile.txt:/etc/caddyfile.txt:rw – Simon P Jun 23 '20 at 03:07
  • still same error: caddy_1 | 2020/06/23 02:51:40 loading Caddyfile via flag: read /etc/caddyfile.txt: is a directory – Simon P Jun 23 '20 at 03:08