0

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.

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Romeo Mihalcea
  • 9,714
  • 12
  • 50
  • 102
  • From your `fig.yml` it looks like you're storing all your data on the host at `/var/devcasts/data/`, so even if docker wasn't preserving volumes, you should still have the data on the host. Since you're using `boot2docker` that directory is probably in the VM unless you're using shared folders. Is that filesystem a tmpfs that gets removed when you restart? Do you see the data on the host filesystem? Are your mysql and elasticsearch containers actually using that path to store data? – dnephin Mar 01 '15 at 21:15
  • yes they are using it because mysql picks up the data upon restarting the fig daemon. It just randomly loses it. I haven't tried digging into the boot2docker filesystem but thanks for pointing me. – Romeo Mihalcea Mar 02 '15 at 17:08

0 Answers0