Run Ghost with Docker
The Hello World version
Connect to your Lightsail instance and create a path for the Ghost content. I created separate paths for each blog hosted on my Lightsail instance so they can be managed independently.
mkdir -p ~/websites/cronspam.org/content
Then launch the Docker image for Ghost. This will automatically pull the Docker image from Dockerhub:
docker run -d \ --name blog \ -e url=http://cronspam.org \ -p 80:2368 \ -v /home/ec2-user/websites/cronspam.org/content:/var/lib/ghost/content \ ghost:3
You can visit the new site at: http://cronspam.org
And the admin page is at
WARNING: Go to the admin page ASAP to create the
admin account, until you do it's available for anyone to claim - the first visitor becomes the
docker-compose. It's always annoying that it's not part of the official Docker tools (yes, I know why, and it's still annoying).
# Install `docker-compose` from Docker sudo curl -L \ https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) \ -o /usr/local/bin/docker-compose # Fix the permissions sudo chmod +x /usr/local/bin/docker-compose # Verify it works docker-compose version
~/websites/cronspam.org/cronspam.org.yaml Docker compose file to configure the Docker container. I created a separate Docker compose file for each blog hosted on my Lightsail instance so they can be managed independently.
Run the compose file:
docker-compose -f ~/websites/cronspam.org/cronspam.org.yaml up --detach