Can You Use Docker Without Kubernetes?
Yes, Docker runs fine without Kubernetes. See a production Compose setup, Swarm mode, managed options, the limits you hit, and when to move to Kubernetes.
Yes. Docker works fully on its own: Docker Engine builds and runs containers, Docker Compose runs multi-container apps on one host, and Swarm mode (built into Docker Engine) clusters a few hosts. Kubernetes becomes worth its complexity when you need many nodes, self-healing at scale, autoscaling and a large ecosystem of operators and policies.
This guide shows how far plain Docker can take you, with a production-style Compose setup, the limits you will hit, and a decision table for when to move on. For background on the two tools, see 8 real benefits of using Docker in DevOps and Kubernetes architecture explained.
Key takeaways
- Docker and Kubernetes do different jobs. Docker builds images and runs containers; Kubernetes schedules containers across a cluster.
- Kubernetes does not need Docker either. Since v1.24 it talks to runtimes such as containerd and CRI-O through the Container Runtime Interface, but images built with Docker run unchanged because they follow the OCI image format.
- One server with Docker Compose, restart policies, health checks and a reverse proxy can run many small production apps.
- Swarm mode adds multi-host services, rolling updates and secrets with very little setup, and is still part of Docker Engine.
- Managed container services (AWS ECS and App Runner, Google Cloud Run, Azure Container Apps) run Docker images without you operating Kubernetes.
- Move to Kubernetes when you need cluster-wide scheduling, autoscaling, multi-team isolation or its ecosystem, not because it is popular.
Docker vs Kubernetes: what each one does
| Task | Docker (Engine, Compose, Swarm) | Kubernetes |
|---|---|---|
| Build images | Yes (docker build, BuildKit) | No, uses images built elsewhere |
| Run containers on one host | Yes | Yes, but heavy for a single host |
| Multi-container app definition | Compose file | Deployments, Services, ConfigMaps, often Helm |
| Restart crashed containers | Restart policies | Controllers recreate pods |
| Spread across many hosts | Swarm mode (basic) | Yes, advanced scheduling |
| Autoscaling | No built-in autoscaler | HPA, VPA, node autoscalers |
| Rolling updates and rollback | Swarm services | Deployments |
| Policy, RBAC, multi-tenancy | Limited | Extensive |
| Learning and operating effort | Low | High |
Running Docker in production without Kubernetes
Single host with Docker Compose
Docker Compose (the docker compose plugin, Compose v2) describes services, networks and volumes in one YAML file. On a single VM it handles most small and medium apps: an API, a worker, a database and a reverse proxy.
services:
proxy:
image: caddy:2
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
restart: unless-stopped
depends_on:
api:
condition: service_healthy
api:
image: registry.example.com/shop-api:1.4.2
env_file: .env
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
interval: 30s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
db:
image: postgres:16
environment:
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
secrets:
- db_password
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
volumes:
pgdata:
caddy_data:
secrets:
db_password:
file: ./secrets/db_password.txt
What this gives you: automatic restarts after crashes and reboots (unless-stopped), health-aware start order, resource limits, log rotation so disks do not fill, and persistent data in named volumes. The top-level version: key is obsolete in the current Compose Specification, so leave it out. More patterns are in 10 most used Docker Compose files explained.
Deploying updates
A simple, repeatable deploy from CI:
ssh deploy@app01 '
cd /srv/shop &&
docker compose pull api &&
docker compose up -d api &&
docker image prune -f
'
Pin image tags (or digests) in the Compose file and change them in Git, so every deploy is a reviewed commit. docker compose up -d recreates only the services whose configuration or image changed. This approach has a brief interruption while the container restarts; if that matters, run two replicas behind the proxy or use Swarm.
Restart policies
| Policy | Behaviour | Use for |
|---|---|---|
no | Never restart (default) | One-off tasks |
on-failure[:max] | Restart on non-zero exit, optional retry limit | Batch jobs that may fail transiently |
always | Always restart, including after daemon restart | Long-running services |
unless-stopped | Like always, but stays stopped if you stopped it manually | Most long-running services |
Docker restarts a container when its process exits. It does not restart a container just because its health check reports unhealthy; for that you need Swarm, an external watchdog, or an orchestrator.
Multiple hosts with Swarm mode
Swarm mode turns a few Docker hosts into a cluster with a single command. You get replicated services, an internal load balancer (routing mesh), rolling updates with rollback, overlay networks and encrypted secrets, using a Compose-style file.
# on the first manager
docker swarm init --advertise-addr 10.0.1.10
# on each worker, using the token printed above
docker swarm join --token <worker-token> 10.0.1.10:2377
docker stack deploy -c stack.yml shop
docker service ls
docker service update --image registry.example.com/shop-api:1.4.3 shop_api
docker service rollback shop_api
services:
api:
image: registry.example.com/shop-api:1.4.3
deploy:
replicas: 3
update_config:
parallelism: 1
delay: 10s
failure_action: rollback
restart_policy:
condition: on-failure
Use an odd number of managers (three or five) so the Raft quorum survives a failure. Swarm's ecosystem is far smaller than Kubernetes', with fewer integrations for autoscaling, policy and service mesh, so weigh that if you expect to grow. Other options are compared in Kubernetes alternatives by use case.
Managed container services
If you want orchestration without running it, cloud services accept the same Docker images:
- AWS ECS (with Fargate for serverless compute) and AWS App Runner.
- Google Cloud Run, which scales HTTP containers to zero.
- Azure Container Apps and Azure Container Instances.
These handle scaling, load balancing and host patching. The trade-off is provider lock-in in the deployment configuration, though the image itself stays portable.
Where plain Docker stops being enough
Signs you are outgrowing Compose or Swarm:
- You run more containers than fit on a few hosts and spend time deciding manually where each goes.
- Traffic swings enough that you need automatic scaling of replicas and nodes.
- Several teams share infrastructure and need namespaces, quotas and RBAC.
- You need zero-downtime deploys with canary or blue-green strategies and automatic rollback on metrics.
- You depend on ecosystem tools that assume Kubernetes: operators for databases, GitOps controllers like Argo CD, policy engines, service meshes.
- Hiring and tooling around you already assume Kubernetes.
Decision table
| Situation | Recommended |
|---|---|
| Local development and CI test environments | Docker and Compose |
| One app or a few small apps, one team, one or two servers | Docker Compose on a VM |
| Need a few hosts and rolling updates, small ops team | Swarm mode |
| Want orchestration with no cluster to run | ECS/Fargate, Cloud Run, Azure Container Apps |
| Edge devices or single-board computers | Docker or Podman; K3s if you need Kubernetes APIs |
| Many services, many teams, autoscaling, strict policy | Kubernetes (managed EKS, AKS, GKE or OpenShift) |
Making a Docker-only setup production ready
- Images: small base images, non-root user, pinned tags, scanned in CI. See Docker container hardening rules.
- Secrets: Compose or Swarm secrets, or a secret manager; never bake them into images or commit
.envfiles. - Data: named volumes or managed databases, with tested backups. Volume practices are in 12 Docker volume best practices.
- Logs: rotation on the json-file driver, or ship logs to a central system.
- Monitoring: node exporter and cAdvisor scraped by Prometheus, plus uptime checks.
- Host security: patch the OS, restrict SSH, keep the Docker socket away from untrusted containers, and treat membership of the
dockergroup as root access. - Infrastructure as code: create VMs with Terraform and configure them with Ansible so a host can be rebuilt quickly.
What about Podman?
Podman is a daemonless, Docker-compatible container engine common on RHEL and Fedora. It runs containers rootless by default and can generate systemd units through Quadlet files, which is a clean way to run containers as services on a single host without Docker or Kubernetes. Most Dockerfiles and many Compose files work with Podman.
Learn Docker hands-on
Our Docker training in Pune covers images, Compose, networking, volumes and Swarm with labs, and leads naturally into Kubernetes. Classes run in Kharadi and live online.
Frequently asked questions
Can I use Docker without Kubernetes in production?
Yes. Many production apps run on Docker Compose on one or two servers, or on Swarm mode across a few. Add restart policies, health checks, log rotation, backups and monitoring, and it works well for small to medium workloads.
Is Kubernetes replacing Docker?
No. They solve different problems. Kubernetes stopped using Docker Engine as a runtime in v1.24 and uses containerd or CRI-O instead, but Docker is still widely used to build images, and those images run on Kubernetes unchanged.
Is Docker Swarm still supported?
Swarm mode is still built into Docker Engine and documented by Docker. Its ecosystem is much smaller than Kubernetes', so it suits small clusters and teams that value simplicity.
When should I move from Docker Compose to Kubernetes?
When you need many nodes, automatic scaling, multi-team isolation with RBAC and quotas, advanced deployment strategies, or Kubernetes-only tools such as operators and GitOps controllers. If none of those apply, Compose or a managed service is simpler.
Can Docker Compose restart unhealthy containers?
Compose restart policies restart a container when its process exits, not when a health check fails. Swarm services replace unhealthy tasks, and orchestrators like Kubernetes restart containers that fail liveness probes.
Do I need to learn Docker before Kubernetes?
Yes, it helps a lot. Kubernetes runs containers, so understanding images, containers, ports, volumes and networks first makes Kubernetes concepts much easier.
What are alternatives to Kubernetes for running Docker containers?
Docker Compose, Docker Swarm mode, HashiCorp Nomad, and managed services such as AWS ECS, Google Cloud Run and Azure Container Apps. Podman with systemd is another single-host option.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0