Cannot connect to the Docker daemon on macOS
Asked Answered
C

38

543

I normally prefer to manage my apps on my OSX with brew

I am able to install docker, docker-compose and docker-machine

docker --version
Docker version 17.05.0-ce, build 89658be
docker-compose --version
docker-compose version 1.13.0, build unknown
docker-machine --version
docker-machine version 0.11.0, build 5b27455

I did not download and run 'Docker for Mac' app.

However when I try to run

> docker run -d -p 80:80 --name webserver nginx
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

I have already checked the sock file

ls -lah /var/run/docker.sock /var/tmp/docker.sock
ls: /var/run/docker.sock: No such file or directory
ls: /var/tmp/docker.sock: No such file or directory

I have also tried this proposed solution: Mac OS X sudo docker Cannot connect to the Docker daemon. Is the docker daemon running on this host?

But I got this error message:

$ eval $(docker-machine env default)
Host does not exist: "default"

Is it possible to get a docker service to run by command line tools?

Caracole answered 20/5, 2017 at 10:36 Comment(3)
Launch the Docker application from Launchpad, will be showing a dialog asking that for run the App, is necessary granted some privileged for this App, after this, the Docker is back to the game.Ericson
In my case there was another user loggedin thats why it was failing. Logout other user and worked thenThiourea
This should be main and bolded comment @RafaelKerrJubal
L
1000

On a supported Mac, run:

brew install --cask docker

Then launch the Docker app. Click next. It will ask for privileged access. Confirm. A whale icon should appear in the top bar. Click it and wait for "Docker is running" to appear.

You should be able to run docker commands now:

docker ps

Because docker is a system-level package, you cannot install it using brew install, and must use --cask instead.

Note: This solution only works for Macs whose CPUs support virtualization, which may not include old Macs.

Edit 2022 - It was brought up in the comments section that there has been a licensing change for Docker Desktop. Please consider alternatives below, and check the comments for details.

Limann answered 23/6, 2017 at 10:31 Comment(25)
This should be the accepted answer. Go to the launch pad after install and search dockerLummox
I did a brew install docker and the app wasn't installed until I ran the command brew cask install docker. Thanks!Commensurable
What happens if the command still doesn't work even after the cask install (and Docker whale shows it's running after password given)?Cellulose
@Cellulose Please be more specific. What does not work? Are you seeing any error messages etc?Limann
I forget exactly. The desktop app was running, but not loading a container. From the command line nothing worked or knew to reference that app — I’ll try again in the future to get you more specific information. Perhaps the other brewed non-cask items (docker, docker-machine, etc) need to first be uninstalled?Cellulose
It just worked for me, but I ran brew uninstall docker before reinstalling with brew cask install docker. Then everything worked like a charm.Familiarize
This solution only works for Macs whose CPUs support virtualisation. It does not work on a 2009 Mac Pro, for example. Could you please edit your answer to include this important fact?Reynold
Error: It seems there is already an App at '/Applications/Docker.app'.Pinky
launching docker pap did it for meTabular
This is great and all; but is there no way to do this without getting into the GUI? $ open /Applications/Docker.app returns LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Docker.app.Secrecy
Anyone coming across this, heads up! This will kill your minikube's network settings. So if you are using minikube make sure you know this before going all cask install crazy. Wasted an hour fixing this.Tanah
But why should this be the accepted answer? It's a bunch of GUI add-ons without actually solving the problem through troubleshooting. I think @kenorb's answer should be the accepted one.Alric
There are definite tradeoffs to using Docker Desktop with this approach as stated here. I believe this answer should be updated to indicate this. I personally chose not to use Docker Desktop, but to each their own.Bentlee
@Secrecy try running this command open --hide --background -a DockerThreefold
Now that there is a licensing change on Docker Desktop, this is not a good answer.Cilla
@Cilla - Can you elaborate? How does the answer need to be updated?Limann
@Limann docs.docker.com/desktop/mac/release-notes/#new references a new licensing model which requires organizations over a certain size to pay to use the GUI on Mac and Windows. The answer should really be more like https://mcmap.net/q/56133/-cannot-connect-to-the-docker-daemon-on-macos. I also wrote about problems on bigsur here mindhaus.medium.com/…Cilla
perfect instructionsFlaminius
This is the correct answer, especially for users do not want to tie themselves with Docker Desktop or wanted to use Docker together with Rancher DesktopDoug
does not seem to work anymore, I get Error: It seems there is already a Binary at '/usr/local/share/zsh/site-functions/_docker'.Blithering
@Blithering if I am not wrong, you have installed docker earlier. Same issue happened with me. So I ran 'brew uninstall docker', before running 'brew install --cask docker'.Bendix
Might be good to note that this method downloads and installs docker desktop. Which is a complete dumpster fire on mac, extremely unstable and prone to wiping everything.Funk
Running brew install --cask docker prompts for a password.Mosher
The password prompt was for my system password, because docker is rootful by default. DOh!Mosher
I installed the formula rather than the cask... good shout!Highball
E
282

On macOS the docker binary is only a client and you cannot use it to run the docker daemon, because Docker daemon uses Linux-specific kernel features, therefore you can’t run Docker natively in OS X. So you have to install docker-machine in order to create VM and attach to it.

Install docker-machine on macOS

If you don't have docker-machine command yet, install it by using one of the following methods:

  • Using Brew command: brew install docker-machine docker.

  • Manually from Releases page:

    $ curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine
    $ chmod +x /usr/local/bin/docker-machine
    

See: Get started with Docker for Mac.

Install Virtualbox

docker-machine relies on VirtualBox being installed and will fail if this isn't the case. If you already have VirtualBox, you can skip this step.

  • Using Homebrew: brew install --cask virtualbox
  • Manually using the releases on Virtualbox.org

You will need to actively accept loading the Virtualbox kernel extension in the OS X Security panel and then proceed to restart the machine for the next commands not to fail with Error: VBoxNetAdpCtl: Error while adding new interface

Configure docker-machine on macOS

Create a default machine (if you don't have one, see: docker-machine ls):

docker-machine create --driver virtualbox default

Then set-up the environment for the Docker client:

eval "$(docker-machine env default)"

Then double-check by listing containers:

docker ps

See: Get started with Docker Machine and a local VM.


Related:

Emeric answered 8/4, 2018 at 15:40 Comment(14)
this should be the accepted answer. It clearly outlines a) why it doesn't work, b) instructions to get it working without downloading the UI on OSX and c) reference links for further reading.Redouble
when you get all above staff done, you'd better add eval "$(docker-machine env default)" to your .*rc file of your shell(e.g. .zshrc, .bashrc)Shortening
Nice answer, while I'm a newbie, what's the purpose of running `eval "$(docker-machine env default)", and should I add this to my .zshrc file?Kinney
@xiaojueguan: Why?Kinney
I had to upvote this answer. Docker Desktop is licensed and there was change of Policy. It remains free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects.Chitin
If you are on MacOS and using Virtualbox >=6.1.28 and you are receiving an error along the lines of: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available) VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp Then check out this answerThoroughbred
Docker machine is now deprecated, it should be outlined in the answer docs.docker.com/machineEffect
Also it is not possible to install Virtualbox on ARM Macs... And as far as I can tell is not very likely to be possible. Basically it will support only ARM guest OSes (which is not terrible) or it has to emulate an Intel CPU which most likely will work awful.Insurrectionary
Virtualbox is now available as a Developer preview for macOS / Arm64 (M1/M2) macs : osxdaily.com/2022/10/22/…Countrydance
I got: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?Amboina
on osx 12.4 (monterey) got stucked here : docker-machine create --driver virtualbox default Running pre-create checks... Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"Enunciation
@Enunciation use docker-machine create --driver virtualbox --virtualbox-no-vtx-check default instead. It works to get past this on my M1 mac.Bathetic
"Latest 7.0.x test builds" for ARM64: virtualbox.org/download/testcase/…Benign
I'm on Mac Sonoma, nothing fixed "Cannot connect to the Docker daemon at unix:///var/run/docker.sock" for me. Using colima instead of docker-machine now.Engross
D
123

If you wound up here after Docker Desktop 4.13.0 like me, it's because Docker got rid of the /var/run/docker.sock symlink in default behavior! See release notes here.

Quick fix: copy the command under "Permanent Solution" below

The Problem

I was experiencing docker ps (and other docker client commands) working, but other libraries that interact with docker (such as supabase CLI) resulted in:

$ supabase start
Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Solution

Now, you have to do something manual in order to get your tools to find the real docker socket file, which by default is at ~/Library/Containers/com.docker.docker/Data/docker.raw.sock.

Permanent Solution: Manually Symlink

This is a permanent solution that "undoes" this temporary fix.

sudo ln -s ~/Library/Containers/com.docker.docker/Data/docker.raw.sock /var/run/docker.sock
DOCKER_HOST=unix:///var/run/docker.sock docker ps # test that it works using linked socket file

Temporary Solution: Use DOCKER_HOST

This will temporarily get your command to use the new socket file

DOCKER_HOST=unix:///Users/$USER/Library/Containers/com.docker.docker/Data/docker.raw.sock docker ps

(replacing docker ps with whatever command you'd like, such as supabase start)

You can also make it work in your current terminal session, or paste into your .zshrc for always, with:

export DOCKER_HOST=unix:///Users/$USER/Library/Containers/com.docker.docker/Data/docker.raw.sock
Dittman answered 21/10, 2022 at 2:28 Comment(12)
This is the only answer that helped me on my M1 mac.Byrle
Great answer! maybe you should transform it into a new question for all those who recently installed supabase and encounter this error 👍Lobell
Thanks a lot. I was getting "Cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running? (Details: [2] No such file or directory)" since I set up a fresh installation of Ventura and Docker. This gave me headache the whole day. I was about to give up when I stumbled over your answer. You should definitely transform this to a new question. Thx a lot.Dissonant
Thanks a lot! However, if someone else came here like me because of this issue in IntelliJ etc. then it's better to fix this in IntelliJ directly, see stackoverflow.com/a/74175227Macedonia
Lifesaver, this worked by adding to my .zshrc!Sobriety
Perm solution doesnt work for me sudo ln -s ~/Library/Containers/com.docker.docker/Data/docker.raw.sock /var/run/docker.sock ln: /var/run/docker.sock: File exists You have to kill Docker Desktop first, then ` sudo rm /var/run/docker.sock`, run the fix and start Docker Desktop again.Aflame
@LukaszMadon YES. Thank you: that was the only thing that worked for me, after all of the above.Scansion
I have two users on my machine (so, /Users/$(whoami) would differ), is there a "Permanent solution" for such a case? P.S.: the temporary solution was a life saver. Thanks a lot!Outclass
Hey folks! This should have been addressed in 4.13.1, so you shouldn't need to manually create the symlink anymore! If you're still experiencing this, I would recommend updating Docker and see if it resolves itself. docs.docker.com/desktop/release-notes/#4131Dittman
4.19 and still have this issue. Creating the symlink manually helped.Greenness
4.21 still has this issue and above 'permanent solution' works, which means you do have to manually create symlink if you didn't enable the default sock to be used ( uncheck in advance tab in docker desktop )Dunson
Ditto - I'm also running Docker 4.21.1 and the permanent solution here fixed my problem! Thanks @efriis!Rearm
J
61

ATTN: docker-machine is deprecated (see here)

The docker-machine project has now been officially laid to rest.

I found Colima to be a great replacement and you can easily connect the docker daemon with a simple steps:

brew install docker docker-compose colima
# make coffee
colima start

Ready to docker:

docker run hello-world
Jempty answered 12/10, 2022 at 8:51 Comment(7)
Thanks a bunch! I tried the other answers here but this is the only solution that worked for my M1 Pro oO. Finally, I am able to docker httpbin without installing the app :)Gary
The only answer that helped me and gave extra coffee.Raglan
Was the only answer that helped me with a MacOS M2 chip. Thank you.Nasser
it was the coffee, right?Armada
Homebrew is awful on older versions of OS X, such as you might want to use with an old machine you're not ready to simply throw in the trash. And colima doesn't install with MacPorts. "Error: Failed to build spice-server: command execution failed".Singularize
The above worked for me, however, to get some other services to work properly, I also had to create a symlink like the following, in case it helps anyone else: sudo ln -s ~$USER/.rd/docker.sock /var/run/docker.sockSawn
This is really helped me!!Fortyfive
H
51

I had this same issue I solved it in the following steps:

docker-machine restart

Quit terminal (or iTerm2, etc, etc) and restart

eval $(docker-machine env default)

I also answered it here

Hutchison answered 11/2, 2018 at 7:9 Comment(3)
The eval one "should" be all you need :)Genera
I get -bash: docker-machine: command not found.Rationale
docker machine is deprecated, the repo is lockedSaba
D
37

I have Mac OS and I open Launchpad and select docker application. from reset tab click on restart.

Danyluk answered 8/3, 2019 at 22:16 Comment(2)
Yes, you have to launch the Docker application first hahaBittner
This one is a common failure among specialists, no sarcasm.Trull
T
30

For me Re-starting docker, didn't help. (Tried with both through terminal and UI)

The below option was unchecked, so I made it checked. After this I was able to run my container Setting -> Advanced -> Enabled default Docker socket(Requires Password)

Note - It will require admin Credentials.

enter image description here

Tenaille answered 10/5, 2023 at 14:53 Comment(3)
This fixed my issue in Rubymine with the latest version of Docker for the error. Thank you!Crude
fixed the issue for me as well running on MacOsUnexampled
I was about to post this solution, thanks pal!Amoeba
S
18

Try this to create default.

docker-machine create default
Spry answered 26/5, 2017 at 14:9 Comment(5)
this just gave me ... docker-machine create default Creating CA: /Users/stens/.docker/machine/certs/ca.pem Creating client certificate: /Users/stens/.docker/machine/certs/cert.pem Running pre-create checks... Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path" .... which seems wrong since VirtualBox no longer is necessary to run docker on osxEver
Appears you can use xhyve as well, see https://mcmap.net/q/56809/-how-to-run-quot-docker-machine-create-quot-in-os-x or just install virtualbox :)Genera
And.. so what ?Titanate
@Titanate OK I added an answer to attempt to clarify.Genera
docker machine is deprecated. the repo is locked.Saba
E
11

on OSX assure you have launched the Docker application before issuing

docker ps

or docker build ... etc ... yes it seems strange and somewhat misleading that issuing

docker --version

gives version even though the docker daemon is not running ... ditto for those other version cmds ... I just encountered exactly the same symptoms ... this behavior on OSX is different from on linux

Ever answered 6/6, 2017 at 0:51 Comment(0)
S
11

To extend other answers - after spending all morning on this exact issue and none of the other answers helped, finally I discovered that docker was trying to access the wrong path for docker.sock (!!) because some months ago I installed colima.

Running this helped me switch back:

docker context use default

Stonework answered 20/10, 2022 at 12:54 Comment(2)
I think this is what did it for me as well - I also had installed Colima a while back. But I needed to restart Docker and open a new terminal. Not sure both necessary, but it's working now. Thanks!Hoagland
This did the trick for me. After switching back to Docker Desktop from Orbstack.Jeep
T
10

Install minikube and come join the dark side.

https://kubernetes.io/docs/tasks/tools/install-minikube/

$ bash --version
GNU bash, version 5.0.3(1)-release (x86_64-apple-darwin18.2.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

eval $(minikube docker-env)

$ docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate     -i /local/swagger.json     -l python     -o /local/test/
[main] INFO io.swagger.parser.Swagger20Parser - reading from /local/swagger.json
[main] WARN io.swagger.codegen.DefaultGenerator - 'host' not defined in the spec. Default to 'localhost'.

Works great on Macbook Pro 2018 with bash v5. No need to install all the other docker nonsense these days IMO. The VM and install script that comes with minikube can replace docker machine from my experience.

Tanah answered 17/4, 2019 at 6:39 Comment(4)
As a follow up comment, I needed docker as well for another project w/o kube and the docker desktop works great. Just don't start it up always or else kube gets angry from this post.Tanah
minikube and eval $(minikube docker-env) does not resolve the issue for me.Ambala
Is Docker Desktop installed? Try using Wireshark to view the packets and connections. The env command will show the environment variables. That should give some insights on the macos networking layers. With minikube, the Kaniko builder is likely a better solution come 2022.Tanah
I am using minikube instead of docker desktop and this worked for me.Hyalite
J
10

This did the trick for me:

open --background -a Docker

Takes some seconds until you can connect to docker.

I am on a Mac OS Big Sur.

Jay answered 14/1, 2022 at 9:52 Comment(3)
Unable to find application named 'Docker'Nomen
@Nomen I am not sure if it is relevant. I am on a Mac OS Big Sur. I included that in my answer.Jay
Docker app should be installed firstly with brew install --cask dockerPeen
C
10

Just opening Docker Desktop worked for me.

Crust answered 24/5, 2022 at 8:33 Comment(2)
Docker Desktop now requires a paid subscription for commercial useSaba
This was the solution for meRoney
B
7

I had docker up to date, docker said it was running, and the diagnosis was good. I needed to unset some legacy environment variable (thanks https://docs.docker.com/docker-for-mac/troubleshoot/#workarounds-for-common-problems )

unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_TLS_VERIFY
Breastbeating answered 18/7, 2018 at 2:36 Comment(2)
this fixed my issue after an update from VM based docker to the Mac Installer. It kept looking for the VM.Croak
use this if you see a wrong IP address in 'Cannot connect... etc'Croak
G
7

This problem:

$ brew install docker docker-machine
$ docker ps

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

This apparently meant do the following:

$ docker-machine create default # default driver is apparently vbox:
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
$  brew cask install virtualbox
…
$ docker-machine create default 
# works this time
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ eval "$(docker-machine env default)"
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

It finally works.

You can use the “xhyve” driver if you don’t want to install virtual box. Also you can install the “docker app” (then run it) which apparently makes it so you don’t have to run some of the above. brew cask install docker then run the app, see the other answers. But apparently isn't necessary per se.

Genera answered 21/9, 2020 at 19:37 Comment(0)
B
7

In my case, MacOS asked me to give docker access to run the default socket. I cancelled by mistake. However, in the advanced settings section I found the setting. After checking it and restarting docker, the permission issue got resolved.

enter image description here

enter image description here

Botheration answered 23/11, 2023 at 12:33 Comment(1)
Ding! Ding! Ding! We have a winner!!! I wish this answer was at the top; it's such an easier thing to check for than the top answers. It fixed my issue, thank you!!!Adachi
E
5

I had the same problem. Docker running but couldn't access it through CLI.

For me the problem was solved by executing "Docker Quickstart Terminal.app". This is located in the "/Applications/Docker/" folder. As long as I work in this instance of the Terminal app Docker works perfectly. If a second window is needed I have to run the "Quickstart" app once more.

I have a Docker for Mac installation. Therefore I am not sure if my solution is valid for a Homebrew installation.

The "Docker Quickstart Terminal" app seems to be essentially some applescripts to launch the terminal app and a bash start script that initialise all the necessary environment variables.

Hope this helps someone else !

Ezekiel answered 4/1, 2018 at 14:23 Comment(0)
E
4

You should execute script for install docker and launch it from command line:

brew install --cask docker
sudo -H pip3 install --upgrade pip3
open -a Docker
docker-compose ... 

after that docker-compose should work

Ethicize answered 13/5, 2020 at 20:15 Comment(0)
R
3

I was facing similar issue on my mac, and I found that docker wasn't running in my machine, I just went to applications and invoked whale and then it worked .

Richburg answered 13/9, 2019 at 9:22 Comment(0)
B
2

Docker was designed to run on Linux. It can, however, run in a VM on macOS. To do so is a bit of a kludge and that's perhaps why Docker Desktop exists in the first place. But that doesn't mean you can't enjoy using Docker from the comfort of the command line on a Mac.

Some options to consider:

  1. You could use lima and add an alias docker='lima nerdctl' to your bash profile.
  2. You could install a Linux VM on your machine and use it instead (not recommended).
  3. Dual-boot Linux on Mac. Even machines with the T2 and M1 chips are supported now.
Birthplace answered 6/2, 2022 at 6:15 Comment(0)
S
2

The one hack which always works for me even on Mac Ventura 13.3.1 is

stop docker

Remove docker sock

sudo rm /var/run/docker.sock

Start docker again.

Springhouse answered 25/4, 2023 at 19:20 Comment(0)
S
1

With the updated version of VirtualBox (6.1.32r149290), the command docker-machine create --driver virtualbox default doesn't work, there is an error with auto-generated IP for the Virtual VM, explanation is here https://mcmap.net/q/56810/-e_accessdenied-when-creating-a-host-only-interface-on-virtualbox-via-vagrant-closed .

This command helped me to resolve the issue: docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.59.3/24" default.

Snoop answered 22/3, 2022 at 21:25 Comment(0)
R
1

Another solution for me (on the Apple Silicon) was to install rancher or Podman, but Podman has some issues while importing the libraries (i.e. paho_mqtt for Rust).

brew install rancher

Then starting the App and choose the service to start the VM.

Rend answered 27/3, 2023 at 13:5 Comment(1)
This is the answer for me - can't use docker Desktop due to licensing concerns.Resentment
M
1

I had the similar problem. And probably my particular case/solution can help others also.

Prerequisites:

I have MacOS (M1 chip) and installed Docker App. Docker Engine v20.10.23.

In my particular case I've tried to run spring-boot:build-image command in Maven with IntelijIdea to make a Docker Image for a service.

In response I had - [2] No such file or directory

And in IntelijIdea console I had - [INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [2] No such file or directory

So, initially, I run in Mac terminal docker ps . It returned "Cannot connect to the Docker daemon at tcp://localhost:2376. Is the docker daemon running?"

Solution:

So I followed the next steps, as advised in another comments:

  1. run in terminal brew install --cask docker From the @friederbluemle answer above the explanation is next: "Because docker is a system-level package, you cannot install it using brew install, and must use --cask instead."

I suppose that initially I installed Docker with brew install, so probably it was the part of this issue.

  1. run Docker App
  2. run in terminal export DOCKER_HOST=unix:///var/run/docker.sock

After that when I run in terminal docker ps , it returned table columns CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES and command spring-boot:build-image works fine.

Margertmargery answered 12/4, 2023 at 7:41 Comment(1)
Thanks @rsnlpn, i added export DOCKER_HOST=unix:///var/run/docker.sock in my .zshrc and done!Chartist
I
0

I first tried docker and docker-compose via homebrew, but it had the problem listed here. I had to install docker's official install from https://docs.docker.com/docker-for-mac/install/ and then everything worked as expected.

Ingressive answered 17/4, 2018 at 10:59 Comment(0)
P
0

i simply had to run spotlight search and execute the Docker application under /Applications folder which brew cask install created. Once this was run it asked to complete installation. I was then able to run docker ps

Prickle answered 19/12, 2018 at 18:36 Comment(0)
M
0

Tried the following and its working fine now

$ docker-machine create default
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet0"
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!

Then

$ docker-machine env default

Finally

$ eval $(docker-machine env default)
$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
Miyamoto answered 3/6, 2021 at 19:57 Comment(1)
docker machine is deprecated. the repo is locked. The last update was more than 3 years agoSaba
S
0

I run brew install docker-machine; then the problem is solved. The latest docker version does not have docker-machine included.

Straticulate answered 15/8, 2021 at 5:44 Comment(2)
docker machine is deprecatedSaba
Docker machine is deprecated because docker.com only wants to support the proprietary docker desktop on mac. For medium-to-large companies, this involves substantial license fees. Use docker-machine as long as it works (or choose alternatives such as colima) if you work for such a company.Hello
M
0

Install Docker Desktop form given url

https://www.docker.com/products/docker-desktop/

Go to setting on top right corner

  • Goto General
  • Tick on Start Docker Desktop when you login you
Mcchesney answered 5/8, 2022 at 17:43 Comment(0)
A
0

If you are running into this issue with lima on Mac OSX, check to ensure the docker instance is running using limactl list. In my case the default instance was running but docker was not after a reboot. You may want to add limactl start docker into your Shell config, e.g. ~/.zshrc

➜ docker ps
Cannot connect to the Docker daemon at unix:///Users/xxxx/.lima/docker/sock/docker.sock. Is the docker daemon running?

➜ limactl list

NAME       STATUS     SSH                VMTYPE    ARCH      CPUS    MEMORY    DISK      DIR
default    Running    127.0.0.1:60022    qemu      x86_64    4       4GiB      100GiB    ~/.lima/default
docker     Stopped    127.0.0.1:50310    qemu      x86_64    4       4GiB      100GiB    ~/.lima/docker

➜ limactl start docker

...(lima log output)

➜ limactl list

NAME       STATUS     SSH                VMTYPE    ARCH      CPUS    MEMORY    DISK      DIR
default    Running    127.0.0.1:60022    qemu      x86_64    4       4GiB      100GiB    ~/.lima/default
docker     Running    127.0.0.1:50310    qemu      x86_64    4       4GiB      100GiB    ~/.lima/docker

➜ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
Ambala answered 12/4, 2023 at 22:52 Comment(0)
G
0

Get the right link from https://www.docker.com/.

Either Intel chip or Mac chip. Then install manually.

It should work fine after that.

Genniegennifer answered 25/4, 2023 at 16:48 Comment(0)
B
0

My problem was resolved simply by running the following command on Ventura 13.0 (M2 Pro CPU Architecture), like the command working on Linux Distros:

sudo chown $USER /var/run/docker.sock

Then you should logout from your account or restarting Docker desktop and you can evaluate whether it works properly or not by executing docker ps command.

Burnejones answered 1/5, 2023 at 18:17 Comment(0)
C
0

Input Command = docker ps

Output = Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

If this you facing on your Mac then follow the following steps.

  1. Start the docker application from Spotlight search
  2. Once docker is running then use docker ps or docker info command
Crampton answered 26/6, 2023 at 12:37 Comment(1)
I don't have docker on spotlight searchSewell
T
0

I got a similar case in MacOS docker desktop, that PHPStorm is not recognizing any container and report socket not found or docker is not running. I found in docker app => settings => advanced => checkbox : Allow default Docker socket to be used. After I check this and restart docker app, it works okay. Just a tip for docker beginners like me. Thanks,

Trawl answered 28/9, 2023 at 1:56 Comment(0)
H
0

Another suggestion (2023), since docker-machine is deprecated (2022):

OrbStack (free for personal use)

OrbStack is the fast, light, and easy way to run Docker containers and Linux. Develop at lightspeed with our Docker Desktop alternative.

  • Lightning fast: Starts in seconds with turbocharged networking, smooth Rosetta x86 emulation, VirtioFS file sharing, and other optimizations for some workloads.
  • Unbelievably simple: Drop-in replacement for Docker Desktop. Easily get started with Linux machines in 1 minute with the simple, yet powerful, app and command line.

So:

I normally prefer to manage my apps on my OSX with brew

brew install orbstack
docker run -p 80:80 docker/getting-started
Hatchway answered 28/9, 2023 at 8:40 Comment(0)
C
0

For macOS (Docker Desktop):

Docker Desktop for macOS does not natively support this feature. However, you can use socat, a multipurpose relay, to achieve the same effect.

  1. Install socat if you haven't already.
brew install socat

Run the following command to expose the Docker daemon:

socat TCP-LISTEN:23750,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock &

This command will need to be running as long as you want to access the Docker daemon at tcp://localhost:23750. You may want to set it up as a background service if you need it running all the time.

Clearwing answered 2/2, 2024 at 19:47 Comment(0)
S
-1

installing docker-machine was enough for me to solve the problem.

Selima answered 21/8, 2021 at 23:27 Comment(1)
docker machine is deprecatedSaba
M
-1

QUICK AND SIMPLE

Install Docker Desktop form given url

https://www.docker.com/products/docker-desktop/

Go to setting on top right corner

  • Goto General
  • Tick on Start Docker Desktop when you login you
Mcchesney answered 5/8, 2022 at 17:44 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.