Is the docker daemon running mac os

Can’t connect to Docker containers on OSX

I’m new to Docker, and I can’t seem to connect to any containers.

I installed Docker Toolbox. Now I’m trying to get Shipyard to work. I followed the steps inside of a Docker Quickstart Terminal. The instructions say:

Once deployed, the script will output the URL to connect along with credential information.

The Shipyard installer ended with:

However, I went to http://10.0.2.15:8080 on my browser and it didn’t connect.

In another Docker Quickstart Terminal, I did a docker ps to see what the container was and to get its IP Address and I got:

I’m not sure why the IP was different, but I tried to connect to http://172.17.0.8:8080 and this didn’t work either. http://localhost:8080 also failed.

This also happened when I tried to run docker-gunicorn-nginx — everything started, but I couldn’t connect to the machine.

2 Answers 2

If you read through Docker’s Installation on Mac OS X you’ll see that on OSX, Docker containers don’t run on the host machine itself:

In a Docker installation on Linux, your physical machine is both the localhost and the Docker host. In networking, localhost means your computer. The Docker host is the computer on which the containers run.

On a typical Linux installation, the Docker client, the Docker daemon, and any containers run directly on your localhost. This means you can address ports on a Docker container using standard localhost addressing such as localhost:8000 or 0.0.0.0:8376.

In an OS X installation, the docker daemon is running inside a Linux VM called default. The default is a lightweight Linux VM made specifically to run the Docker daemon on Mac OS X. The VM runs completely from RAM, is a small

24MB download, and boots in approximately 5s.

In OS X, the Docker host address is the address of the Linux VM. When you start the VM with docker-machine it is assigned an IP address. When you start a container, the ports on a container map to ports on the VM. To see this in practice, work through the exercises on this page.

Indeed, opening a new Docker Quickstart Terminal, I see:

Источник

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

Comments

thesilverbadger commented Aug 1, 2016

This has just started very recently (last ran Docker last week). Looks to be a duplicate of #42, although that issue is sparse of details.

Читайте также:  Виды служебные приложения windows

Diagnostic ID: DEDC5D44-B2E1-4661-8003-309D06286A47
Docker for Mac: 1.12.0 (Build 10871)
macOS: Version 10.11.6 (Build 15G31)
[ERROR] docker-cli
/var/run/docker.sock does not exist
Permission denied (EACCES) connecting to /var/run/docker.sock: check permissions
docker ps failed
[OK] app
[OK] moby-syslog
[OK] disk
[OK] virtualization
[OK] system
[OK] menubar
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

Steps to reproduce

  1. Running any docker commands in Terminal (e.g. docker info).
  2. I’ve tried resetting and uninstalling using the Uninstall/Reset option in Preferences, then reinstalling using a fresh download. No luck.

The text was updated successfully, but these errors were encountered:

thesilverbadger commented Aug 1, 2016

To follow up on this, installing on a different Mac that hasn’t had Docker for Mac installed before works correctly. So seems to be an update problem?

dkvk commented Aug 2, 2016

Hi, I have this issue as well.

I found out that the symlink to the docker.sock was linked wrong. It’s easy to work around, although it’s a hack and I hope it’s getting fixed in later versions.

To find out if your docker.sock file is wrongly linked do:

The link is to a file under /var/root which seems to be wrong.

The hack around this is to recreate the symlink to where it should live:
sudo ln -sf

/Library/Containers/com.docker.docker/Data/s60 /var/run/docker.sock
This should recreate the symlink pointing to the right file under your user folder.

And as you can see the docker.sock file is now linked to the corresponding file under the users folder.

It seems that this has to be done every time you start/restart Docker on the computer.

jonashaag commented Aug 9, 2016

Same problem, just installed Docker for Mac, never had Docker on the machine before. I used the stable .dmg from the official site and haven’t changed any settings — so, pretty much a vanilla setup that should just work.

adi-li commented Aug 17, 2016

Same issue here, but my symlink is linked to /var/_xcsbuildd/Library/Containers/com.docker.docker/Data/s60 .

The problem was found after I installed the Xcode Server.

jamieshaw commented Sep 1, 2016

Me too. Same problem, enabling Xcode Server (Xcode server was configured but disabled before Docker installation) changed the symlink of the socket to:
/var/_xcsbuildd/Library/Containers/com.docker.docker/Data/s60

djs55 commented Sep 6, 2016

I’ve created a patch to improve the way we compute the symlink directory, which will hopefully fix this issue. Unfortunately it’s too late for beta 25 but it should be in beta 26. I’ll let you know when the patch is available for testing.

mchiang0610 commented Sep 13, 2016

Closing since it may be fixed. Otherwise, may also be similar to #119

rkommisetty commented Nov 8, 2017

When I installed docker using brew cask install docker on my mac. I couldn’t even find the docker.sock file in /var/run folder.

Then I uninstalled docker using brew cask uninstall docker and then downloaded the .dmg file from docker website

and installed it. Everything looks normal now. I can run docker as expected.

Источник

Mac OS X sudo docker Cannot connect to the Docker daemon. Is the docker daemon running on this host?

I installed docker and there seems to be some issue.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

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

What should I do?

