Table of Contents

About

Checks if the port 80 is open silently and sets the return status.

Requirements

The flaws of this method is that bash is required due to /dev/tcp being a bashism (not a kernel feature) and containers might not contain bash. Similarly, for Debian images, timeout is to be be found in coreutils and might not be available. Both these packages are relatively heavyweight for a container that is supposed to just run a single monolithic binary.

Code

timeout 10s bash -c ':> /dev/tcp/127.0.0.1/80'