Update README documentation
Update documentation about persisting data. Add documentation about using docker-compose
This commit is contained in:
parent
1858f38e52
commit
68103dd65a
28
README.md
28
README.md
|
|
@ -12,6 +12,12 @@ This currently is pretty minimal and uses:
|
||||||
* cron
|
* cron
|
||||||
* vim editor
|
* vim editor
|
||||||
|
|
||||||
|
## Persisting data
|
||||||
|
|
||||||
|
To save the Grav site data to the host file system (so that it persists even after the container has been removed), simply map the container's `/var/www/html` directory to a named Docker volume or to a directory on the host.
|
||||||
|
|
||||||
|
> Note that if the mapped directory or named volume is empty, it will be automatically populated with a fresh install of Grav the first time that the container starts. However, once the directory/volume has been populated, the data will persist and will not be overwritten the next time the container starts.
|
||||||
|
|
||||||
## Building the image from Dockerfile
|
## Building the image from Dockerfile
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -31,3 +37,25 @@ Point browser to `http://localhost:8000` and create user account...
|
||||||
```
|
```
|
||||||
docker run -d -p 8000:80 --restart always -v grav_data:/var/www/html grav:latest
|
docker run -d -p 8000:80 --restart always -v grav_data:/var/www/html grav:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Running Grav Image with docker-compose and a volume mapped to a local directory
|
||||||
|
|
||||||
|
Running `docker-compose up -d` with the following docker-compose configuration will automatically build the Grav image (if the Dockerfile is in the same directory as the docker-compose.yml file). Then the Grav container will be started with all of the site data persisted to a named volume (stored in the `./grav` directory.
|
||||||
|
|
||||||
|
```.yml
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue