Install Ghost with Docker
Table of Contents
Ghost is a CMS platform (like WordPress) you can install on your server for free. It’s simpler than WordPress, but it has everything you need to create a blog. These are the steps to install it with Docker:
- Install Docker if it’s not already installed (Install Docker).
- Create a network (replace NETWORK_NAME):
docker network create NETWORK_NAME
- Run MySQL container. Replace
DB_HOSTwith a name for the container,NETWORK_NAMEwith your new network name,DB_NAMEwith a name for the database,DB_USERwith a name for the database user andDB_PASSWORDwith a password for the database:
docker run --name DB_HOST -d --network NETWORK_NAME -e MYSQL_DATABASE=DB_NAME -e MYSQL_USER=DB_USER -e MYSQL_PASSWORD=DB_PASSWORD -e MYSQL_RANDOM_ROOT_PASSWORD=yes mysql:5.7
- Run Ghost container (wait 20-40 seconds for MySQL to set up). Replace
GHOST_CONTAINERwith a name for the container,NETWORK_NAMEfor network name,http://localhost:8080for server public IP or domain (change local port in-p 8080:2368if needed),DB_HOSTwith the MySQL container name,DB_USERwith the database user,DB_PASSWORDwith the database password andDB_NAMEwith database name:
docker run --name GHOST_CONTAINER -d --network NETWORK_NAME -p 8080:2368 -e url=http://localhost:8080 -e database__client=mysql -e database__connection__host=DB_HOST -e database__connection__user=DB_USER -e database__connection__password=DB_PASSWORD -e database__connection__database=DB_NAME ghost:4-alpine
- Now you can access your newly created website typing your VPS public IP and port 8080 in your browser (check your VPS provider’s firewall to open port 8080):
http://<SERVER-PUBLIC-IP>:8080.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: