Ghost docker exit with error

I am running a test environment Ubunthu (AWS lightsail).

I have a docker-compose ghost + caddy + PostgreSQL
docker-compose.yml

ghost:
image: ghost:latest
container_name: ghost
networks:

  • ghost-network
    volumes:
  • ghost-data:/var/lib/ghost/content
    environment:
    url: http://xyz.co/blog
    database__client: pg
    database__connection__host: postgres
    database__connection__user: ghost
    database__connection__password: ghost_password
    database__connection__database: ghost_db
    command: sh -c “npm install pg && npm install && npm start”

here is what I see in log files?

sudo docker-compose logs ghost
Attaching to ghost
ghost |
ghost | added 14 packages in 2s
ghost |
ghost | up to date, audited 15 packages in 674ms
ghost |
ghost | found 0 vulnerabilities
ghost | npm error Missing script: “start”
ghost | npm error
ghost | npm error Did you mean one of these?
ghost | npm error npm star # Mark your favorite packages
ghost | npm error npm stars # View packages marked as favorites
ghost | npm error
ghost | npm error To see a list of scripts, run:
ghost | npm error npm run
ghost |
ghost | npm error A complete log of this run can be found in: /root/.npm/_logs/2024-05-26T12_38_58_301Z-debug-0.log
u

please advise how to fix the issue?

Thanks

Postgres is not support. The only supported database is MySQL 8:

Also, Ghost does not have a start script defined in the package.json. This line…

…confirms that.

What you posted does not look like a full docker compose file. We will need that to properly help you debug this.

However, why invent the wheel? There are plenty of working docker compose files out there. For example, this one:

It also uses Caddy – so, all the boxes checked for you.

Great @jannis.
Thank you for the fast response, I will try the docker-compose you’ve suggested.