Читайте также:  Системные требования для операционной системы linux

7 Answers 7

You need to set up your shell to use Docker: eval $(docker-machine env default) Where does this command come from? Run docker-machine env default and you’ll see something like the following:

Also you may or may not have to simply start the Docker host beforehand via: docker-machine start default

docker-machine is a legacy stuff for OSX that operates with VirtualBox. What you should do is get rid of it completely, and then you should download the latest version of docker, that is called Docker for Mac

Make sure, you remove the legacy docker, and the docker-machine from your Mac before installing Docker for Mac. If you do not do that, the legacy docker binary will be favoured after the installation, and you will still get the error message, which says that cannot connect to the Docker daemon.

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

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

I just had this problem. I was using the old docker-machine and I switched to the latest docker for mac. Running eval $(docker-machine env default) sets up some environment variables.

To solve my problem, I unset those environment variables.

unset DOCKER_HOST DOCKER_MACHINE_NAME DOCKER_TLS_VERIFY DOCKER_CERT_PATH

if you are using docker toolbox, type this before running the docker ps command to set the environment

to have it persistent on new terminals & reboot put it to the bash_profile file

remove the export DOCKER_HOST. from your environment (.bashrc, .bash_profile what have you), restart shell/terminal, worked for me.

Not the answer you’re looking for? Browse other questions tagged macos docker or ask your own question.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Docker deamon config path under mac os

I am using docker in Version 1.12.0 (build 10871) on Mac OS (El Capitan 10.11.4) and I want to provide a config file for the docker daemon.

Under Ubuntu you place the config under /etc/default/docker (see docs). Unfortunately, I cannot figure out where to place the config in Mac OS

/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 . I haven’t found any config outside of it yet.

4 Answers 4

Docker 19+

Config file is now available in

Docker EE/CE 17+

Docker for Mac/Windows has added a config editor to the tray icon UI to allow editing of Dockers daemon.json file that will be persisted in the VM.

To access it go to the Docker Icon > Preferences > Daemon > Advanced

Original Answer

The Docker for Mac VM is based on Alpine Linux. The init system is based on OpenRC.

You can attach a screen session to the VM’s tty (terminal) and poke around

The docker daemon config is in the usual spot

The /etc/init.d/docker script that manages the startup does not seem very configurable, apart from editing the script.

Читайте также:  Как сменить папку onedrive windows 10

/host_docker_app in the VM is a mount of the data in

/Library/Containers/com.docker.docker/Data/ from OSX. This seems like the most likely place to persist custom config but it doesn’t look like there is any interface to source/load config or anything at startup from there.

It looks like changes outside of /var or /host_docker_app will not persist over reboots. There was a mechanism to persist some startup config in the old boot2docker VM image but I haven’t found anything like it for the new VM.

Источник

Couldn’t connect to Docker daemon on Mac OS X

I would like to run multi-container application using docker-compose on Mac OS X El Capitan (v10.11.2).

However, the command $ docker-compose up command complains that it can’t connect to the Docker daemon.

ERROR: Couldn’t connect to Docker daemon — you might need to run docker-machine start default .

Only after executing $ eval «$(docker-machine env default)» I do have access to the docker-compose command.

Why is this and how can I overcome this extra step?

5 Answers 5

Update for Docker versions that come with Docker.app

The Docker experience on macOS has improved since this answer was posted:

The only prerequisite is now for Docker.app to be running. Note that starting it on demand takes a while, because the underlying Linux VM must be started.

Any shell then has access to Docker functionality.

By default, Docker.app is launched at login time (you can change that via its preferences).
If you instead prefer starting and stopping Docker on demand from the command line, here are bash scripts that do that, docker-start and docker-stop ; place them anywhere in your $PATH .

When docker-start launches Docker.app , it waits until Docker has finished starting up and is ready.

docker-start :

docker-stop :

Original, obsolete answer:

Kevan Ahlquist’s helpful answer shows what commands to add to your Bash profile (

/.bash_profile ) to automatically initialize Docker on opening an interactive shell.

Note that you can always initialize Docker in a new shell tab/window by opening application /Applications/Docker/Docker Quickstart Terminal.app (e.g., via Spotlight).
From an existing shell, you can invoke it as open -a ‘Docker Quickstart Terminal.app’ (which also opens a new shell tab).
What this answer offers is a convenient way to start Docker in the current shell.

Adding the Bash shell functions below — docker-start and docker-stop — improves on Kevan’s approach in the following respects:

You can run docker-start on demand, without the overhead of starting the VM on opening the shell (once the Docker VM is running, initialization is much faster, but still takes a noticeable amount of time).
(Of course, you can still opt to invoke docker-start right from your profile.)

docker-stop allows stopping Docker and cleaning up the environment variables on demand.

The functions ensure that Docker’s error messages are not suppressed, and they pass Docker error exit codes through.

Additional status information is provided.

You may pass a VM name as a parameter; default is default .

Shell functions for on-demand starting and stopping of Docker (place them in, e.g.,

/.bash_profile for global availability in your interactive shells).

Note: The functions work in bash , ksh , and zsh , but in ksh you have to rename them so as not to include a ‘-‘ in the function names.

Источник

Оцените статью