# Ghost is apparently not reading environment variables (using Docker)

**URL:** <https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019>\
**Category:** Developer help\
**Created:** [July 25, 2025, 6:16pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019 "2025-07-25T18:16:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![filipesm](https://avatars.discourse-cdn.com/v4/letter/f/a3d4f5/32.png) [@filipesm](https://forum.ghost.org/u/filipesm)\
**Post date:** [July 25, 2025, 6:16pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/1 "2025-07-25T18:16:26Z")

</div>

Hello. Thank you for the amazing piece of software and tooling 🙂

We have a Ghost instance running on Digital Ocean. We are starting it with Docker/Podman. The environment variables seem to be passed to the container, but not read by Ghost itself.

For example, running `env` inside the running container prints:

```auto
mail__transport=SMTP
GHOST_VERSION=5.121.0
...

```

because we have the following `docker-compose.yaml`

```auto
...
ghost:
    container_name: ghost
    image: ghost:latest
    restart: always
    environment:
      url: https://${GHOST_DOMAIN}

      mail__transport: SMTP
...

```

However, running `ghost config mail.transport` prints

```auto
Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

Direct

```

Because of this, we cannot send transactional emails, and thus I cannot login (due to the new feature of demanding that staff users get an email when logging in).

Are we doing something wrong? Thanks!

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [July 25, 2025, 7:07pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/2 "2025-07-25T19:07:20Z")

</div>

As far as I understand, `ghost config [key]` does not return environment variables. Just tried it on a running site that definitely has stuff set (e.g. `url`) and I am getting the same result as you.

So, the issue is rather with the mail setup itself. The fact that `ghost config [key]` does not return anything is a red herring.

How does the rest of the mail configuration look like? Has this worked before?  
As an alternative, if you need to log in quickly, have a look here at the `security` config:

> **[Configuration - Adapt your publication to suit your needs](https://ghost.org/docs/config/#security)**
>
> Find out how to configure your Ghost publication or override Ghost's default behaviour with robust config options, including mail, storage, scheduling and more!

---

<div class="post-metadata">

**Author:** ![filipesm](https://avatars.discourse-cdn.com/v4/letter/f/a3d4f5/32.png) [@filipesm](https://forum.ghost.org/u/filipesm)\
**Post date:** [July 25, 2025, 7:11pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/3 "2025-07-25T19:11:39Z")

</div>

Hello Jannis. That helps definitely.

I have disabled that and logged in successfuly 🙂

It has worked in the past.

The rest looks like this:

```auto
mail __options__ secure=True
mail __options__ auth__user=geral@d**o.pt
mail__transport=SMTP
mail __options__ port=465
mail__from=' ***' <geral@d** o.pt>
mail __options__ auth__pass=***
mail __options__ host=mail.d**o.pt

```

With “\*\*\*” being just redacted stuff, that _should_ be correct. We have also tried using Mailgun, with no success. We will try again later, but it should be working, I think.

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [July 25, 2025, 7:24pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/4 "2025-07-25T19:24:15Z")

</div>

Glad to hear it’s working!

In production, the mail setup is required (meaning, if new features are added, Ghost assumes that you have a working mail setup for production), so you should figure that out.

What I’d check is if the exact SMTP credentials work elsewhere. Then work from there.

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [July 25, 2025, 8:44pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/5 "2025-07-25T20:44:36Z")

</div>

> [@filipesm](#):
>
> We have a Ghost instance running on Digital Ocean.

Bingo. That’s your problem. DO is blocking outbound SMTP. Switch to port 2525 (not blocked by DO recently at least), or switch to using a mail service that’ll accept email via API.

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [July 25, 2025, 8:52pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/6 "2025-07-25T20:52:39Z")

</div>

Not having to deal with DO myself, I always forget about that. Good point! 🙃

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [July 25, 2025, 9:19pm UTC](https://forum.ghost.org/t/ghost-is-apparently-not-reading-environment-variables-using-docker/59019/7 "2025-07-25T21:19:09Z")

</div>

I don’t use DO either, I’ve just seen it enough times!
