Search

Docker

🔍
Navigation

Requirements

📌
To follow this course, it is required to know following …
•
No Requirements

Containers and Images

An image packages an application and its dependencies. A container is a running instance of that image. Containers share the host kernel rather than each running a complete guest operating system; Docker Desktop runs Linux containers through a virtualized Linux environment on macOS and Windows.

A Small Local Example

With Docker installed and running, this command starts a temporary web server. Open http://localhost:8080, then press Ctrl+C in the terminal to stop it.
docker run --rm --name web-notes -p 127.0.0.1:8080:80 nginx:stable
Plain Text
복사
The left port belongs to the host; the right port belongs to the container. Publishing without a host address normally binds to all host interfaces. Use a current Docker version and review firewall and network settings before exposing a service.

Data and Configuration

•
Use a named volume or a deliberate bind mount for data that must survive container replacement.
•
Keep credentials out of images and source control. Pass configuration through an appropriate runtime mechanism.
•
Record image versions. A moving tag such as stable is convenient for exploration but does not pin a reproducible deployment.

Common Mistakes

EXPOSE documents an intended port; it does not publish that port on the host. Inside a container, localhost refers to that container, not another service. Use the service’s network name when containers share a Docker network.
A running process is not proof that an application is ready. Check its logs and an appropriate health endpoint, and keep backups for persistent data.

Reference