Cannot pull caddy image?

1. Output of caddy version:

caddy: command not found

2. How I run Caddy:

stack Caddy with ghost in docker compose

a. System environment:

ubuntu 22.04 systems docker engine

b. Command:

docker-compose up -d

c. Service/unit/compose file:

Paste full file contents here.
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:

version: '3.1'

services:

  ghost:
    image: ghost:latest
    restart: always
    ports:
      - 8080:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://localhost:8080
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specifi>
      #NODE_ENV: development

  db:
    image: mysql:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

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:

I cannot pull caddy image.

4. Error messages and/or full log output:

Paste logs/commands/output here.
volume caddy_data declared as external, but could not be found. please create the volume manually using `docker volume create --name=caddy_data` and try again.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

docker volume create --name=caddy_data

6. Links to relevant resources:

Your docker-compose file looks invalid. You can’t have version in there twice, you can’t just paste two docker-compose files one after the other.

And the error it gives you is correct, you need to create the caddy_data volume ahead of time before trying to run it, because it’s declared as external.

2 Likes

I tried to remove ghost version but it won’t work, I thought It could stack up Self Hosting a Ghost blog with docker-compose, Mailgun setup, and Stripe subscriptions
what should I do ??

How do I make my docker-compose not create this external caddy_data?