Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

garethredfern's avatar

Using Laravel Sail Need to Change Host IP

Hi, I have got Laravel Sail working but for some reason I have to change the DB_HOST to use the containers IP address and I have to do the same for MAIL_HOST to get mail sending.

Does anybody know how I can get round this and just use the default settings in the .env file?

0 likes
1 reply
garethredfern's avatar
garethredfern
OP
Best Answer
Level 10

Found the solution. You don't need to set the DB_HOST to the container's IP addres and the same for MAIL_HOST.

All you need to do is set them to the service names provides in the docker-compose.yml file:

DB_HOST=mysql
MAIL_HOST=mailhog

Please or to participate in this conversation.