Key takeaway
- How Docker works: daemon, client, images, containers, registries, Compose and Swarm mode, plus monitoring basics and AI agents in container operations.
Docker is an open platform for building, shipping and running applications in containers, which are isolated, lightweight environments that share the host operating system's kernel. Containers separate an application from the infrastructure underneath, so the same package runs on a laptop, a data centre server or a cloud provider.
This guide is for developers, DevOps engineers and architects who are new to Docker or need a clear map of its parts. It covers the architecture, images and containers, how Docker differs from virtual machines, Compose and Swarm mode, monitoring basics and how AI agents change container operations.
What is Docker and why do teams use it?
The Docker overview lists the main reasons. Developers work in standardised containers, which suit CI/CD pipelines, so a fix can move from development to test to production by pushing an updated image. Containers run on laptops, data centre servers and cloud providers, and workloads can be scaled up or down quickly. Docker is also presented as a lighter and cost-effective alternative to hypervisor-based virtual machines.
Docker is written in Go and uses Linux kernel features. It relies on namespaces to give each container its own isolated workspace. That is why a container starts quickly and uses less than a full virtual machine: it does not boot a separate operating system.
How is Docker built?
Docker uses a client-server model. The client sends commands to the daemon, which builds, runs and distributes containers, and they communicate through a REST API over UNIX sockets or a network interface.
| Part | What it does |
|---|---|
| Docker daemon (dockerd) | Listens for API requests and manages images, containers, networks and volumes. |
| Docker client (docker) | The main interface. Commands such as docker run go to the daemon, and one client can work with more than one daemon. |
| Registry | Stores images. Docker Hub is the public default and private registries are supported. |
| Docker Desktop | An app for Mac, Windows and Linux that bundles the daemon, client, Compose and related tools. |
| Docker Compose | Another client, used for applications made of several containers. |
What are images and containers?
An image is a read-only template built from a Dockerfile, where each instruction adds a layer. When you change the Dockerfile and rebuild, only the changed layers are rebuilt, which keeps images small and fast to update. For faster builds, read about building efficient container images with BuildKit.
A container is a runnable instance of an image. You can connect it to networks, give it storage and save it as a new image. By default it is isolated from other containers and from the host, and any state you have not saved is lost when the container is removed. Registries hold images: docker pull and docker run fetch from the configured registry, and docker push uploads to it.
How do containers differ from virtual machines?
| Aspect | Container | Virtual machine |
|---|---|---|
| Operating system | Shares the host kernel | Runs its own guest operating system |
| Isolation | Kernel namespaces per container | A hypervisor separates machines |
| Packaging | Layered image | Full machine image |
| Typical use | Microservices and CI/CD | Strong separation of whole systems |
Containers are also the usual packaging for Laravel applications, Python Flask applications and ASP.NET applications on Kubernetes. For the wider picture, see containerisation for applications and the role of containers in DevOps.
When should you use Compose or Swarm mode?
Docker Compose describes a multi-container application in one file and starts it with one command, which suits development, testing and staging. The Swarm mode documentation describes Swarm as Docker's built-in clustering for a group of Docker Engines, with these features:
- Cluster management built into the Docker CLI, with declarative services and a set number of tasks per service.
- Reconciliation, where the manager replaces failed tasks on healthy nodes.
- Overlay networking, service discovery through DNS names and load balancing.
- Mutual TLS between nodes by default, and rolling updates with rollback.
The same page advises using Compose if you do not plan to deploy with Swarm, and suggesting Docker Desktop's integrated Kubernetes if you are targeting Kubernetes. It also says Swarm mode is different from Docker Classic Swarm, which is no longer actively developed. Older write-ups of Docker Enterprise Edition and of cloud deployment wizards describe screens and products that have changed, so use each provider's current documentation for cloud deployments and for Kubernetes security automation. If you run containers on a public cloud, our cloud services page lists related work.
How do you monitor and secure containers?
- Collect container events, which show restarts, crashes, image changes and out-of-memory kills.
- Set CPU and memory limits from observed use rather than guesses.
- Keep logs outside the container and search them centrally.
- Use the CLI for quick checks, such as docker ps, docker logs and docker info.
- Review the daemon's exposure, container configuration and the host kernel.
How do AI agents change container operations?
Agents can read container events and logs together, explain why a container restarted, draft a Dockerfile or Compose file for review, and propose resource limits from observed behaviour. They can also be packaged as containers themselves, so the image and registry practices above apply to the agents you run. Keep a person approving any change to production services, and scan and sign images before they are deployed. XenonStack's ElixirClaw is the AI agents computing platform for building and running agents of this kind.
What should you do first?
- Write a Dockerfile for one service and build the image.
- Run it locally, then describe it and its dependencies in a Compose file.
- Push the image to a registry and run it in a test environment.
- Add event, log and resource monitoring before you scale out.
To map one decision your agents make, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is the difference between a Docker image and a container?
An image is a read-only template built from a Dockerfile. A container is a runnable instance of an image.
What does the Docker daemon do?
The daemon listens for Docker API requests and manages images, containers, networks and volumes.
Is Docker Swarm still used?
Swarm mode is built into Docker Engine and documented for production use. Docker Classic Swarm is a different product and is no longer actively developed.
When should I use Docker Compose?
Use Compose to define and run an application made of several containers, for example in development, testing and staging.
How can AI agents help run containers?
They can analyse events and logs, draft Dockerfiles and propose resource limits for approval, and they can themselves run as containers.
Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.
Ready to put AI agents to work? Explore ElixirClaw, the agentic OS platform to build, orchestrate and govern AI agents.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE