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/). 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 ## 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 ## Authentication
For authenticating as super user with each of these examples, `root` should be the username and `password` should be the password. 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: db:
image: mongo:latest image: mongo:latest
volumes: volumes:
- ./data:/data/db - dbdata:/data/db
ports: ports:
- 27017:27017 - 27017:27017
environment: environment:
MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password MONGO_INITDB_ROOT_PASSWORD: password
volumes:
dbdata:

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

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

Loading…
Cancel
Save