Let's see what happens when we try to ping
localhost from within our PHP container.
We cover a small gotcha that could waste your time.
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
I'm Chris Fidao. I wrote the Servers for Hackers eBook, and publish related videos at the Servers for Hackers video site. I also curate the Servers for Hackers newsletter, which is read by over 12,000 programmers who want to learn about servers.
I'm also the author of the Deploy PHP! video series, a video series about automating your deployments. A few years ago, I wrote Implementing Laravel, a book all about coding in Laravel - now offered free!
A Servers for Hackers project.
© 2017 Fideloper LLC
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein.