If you are starting a new Laravel project with Sail and hit with an error similar to this:
Cannot create container for service laravel.test: invalid IP address in add-host: "host-gateway"
I can help you out. It's a simple fix 💪️
Solution for invalid IP address in add-host: "host-gateway" #
- Open the
docker-compose.yml-file in your Laravel project folder
- Comment out the lines under extra-hosts:
# extra_hosts: # - 'host.docker.internal:host-gateway'
sail up -d --force-recreateto start Laravel Sail again with the new config.
- Win 🎉️
That's it! Simple as that.
Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.