diff --git a/.gitignore b/.gitignore index 1269488..7376571 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -data +docker-compose.override.yml diff --git a/README.md b/README.md index 23f1727..8a1f098 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/mongo/docker-compose.yml b/mongo/docker-compose.yml index 801c924..a1e694f 100644 --- a/mongo/docker-compose.yml +++ b/mongo/docker-compose.yml @@ -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: diff --git a/mysql/docker-compose.yml b/mysql/docker-compose.yml index 77d350f..1d18f0a 100644 --- a/mysql/docker-compose.yml +++ b/mysql/docker-compose.yml @@ -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: diff --git a/postgres/docker-compose.yml b/postgres/docker-compose.yml index 3cc92c7..a143f2b 100644 --- a/postgres/docker-compose.yml +++ b/postgres/docker-compose.yml @@ -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: +