Grav CMS: Docker Image with Skeleton Packages
A quick guide leveraging Grav with Docker and sample content.
What is Grav CMS?
Grav is a modern open-source flat-file CMS, meaning it doesn't require a database. It is extremely fast, and it offers a variety of features that are easy to customize. It's not something I've adopted, but I gave Grav a try in my home lab to see what it's like.
Grav vs. Ghost: The Differences
Ghost is praised for its simplicity and focus on blogging, with a strong emphasis on SEO and modern web practices. Grav is known for its flexibility and ease of customization, used by those who prefer a flat-file approach and a more developer-oriented experience.
Setting Up Grav CMS in Docker
Despite not using Grav for this blog, I noticed a gap in resources when it comes to setting it up in Docker with skeleton content, so I've put together a template that can be easily reused. "Skeleton" refers to a pre-packaged set of themes, plugins, and content. Essentially, it's a ready-to-use foundation for a new Grav site, enabling users to get a head start with a pre-configured design and structure. Skeletons are great for those who want a quick setup without starting from scratch, as they provide a structured yet customizable framework.
Create Docker Volume:
- Start by creating a docker volume named grav.
docker volume create grav
- Next, run the Grav container with the following command:
docker run -d \
--name grav \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-v grav:/config \
-p 12561:80 \
--restart always \
lscr.io/linuxserver/grav:latest
Adjust the environment variables and port number as needed.
Template Setup:
- Access the docker volume's directory and set up the template:
cd /var/lib/docker/volumes/grav/_data/www/
rm -rf ./*
wget https://getgrav.org/download/skeletons/shop-site/1.0.0-admin
unzip 1.0.0-admin
rm ./1.0.0-admin
In this example, we're using the 'shop-site' skeleton, but you can replace the link with any other Grav template of your choice.
- Finally, access Grav on
{Docker Host IP}:12561
, create your admin account, and start using the template.