August 12, 2017

When Localhost isn't the Local Host

We cover a small gotcha that could waste your time.

tl;dr

If your code (e.g. php/php-fpm) is executed on a separate container as your web server (e.g. nginx), then pinging localhost as an HTTP request wont' work, because there's no web server listening for HTTP requests within your code (php) container!

Use the hostname of your Nginx/web server container instead, e.g. http://nginx instead of http://localhost.

Looking for a deeper dive into Docker?

Sign up here to get a preview of the Shipping Docker course! Learn how to integrate Docker into your applications and develop a workflow to make using Docker a breeze!

Current

When Localhost isn't the Local Host

All Topics