Lesson 18
Deploying Docker apps
This page explains how a local Docker app becomes a deployed service with versioning, configuration, ports, storage, and restart planning.
Local success proves the app can run. Deployment proves the app can run reliably on another machine without you sitting beside it.
Once the app leaves your laptop, you must think about image version, secrets, ports, storage, restart behavior, and logs.
A deployed container should be stable, reachable, repeatable, and easy to replace with a newer version later.
Deployment flow
Build image
Tag image
Push to registry
Pull on server
Run container
Simple architecture
Developer machine
Registry
Server
Running app
Users access it
What changes after local development
- Local testing becomes public-facing service delivery.
- Manual restarts are not enough anymore.
- Environment variables become more sensitive.
- Persistent data must survive container replacement.
What a deployment plan usually includes
- A specific image tag such as `my-app:1.0.0`.
- A registry where the image can be pulled later.
- Host port and domain planning.
- Runtime configuration and logs.
Example high-level command flow
docker build -t my-app .
docker tag my-app yourname/my-app:1.0
docker push yourname/my-app:1.0
# on the server
docker pull yourname/my-app:1.0
docker run -d -p 80:3000 yourname/my-app:1.0
This is not the full production story, but it shows the basic movement from local image to deployed runtime.
Common beginner mistakes
- Deploying only `latest` instead of a clear version tag.
- Forgetting to pass correct environment variables.
- Using no persistent storage for important data.
- Assuming local machine behavior is identical to server behavior.
Key idea to remember
Local Docker proves the app can run
This is your first milestone.
Deployment proves the app can serve users
Now availability and repeatability matter.
Versioned images make deployment safer
You know exactly what build reached the server.
Runtime setup matters as much as image build
Configuration, ports, storage, and restart policy all affect success.
Next page: Lesson 19 explains why Nginx often sits in front of application containers in real deployments.