Running Containers Print

  • 0

Practical operation.

WHAT TO SPECIFY WHEN RUNNING

The image A name, so it can be referred to Port mappings Volumes Environment variables Resource limits A restart policy

WHAT PORT MAPPING DOES

Connects a port on the host to a port in the container.

WHY IT IS NECESSARY

Ports inside are not reachable from outside by default.

WHAT TO BE CAREFUL WITH

Publishing to all interfaces when local access would do.

WHY

It exposes the service to the network, and firewall rules may not apply as expected.

WHAT DETACHED MODE DOES

Runs in the background.

WHAT INTERACTIVE MODE PROVIDES

A terminal attached, for shells and debugging.

WHAT A RESTART POLICY CONTROLS

Whether the container restarts after exiting or after the host reboots.

WHAT TO SET FOR A SERVICE

Restart unless deliberately stopped.

WHY THAT WORDING MATTERS

It restarts after failure and after reboot, but respects a manual stop.

WHAT RESOURCE LIMITS PREVENT

One container consuming the whole host.

WHAT TO SET

Memory and processor limits, always.

WHAT HAPPENS WITHOUT A MEMORY LIMIT

A leaking container can take down the host.

WHAT TO CHECK AFTER STARTING

The logs, and that it is actually running rather than restarting repeatedly.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot