Add docker managed volumes

pull/1/head
Mark O'Connor 5 years ago
parent 9fde6e6120
commit 0e95351890

2
.gitignore vendored

@ -1 +1 @@
data
docker-compose.override.yml

@ -10,7 +10,11 @@ Because I've oft needed them, particularly when I just don't wanna deal with the
Clone the repo or copy a `docker-compose.yml` file to your system, `cd` into that directory, and turn it on with `docker-compose up`. For a full reference on how to use Docker Compose, [go here](https://docs.docker.com/compose/reference/).
## Local Persistence
In each setup, your data is configured to be stored locally in a `./data` directory. If that directory doesn't exist, it'll be created automatically.
In each setup a docker managed volume is created to persist the database. This can be deleted by Docker compose by passing the "-v" option when deleting the container(s).
```
docker-compose down -v
```
## Authentication
For authenticating as super user with each of these examples, `root` should be the username and `password` should be the password.

@ -4,9 +4,12 @@ services:
db:
image: mongo:latest
volumes:
- ./data:/data/db
- dbdata:/data/db
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
volumes:
dbdata:

@ -4,9 +4,12 @@ services:
db:
image: mysql:latest
volumes:
- "./data:/var/lib/mysql"
- dbdata:/var/lib/mysql
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
dbdata:

@ -4,10 +4,13 @@ services:
db:
image: postgres:latest
volumes:
- ./data:/var/lib/postgresql/data
- dbdata:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "password"
volumes:
dbdata:

Loading…
Cancel
Save