Data lost after dinghy restart (postgres container)

I’m creating a container using this docker-compose.yml

  container_name: "postgresdb"
  image: "postgres:9.5"
    - "/var/docker/data/postgresdb:/var/lib/postgresql/data"
    - "5432:5432"
    VIRTUAL_HOST: "postgresdb.docker"
    VIRTUAL_PORT: "5432"
    POSTGRES_DB: "dev"

After running my container for the first time, I create some tables in my db.
After that I stop my container and stop dinghy (dinghy halt).
After that I start dinghy (dinghy up) and start the postgres container.
The tables now are gone.

  • Launching node docker container for debugging from VS Code
  • Do Docker Linux Images Contain Kernels?
  • Adding files to bluemix volume
  • Create a docker image/container from EC2 AMI
  • docker: show open ports from linked container
  • Clean Docker /var/lib/docker/devicemapper
  • I checked inside dinghy vm and the mounted volume is there.


    Macbook pro
    Dinghy 4.3.1
    docker-machine version 0.6.0, build e27fb87
    docker-compose version 1.6.2, build 4d72027
    Virtualbox 5.0.16 r105871 (with the latest extension pack)
    Docker version 1.10.3, build 20f81dd

    When I removed the volumes mounting from docker-compose.yml and restarted dinghy it worked as expected. Of course the data will be lost if I delete the container which is expected.

    So the question still stands for the mounted volumes. Perhaps the api for mounted volumes has changed? I’ve read about the new way of doing things, but isn’t this supposed to be backwards compatible?

  • Why are docker host volumes being mounted incorrectly?
  • What would the file look like for Gitlab CI?
  • Can run ARM/rpi images in Docker on Windows but not linux
  • Docker File: Chmod on Entrypoint Script
  • Can't push my own image to IBM Bluemix Registry
  • Connect container to local database
  • One Solution collect form web for “Data lost after dinghy restart (postgres container)”

    This isn’t unique to dinghy, it’s due to docker-machine using a root
    volume that isn’t persisted across reboots. I’d recommend using a
    named volume if you want the data to persist, rather than a hard-coded
    path inside the linux VM. For instance:

        - "mydatavol:/var/lib/postgresql/data"
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.