hostname -I

As a very experienced Linux admin I really ought to know all the ways of finding a host’s IP address; I want a quick way of getting it n a Dockerfile to be injected into a my.cnf to set the bind address to enable connections from linked containers.

The output from ifconfig is a bit messy and I want to avoid unnecessary processes. And so I learn a new trick today:

# hostname -I
172.17.0.2

Perfect.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s