Running the container

Let's run our container. Before that, we need to keep in mind some things. The container should be run on the Twitter network to be able to connect to our Redis instance which is running on the Twitter network as well. Remember the localhost address for Redis does not work anymore when running in the containers infrastructure.

To run our container, we can execute the following command:

docker run -d --name hashtag-tracker --net twitter -p 9090:9090 springfivebyexample/tracked_hashtag

Congratulations, our application is running in the Docker container and connected to our Redis instance. Let's create and test our APIs to check the desired behaviors.

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.