1. The problem I’m having:
Can’t mount Caddyfile when using docker context. However, once I move the compose file over to the remote machine (along with the relevant files) it works fine.
steps to reproduce
docker context create <NAME> --docker "host=ssh://<HOST>"
docker context use <NAME>
docker compose up -d
2. Error messages and/or full log output:
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during con
tainer init: error mounting "/home/user/Code/homelab-setup/caddy/config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": create mountpoint for /etc/caddy/Caddyfile mount: cannot create subdi
rectories in "/var/lib/docker/overlay2/bb5c9bfc60c81ef1606663b988c2901c3b3f25ce7e62366dafd8451646aa9631/merged/etc/caddy/Caddyfile": not a directory: Are you trying to mount a directory onto
a file (or vice-versa)? Check if the specified host path exists and is the expected type
3. Caddy version:
command output
docker image ls
caddy latest 14300de7e087 3 weeks ago 50.5MB
docker compose exec -it caddy caddy version
v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=
4. How I installed and ran Caddy:
docker compose
a. System environment:
Docker with compose
b. Command:
docker compose up -d
c. Service/unit/compose file:
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./caddy/config/Caddyfile:/etc/caddy/Caddyfile
# - ./caddy/config/http.Caddyfile:/config/http.Caddyfile
# - ./.Caddyfile.txt:/opt/caddy/Caddyfile:ro
# - ./caddy/config:/etc/caddy
# - ./caddy/config/Caddyfile:/etc/caddy/Caddyfile:ro
- ./caddy/certs:/certs:ro
- caddy_data:/data
# command: /usr/bin/caddy run --config /config/http.Caddyfile
d. My complete Caddy config:
This is just temporary for testing purposes
* {
respond "Hello World!"
}