Official docker is installed on this Mac El Capitan. While running a bash file, one of the commands is to start the docker daemon if it is not running: $(docker-machine status) 'Stopped' && docker-machine start eval $(docker-machine env) I am guessing it was not running because I got the below output which I was hoping the above code would handle gracefully. What needs to be done for that to happen? Starting 'default'. (default) Check network to re-create if needed.
(default) Waiting for an IP. Machine 'default' was started.
Note: If you override this option and then do not specify a hosts entry in the daemon.json or a -H flag when starting Docker manually, Docker fails to start. Run sudo systemctl daemon-reload before attempting to start Docker.
Waiting for SSH to be available. Detecting the provisioner. Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command. Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host '192.168.99.100:2376': tls: DialWithDialer timed out You can attempt to regenerate them using 'docker-machine regenerate-certs name'. Be advised that this will trigger a Docker daemon restart which will stop running containers. How ever running the script file the second time, all went well.
Docker on OS X (or macOS as it's now called) runs inside a Linux virtual machine, usually using VirtualBox as the hypervisor. So when you start docker using docker-machine start, it will take a little while for the virtual machine to and all of the services on it to start and become available. So to work around this, you could do something like the following: $(docker-machine status) 'Stopped' && docker-machine start sleep 10 eval $(docker-machine env) You may wish to adjust the value passed to sleep if this turns out to be too much or not enough time, as the amount of time it takes for your virtual machine to become available depends on the hardware on your OS X host as well as the virtual hardware allocated to the Docker guest.
Written by Daniele Procida Updated over a week ago Many problems that appear to be Docker-related are often in fact caused by VirtualToolbox. Before proceeding on the assumption that the problem lies with Docker, please see:.
Error: 'Couldn't connect to Docker daemon' Problem Docker commands report that they cannot connect to the Docker daemon: Cannot connect to the Docker daemon. Is the docker daemon running on this host? However, you're sure it is actually running. Probable cause The problem may be an issue with users and groups. Solution You need to add yourself to the docker group.
What to do See this for more.