New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker support #79
Conversation
@dosten thanks for sending this improvement. Before merging it, I'll wait for someone with Docker experience to review it. Thanks. |
I'm agree to add docker. I think it will be nicer if Dockerfiles files were in a I use a different Dockerfile to have no warning/error while running
In the readme, we should also explain how use the app/console with docker-compose: And maybe we should rename the web service (in |
The So I don't think that add |
@bocharsky-bw I'm on Mac and I don't have this problems. You can set the option |
@romqin Do you think it will be a right solution? It all will be need to add to docs, it's too specific for separate OS. And what about Anyway I vote to move this |
For the cache and logs, what we can do is to add a volume container to hold them. This way we will not have any perm issue (but if you want to see the logs you will have to use docker exec) EDIT: actually no need for another container, just define the volumes (see @jderusse comment below) |
WORKDIR /app | ||
|
||
ENTRYPOINT ["./app/console"] | ||
CMD ["server:run", "0.0.0.0:8000"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use the default http port 80, if the end user want to map it with something else, he can do it with -p 8000:80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for 8000
port because it used as a default port for app/console server:run
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server:run
is designed to run on the developer's machine which probably have an other webserver listening on port 80.
This issue does not exists in a containers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense. However, I think almost every developer should change 80
to something different because he most probably also has an installed server which already listening 80
on host machine. So maybe better left 8000
for container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think that the server should be run on port 80. If it is already used on the host, the port must be changed in the docker-compose.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some developpers don't use the port forwarding to the Host.
But use DNS to directly access the container. It will be great to use the default port.
Is the Dockerfile for demo or dev purposes ? |
Do you think it's possible to agree on some common Docker configuration to merge this? Thanks! |
I plan to use Dockerfile for dev purpose too. |
@@ -0,0 +1,11 @@ | |||
FROM php:5.6 | |||
|
|||
RUN echo "date.timezone = UTC" > /usr/local/etc/php/conf.d/date.ini |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this:
RUN echo "date.timezone = UTC" >> /usr/local/etc/php/conf.d/symfony.ini && \
echo "short_open_tag = off" >> /usr/local/etc/php/conf.d/symfony.ini && \
apt-get update && \
apt-get install -y libicu-dev && \
docker-php-ext-install intl mbstring opcache && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
It's for the app/check.php
and also to add opcache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that libicu-dev
needs for intl
, right? But why we need g++
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. g++
is not required, I removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about xdebug
? Could we install it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about to create docker/php/symfony.ini
file and COPY it into the container instead of echoing with RUN command?
Should we close this issue as "won't fix for now" ... or do you think we are close to some agreement? Thanks. |
Also I am a big fan of Docker (I hosted a Docker Workshop on the latest Symfony Live in Berlin where I created different Docker environments for the Symfony Demo App), I am of the mind that it's the wrong approach for providing a Docker setup within this project. In addition: It would be better to provide those information in additional projects, like "symfony-demo-docker", "symfony-demo-vagrant" or a generic one "symfony-demo-provisioning". |
@frastel 👍 Providing a VM, Docker, Vagrant or whatever will just add complexity to the project, is not really Symfony focused (although it makes sense of course, but it's out of the scope of this project IMO) and make it harder for newbies. |
Just asking: would it make sense to write some cookbook about "Symfony + Docker" and use the "Symfony Demo" as an example? |
I'm 👍 for this cookbook! It'll be very interesting and keep a lot of time of other devs, IMO. |
IMO it would be better to take a brand new Symfony standard rather. It would be easier to maintain. |
@frastel It's something that I meant here, but you describe this much better 👍 |
@frastel 👍 I'm in favor of a cookbook for "Symfony + Docker" so closing.. |
where does this discussion continue now exactly? can you post a link to the "cookbook", pls. |
@ivoba I think this in the docs repo now symfony/symfony-docs#4055 |
Hi!
This PR adds Docker support, so, anyone with a Docker installation can run
$ docker-compose up
to run the application :)