Skip to content

Commit 1f23c0a

Browse files
Merge pull request #1 from myspotontheweb/master
Add docker managed volumes
2 parents 08414b5 + 0e95351 commit 1f23c0a

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
data
1+
docker-compose.override.yml

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ Because I've oft needed them, particularly when I just don't wanna deal with the
1010
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/).
1111

1212
## Local Persistence
13-
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.
13+
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).
14+
15+
```
16+
docker-compose down -v
17+
```
1418

1519
## Authentication
1620
For authenticating as super user with each of these examples, `root` should be the username and `password` should be the password.

mongo/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ services:
44
db:
55
image: mongo:latest
66
volumes:
7-
- ./data:/data/db
7+
- dbdata:/data/db
88
ports:
99
- 27017:27017
1010
environment:
1111
MONGO_INITDB_ROOT_USERNAME: root
1212
MONGO_INITDB_ROOT_PASSWORD: password
13+
14+
volumes:
15+
dbdata:

mysql/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ services:
44
db:
55
image: mysql:latest
66
volumes:
7-
- "./data:/var/lib/mysql"
7+
- dbdata:/var/lib/mysql
88
restart: always
99
ports:
1010
- 3306:3306
1111
environment:
1212
MYSQL_ROOT_PASSWORD: password
13+
14+
volumes:
15+
dbdata:

postgres/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ services:
44
db:
55
image: postgres:latest
66
volumes:
7-
- ./data:/var/lib/postgresql/data
7+
- dbdata:/var/lib/postgresql/data
88
ports:
99
- 5432:5432
1010
environment:
1111
POSTGRES_USER: "root"
1212
POSTGRES_PASSWORD: "password"
1313

14+
volumes:
15+
dbdata:
16+

0 commit comments

Comments
 (0)