What carries over
| Docker habit | Cloud equivalent | Why it still matters |
|---|---|---|
Declarative container images (Dockerfile, docker build) |
Infrastructure as Code (IaC) – Docker images are still the unit of deployment in most cloud services (ECS, GKE, Cloud Run). | The same layered image format is pushed to registries (ECR, GCR, Artifact Registry) and referenced by cloud resources. |
Compose for multi‑container orchestration (docker-compose.yml) |
Service definitions – docker-compose maps closely to Kubernetes Pod/Deployment specs, ECS task definitions, or Docker Swarm stacks. |
The mental model of a single YAML describing how containers talk to each other stays intact; you just translate fields. |
Port mapping & networking (-p 8080:80) |
Service exposure – Cloud load balancers, Ingress, or Cloud Run's automatic URL mapping replace manual -p. |
Understanding inbound/outbound ports, health checks, and service discovery is still required, just at a higher abstraction. |
Environment variables for config (-e KEY=val) |
Secrets & config stores – aws ssm put-parameter, gcloud secrets create, or Kubernetes ConfigMap. |
The principle of externalizing config remains; the delivery mechanism changes. |
Layered caching (docker build --cache-from) |
Build cache in CI/CD – Cloud Build, GitHub Actions, or CodeBuild cache layers between builds. | Efficient builds still rely on reusing unchanged layers; the tooling differs. |
| Logging to stdout/stderr | Centralized log services – CloudWatch Logs, Stackdriver Logging, Loki. | The contract of “container writes to stdout” is unchanged; the collector is now a managed service. |
Health‑check directives (HEALTHCHECK) |
Readiness/Liveness probes in Kubernetes or health‑check settings in load balancers. | The same idea of a container reporting its health, just expressed in a different resource. |
Image tagging and immutability (myapp:1.2.3) |
Versioned deployments – immutable tags in ECR/GCR, rollout policies. | Guarantees repeatable deployments across environments. |
What's new
Example task: Deploy a simple “Hello World” HTTP service
Docker (local)
# Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY app.py .
CMD ["python", "app.py"]
# Build & run locally
docker build -t hello .
docker run -d -p 8080:8080 hello
Cloud (AWS ECS Fargate)
# task-definition.json
{
"family": "hello-task",
"networkMode": "awsvpc",
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"containerDefinitions": [
{
"name": "hello",
"image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/hello:latest",
"portMappings": [{ "containerPort": 8080, "protocol": "tcp" }],
"essential": true,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/hello",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
}
}
]
}
# Push image to ECR
aws ecr get-login-password | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com
docker tag hello:latest 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello:latest
docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello:latest
# Register task definition
aws ecs register-task-definition --cli-input-json file://task-definition.json
# Create a service in a cluster (assumes VPC, subnets, SG already)
aws ecs create-service \
--cluster my-cluster \
--service-name hello-service \
--task-definition hello-task \
--desired-count 1 \
--launch-type FARGATE \
--network-configuration "awsvpcConfiguration={subnets=[subnet-abc123],securityGroups=[sg-abc123],assignPublicIp=ENABLED}"
What changed and why
| Aspect | Docker | Cloud (ECS) | Reason |
|---|---|---|---|
| Image registry | Local daemon | Managed registry (ECR) | Cloud services need a globally reachable, authenticated store. |
| Runtime | Local Docker Engine | Managed Fargate compute | No servers to patch; you pay per vCPU/GB‑second. |
| Networking | Host‑port mapping | VPC‑aware ENI, security groups | Cloud isolates workloads; you must declare subnets and SG rules. |
| Logging | docker logs |
CloudWatch Logs integration | Centralized, searchable logs across all tasks. |
| Scaling | Manual docker run
|
Desired count, auto‑scale policies | Cloud can automatically adjust task count based on metrics. |
| Deployment |
docker run command |
Declarative task definition + service | Immutable infrastructure; changes trigger new task revisions. |
Common pitfalls
Assuming “run locally = run in cloud.”
Local networking (localhost) disappears behind VPCs and load balancers. Forgetting to open the right security‑group ports leads to “connection refused” errors that look like container bugs.Hard‑coding credentials
Docker-e AWS_ACCESS_KEY_ID=…works locally but is a security nightmare in the cloud. Use IAM roles for ECS tasks, Workload Identity for GKE, or instance profiles instead.Neglecting resource limits
In Docker you may run with default CPU/memory, but cloud services enforce limits per task/pod. Under‑provisioned limits cause throttling or OOM kills that surface as intermittent failures.Over‑relying on
docker-compose up
docker-composedoes not translate 1‑to‑1 to Kubernetes or ECS. Missing fields (e.g., health‑check intervals, rollout strategies) cause deployments that never become ready. Use tools likekomposeor write native manifests.Ignoring regional latency and data residency
A container image stored in a distant registry adds pull latency; some services (e.g., S3) have region‑specific endpoints. Always pick the same region for compute, storage, and registry.Treating logs as a side‑effect
Cloud platforms charge for log ingestion and retention. Unbounded stdout can explode costs. Configure log drivers and retention policies early.
Your 30‑day plan
Week 1 – Foundations
- Task 1: Set up a free‑tier cloud account (AWS, GCP, or Azure). Enable the container registry service (ECR, Artifact Registry, or ACR).
-
Task 2: Push an existing Docker image to the cloud registry using the CLI (
aws ecr get-login-password …). Verify it appears in the console. - Task 3: Deploy a single‑container task using the managed serverless compute (ECS Fargate, Cloud Run, or Azure Container Apps). Confirm you can reach it via the provided URL or load balancer DNS.
- Mini‑project: “Hello Cloud” – a tiny Flask (or Express) app that returns the request’s IP address. Deploy it and test from your laptop.
Week 2 – Networking & Configuration
- Task 1: Create a VPC (or use the default) with at least two subnets, a security group, and a NAT gateway if needed.
-
Task 2: Move configuration from
docker run -eto a managed secret store (AWS Secrets Manager, GCP Secret Manager, Azure Key Vault). Update the task definition to pull the secret at runtime. - Task 3: Set up a Cloud Load Balancer (ALB, HTTP(S) LB, or Azure Front Door) that routes traffic to your service. Add health‑check settings.
- Mini‑project: “Config‑driven API” – expose an endpoint that reads a value from the secret store and returns it. Deploy with the load balancer and verify secure access.
Week 3 – Orchestration & CI/CD
-
Task 1: Write a Kubernetes manifest (Deployment + Service) that mirrors your
docker-compose.yml. Deploy to a managed K8s service (EKS, GKE, AKS). -
Task 2: Install a CI pipeline (GitHub Actions, GitLab CI, or Cloud Build) that builds the image, pushes to the registry, and triggers a rolling update (
kubectl rollout restart). - Task 3: Enable auto‑scaling: configure a Horizontal Pod Autoscaler (or ECS Service Auto Scaling) based on CPU utilization.
- Mini‑project: “Scalable worker” – a background job container that processes messages from a queue (SQS, Pub/Sub, or Service Bus). Verify it scales up when you artificially increase load.
Week 4 – Observability & Cost hygiene
- Task 1: Wire the service to a centralized logging solution (CloudWatch Logs, Stackdriver Logging, or Azure Monitor). Create a query that filters error‑level logs.
- Task 2: Add distributed tracing (AWS X‑Ray, OpenTelemetry on GKE, or Azure Application Insights) to the same service. Generate a few requests and view the trace graph.
- Task 3: Set up budget alerts and enable log retention policies (e.g., 30 days). Review the cost dashboard for any surprises.
- Mini‑project: “Production‑ready demo” – take the “Config‑driven API” from Week 2, run it behind the load balancer, enable logs/traces, and document the end‑to‑end request flow.
FAQ
How much of my existing Dockerfile can I reuse?
Almost all of it. The image build process is identical; you only need to push the resulting image to a cloud‑accessible registry.
Do I still need docker-compose when using Kubernetes?
Not for production. docker-compose is great for local iteration, but Kubernetes uses its own YAML manifests. Convert the compose file with kompose or rewrite manually for finer control.
What’s the simplest way to get IAM permissions for a container without embedding keys?
Assign an IAM role to the compute resource (ECS task role, GKE Workload Identity, or Azure Managed Identity). The SDKs automatically pick up temporary credentials.
Is it worth learning Terraform now, or can I stick to the cloud CLI?
For a single service you can use the native CLI, but Terraform gives you repeatable, version‑controlled infrastructure. Starting early saves time when you scale to multiple services.
Keep going
- See what already transfers: take the free Docker → Cloud readiness check
- Related: Node.js + Express developer learning Java + Spring Boot: what carries over, what's new, 30-day plan
- Related: Java developer learning Node.js: what carries over, what's new, 30-day plan
Originally published at switchbyskill.com.
Top comments (0)