No, a 172 ip address doesn’t mean it’s in Docker

A very popular CLI tool, I shall not name, assumes that if it is running on a machine with a 172.x.x.x IP address, then it is running in Docker. I’m not even making this up, and if it is, it changes the entire behavior to a ‘production mode.’

First of all, the actual IP range is 172.16.x.x, so I feel sorry for whoever owns the nearby IP ranges. Then there is the fact that this is my home’s IP range. So, that was a fun rabbit hole.

Second of all, just … don’t do this. Just detect whether you have a TTY, and if you do, enter an interactive mode, and if not, go non-interactive. It doesn’t matter what the IP address is.


Want an inside scoop?

Check out PHP Shenanigans for only €5/mo or €30/yr