-
Notifications
You must be signed in to change notification settings - Fork 285
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
Volumes from docker-compose file no longer working after a reboot #584
Comments
The host-mount volume is not available immediately upon Docker start but becomes available a few seconds later. For that reason, containers autostarted with |
I'm hitting this issue as well. As a developer completely new to Docker, can anyone recommend a workaround until the issue is resolved? Would I be better off just changing the restart policy to "no", and writing a script to manually start them up? |
Try Power Shell 3 command under Adminstator access rights as follows: Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private Then enable drive C,D share in Docker settings. |
This problem also applies to docker running on Linux. |
Same issue on Ubuntu after computer restart
Distributor ID: Ubuntu Client: Server: |
I am facing the similar issue with windows shared volumes . If I am using the same compose file with Mac Os host/ Linux host not seeing any issue with shared volumes . @friism can you confirm this is windows host specific issue ? My compose file looks as follows |
Any workaround ? |
Sure. docker restart <container>. I've placed this in cron which is
executed after reboot.
2018-01-24 12:58 GMT+01:00 Xtrazyx <[email protected]>:
… Any workaround ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#584 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGNlyMeTTnbrfSthLmHeyx_197PgQ_PVks5tNxrUgaJpZM4Mcy5X>
.
|
Ok since i am on Windows 10 (!!!) i have had to make the ScheduleJob Powershell Script counterpart :) |
Would a named volume fix this issue or will the docker-compose start -d face the same problem? |
The problem is caused at system start up only, so docker-compose start -d should work. |
Will moving to swarm with single worker node resolve the problem? |
@friism that does not work all the time even restarting the container manually can mount the data but with an old version not the latest version... |
Any update on this or official recognition from Docker on this? Real shame that host_mnt volumes with auto-start just don't work. Are there any graceful workarounds? |
Thank god i found this page! I'm new to docker & started testing it out over several days but had containers getting reset & couldn't work out why. So after a while, out of frustration, I gave up & uninstalled docker. I wanted to use it though, so a few months later (now) I tried it again & this time figured out the volume is missing only if the container auto starts. which brought me here. How many other people have this issue & can't work it out & end up leaving docker for an alternate solution? Is there any easy workaround? This seems like a major issue & I'm surprised it wasn't resolved the day after it became known. I assume by delaying container launches until the mount is ready. |
I wrote a container shaynesweeney/holdup that is a simple Go app that uses the Docker API to start stopped containers once the volume /test shows a file (i.e. the mount is good). So add the volume /test and map it to a host mount with at least one file inside of it, also pass in /var/run/docker.sock as :ro to the container. Create the holdup container with
Here's the source: This is working well. Also has the side effect of starting containers if they were stopped. EDITED: changed to reflect c1n1c0's findings |
Thanks for your suggestion, but with my lack of docker knowledge I'm stuck with a |
did you pass in /var/run/docker.sock to the holdup container? |
wasn't aware i had to do that. seems to be working now. |
Yeah just make sure there's a file in C:\docker\holdup and it should bring any stopped containers up once the host mount is ready. |
done & done. legend. thank you! hopefully this issue can be resolved in the near future. |
It's likely still not fixed on windows. However, Linux and Mac working very well. |
This problem can actually exist for two years, it really makes me stunned. |
Has anyone been able to solve this problem? @mikeparker |
Thanks for your patience on this one. It would also be great to get more in-depth use cases for this: what kinds of data/containers are you running and is this for development or production usage? |
My use case:
While all of the above containers needed mounted data and config volumes from the Windows host, I've only ever experienced Cassandra being affected by this bug. |
I am using docker for win in the development environment. This is my docker-compose.yml |
@mikeparker commented on 15 Jan 2019, 15:28 GMT:
|
Same for Linux, development use case. I use docker/docker-compose inside a Vagrant VM (Virtualbox). Host -> Vagrant VM -> Docker Issue is with bind mounts volumes that is shared from host machine to VM, maybe it is not ready when docker containers starts. When I access the containers, the volume directory is there but empty. So I have to restart containers to fix it. |
For me the use case is a MySQL server on a Windows machine (production). |
The same problem on Ubuntu 18.04.1 LTS. Auto-mount via /etc/fstab:
|
I upgraded the docker desktop today, but the problem still exists.
|
I had the same problem in win10, using mysql and elabftw containers. |
A side issue I spent some time on - disks stopped to map at all. It turned out that I changed Windows password - so it stopped mapping Windows drives without any special complains. After resetting credentials in Docker options got it working again. That is on the top of the issue described in the thread - but, considering time I waste on that, decided to mention it here. |
Same issue. I will be looking into some of the workarounds above later today. Use case: Running a MySQL container in Docker Desktop for Windows with /var/lib/mysql mounted to a volume that resides on a secondary HDD in my desktop. Container starts but with /var/lib/mysql empty and needs to be restarted before /var/lib/mysql mounts correctly with my databases. |
I read the other workarounds and I was too lazy to figure out how to run Sean's Go script on Windows. This is what I threw together and it works. There is probably a better easier way to do this but it's good enough for my purposes. I have my MySQL docker-compose.yml in D:\Docker\MySQL.
Added a Task Scheduler Task with the action Start a program to run the script. Program/script: powershell.exe |
I still have this issue. After Docker Desktop restart WordPress starts up in the original state and all previously added themes and plugins are lost. |
Hi After many hours I have somehow fix this issue on my system. My Evirement:
Here are two things that I beleave has fix my problem: 1. Named volumes:I have found this issue when I have in my docker-compose.yml file unamed volumes in services section, for example:
Changing unamed volumes to named I almost fix the problem (after reboot I get different arror), here is my yml now:
2. Change startup type of "Docker for Windows Service" from Automatic to Automatic (Deleyed Start)I hope that this will help to someone with similar issue. |
I can confirm that it's not like what friism said two years ago that "The host-mount volume is not available immediately upon Docker start but becomes available a few seconds later." my env: The workaround shaynesweeney/holdup gave is nice. Sometimes this problem has something to do with firewall or docker built-in shared drive settings (including the credentials parts). If the problem persists, I recommend you to check and restart docker, firewall, shared drive settings and resetting shared drive credentials settings. |
I have the same problem |
What I did is removed |
I had the same problem. Thank you for help. Docker should output an error in such situation. |
@v-ladynev This was fixed with the latest release, are you sure you're using latest? From the release notes: (https://docs.docker.com/docker-for-windows/release-notes/)
If you are still getting a shared drive silently failing to mount on boot please let me know. |
@mikeparker I was using an old version. So it was my mistake. Thank you. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
When launching a set of containers with docker-compose on Docker for Windows, initially, everything works as expected. Data persisted to the local machine's drives via volume mounts is written back to the host machine.
Stopping and starting the containers also works as expected - the persisted data is correctly mounted inside the container.
When rebooting the host machine, the restart policy of the containers ensures they automatically start, however the persistent data is no longer visible from inside the container, and so it appears as if it's the first time the containers have been run.
mount command run inside the MySQL container after a restart. Notice there's no mount for /var/lib/mysql
Simply stopping and starting the containers rectifies the issue:
Information
Diagnostic ID from "Diagnose & Feedback" in the menu.
70292EF9-2E63-4FF6-88A3-8C42E7C4A28F/2017-03-14_15-52-24
host distribution and version (Windows version, build number, etc)
Windows 10 Pro 64 bit 1607
Steps to reproduce the behavior
docker-compose up -d
docker-compose stop
thendocker-compose start
and you can then log in again with your changed password.The text was updated successfully, but these errors were encountered: