Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 1.12 KB

File metadata and controls

31 lines (25 loc) · 1.12 KB

Webpage connects to Redis using Docker Compose

In this exercise, you will build on the previous step by connecting your webpage to a Redis service so that the access counter is stored in Redis and persists across runs.

This time, instead of running individual containers manually, you'll use a docker-compose file to orchestrate the entire setup.

Solution

Here is the solution uses the following compose.yaml to define the services and network.

Steps to run

  1. Navigate to the project directory where your compose.yaml file is located.
  2. Run the services using Docker Compose:
docker compose up --build
  1. Access the webpage at http://localhost:5000. Each visit or interaction on the links lister should increment a counter stored in Redis.

  2. Check the counter in Redis: Open a terminal inside the Redis container:

docker exec -it <redis-container-id or name> redis-cli

Then run:

GET count_reddit

You should see a number representing the current count of accesses, for example:

"2"