Run a Container¶
When to Use This Guide¶
Use this guide when you want to start a container from an image, whether it is an official image like nginx or one you built yourself.
Step 1: Run the Container¶
Start a container in the background and map a port.
-druns it in the background-p 8080:80maps host port 8080 to container port 80--name webnames it for easy reference
Step 2: Confirm It Is Running¶
You should see web listed with a status of Up.
Step 3: Access It¶
Or open http://localhost:8080 in a browser.
Common Issues¶
Port is already allocated
Use a different host port.
Name is already in use
Remove the old container first.