docker-library / ghost

Docker Official Image packaging for Ghost
https://hub.docker.com/_/ghost
MIT License
720 stars 311 forks source link

find: /var/lib/ghost/content/themes/source: No such file or directory #395

Closed ipari closed 10 months ago

ipari commented 10 months ago

The ghost container's status remains "Restarting" after docker-compose up -d When I checked the log, I saw the following:

2023-10-22 02:07:10 find: /var/lib/ghost/content/themes/source: No such file or directory
2023-10-22 02:07:10 find: /var/lib/ghost/content/themes/casper: No such file or directory

How can I solve this?

LaurentGoderre commented 10 months ago

Can you share your docker compose file? I ran the docker-compose from the readme and didn't get any errors.

ipari commented 10 months ago

@LaurentGoderre Thanks for your reply. Here is my docker-compose.yml

version: '3'
services:
    blog:
        image: ghost:5
        restart: always
        ports:
            - 5004:2368
        environment:
            database__client: ${GHOST_DB_CLIENT}
            database__connection__host: ${GHOST_DB_HOST}
            database__connection__user: ${MYSQL_USER}
            database__connection__password: ${MYSQL_PASSWORD}
            database__connection__database: ${MYSQL_DATABASE}
            url: ${GHOST_URL}
        volumes:
            - .content:/var/lib/ghost/content
    db:
        image: mysql:8
        restart: always
        ports:
            - 5005:3306
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
        volumes:
            - .db:/var/lib/mysql
LaurentGoderre commented 10 months ago

Do you have a themes folder in your host content folder?

ipari commented 10 months ago

There is nothing in content folder

LaurentGoderre commented 10 months ago

Btw, these lines:

database__client: ${GHOST_DB_CLIENT}
database__connection__host: ${GHOST_DB_HOST}

Should be:

database__client: mysql
database__connection__host: db
LaurentGoderre commented 10 months ago

The issue is that when the content folder doesn't have themes, it tries to copy some of the base content and symlink from the current theme.

Screenshot 2023-10-30 at 12 07 16 PM

If you want to volume mount but have nothing to start with you can run this before you start your compose

docker cp $(docker create --name temp-copy ghost:5)://var/lib/ghost/current/content/. .content/ && docker rm temp-copy
ipari commented 10 months ago

OMG it finally works! Thank you 🤩🤩