AWS Docker Ghost - Configure URL

Hello!

I installed Ghost on AWS / Lightsail Ubuntu 18 / Docker container, per this guide: Building a Photo Diary on Amazon Lightsail with Ghost | AWS Compute Blog

I am experiencing some bugs, for example, in the admin / “View Site”, the site does not show and Firefox says “Unable to connect”. I believe this is happening because the URL has not been configured in Ghost.

I want to run ghost config url <your domain here> but I’m not sure what code to run in front of this command to access Ghost, or if I can even use the command line in this configuration to configure the URL.

Anyone know? Thank you!

you can define URL parameter to do that
stop the container

docker stop CONATINER-NAME-OR-ID

then stat the container with URL parameter like Below

sudo docker run -d --name blog -e url=https://yourdomain.com -p 80:2368 -v /var/lib/ghost/content:/var/lib/ghost/content ghost

hope this helps

Hey @inoryum thank you for answering!

The stop command worked. On the second command, I got this error:

 Error response from daemon: Conflict. The container name "/blog" is already in use by container “CONTAINER ID”. You have to remove (or rename) that container to be able to reuse that name.

I tried some variations of the command that you recommended, but still wasn’t able to configure the URL. I don’t want to create / remove / rename the container, but just set the URL.

Should I start over and use your command in setup, or is there an easier way to configure the URL after running ghost?

The easiest solution to start over…

Otherwise you have to do some more steps

:man_facepalming: Doh!

Ok, will give it a fresh attempt.

Much appreciated @inoryum

or you can use docker-compose with the following docker-compose.yaml file

version: '3'

services:

  ghost:
    container_name: myblog
    image: ghost:latest
    restart: always
    ports:
      - 3000:2368
    volumes:
      - ./content:/var/lib/ghost/content
    environment:
      url: https://mydomain.com
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: hidden
      database__connection__database: myblog_db
      mail__transport: SMTP
      mail__from: "myblogr <noreply@myblog.com>"
      mail__options__host: "smtp.mailgun.org"
      mail__options__port: 587
      mail__options__auth__user: "my@mailgunsmtpuser.com"
      mail__options__auth__pass: "mailgunsmtppassword"

  db:
    container_name: myblog_db
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD:  hidden
    volumes:
      - ./data:/var/lib/mysql

Then to start the container run

docker-compose up -d