How to add custom config to Ghost in Docker

I am trying to setup email but when entering into the docker with docker exec sh the config file does not show the mail options I setup on the .env file.

Where are those settings from the env file stored on docker?

Thanks

Ghost has two ways of accepting configuration. Either through a config.[environment].json or by passing in environment variables.

See:

When running Ghost with the new ghost-docker repository the .env file, you mentioned, is passed in. That’s defined in line 30-31 of the compose file:

What happens: all the environment variables from the .env file are being passed into the Docker container. You can check that by running printenv from within the docker container.

If you want to add configuration into the Docker container, you would just add them as environment variables into the .env and restart the stack.

For environment variables, you just take the keys from the JSON configuration and replace a nested object with two underscores (__).

This:

{
  ...
  "mail": {
    "from": "noreply@example.com"
  }
  ..
}

will become

mail__from: noreply@example.com

in the .env file.

1 Like

Ok, then I am passing them correctly. I imagine the env file will override the default config file.

I am getting errors with the mail, but this could be a different bug then.
I will open another topic with the error to see if someone can help me with that.

I feel the caddy-ghost docker setup is not for me. I probably will keep the docker but handle mysql and nginx outside of the docker.

Still testing the options. Thanks!

1 Like

The email issue was a SSL issue. I saw other topics with similar issues.
If you have issues with email, disable the secure (set it to false) and try.