Include wget command in image for healthcheck
What is expected
wget command to be available so healthcheck can be used
What is Happening
wget command not included in image
Changes (Optional)
Please add wget command to image.
docker-compose.yml healthcheck
healthcheck:
test: wget --no-verbose --tries=1 --no-check-certificate --spider http://localhost:5380
interval: 10s
timeout: 10s
retries: 3
start_period: 10s
Hey, it's an DPS acceptance criteria to have a minimal docker image, so add wget to the image will increase its size, I think healthcheck is not a must have, but a nice to have feature unless it's causing some bug, I'm not inclined to add such feature because it will against DPS acceptance criteria.
You are able to create an extended image and configure the healthcheck if you really need it for your use case though.
@gjrtimmer I've been having some success with this:
test: bash -c "exec 5<>/dev/tcp/dps.docker/53"
@mageddo is there any other way you might recommend doing a healthcheck?
@gunar yeah, it must do the job as you are using dps.docker hostname it means that if you are solving that name then DPS is working and 53 port is listening.
On the future I may consider implement some more complete health and embed it at the container without have to install new commands to the container using some native Linux communication between sh and the process maybe signals, named pipes or even tcp .
Just a draft I've made some tests using your command:
- Created a DNS tcp query
- Encoded it to hexadecimal
- Sent the message to DPS tcp server
- Get the first 2 bytes response and encoded that to hex (query response size)
- The print to the output https://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
bash -c "exec 5<>/dev/tcp/127.0.0.1/8053 && echo -e -n '\x0\x1d\x26\x1a\x1\x0\x0\x1\x0\x0\x0\x0\x0\x0\x4\x68\x6f\x73\x74\x6\x64\x6f\x63\x6b\x65\x72\x0\x0\x1\x0\x1' >&5 && head -c2 <&5 | od -t x1 && exec 5<&-"
0000000 00 2d
0000002
In the meanwhile I think we should consider to add a command like yours at the healthcheck