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.

  • how to use libfaketime to setting system date
  • Docker Ip Failover
  • How should I pass sensitive environment variables to Amazon ECS tasks?
  • How to make sbt-native-packager combine two layers of docker image
  • deploy war file on tomcat docker container
  • Docker hub automated build fails but locally not
  • 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.

  • How do I create a file within “docker run”
  • Deploying scala app as a docker container
  • Run multiple services inside one docker container [closed]
  • Docker Postgres - PDO exception get
  • The command '/bin/sh returned a non-zero code: 1
  • Using xdebug through Docker container in PhpStorm
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.