Environment Setup
Learn how to install and configure Docker, Kubernetes, and essential development tools. Set up a local development environment that mirrors production infrastructure.
Overview #
In this first step, you’ll set up a complete local development environment that mirrors production cloud-native infrastructure. This foundation will enable you to develop, test, and debug applications locally before deploying to production.
Step 1: Install Docker Desktop #
Docker Desktop provides an easy way to run containers on your local machine and includes Kubernetes support.
For macOS: #
# Download Docker Desktop from https://www.docker.com/products/docker-desktop
# Or install via Homebrew
brew install --cask dockerFor Windows: #
- Download Docker Desktop from the official website
- Run the installer and follow the setup wizard
- Restart your computer when prompted
For Linux: #
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add the repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker Engine
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.ioStep 2: Enable Kubernetes in Docker Desktop #
- Open Docker Desktop
- Go to Settings → Kubernetes
- Check Enable Kubernetes
- Click Apply & Restart
Wait for Kubernetes to start (this may take several minutes).
Step 3: Verify Your Installation #
Run these commands to verify everything is working correctly:
# Check Docker version
docker --version
# Check Kubernetes version
kubectl version --client
# Test Docker with a simple container
docker run hello-world
# Check Kubernetes cluster status
kubectl cluster-infoStep 4: Install Additional Development Tools #
kubectl (if not included with Docker Desktop) #
# macOS
brew install kubectl
# Windows (using Chocolatey)
choco install kubernetes-cli
# Linux
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectlHelm Package Manager #
# macOS
brew install helm
# Windows (using Chocolatey)
choco install kubernetes-helm
# Linux
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt update
sudo apt install helmk9s (Optional but Recommended) #
k9s provides a terminal-based UI for managing Kubernetes clusters.
# macOS
brew install k9s
# Windows (using Chocolatey)
choco install k9s
# Linux
curl -sS https://webinstall.dev/k9s | bashStep 5: Configure Your Development Environment #
Create a dedicated namespace for development:
kubectl create namespace dev-environment
kubectl config set-context --current --namespace=dev-environmentVerification Checklist #
Before proceeding to the next step, ensure you can run these commands successfully:
-
docker run hello-worldcompletes without errors -
kubectl get nodesshows your local cluster -
helm versiondisplays the installed version -
kubectl get namespacesshows yourdev-environmentnamespace
Troubleshooting #
Common Issues #
Docker not starting:
- Ensure your system meets the minimum requirements
- Check that virtualization is enabled in BIOS/UEFI
- Try restarting Docker Desktop
Kubernetes not starting:
- Increase Docker Desktop memory allocation to at least 4GB
- Reset Kubernetes cluster in Docker Desktop settings
- Check Docker Desktop logs for specific error messages
Permission denied errors (Linux):
# Add your user to the docker group
sudo usermod -aG docker $USER
# Log out and back in for changes to take effectWhat’s Next? #
With your development environment set up, you’re ready to build and containerize your first application. In the next step, you’ll create a sample web application, write a Dockerfile, and build your first container image.
The foundation you’ve built here will support all future development work, so take time to ensure everything is working properly before proceeding.
Complete these tasks to finish this step:
- Docker Desktop provides an integrated Kubernetes development environment
- kubectl is the primary tool for interacting with Kubernetes clusters
- Helm simplifies application deployment and management
- Namespaces provide isolation for development workloads
Docker not starting on Windows/Mac
Ensure virtualization is enabled in BIOS and restart Docker Desktop. Check system requirements and available memory.
Kubernetes not starting in Docker Desktop
Increase Docker memory allocation to at least 4GB in Docker Desktop settings. Reset Kubernetes cluster if needed.
kubectl command not found
Add kubectl to your system PATH or reinstall Docker Desktop which includes kubectl.