Ghost and Docker, a lot of problems!

Hi, hi installed ghost on my machine with docker,
I followed the official tutorial and the official image.

I used this comand

docker run -d --name some-ghost -e url=http://my-server-adress.com -p 80:2368 ghost

because the standard comand

 docker run -d --name some-ghost ghost

doesn’t show me ghost in my-server-adress.com:2368 (the door is open)

So, i configured ghost from my-server-adress.com/ghost,
but i have a lot of problem:

  1. I can’t invite staff because ghost tell me to configure mail service (direct mail no works…)
  2. I go on the container and i open the terminal:

i use ghost cli for configurate the email service with my gmail credentials
after this, the comand ghost restart doesn’t work because im the root user.
so, i switch my user to node user, but i have another error:

so, at this point, i restart the docker container, but after this comand, the website return me a 502 error.
when i go to check the config.production.json file i see two difference:

the port was 2368 now is 2369, the host ip was 0.0.0.0 now is 127.0.0.1…

so, after this change im not able to use ghost again, i need to create another container!

who can help me?

Hey!

It’s worth noting that the “official image” is not official from Ghost, it’s official from Docker - we do not maintain nor support it! You may get better help on their GitHub (https://github.com/docker-library/ghost) or forums!

That said, we can try our best to help you!

doesn’t show me ghost in my-server-adress.com:2368 (the door is open)

This is because you mapped the ports with your command -p 80:2368 this forwards your host machines port 80 to the containers port 2368 - so unless you have another instance running, there will not be a Ghost server listening on my-server-address.com:2368, it should just be my-server-address.com

i use ghost cli for configurate the email service with my gmail credentials
after this, the comand ghost restart doesn’t work because im the root user.
so, i switch my user to node user, but i have another error:

As far as I understand the docker image is supposed to be configured with environment variables, I may be wrong, but you should check with them how you’re supposed to configure mail.

Our docs how on to configure Ghost include information on how to use environment variables: https://ghost.org/docs/concepts/config/#running-ghost-with-config-env-variables

Hopefully this gets you onto the right track!

Fabien this my-server-adress.com:2368 doesnt work because i used command to set port 80, but if i use the standard comand without change port, i dont see difference, i see a big 502 error…

So, i followed the ghost tutorial for configure email with ghost cli but i can’t find where and how configure docker env variables

You’ll need to be a bit more explicit if you want help, what is the “standard command”?

You have already configured the url environment variable with docker using the -e flag (https://docs.docker.com/engine/reference/commandline/run/)

If you are struggling with docker, I would suggest using the ghost-cli and following our official docs for installing on an ubuntu server https://ghost.org/docs/install/ubuntu/!

This will start a Ghost instance listening on the default Ghost port of 2368.

$ docker run -d --name some-ghost ghost

so, i aspect to see my ghost on my-server-adress.com:2368… but i have a 502 error

so, for this reason i used this comand:

 docker run -d --name some-ghost -e url=http://myserver.com -p 80:2368 ghost

Just running a container doesn’t map your container port to your host ports, you’ll need to run it with -p 2368:2368

As for the 502 error, do you have any other server software running on your machine? What is serving the 502?

docker run -d --name some-ghost -e url=http://myserver.com:2368 -p 2368:2368 ghost

i used this command, but i dont see difference, at myserver.com:2368 i see a 502 error… but if i change the port with 80 works

so, i dont use ghost cli if i’m using docker? i dont know docker and i dont know were are the ghost’ env variable for docker… i know that existe a config.production.json file with this information… but this can be edit by ghost cli, but i change this values, docker stop working

Who can help me?