Docker - Brandon-Duffy/SYS-265 GitHub Wiki

Setting up Grav in Docker using the GitHub Repo docker-grav

Prerequisites

  1. Docker installed on your system.
  2. Docker Compose installed on your system.
  3. Git installed on your system.

Steps

1. Download the Dockerfile

Clone the docker-grav repository from GitHub:

git clone https://github.com/getgrav/docker-grav.git

2. Create the docker-compose.yml file

Navigate to the cloned docker-grav directory:

cd docker-grav

Create a new file named docker-compose.yml using your preferred text editor and add the following content:

version: '3'

volumes:
  grav-data:
    driver: local
    driver_opts:
      type: none
      device: $PWD/grav
      o: bind

services:
  grav:
    build: ./
    ports:
      - 8080:80
    volumes:
      - grav-data:/var/www/html

3. Run Grav with Docker Compose

With the docker-compose.yml file created, run the following command in the terminal:

docker-compose up -d

This command will automatically build the Grav image (if the Dockerfile is in the same directory as the docker-compose.yml file) and start the Grav container with all of the site data persisted to a named volume (stored in the ./grav directory).

4. Access Grav

Now you can access Grav by opening your web browser and navigating to http://localhost:8080.