Skip to content

Ghost will not read custom theme in content/themes. #436

Closed

Description

@broccolihighkicks
docker run \
--platform=linux/arm64 \
--name ghost-01 \
-e NODE_ENV=development \
-p 127.0.0.1:2368:2368 \
-v "$(pwd)/vol/content:/var/lib/ghost/content" \
-v "$(pwd)/vol/config.development.json:/var/lib/ghost/config.development.json" \
-e server__host=0.0.0.0 \
ghost:5.116.2

I am using this to run a Ghost instance, and inside $(pwd)/vol/content/themes/starter on my macOS host I have the starter theme:

https://github.com/TryGhost/Starter

It is checked out from that git repo, npm installed, and npm run build has been run.

I restart the container, and the theme files are in the folder and readable from the container.

But the Ghost UI (Settings -> Themes -> Installed) does not show it.

I have also tried changing all the permissions of the files to chmod 777 and also changed them to be owned by node.

Is this the correct way to enable a custom theme with the docker container?

Activity

  1. tianon commented on Apr 21, 2025

    @tianon
    Contributor

    I have to admit that my experience with Themes in Ghost is extremely limited -- from https://ghost.org/help/installing-a-theme/#installing-a-theme-manually, it seems possible that Ghost does not auto-discover themes in that directory and that more is required for it to pick them up, but perhaps that's inaccurate and something else is happening here? 🤔

  2. tianon commented on Apr 21, 2025

    @tianon
    Contributor

    Ok, it took a lot of tries, and I got lost in some Ghost-specific details along the way, but the end result was success.

    I'm running https://github.com/tianon/rawdns locally (which is why I'm using url=http://ghost.docker:2368), I don't have a mail server (hence mail__transport=stub), and I don't want to set up a separate database just for testing (hence database__ stuff):

    $ # I start with `bash` instead of letting Ghost start since we need to restart Ghost after installing a theme and that was easier for me than doing this correctly with a volume, etc
    $ docker run -it --rm --name ghost --pull=always --env database__client=sqlite3 --env database__connection__filename=content/data/ghost-non-production.db --env database__useNullAsDefault=true --env url=http://ghost.docker:2368 --env NODE_ENV=development --env mail__transport=stub ghost bash
    root@96b1971bde38:/var/lib/ghost# # I started with "apt-get update" and "apt-get install git" so I can just "git clone" the theme later
    root@96b1971bde38:/var/lib/ghost# apt-get update
    root@96b1971bde38:/var/lib/ghost# apt-get install git
    root@96b1971bde38:/var/lib/ghost# # switch to the "node" user -- I should've used "--user node" instead but this is easy enough
    root@96b1971bde38:/var/lib/ghost# gosu node bash
    node@96b1971bde38:/var/lib/ghost$ # initialize all the content directories
    node@96b1971bde38:/var/lib/ghost$ docker-entrypoint.sh node current/index.js
    ...
    Ctrl+C
    node@96b1971bde38:/var/lib/ghost$ git clone https://github.com/TryGhost/Starter.git content/themes/starter
    node@96b1971bde38:/var/lib/ghost$ cd content/themes/starter/
    node@96b1971bde38:/var/lib/ghost/content/themes/starter$ npm install
    ...
    added 435 packages, and audited 436 packages in 4s
    ...
    node@96b1971bde38:/var/lib/ghost/content/themes/starter$ cd /var/lib/ghost/
    node@96b1971bde38:/var/lib/ghost$ docker-entrypoint.sh node current/index.js
    ...

    Now I was able to go in my browser to http://ghost.docker:2368/ghost/#/settings/design/change-theme and after setting things up I was able to successfully swap to my "Starter" theme.

  3. locked and limited conversation to collaborators on Apr 21, 2025
  4. converted this issue into a discussion #437 on Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions