dockersamples/example-voting-app

Error: result, vote, worker containers are unhealthy

radadad2e opened this issue · 2 comments

Description
With docker-compose up on a fresh clone of this repo I am receiving container unhealthy errors for result, vote and worker containers, and the command ends with Encountered errors while bringing up the project.

Steps to reproduce the issue, if relevant:

  1. Clone example-voting app
  2. Open in VS Code
  3. Run docker-compose up

Describe the results you received:

PS C:\Users\rick\dev\tut\docker\example-voting-app> docker-compose up
Creating network "example-voting-app_back-tier" with the default driver
Creating network "example-voting-app_front-tier" with the default driver
Creating example-voting-app_redis_1 ... done
Creating example-voting-app_db_1    ... done

ERROR: for result  Container "dc98aab67cce" is unhealthy.

ERROR: for vote  Container "5b9ce498a1b3" is unhealthy.

ERROR: for worker  Container "5b9ce498a1b3" is unhealthy.
ERROR: Encountered errors while bringing up the project.

example-voting-app_redis_1 running in Docker desktop
example-voting-app_db_1 running in Docker desktop
localhost:5000 page:

This page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):
example-voting-app_redis_1 logs:

1:C 07 Sep 2021 23:16:32.565 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 07 Sep 2021 23:16:32.565 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 07 Sep 2021 23:16:32.565 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 07 Sep 2021 23:16:32.565 * Running mode=standalone, port=6379.
1:M 07 Sep 2021 23:16:32.565 # Server initialized
1:M 07 Sep 2021 23:16:32.565 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 07 Sep 2021 23:16:32.565 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 07 Sep 2021 23:16:32.566 * Ready to accept connections

example-voting-app_db_1 logs

PostgreSQL Database directory appears to contain a database; Skipping initialization
LOG:  database system was shut down at 2021-09-07 23:13:39 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

Output of docker version:

Docker version 20.10.8, build 3967b7d

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  compose: Docker Compose (Docker Inc., v2.0.0-rc.2)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 5
 Server Version: 20.10.8
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.16.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 12.31GiB
 Name: docker-desktop
 ID: EAJW:ZZFQ:BFLN:TMBK:U3WD:RHI4:ZPD6:7UCU:XYJF:ZDV6:DEML:3H5Q
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Additional environment details (AWS, Docker for Mac, Docker for Windows, VirtualBox, physical, etc.):
Windows build 19042
WSL 2

I tried using swarm though and it works.

Thanks @rohitkaran1999. Swarm didn't work for me at that moment, unfortunately.

But I've since tried again with better results. "up" now creates the containers, and starts db & redis, but worker, vote and results are not started. I can simply start those in Docker desktop and then everything is running. No edits, no fresh get, it just started working. No idea how it will work tomorrow.

If I can repro something more consistently I'll create another ticket.