Live Coding - Install PHP Symfony in Docker + Docker Volume Tricks

preview_player
Показать описание
------
. Tonight I am going to install Symfony in a Docker container and demonstrate some tricks with Docker volumes.

In this live coding class I we will:
Create a Dockerfile
Create a Docker image with composer
Install Symfony 4.2.2 inside the Docker container
Create Docker volumes for Symfony cache and logs
Explain the difference between Docker volumes and bind mounts

Do checkout the offers on programming resources below:

== My Programming Courses ==
Professional programming courses for web developers

Docker in Motion

== Recommended Programming Books ==
Manning Publications books

Python books

PHP books

Linux books

MYSQL books

Docker books

Website hosting from Cloudways:

NordVPN

Namecheap $0.88 for a domain

#docker #symfony #php
Рекомендации по теме
Комментарии
Автор

Why does your dockerfile need to COPY all of . when you are bind mounting .?

Around the 50 minute mark, you explain how mounting order is important. Does the Dockerfile get overwritten by the volumes command in the docker-compose?

Thanks for the tutorial. I like how you explain things.

ChrisZwemke
Автор

thx, I succeeded to create my image.
Now I need to find how to create an container for mysql...

jobarmure
Автор

Thank you for this screencast. I was looking for this, setting up the environment inside the docker. I have a request to make, can you do this for node react app too. I failed to build my node-react image install inside the docker. I have had success with setting Ngnix and create a react app but I can't seem to get it run, something to do with ports and volumes in docker. Anyways thank you for this tutorial it is well explained.

shruts
Автор

Hey Peter!
It was a very useful video!
I now understand how I can develop a symfony application in my local dev environment while seeing the results in a docker container.
But I still can't cope with how I can easily develop an optional symfony plugin.
So let's say I have a symfony application running in a few instances. There are bundles which are added to the instances via composer require. But not all instances.
So unless I create multiple images, In order to not have all plugins present in the image, I need to run composer require in the entrypoint.sh
Plugins have dependencies so composer cannot be left out.
If I begin with your development example (set the app dir as volume) and I do a composer require with the plugin, the plugin's code will apear in the docker container, but will have no connection to the local codebase of the plugin. So should I require the plugin and then set a volume?
How is developing an optional symfony bundle properly done?

Kemano
Автор

isnt the point of Docker when I get this docker file and docker-compose file and run it to install everything, I tried copy both files and start it but I'm getting error
Composer could not find a composer.json file in /var/www/html/app

NagatoKamiPain
Автор

Hi, isn't it bad to run composer install from the Dockerfile instead of doing it when running the container with the intended environment variables? (especially APP_ENV)
Thanks for the video!

Rems
Автор

But, but... wait a minute. :) The vendor directory on the host is empty, right? How do you use PhpStorm on the host machine with an empty vendor directory?

payskin
Автор

Hi. After watching your video, I started to understand how to work with docker and symfony. Thanks. Great explanation. I would like to see more Docker+Symfony videos, especially Docker+Symfony+MySQL (maybe u already have it? Share a link please)! Like and Subscription

ICSVortex-DCS
Автор



I'm on a mac, anyone knows what is the reason?

matheusvieira
Автор

There is something I don't understand. As you showed we run the process of the creation of the project on the image right? so we don't have installed anything on the host. docker is running as root. The composer will install all the project with root permissions. and because we are in sync between host and image we are files are the same so the permissions are root for almost anything.


I know that I can use hacky solutions but I don't think it's a good idea. So how to deal with that issue. Am I doing something wrong? I don't get it.


One more thing, If the project is hosted on GitHub, how to share the code for development and deployment?


Thanks

mhrddd