Return to site

Mount your friends custom bodies

broken image
broken image
broken image

Users/nola/docker/postgres/init/initData.sql:/docker-entrypoint-initdb.d/ Users/nola/docker/postgres/docker-pg-vol/data:/var/lib/postgresql/data I will explain it by mounting volume to a postgreSQL container and also initializing the database with some initialization scripts to create table and load data.Idea is to launch the container but mount the volume on host file system so that even if the container is deleted, data can continue to persist in the host file system.volumes are directories (or files) that are outside of the container and exist as normal directories and files on the host filesystem.

broken image

In order to save or persist the data even after a container is deleted, you should use volumes.This writable layer does not persist after the container is deleted, therefore if you launch a postgreSQL container and create database and delete the container all the data will also get lost.All changes made to the running container, such as creating new tables, inserting data etc are written to the writable container layer.

broken image