fig.sh and mysql container losing all data after stopping services

I have a fig setup that is so inconsistent that is driving me nuts. At random times between stopping services and restarting it loses the mysql data that was created. I tried with data only containers and linking them with volumes_from and even setting the volumes directive. Last night my computer froze and I had to issues a restart only to find out that all my mysql data was lost when issuing a fig up command.

I really like the idea of orchestrating things up and not having to install local services such as mysql or elasticsearch locally but this inability to maintain a persistent database is quite irritating.

  • Background OpenCpu R process in Docker
  • docker install with tcp enabled 0.0.0.0
  • Chef and Docker
  • Startup script for a docker container
  • Docker-Compose mount on Windows Server 2016 TP4
  • How to fix docker-machine ip?
  • I updated both docker and fig to latest versions without any kind of success. Here’s my fig config, maybe someone can spot something I’m doing wrong:

    redis:
      image: redis:latest
      volumes:
        - /var/devcasts/data/redis:/data
    
    mysql:
      image: mysql:latest
      ports:
       - 3306
      environment:
        MYSQL_DATABASE: mydb
        MYSQL_ROOT_PASSWORD: ********
      volumes:
        - ./dbbackup:/dbbackup
        - /var/devcasts/data/mysql:/var/lib/mysql
    
    elasticsearch:
      image: dockerfile/elasticsearch
      volumes:
        - /var/devcasts/data/elasticsearch:/data
    
    web:
      build: .
      command: ./start.sh
      environment:
        DEBUG: 1
      volumes:
        - .:/code
      ports:
        - "8000:8000"
      links:
        - mysql
        - redis
        - elasticsearch
    

    I’m using a mac with boot2docker by the way but I think I had this problem when trying inside a vagrant ubuntu as well.

  • Docker support - Google App Engine (Java)
  • Docker base image state replication
  • Logging PHP API Request Info from Docker container
  • Kubernetes - Unknown admission plugin: DefaultStorageClass
  • boot2docker starting in Windows 7
  • Is it possible to run match servers on Kubernetes for a Real Time Multiplayer game?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.