ERROR: for caddy_caddy_1 Cannot start service caddy: failed to create shim task:

1. Output of caddy version:

caddy: command not found

2. How I run Caddy:

docker-compose

a. System environment:

ubuntu 22.04 systems docker engine

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
    external: true
  caddy_config:

Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

Paste your config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.

3. The problem I’m having:

cannot run container, want to run Automatic HTTPS to my domain.

4. Error messages and/or full log output:

Starting caddy_caddy_1 ... error

ERROR: for caddy_caddy_1  Cannot start service caddy: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/chatofking/caddy/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /home/chatofking/caddy/Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: 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

ERROR: for caddy  Cannot start service caddy: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/chatofking/caddy/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /home/chatofking/caddy/Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: 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
ERROR: Encountered errors while bringing up the project.

USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

I dont know how to config caddyfile

6. Links to relevant resources:

Did you read the docs?

You need to have a Caddyfile beside your docker-compose file so that Docker can mount it in the container, so Caddy can actually run.

2 Likes

I got [Error writing Caddyfile: is a directory]

docker-compose might have created a directory called Caddyfile when you first tried to run it. Delete the directory, then create a file instead.

2 Likes

I use localhost in my caddy file
when I try to enter web server
I got this error, is it work correctly ??

This site can’t provide a secure connection

ipv4 sent an invalid response.

  • [Try running Windows Network Diagnostics](javascript:diagnoseErrors()).

ERR_SSL_PROTOCOL_ERROR

Yes, you just need to configure your OS/browser to trust Caddy’s internal CA. See:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.