Master GitHub Actions with hands-on labs and exercises. Learn how to automate workflows, run tests, deploy applications, and more using GitHub's powerful automation platform. This repository has everything you need to get started with continuous integration and continuous deployment.
In this lab, you will learn how to run a React Tic-Tac-Toe game in a container using a pre-built Docker image. By the end of this lab, you will have the game running locally and accessible through your web browser.
Duration: 15-30 minutes
prasadhonrao/react-tic-tac-toe
should be accessible from Docker Hub.Pull the Docker image from Docker Hub by running the following command:
docker pull prasadhonrao/react-tic-tac-toe
This will download the pre-built Docker image to your local machine.
Start a container using the downloaded Docker image by running:
docker run -d -p 8080:80 --name react-tic-tac-toe prasadhonrao/react-tic-tac-toe
Explanation of Parameters:
-d
: Runs the container in detached mode.-p 8080:80
: Maps port 80 in the container to port 8080 on your local machine.--name react-tic-tac-toe
: Assigns the name react-tic-tac-toe
to the container.prasadhonrao/react-tic-tac-toe
: Specifies the Docker image to use.Verify that the container is running by executing:
docker ps
You should see an entry for the react-tic-tac-toe
container.
If you want to stop the container, run:
docker stop react-tic-tac-toe
To remove the container after stopping it, run:
docker rm react-tic-tac-toe
In this lab, you successfully:
To use a different port, modify the -p
parameter in the docker run
command. For example, to use port 3000:
docker run -d -p 3000:80 --name react-tic-tac-toe prasadhonrao/react-tic-tac-toe
Access the game at http://localhost:3000.
To explore logs from the container, run:
docker logs react-tic-tac-toe