SalmonKiller
SalmonKiller

Reputation: 2203

Docker - Replacement for `dockerd` on Mac

I wanted to start the docker daemon with an open TCP address like this: docker daemon -H tcp://0.0.0.0:2375, but the terminal suggested that I use dockerd instead, which is apparently not a program that comes with the Docker Client for mac. Is there a way I can either

?

Upvotes: 10

Views: 11707

Answers (6)

VonC
VonC

Reputation: 1325427

get around the use of dockerd by some other method. (2016)

Note that in 2022, you can go without dockerd/Docker Desktop entirely.

See Batuhan Apaydin's article "A modern toolkit to start working with container images on macOS that meets your needs without requiring a Docker Daemon or even Docker Desktop".

It uses lima+nerdctl

The nerdctl tool is designed as a drop-in replacement for the Docker client

And Lima is a hypervisor that launches Linux virtual machines with automatic file sharing, port forwarding, and containerd.

The name of lima comes from an abbreviation of the first two capital letters of LInux MAchines.

The design of Lima is similar to WSL2, but Lima focuses on macOS as the primary target host.
Lima uses QEMU, which is a generic and open source machine emulator and virtualizer, as a hypervisor under the hood to achieve the virtualization thing.

Lima can also work with other container engines such as Podman and even for non-container applications.

By default, when lima launches a VM, it runs buildkitd and containerd in a rootless way and also downloads necessary client tooling around them such as buildctl, nerdctl.
Everything will be set up for us. So, all that’s left is building, pulling, and running containers

For buildkit, Batuhan proposes developer-guy/buildkit-machine

buildkit-machine allows you to make buildkitd daemon accessible in your macOS environment.

To do so, it uses lima, which is a Linux subsystem for macOS, under the hood.
lima spins up a VM that runs buildkitd daemon in a rootless way which means that sock file of the buildkitd daemon is now be able to accessible from /run/user/<USERID>/buildkit/buildkitd.

So: no more Docker Desktop / dockerd, and use container in a rootless mode!

For more, see Bret Fisher's video "Free Docker Desktop Alternatives: DevOps and Docker Live Show (Ep 156)" (Jan. 2022)

Upvotes: 3

Rohit Kumar
Rohit Kumar

Reputation: 1321

If you want to do any specific configuration on mac, you might have already installed Docker Desktop. Docker desktop supports configuration using UserInterface shown below in the screenshot.

enter image description here

Upvotes: 0

chris
chris

Reputation: 2863

Finally I found the config of mac docker like dockerd.

Click the docker icon in the menu bar, preferences, advanced

docker config

Upvotes: 4

Lukewcn
Lukewcn

Reputation: 698

Install socat command: brew install socat Choose a port: (in the example 8099)
Run: socat -d -d TCP-L:8099,fork UNIX:/var/run/docker.sock
and then use tcp://localhost:8099 as API URL

works for me, hope this helps

Upvotes: 7

Fish Monitor
Fish Monitor

Reputation: 4565

It is not supported to run dockerd on Mac. From this issue:

I think on Darwin it should never suggest to run dockerd. The daemon runs in a Linux virtual machine, so you do not need to (and cannot) run it manually.

Upvotes: 0

Botz
Botz

Reputation: 192

I have found a workaround for this in the official forum

https://forums.docker.com/t/using-pycharm-docker-plugin-with-docker-beta/8617/9

$socat TCP-LISTEN:2376,reuseaddr,fork UNIX-CLIENT:/var/run/docker.sock

That workaround opens port 2376 to the world... as TLS isn't enabled, this is a bad idea as anyone on the same network can hijack your docker daemon

Upvotes: 0

Related Questions