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.
Here is the solution uses the following compose.yaml to define the services and network.
- Navigate to the project directory where your
compose.yamlfile is located. - Run the services using Docker Compose:
docker compose up --build-
Access the webpage at http://localhost:5000. Each visit or interaction on the links lister should increment a counter stored in Redis.
-
Check the counter in Redis: Open a terminal inside the Redis container:
docker exec -it <redis-container-id or name> redis-cliThen run:
GET count_redditYou should see a number representing the current count of accesses, for example:
"2"