How to start docker-machine on OSX?

How to start docker-machine on OSX?

I’ve installed and use docker for the first time yesterday,
Everything was working properly, but yesterday night I’ve shutdown my computer.
Today I start it and I wanted to work on my docker app, But when I try to run it like
docker run -d -p 8080:8080 container/app
I got the error :

docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.

But I can’t find how to launch docker again…
Ideas ?
EDIT :
eval “$(docker-machine env default)”

result:

Error checking TLS connection: Host is not running

Solutions/Answers:

Solution 1:

The docker-machine env default command won’t work if the “default” machine is not running.

You can run the docker-machine ls command, which should give you a list of machines that are configured, and their current status (running, stopped).

If a machine is stopped, run docker-machine start <name-of-machine>. After that you should be able to set the environment variables using

eval "$(docker-machine env default)"

please read the documentation at https://docs.docker.com/machine/overview for more details

Solution 2:

After I run the command $ docker-machine start default, I get the message of

Starting "default"...
(default) Check network to re-create if needed...
(default) Creating a new host-only adapter produced an error: /usr/local/bin/VBoxManage hostonlyif create failed:
(default) 0%...
(default) Progress state: NS_ERROR_FAILURE
(default) VBoxManage: error: Failed to create the host-only adapter
(default) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
(default) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
(default) 
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is supposed to fix this issue

A solution is provided at the end of the message,

This is a known VirtualBox bug. Let's try to recover anyway...
Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is supposed to fix this issue

I uninstall and then, try to reinstall the VirtualBox. It was still same.

Related:  How to create named and latest tag in Docker?

Then, I allowed the apps from anywhere in the machine and this solved the issue:

Allow Apps from Anywhere: sudo spctl --master-disable

enter image description here

References