How to docker custom config.production.json

So I have a custom config.production.json that I want to load in my docker container every time the docker container restarts / updates and changes the file.

Right now I’m manually changing the file everytime it gets changed, but sometimes I won’t notice and would rather that the file is overwritten by my local file.
Unfortunately a volume seems not to be possible as it points to the content folder.

So how can I do this?
I found this link, but didn’t quite understand if this is what I’m looking for:

Try a bind mount.

1 Like

Alright thank you got it to work.
For those looking for a solution for docker-compose, add the following under volumes:

    volumes:
      - type: bind
        source: /home/ubuntu/docker/ghost-mindglowing/config/config.production.json
        target: /var/lib/ghost/config.production.json
1 Like

Depending on what config changes you’re trying to make, you can usually provide these as environment variables - e.g. url=http://ghost.local:2368 - Configuration - Adapt your publication to suit your needs

1 Like

Related question - do we really need these static config files? Can’t we get ghost all of the env it needs using docker-compose instead of config.development.json? If so, then how?

I’m guessing that’s not possible since I’m using a custom Portal url.

The portal url comes from the environment, so you should be able to do portal__url=xxx portal__version=yyy

@GhostDog most if not all config options can come from env vars. I’m not sure if the config file has to exist, but if it does, it can be an empty json object ({})

Using the official ghost 4x docker image, I feed it zero config files and do everything via the docker environment parameters. I see in the ghost docker container, those ghost config files are still there but their parameters dont seem to take effect - they seem overruled by the docker environment. I hope this will continue to work this way. I didn’t create an empty json object.
Thanks.

As a reminder, there is no “official” docker image from the Ghost organization - Docker maintains the image that most people use :slightly_smiling_face:

Well that doesn’t inspire confidence. A lot of security exploits in Docker Hub. Docker is the only image of Ghost as I understand it. The other installation methods do not use images.