sixeyed / diamol

Code samples for the book "Learn Docker in a Month of Lunches"
https://www.manning.com/books/learn-docker-in-a-month-of-lunches
Creative Commons Attribution Share Alike 4.0 International
496 stars 261 forks source link

Ch08 TRY IT NOW #30

Closed mehul08 closed 3 years ago

mehul08 commented 3 years ago

Exercise Ch08 TRY IT NOW Pg. 290

Problem I did the exercise but got a different output after running docker container logs numbers_numbers-web_1 command: HTTPCheck: error. Url http://numbers-api/rng, exception Connection refused HTTPCheck: status OK, url http://numbers-api/rng, took 351ms

Screenshot 2021-03-09 at 4 10 20 PM

The output in the book after running docker container logs numbers_numbers-web_1 is: HTTPCheck: status OK, url http://numbers-api/rng, took 3176ms HTTPCheck: status OK, url http://numbers-api/rng, took 115ms

I also did not understand this part - “You can see in my logs that the HTTP check returns a success code, but it takes 3176 ms, and the check is set to require a response within 150 ms, so the check fails and the container exits.”

I think that the web container's dependency check failed during the first attempt because the API container wasn't up so it exited and then it started again because of the restart: on-failure command and the API container had started by that time so it's dependency check passed.

The point is that I have a different output but my understanding is in the right direction. Am I right?

Just wanted to confirm before moving on...

Thank you.

Docker version Client: Docker Engine - Community Cloud integration: 1.0.9 Version: 20.10.5 API version: 1.41 Go version: go1.13.15 Git commit: 55c4c88 Built: Tue Mar 2 20:13:00 2021 OS/Arch: darwin/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.5 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 363e9a8 Built: Tue Mar 2 20:15:47 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.3 GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc: Version: 1.0.0-rc92 GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff docker-init: Version: 0.19.0 GitCommit: de40ad0 Code version fatal: not a git repository (or any of the parent directories): .git

Additional context Add any other context about the problem here.

sixeyed commented 3 years ago

Hi @mehul08 - yes, your understanding is correct.

The exact output you'll see will depend on timings - if the healthcheck runs before the API container is ready, you'll see the connection error message. If the API container has started but is still warming up when the healthcheck runs, then you'll see the message in the book.

Good luck with the rest of the chapters :)