Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fig apparently not using volume_from on mysql service #579

Closed
wlepinski opened this issue Oct 23, 2014 · 7 comments
Closed

Fig apparently not using volume_from on mysql service #579

wlepinski opened this issue Oct 23, 2014 · 7 comments

Comments

@wlepinski
Copy link

http://stackoverflow.com/questions/26532003/fig-apparently-not-using-volume-from-on-mysql-service

I'm trying to setup a very simple setup of a mysql database using a data-container as repository using Fig.sh and Docker.

The code below is self-explanatory:

web:
  build: .
  command: php -S 0.0.0.0:8000 -t /code
  ports:
    - "8000:8000"
  links:
    - db
  volumes:
    - .:/code
dbdata:
  image: busybox
  command: /bin/sh
  volumes:
    - /var/lib/mysql
db:
  image: mysql
  volumes_from:
    - dbdata
  environment:
    MYSQL_DATABASE: database
    MYSQL_ROOT_PASSWORD: rootpasswd

For some reason, if I run a command fig run --rm dbdata /bin/sh and then I cd into the directory /var/lib/mysql. The folder is empty. If I run fig run --rm db /bin/sh and cd into /var/lib/mysql the database is being created there.

What am I doing wrong here? And taking advantage of the question, is this the correct setup or I should let the data inside the mysql container?

Thanks.

@sge-babrams
Copy link

Docs for how to mount a data volume in Docker: https://docs.docker.com/userguide/dockervolumes/

You are missing the local path on the host
volumes:
- SOME_LOCAL_PATH_ON_HOST:/var/lib/mysql

To answer your question on if you should host the data in the docker image: I would say any data store that you lose would cause more than service degradation you should protect against. You can accomplish this through clustering (multiple containers across multiple physical hosts in MM or MS setup) and/or data volumes from the local host. I would recommend using a volume and clustering if needed.

@wlepinski
Copy link
Author

I read on the docs (http://www.fig.sh/yml.html) on volumes section that you can do something like this.

volumes:
 - /var/lib/mysql
 - cache/:/tmp/cache
 - ~/configs:/etc/configs/:ro

@sge-babrams So, this is a typo?

@thomasleveil
Copy link

I believe your issue is about volumes_from which is ignored when using fig run while it is working as expected when using fig up. I'm not sure there is anything wrong with volumes.

@sge-babrams
Copy link

@wlepinski takeing a closer look that seems fine.

@sirwolfgang
Copy link

I just ran into this issue; Is there any reason that fig run ignores volumes_from? That seems like a major bug to me.

@dnephin
Copy link

dnephin commented Dec 10, 2014

It's being worked on in #686, I think that is a bug

@dnephin
Copy link

dnephin commented Sep 1, 2015

I believe this was fixed by #1076

Please re-open if you're able to reproduce with the latest version

@dnephin dnephin closed this as completed Sep 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants