sam-r / laravel-docker-dev Goto Github PK
View Code? Open in Web Editor NEWA PHP MySQL docker compose setup for local development
A PHP MySQL docker compose setup for local development
Hi Sam:
We were talking about how to configure the "docker-compose.yml" and the Laravel ".env" file on the chat of the Erika Heidi dockercon session (about "How to Create PHP Development Environments with Docker Compose") ... Maybe you remember our conversastion.
So, I download your repo and try it and the sending emails process works fine. No like mine.
The configuration of my "docker-compose.yml" and ".env" is similar to yours, but, when I launch the process to send and email, I have this message error on the browser:
Connection could not be established with host 127.0.0.1 :stream_socket_client(): unable to connect to 127.0.0.1:1025 (Connection refused)
Do you know what is the reason of this error?
I had the MAIL_HOST=127.0.0.1
but, after heard your advice, I changed it to the name of my Mailhog service name.
But even with that, I also don't fix the error, even if I follow your suggestions and put the same MAIL environment variables on the ".env" file. The error I receive is the same.
On the other hand, I realize that you name the MailHog service like "mailhog", the same reference for MAIL_HOST, and another inside the Dockerfile:
[docker-compose.yml]
mailhog:
image: mailhog/mailhog
[Dockerfile.app]
RUN echo '\n\
host mailhog\n\
port 1025\n\
from [email protected]\n' \
>> /etc/msmtprc
[.env]
MAIL_HOST=mailhog
But, if the name of the services in the "docker-compose.yml" is a random personal choice, that is, that it is possible to put the name that you want to each service, then, if I replace "mailhog" with "mailhog_server" in the 3 references mentioned above, why the email sending process fails showing this error message?:
Connection could not be established with host mailhog :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known
...even if rebuild the "php" service image with this command when I up the services:
docker-compose up -d --build
Where can a reference to the previous term persist (which, supposedly, would no longer have to exist after the change mentioned in each of the 3 files), even after a reconstruction of the "php" service?
So, only it can works if the reference is "mailhog"? and it is impossible that works if it is apply another name? Why?
And, another more question ... Is it necessary to put the Mailhog lines on the Dockerfile so that there can be a communication between the PHP application and the MailHog server and therefore the emails are sent? If you don't put this lines on the Dockerfile, the email sending process doesn't work?
Where did you get the idea of putting that MailHog reference into the Dockerfile? I have not seen anything like it in the MailHog documentation and much less, they say it is necessary.
I would appreciate receiving a response from you ... Best regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.