Docker Volume with Local Persist

Create a docker volume with mount-point using local-persist docker plugin. (Ubuntu only. For other OS please refer to https://github.com/CWSpear/local-persist)

  • Install
    curl -fsSL https://raw.githubusercontent.com/CWSpear/local-persist/master/scripts/install.sh | sudo bash -s -- --systemd
    
  • Using with docker-compose
version: '2'

services:
  one:
    image: alpine
    working_dir: /one/
    command: sleep 600
    volumes:
      - data:/one/

  two:
    image: alpine
    working_dir: /two/
    command: sleep 600
    volumes:
      - data:/two/

volumes:
  data:
    driver: local-persist
    driver_opts:
      mountpoint: /data/local-persist/data
  • Using with docker command
    docker volume create -d local-persist -o mountpoint=/data/images --name=images
    

Reference:
https://github.com/CWSpear/local-persist

Written on September 9, 2018