Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending a signal to a container with healthcheck affects healthcheck status of the container. #38954

Open
2 tasks done
epicfilemcnulty opened this issue Mar 27, 2019 · 1 comment

Comments

@epicfilemcnulty
Copy link

  • This is a bug report
  • I searched existing issues before opening this one

Expected behavior

When you send a signal to container (particularly SIGUSR1), it should not affect
health status of the container. Affected docker versions: 18.xx

Actual behavior

If you have a valid healthcheck for a container defined, and it reports that your container is healthy, after sending a SIGHUP or SIGUSR1 to the container, docker inspect reports after that that the container is in unhealthy status, while there is no way that the signal could've affected the healthcheck. docker ps output still reports that the container is healthy.

Steps to reproduce the behavior

Create a simple container with a healthcheck that always succeeds:

FROM alpine:3.8 

COPY entry.sh /entry.sh
HEALTHCHECK CMD sleep 3 && exit 0
ENTRYPOINT [ "/entry.sh" ]

And here is the entry.sh script:

#!/bin/sh
while :; do
    echo "..."
    sleep 5
done

Build and run this container:
docker build -t health_check_test .
docker run -d -t --name healthCheckTest health_check_test:latest

Now inspect its' health status:

vzorin@laptop:~/Desktop$ docker inspect healthCheckTest -f '{{.State.Health.Status}}' && docker ps --filter name=healthCheckTest --format '{{.Status}}'
healthy
Up About a minute (healthy)

Send a signal to the container and check its' status afterwards

vzorin@laptop:~/Desktop$ docker kill -s SIGUSR1 healthCheckTest
healthCheckTest

vzorin@laptop:~/Desktop$ docker inspect healthCheckTest -f '{{.State.Health.Status}}' && docker ps --filter name=healthCheckTest --format '{{.Status}}'
unhealthy
Up 2 minutes (healthy)

Output of docker version:

vzorin@laptop:~/Desktop$ docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:51 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:15 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

vzorin@laptop:~/Desktop$ docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 9
Server Version: 18.06.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-36-generic
Operating System: KDE neon User Edition 5.13
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.42GiB
Name: laptop
ID: GUAV:R3DX:4VKZ:Q5ZF:AEQW:S6GT:UGRE:LTEJ:QVM2:5KZP:OENV:Q66C
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: epicfile
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: true

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.)

This bug affects docker versions 18.xx and 17.12.0, 17.09.1 works as expected (i.e. sending SIGUSR1 or SIGHUP to the sample container above does not affect its' health status).
Was also tested on vanilla ubuntu 18.04 with docker 18.xx, 17.12.0 and 17.09.1.

@thaJeztah
Copy link
Member

Wondering if this is related to #37137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants