docker run command with the image name.

- Run a single container for development or testing.
- Launch multiple container instances for scaling or redundancy, then place a load balancer or reverse proxy in front of them.
- Replace a failed instance by removing the container and starting a new one from the same image.
Image naming and tags
- Image names often include a repository and a tag to indicate the version:
- Example:
nginx:1.27
- Example:
- If no tag is provided, Docker defaults to the
latesttag — avoid relying onlatestin production to prevent unexpected upgrades.
- Use explicit tags for reproducible deployments (for example
myapp:2026.10.01). - Scan images for vulnerabilities before deploying.
- Use a private or managed registry for production workloads to control access and retention.
- Automate builds and push images from CI/CD pipelines to ensure traceability.
Avoid using the
latest tag in production. Always pin to an explicit version and test images before promoting them to production environments.
Practical tip: starting multiple instances correctly
- For production or when running many instances locally, you usually want to:
- Run containers in detached mode (
-d). - Assign names (
--name) or labels for easier management. - Expose ports and mount volumes as needed.
- Run containers in detached mode (
- Docker Hub
- GitHub Container Registry (GHCR)
- Google Artifact Registry
- AWS Elastic Container Registry (ECR)
- Azure Container Registry
Public registries like Docker Hub host many official and community images. For production, consider using a private or managed registry (AWS ECR, Azure Container Registry, Google Artifact Registry) to control access and manage image lifecycle.