August 2017
Intermediate to advanced
332 pages
9h 16m
English
Assuming that we have our docker-compose.yml in the calculator project's directory, we can now start the containers:
$ ./gradlew clean build$ docker-compose up --build -d
We can check the port on which the calculator service is published:
$ docker-compose port calculator 80800.0.0.0:32783
If we open the browser on localhost:32783/sum?a=1&b=2, the calculator service should reply 3 and, in the meantime, access the redis service and store the cached value there. To see that the cache value was really stored in Redis, we can access the redis container and look inside the Redis database:
$ docker-compose exec redis redis-cli127.0.0.1:6379> keys *1) "\xac\xed\x00\x05sr\x00/org.springframework.cache.interceptor.SimpleKeyL\nW\x03km\x93\xd8\x02\x00\x02I\x00\bhashCode[\x00\x06paramst\x00\x13[Ljava/lang/Object;xp\x00\x00\x03\xe2ur\x00\x13[Ljava.lang.Object;\x90\xceX\x9f\x10s)l\x02\x00\x00xp\x00\x00\x00\x02sr\x00\x11java.lang.Integer\x12\xe2\xa0\xa4\xf7\x81\x878\x02\x00\x01I\x00\x05valuexr\x00\x10java.lang.Number\x86\xac\x95\x1d\x0b\x94\xe0\x8b\x02\x00\x00xp\x00\x00\x00\x01sq\x00~\x00\x05\x00\x00\x00\x02" ...
Read now
Unlock full access