Process Flow - What is Docker
Write Dockerfile
Build Docker Image
Run Docker Container
App runs isolated
Stop and Remove Container
Docker lets you package an app and its environment into a container that runs the same everywhere.
FROM alpine:latest RUN echo "Hello from Docker!" CMD ["echo", "Hello from Docker!"]
| Step | Action | Result | Notes |
|---|---|---|---|
| 1 | Read Dockerfile | Dockerfile parsed | Start building image |
| 2 | Pull base image alpine:latest | Base image downloaded | Alpine Linux is small and fast |
| 3 | Run command: echo "Hello from Docker!" | Command executed in image build | Creates a layer with this command |
| 4 | Set default command CMD ["echo", "Hello from Docker!"] | Default container command set | Runs when container starts |
| 5 | Build image complete | Image created with layers | Ready to run container |
| 6 | Run container from image | Container starts and runs echo | Outputs: Hello from Docker! |
| 7 | Container stops after command | Container exits | No running process left |
| 8 | Remove container | Container deleted | Clean up resources |
| Variable | Start | After Step 2 | After Step 5 | After Step 6 | Final |
|---|---|---|---|---|---|
| Image | None | alpine:latest pulled | Image built with echo command | Image used to run container | Image remains on system |
| Container | None | None | None | Running with echo command | Stopped and removed |
Docker packages apps with their environment into images. Images are built from Dockerfiles using base images. Containers are running instances of images. Containers run isolated and can be started, stopped, and removed. Docker ensures apps run the same everywhere.