Install Docker on macOS
Installing Docker on macOS is straightforward with Docker Desktop. This guide covers the complete setup process for Mac users.
System Requirements
- macOS 10.15+ (Catalina or newer)
- At least 4GB RAM
- Virtualization enabled in BIOS
Method 1: Docker Desktop (Recommended)
Docker Desktop provides an all-in-one solution with GUI, Docker Engine, Docker Compose, and Kubernetes support.
Download Docker Desktop
- Visit Docker Desktop for Mac
- Download the Docker Desktop installer
- Double-click the
.dmgfile - Drag Docker to your Applications folder
Initial Setup
- Launch Docker Desktop from Applications
- Accept the Docker Desktop Service Terms
- Enter your system password when prompted
- Docker will start and the whale icon will appear in your menu bar
Verify Installation
Open Terminal and run:
docker --version
docker compose version
docker run hello-worldMethod 2: Homebrew Installation
Install Docker Desktop via Homebrew
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Docker Desktop
brew install --cask dockerStart Docker Desktop
open /Applications/Docker.appMethod 3: Manual Docker Engine Installation (Advanced)
For users who prefer command-line Docker without GUI:
Install Docker Engine
brew install docker docker-composeInstall Docker Machine (for older macOS versions)
brew install docker-machineStart Docker Service
# Using Docker Machine (older method)
docker-machine create --driver virtualbox default
eval $(docker-machine env default)
# Using colima (modern alternative)
brew install colima
colima startDocker Desktop Configuration
Resource Allocation
- Click Docker Desktop menu bar icon
- Go to Settings > Resources
- Adjust memory, CPU, and disk space as needed:
- Memory: 4GB+ (recommended 8GB)
- CPU: 2+ cores
- Disk: 64GB+ (for image storage)
File Sharing
- Go to Settings > Resources > File Sharing
- Add your project directories
- This allows containers to access local files
Kubernetes (Optional)
- Go to Settings > Kubernetes
- Enable Kubernetes
- Wait for installation to complete
Command Line Tools
Docker Compose v2 (Plugin)
Docker Desktop includes Docker Compose as a plugin:
docker compose versionUseful Aliases
Add to your ~/.zshrc or ~/.bash_profile:
# Docker aliases
alias d='docker'
alias dc='docker compose'
alias dps='docker ps'
alias di='docker images'
alias d logs='docker logs -f'Development Integration
VS Code Integration
Install the Docker extension from Microsoft:
- Open VS Code
- Go to Extensions
- Search “Docker”
- Install Microsoft Docker extension
IntelliJ IDEA Integration
- Go to File > Settings > Plugins
- Search and install “Docker” plugin
- Configure Docker connection
Common Issues and Solutions
Docker Desktop Won’t Start
# Reset to factory defaults
# Click Docker Desktop icon > Troubleshoot > Reset to factory defaultsPermission Denied Errors
# Ensure Docker Desktop is running
open /Applications/Docker.app
# Check Docker daemon
docker infoPort Conflicts
# Check what's using the port
lsof -i :8080
# Change Docker port mapping
docker run -p 8081:80 nginxOut of Disk Space
- Clean unused images:
docker system prune -a- Increase disk allocation in Docker Desktop Settings
Slow Performance
- Increase memory allocation in Docker Desktop
- Use
.dockerignorefiles - Mount volumes efficiently
Production Considerations
Using Docker Compose
Create docker-compose.yml:
version: '3.8'
services:
web:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
environment:
- NODE_ENV=developmentMulti-Container Development
# Start all services
docker compose up -d
# View logs
docker compose logs -f
# Stop all services
docker compose downSecurity Best Practices
Regular Updates
Keep Docker Desktop updated:
brew upgrade --cask dockerImage Security
# Scan images for vulnerabilities
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
aquasec/trivy image your-image-nameSources
For Linux installation, see our Docker Linux setup. Windows users should check our Windows Docker installation.