DEV Community

Cover image for How to use Docker without Docker Desktop on MacOS πŸ“¦

How to use Docker without Docker Desktop on MacOS πŸ“¦

Elliot Alexander on October 29, 2022

Preamble I think a lot of large software teams have struggled with Docker's licensing changes for Docker Desktop. I know it was a shock ...
Collapse
 
rswrz profile image
Roman Schwarz

I am pretty new to Mac OS and never used Docker Desktop on Mac, instead jumped directly on an alternative to Docker Desktop. What I really like about Colima, that I can have multiple Docker (and Kubernetes) instances. This is handy when you are on an ARM processor (M1 e.g.) but need to build and run x86 containers. Colima allows me to spin up multiple instances with different platforms and configuration. Docker CLI allows to quickly jump between different Docker instances with docker context.

Collapse
 
hilleer profile image
Daniel Hillmann

We had the same concern and discussion in the company i work. In the end I think a big reason for going with docker licensing was the fact that $5/mo is quickly spend in development hours if one have to fight their container setup every now and then.

Collapse
 
elliotalexander profile image
Elliot Alexander

100%. It's definitely a far cleaner option, way easy to manage generally and for $5, it's fantastic all in one solution. I think in the case of the company I'm working at, containers don't play a huge part in our stack and most devs don't necessarily need them running at all times. As a result, $5 per users stacks up to a significant cost when most devs aren't using them day to day, so a relatively quick workaround like this can be super helpful.

Collapse
 
orliesaurus profile image
orliesaurus

I don't really know how to do it - because I didn't look into it that much - but you can technically have docker run on a VPS and basically over SSH tunnel run everything on the VPS with code updates on git push or using rsync

That way your docker runs in a VPS, you have full access via SSH, and your laptop stays very cool and has an excellent battery life.

Collapse
 
rswrz profile image
Roman Schwarz

Technically possible, but problematic with local volume mounts. This is the same when you run docker natively in a local VM. Colima, so Docker Desktop on Mac or Windows, closes this and other gaps very elegant.

Collapse
 
rswrz profile image
Roman Schwarz

Did you try to use the env DOCKER_HOST instead of linking the docker.sock? Most tools consider this env, not sure about AWS SAM.

Collapse
 
elliotalexander profile image
Elliot Alexander

That's a good point actually, I think I assumed Docker or Colima might update it to match the current context but maybe it's not. I did notice from some other tooling (LocalStack I think), that there appeared to be a python library for interacting with Docker that didn't seem to respect the active context. I will do some testing and report back :)

Collapse
 
lamri_abdellahramdane_15 profile image
Lamri Abdellah Ramdane

This is a very helpful guide for developers who want to avoid using Docker Desktop for various reasons. It provides a solid solution using Homebrew and Colima, and even addresses a common issue with symlinks. For developers who want to simplify this process and get a complete, pre-configured local development environment, Servbay is an excellent tool that saves you from all these individual configurations.

Collapse
 
stokestack profile image
G

Unfortunately this is not a viable solution, because Docker Compose will be missing. There's no apparent way to install it manually on Mac, either.

Collapse
 
ajcwebdev profile image
ajcwebdev

Actually, it is possible to make this setup work with Compose. I was able to get my project working with the following sequence of commands:

# Delete any configuration from previous installs
rm ~/.docker/config.json

# Install Colima, Docker, Compose, and Credential Helper
brew install colima docker docker-credential-helper docker-compose

# Set symlink
sudo ln ~/.colima/default/docker.sock /var/run

# Start Colima
colima start

# Check status
colima status
Enter fullscreen mode Exit fullscreen mode

Terminal output:

INFO[0000] colima is running using QEMU                 
INFO[0000] arch: aarch64                                
INFO[0000] runtime: docker                              
INFO[0000] mountType: sshfs                             
INFO[0000] socket: unix:///Users/ajc/.colima/default/docker.sock 
Enter fullscreen mode Exit fullscreen mode

My specs for reference:

  • Chip:
    • Apple M3 Pro
  • System Version:
    • macOS 14.6.1 (23G93)
  • Kernel Version:
    • Darwin 23.6.0 (RELEASE_ARM64_T6030)
  • Processor type:
    • arm64e (ARM64E)
Collapse
 
stokestack profile image
G

Thanks. I encountered a bug in Colima that made it unworkable (something about mounting volumes, if I recall; I did report it), so I'm using Orbstack and everything seems to be running fine.