Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Docker without Docker Desktop #421

Closed
swyxio opened this issue May 27, 2022 · 9 comments
Closed

Running Docker without Docker Desktop #421

swyxio opened this issue May 27, 2022 · 9 comments

Comments

@swyxio
Copy link
Owner

swyxio commented May 27, 2022


category: note

Docker is great. Docker Desktop sucks. Here's my fix.

TL;DR

  1. brew install colima (colima replaces the docker/dockerd binary)
  2. Install the right docker-compose binary for your chipset from the releases page
    • sudo curl -L https://github.com/docker/compose/releases/download/v2.5.1/docker-compose-darwin-aarch64 -o /usr/local/bin/docker-compose for M1 Macs
    • chmod +x /usr/local/bin/docker-compose to let it execute

Now you can start the docker daemon with colima start. You'll need to do this the first time you run the docker binary in every session.

You can also run docker-compose up as per normal but without needing Docker Desktop.

Context

Although I am known for loving Docker (the containerization technology), I am also known for being a critic of Docker Desktop (the desktop UI client for Docker) for its poor performance:

image

The constant upgrade nags until you pay them also don't inspire any love whatsoever.

Docker Desktop is Docker (the company)'s first wedge into getting you to run proprietary software, so Docker strongly guides you to download it as the only way to get started:

In fact, new users can go pretty far without even realizing that you don't need Docker Desktop to run the Docker daemon. I've asked multiple people how to do it and nobody had a good answer, or at least, nobody had an answer that worked on M1 Macs, until now.

For my 2022 New Mac Setup guide I resolved to figure it out once and for all, and what you see here is what I ended up with!

OK I'm ready to try it!

You already missed the instructions. scroll up to TL;DR :)

Troubleshooting 1

A user reported this issue with colima:

FATA[0000] error starting vm: error at ‘starting’: exit status 1

try reinstalling:

brew unlink colima # If it is already installed, uninstall it first

brew install --HEAD colima

colima start --runtime docker

docker ps # success 

Troubleshooting 2

In the comments, @sreetamdas reported Cannot connect to the Docker daemon at unix:///var/run/docker.sock. errors.

# In order to use the `docker` runtime:
brew install docker

# Start colima
colima start --runtime docker


# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock"

Nov 2022 Edit: Podman

you could also try Podman: https://podman-desktop.io/ https://news.ycombinator.com/item?id=33536978#33539372

Oct 2023 update: Orbstack

https://orbstack.dev/

@GreenHatHG
Copy link

after brew install docker may be need to brew link docker

@swyxio
Copy link
Owner Author

swyxio commented Jun 27, 2022

i dont actually run brew install docker anywhere - this is supposed to use colima

@havenchyk
Copy link

@sw-yx I tried following your instruction twice and got this error

INFO[0000] starting colima
INFO[0000] runtime: docker
FATA[0000] dependency check failed for docker: docker not found, run 'brew install docker' to install

that's why I think people mention to run brew install docker

@GreenHatHG
Copy link

GreenHatHG commented Jul 19, 2022 via email

@sreetamdas
Copy link
Contributor

sreetamdas commented Oct 15, 2022

While trying to run https://github.com/supabase/cli I kept running into the following error:

Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  in github.com/supabase/cli/internal/utils.AssertDockerIsRunning:40
  in github.com/supabase/cli/internal/start.Run:43

For anyone running into this issue, you will need to do the following:

# In order to use the `docker` runtime:
brew install docker

# Start colima
colima start --runtime docker


# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock"

@nandudb
Copy link

nandudb commented Nov 16, 2022

╰─ colima list
PROFILE    STATUS     ARCH      CPUS    MEMORY    DISK     RUNTIME    ADDRESS
default    Running    x86_64    4       12GiB     60GiB    docker

─ docker ps
Cannot connect to the Docker daemon at tcp://localhost:2375/Users/$HOME/.colima/default/docker.sock. Is the docker daemon running?```

Copy link

Awesome, my computer runs so much faster

@swyxio
Copy link
Owner Author

swyxio commented Apr 12, 2024

  1. i had issues with a hanging colima stop and this helped me: Colima hangs on macOS, cannot stop abiosoft/colima#987
brew install --HEAD colima
colima start --runtime docker
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock"

this did require an update of Xcode which was INCREDIBLY annoying

@GreenHatHG
Copy link

GreenHatHG commented Apr 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants