Docker
Docker is a container platform that packages an application and its dependencies into an image, then runs it as an isolated container. In hosting, Docker is used for applications, databases, queues, or internal tools that need a consistent environment.
Core terms
| Term | Meaning |
|---|---|
| Image | Read-only template with the application and dependencies |
| Container | A running instance of an image |
| Volume | Persistent storage outside the container lifecycle |
| Network | Virtual network between containers |
| Dockerfile | Recipe for building an image |
| Compose | Definition of several containers in one file |
Basic flow
docker build -t my-app .
docker run -d --name app -p 3000:3000 my-app
For data that must survive, mount a volume:
docker run -d -v app-data:/var/lib/app my-app
What to watch for
- A container is not a VM. Isolation is lighter; do not treat it as a full security boundary.
- Data belongs in a volume. Files inside the container disappear when it is removed.
- Resource limits matter. Without CPU/RAM limits, one container can exhaust the VPS.
- Update images regularly. Old images carry unpatched vulnerabilities.
- RAM and disk are finite. A small VPS with many containers runs out quickly.
- Ports and reverse proxy. Containers usually listen on an internal port, then Nginx/Caddy forwards HTTPS traffic.
Every container uses RAM and disk. On a 1–2 GB VPS, run only the services you need, set memory limits, and monitor image size. Use docker system prune regularly, but never remove volumes still in use. For production, store images in a registry and deploy explicit versions, not latest. Separate the database from the app container when possible.
FAQ
Can Docker replace a VPS?
No. Docker packages and runs applications; the VPS is the machine the containers run on.
Does data disappear when a container restarts?
Data in the container filesystem can disappear when the container is removed. Use a volume for data that must persist.
Is Docker safe for production?
It can be, provided images are updated, containers do not run as root, resources are limited, and network access is controlled.
Disclaimer: Hosting Wiki articles are prepared for educational and reference purposes. Hosting technology keeps evolving, so some technical details may change over time.