

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 2
click for more info
Not enough gems
Cost: 6 gems
1: Containers
incomplete
2: Images
incomplete
3: Run a Container
incomplete
4: Stop a Container
incomplete
5: Multiple Containers
incomplete
This lesson's interactive features are locked, please to keep using them
Now that you've downloaded the getting started image, let's use it to run a new container. The docker run command starts a new container from an image. Let's break down the syntax:
# this is just an example, don't run this
docker run -d -p hostport:containerport namespace/name:tag
-d: Run in detached mode (doesn't block your terminal)-p: Publish a container's port to the host (forwarding)hostport: The port on your local machinecontainerport: The port inside the containernamespace/name: The name of the image (usually in the format username/repo)tag: The version of the image (often latest)docker run -d -p 8965:80 docker/getting-started:latest
docker ps
On one of the columns you should see this:
PORTS
0.0.0.0:8965->80/tcp
This is saying that port 8965 on your local "host" machine is being forwarded to port 80 on the running container. Port 80 is conventionally used for HTTP web traffic. Navigate to http://localhost:8965 and you should see a webpage served from the container!
Submit the CLI tests against your "getting started" container on http://localhost:8965. There's no penalty on failure for this lesson.
If you want to use a different port, you can change the port the bootdev cli will use like this:
# if you want 42069
bootdev config base_url http://localhost:42069