Thursday, August 23, 2018

Docker-compose: create named data volume

To create a named data volume using the version 2 of compose files you will have a separated area:
version: '2'

services:
  db:
    image: postgres
    volumes:
      - amazingvolume:/var/lib/postgresql/data

volumes:
  amazingvolume:
    external: true
So you can define the volume name (amazingvolume), if it's external or not and under your service (db in this example) you can define which directory you gonna mount.

No comments:

Post a Comment