-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 data-only containers #613
Comments
Could you include the fig commands you're using as well? I believe I've seen this work |
Ofcourse, added both my goal and the minimal test. Thank you for taking a look so soon! |
The minimal example can be made more minimal ofcourse, since you don't really need the mysql image. Replacing the |
I think I was able to reproduce this. I had to run I think docker will also silently ignore volumes if the directory doesn't exist in the container. I ran |
I had the same issues, updating to 1.0.1 fixed it ... |
Confirming that @dnephin's proposed solution worked for me as a workaround. |
I'm having a similar issue as fig rebuilds my db container every time I I've got all my database files mounted as host volumes so I don't really lose any data when this happens, but it's still annoying as other containers rely on db too. |
On fig up the doc tells I think we should add a parameter to fig.yml: no-recreate. This parameters should tell that fig up must never recreate this container. |
please don't use |
A parameter like that would not fix the underlying bug, which assumes linked containers should be recreated too when specifying only one or a few containers to up. What would be the reason to do that? I get that Fig recreates changed containers, and/of those you specify in the That makes no sense and breaks connections from other existing containers linked to the same container as those are not recreated. Recreating one website container forcibly recreates my DB container and thus breaks all other sites or node using the same DB containers until I manually recreate those too. |
This issue is quite similar to #447, I've proposed a solution there (which doesn't use negative flags). |
Actually I don't think #447 is the same need but I agree on negative flags. Maybe we could tag a container as "permanent: true" or "data-container: true" so that this container is never changed or re-created by fig and require manual docker action. |
On a related note,
The first time it works fine, but then the second time
|
@rocketraman see #516 |
Thanks! |
Sorry, ignore the below -- turns out I was inspecting the wrong container due to a naming error. D'oh! Though I also still have the issue of getting volumes from data only containers to mount correctly in other containers. Still investigating the exact nature of the problem.
My image Dockerfile looks like this:
and the fig config looks like this:
when I run with Running with
I also noticed that in the container created by fig, the command that is being run as shown by inspect doesn't look correct:
|
Reading this back, I don't think data-only containers even need a command. At least since Docker 1.4, volumes are initialised at So having an option to only create a service without starting would solve at least some cases. |
@thaJeztah if we get #630 merged, that would be possible with |
@aanand exactly; and it would prevent having to add "magic" no-op commands, so a much cleaner solution. |
@thaJeztah hmmm, actually that's not right: |
Ran into a similar issue while debugging with a coworker and wanted to leave this comment in case it helped anyone else. One of our users had an issue with data not persisting between fig runs. We found that the docker daemon running inside of boot2docker seemed to be ignoring volume configs completely (whether we used volumes_from with a data container, or even a static volume mount). The container that wound up getting spawned would always have a docker-daemon created volume mount (similar to when a Dockerfile contains a VOLUME line and no other volume information is provided at run time, and that image did contain a VOLUME line for that dir). Also, it would create a new version of the data container each run, rather than re-using the initially created one. While we didn't find the root cause of the issue we noticed that the docker client (on the OSX side) was 1.3.2, whereas the docker server was running 1.4.0. After upgrading boot2docker and getting the OSX docker client up to 1.4.0 the volumes are mounting as expected and data is persisting. Hope this helps someone with a similar issue. |
@drags Docker 1.4.0 causes an issue with Fig where volumes aren't mounted - you should upgrade to 1.4.1 as soon as possible. |
I'm having a hard time getting persistent volumes from my data only containers. I had to use @dnephin's workaround Ubuntu 14.04, Docker version 1.3.3 (build d344625), Fig version 1.0.1 (master@55095e) |
#711 has been merged which I believe resolves this issue. It will be in the next release |
Is it possible that the no-op is no longer required since moby/moby#8942 was fixed in moby/moby#9089 ? That would mean that starting the intermediate container would be unnecessary. |
I've just hit this when trying to run a single-binary go container. |
Is there a workaround to use data containers with docker-compose? Would downgrading docker (I'm on 1.4.1 now) help? I'd like to be able to use data containers but they get wiped every time I do a If not I can use host mounted volumes for now. Thanks for the hard work on docker-compose I really feel this will change how I develop forever. |
Using docker v1.3.3 and docker-compose@master appears to have working data-only containers. |
I tried Docker 1.4.1 again, and I found a bug in one of my containers that was wiping the data container on every start... I have fixed that bug and now it seems like everything is working! Apparently there was just a misfortunate bit of googling that led me to believe this problem was something other than my own! Thanks for the help! |
@kojiromike Yes. |
OK, this thread is a bit of a jumble of issue reports, and it's not clear if there's an actual bug here or not. I'm going to close it until someone can come up with a reproducible error. |
Using this simple configuration:
I would expect that the mysql data is persisted on the data-only container 'data'. But writing anything to /var/lib/mysql is NOT persisted across runs. Doing this with plain docker does work.
Am I overlooking something, or is this either a bug or a feature of fig?
The fig commands I'm trying to use are:
The mysql image has an entrypoint that takes init and start command. The first one populates /var/lib/mysql, the second one starts the mysql server with /var/lib/mysql as it's datadir. Both run, but the second one fails because /var/lib/mysql is empty.
The following is a minimal example of it failing:
Where the first
ls -l
shows that the file was created, where as the second one returns empty.Using docker 1.3.0 and fig 1.0.0
The text was updated successfully, but these errors were encountered: