Docker container stop when mac sleep - macos

Since a few days my docker containers are all stopping when the computer sleep for something like 20min.
It was not doing that before, I have no logs in my containers, everything seems fine.
Do you have any idea why this is happening ?

I have the same, but I found solution at Github: https://github.com/docker/for-mac/issues/85#issuecomment-314054172
I'm now running 17.06.0-ce-mac17 (18432) and after changing the settings to "No proxy" I haven't had any problems.

Related

docker desktop Preferences settings page is not loading and state is docker desktop is starting from forever

Main issue is docker desktop is not starting in mac &
The status bar is showing docker desktop is starting but this process is not ending
I tried system reboot multiple times, Reinstallation of different docker desktop versions but didn't help.
I found answers which mentioned to change the Preferences -> Settings and allocation of different memory and core to docker desktop here but settings page is also in endless loading state
Internet speed ~10MBps| mac OS 10.14 Mojave | 16GB RAM|. Please help fixing it
When Docker preference setting page is not working
Click on Docker desktop icon >> Preferences ( This page is not loading) >> Click on the Troubleshoot icon ( top right corner with a bug image placeholder) >> Reset to factory defaults
I've been trying so many things to make it work and the only thing that worked for me in Windows was running this in cmd
"C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon
I took this on Docker cannot start on Windows
Try this: Github Link it works for me!
I found a magical solution, first open the docker preferences settings, and then click the docker icon in the status bar to select restart. At this time, you will be surprised to find that the settings UI is no longer in the loading state, then select Kubernetes in this short time, cancel the enable Kubernetes option, finally click the application below and restart. docker returned to normal. All this should be caused by Kubernetes not starting normally.
Docker version 2.2.0.5
macOS High Sieera 10.13.6
On my side I had a similar issue on my Windows machine.
It was probably caused by a forced shutdown after sleep mode (perhaps no more battery).
I tried many things like restarting the Services but it was not working when I started to watch the folder .docker in my home directory.
I did this:
I first stopped my Docker Desktop process
then I deleted the file named .token_seed.lock in ${USER_HOME}/.docker/
Start the Docker Desktop from the shortcut
and after that my Docker was running without any issue and my stored images were correctly displayed (and starting / stopping properly).
Docker demon isn’t responding all your need is
Quit docker desktop.
force quit all docker processes in activity monitor (this should force stop the demon).
start docker desktop again.
I was having the same issue and what it solved it was to force Docker using Linux language. You can use this command for that:
'C:\Program Files\Docker\Docker\DockerCLI.exe' -SwitchLinuxEngine
1 - If you haven't already, follow Microsoft's Steps 4-6
https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
After setting up your distro
2 - Inside Docker Click on the Bug Icon (next to the settings top)
3 - Do Factory reset for Docker
4 - Stop Docker from Task Manager
5 - Run this command
'C:\Program Files\Docker\Docker\DockerCLI.exe' -SwitchLinuxEngine
6 - Now Launch Docker and it will work! hopefully.
If it doesn't (in step 3 I also deleted Containers, WSL settings, Hyper V) from Docker Settings (Be careful deleting your own Containers is dangerous)
I've just solved this problem.
I'm using docker on Ubuntu vmware.
I think, the cause is just docker engine is not started.
The solution is below:
This function is for virtual machine in the virtual machine.
Oh yes, so now we can run the docker engine successfully.
Of course, the "forever loading" problem has been solved.
I have encountered the exact same problem right after I added a key-value pair into the Docker daemon configuration file through the Docker Desktop -> Preferences -> Docker Engine tab. The change broke my Docker engine and I couldn't undo my changes through UI since the UI was broken and showing the loading animation.
I solved the problem by manually removing the changes I made. The daemon configuration file is located in ~/.docker/daemon.json.

AWS ECS trouble - Running shell script to boot program

I am trying to run a Docker image on amazon ECS. I am using a command that starts a shell script to boot up the program:
CMD ["sh","-c", "app/bin/app start; bash"]
in order to start it because for some reason when I run the app (elixir/phoenix app) in the background it was crashing immediately but if I run it in the foreground it is fine. If I run it this way locally, everything works fine but when I try to run it in my cluster, it shuts down. Please help!!
Docker was supposed to keep track of your running foreground process, if the process stop, the container stop. The reason your container work when you use command with "bash" because bash wasn't stop.
I guess you use she'll script to start an application that serve in background like nginx or a daemon. So try to find an option that make the app running foreground will keep your container alive. I.e nginx has an option while starting "daemon off"
for some reason when I run the app (elixir/phoenix app) in the background it was crashing immediately
So you have a corrupted application and you are looking for a kludge to make it looking like it somewhat works. This is not a reliable approach at all.
Instead you should:
make it working in background
use systemctl or upstart to manage restarts of Erlang VM on crashes
Please note that it matters where you have your application compiled. It must be the exactly same architecture/container as the production one, with same Erlang, Elixir, OS versions, otherwise nobody guarantees it will be robust or even working.

PyCharm debugger stopping containers after "Waiting for connection" ends

I am trying to debug docker-compose containers in PyCharm.
Here is how my run configuration looks like:
Note that it is a Django app. When I try to start the debugger it is successfully starting all containers and I can access the app on the browser for a short amount of time. Also there is a background task running "Waiting for connection"
Right after it ends, the containers are suddenly stopped.
What am I doing wrong?
Here is what I did to fix this:
Moved the entrypoint to the docker-compose file instead of the Dockerfile
Changed the port to 8000 from 8050
I have no idea why this matters but it fixed it.

Docker hangs while pulling

I am trying to run docker run docker/whalesay cowsay boo from the tutorial.
Here is the output I get:
Unable to find image 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e190868d63f8: Already exists
909cd34c6fd7: Already exists
0b9bfabab7c1: Already exists
a3ed95caeb02: Pulling fs layer
00bf65475aba: Already exists
c57b6bcc83e3: Already exists
8978f6879e2f: Waiting
8eed3712d2cf: Download complete
It has been 10 minutes but nothing shows up. Is it supposed to take that long?
I tried control+C and re-run the command, and restarting Docker Quickstart Terminal. It's still not solving the problem.
You don't have to reinstall. Just restarting docker service should do
service docker restart
Similar situation. I got the feeling that concurrent download caused the problem. So I just force the docker downloading connection to 1.
docker-icon -> perferences -> daemon -> add the following code:
{
"max-concurrent-downloads": 1
}
slower but more stable.
Reinstalling docker from scratch solved the problem for me
I also was getting stuck on the "Pulling fs layer" when pulling images, and just want to add another reason it might be happening (this was what happened to me): I was connected to my corporate network and needed to set proxies; once I set the proxies, the image pull finished fine.
I had the same problem because of antivirus program. After I've disabled it (to disable it quickly, I just renamed McAfee installation directory and rebooted) - Docker finally was able to pull all layers.
Just reset default os in virtualBox and try again.
In my case, I had installed boot2docker long ago (March 2016), and this was overshadowing Docker for Mac. I had to manually uninstall boot2docker.

Troubleshoot Docker-On-Windows attempt to run hello-world

I have installed docker on windows and successfully brought up the bash shell window. However, when I test my installation with docker run hello-world I get the following:
Post http://127.0.0.1:2375/v1.20/containers/create: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it..
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
I thought at first it was because I needed to be logged in to docker hub. When I tried docker login and gave it my docker-hub account name, I got
The handle is invalid.
BTW, it did not ask me for my password.
I am puzzled. Please advise.
A little more troubleshooting helped resolve the problem. Steps taken:
I ran the new program Kitematic. It complained that it could not run the VM and offered a remove-and-setup-again option.
I chose the remove-and-setup-again option.
I then ran Kitematic again and it prompted for my dockerhub credentials
Once I successfully entered those and Kitematic seemed healthy I tried the Quickstart terminal again.
Running that provoked some checks from my anti-virus software which wanted to block internet activity from the VM. Once I overrode that, all went well.
In conclusion, it seems that retrying an install does change things (I do not know why) and secondly, anti-virus software can be a bother.

Resources