

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
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
Running a single container? That's easy. Realtm engineers control entire fleets of containers. Remember, Docker containers are very lightweight. It's normal to run many containers on a single host machine.
Remember, each container is its own isolated environment and process. Even if we start 10 containers from the same image, the image is just the definition of the container (the code and starting environment). Each container is a separate instance of that image.
docker run -d -p 8965:80 docker/getting-started
docker run -d -p 8966:80 docker/getting-started
docker run -d -p 8967:80 docker/getting-started
docker run -d -p 8968:80 docker/getting-started
docker run -d -p 8969:80 docker/getting-started
We use port 80 within each container because that's the port that the application is binding to inside the container. It's being forwarded to the different ports we specify on the host (our) machine.
We have to use different host ports for different containers because two processes can't bind to the same port on the same operating system.
Keep in mind, even though they all serve the same page, each is served from its own container!
docker ps
Run and submit the CLI tests.
When you're done running the tests, make sure to stop the containers.