Many times I've tried and failed to understand what docker is. Now I have a basic but solid idea of what it is thanks to a PHP guide. Wasn't expecting that but thank you very much ^^
I love how you explained Docker and its configuration. I've been trying to understand it for months but your content made me unify everything I read before and even get a project up and running within docker. I'm a seasoned PHP dev and I'm enjoying re-learning from your course coz its making me understand 'newer' concepts and expanding my thinking. Thanks Gio!
wow, It's been a while. I stopped watching you cause there were no more PHP videos. Tnx I will finish again today. Will wait for another 8-10 videos to watch. Thank you for this amazing course. I want to let you know that I got the job that I was telling you about. It's a PHP/Laravel Job. I have learnt so much from you about PHP. Thank you. I will be grateful forever :)
@@ProgramWithGio I have been able to solved it. i didnt type the codes well. Thank you very much. I am enjoy this course by the time i get to video 70 i will be able write a complete program. you are blessing me
Even after 2 years of publishing the course, I managed to ask my questions and get my problems solved via twitter and discord. I mean it is not sth u get with ANY FREE COURSE out there. I just want to say Im rly grateful...
Once you use docker (and get over the first headaches) you will never want go back to thing like XAMPP, docker, and specially docker-compose, are great for local development, even more for people who use Linux, in which docker runs at lightspeed. Thanks for the tutorial, great video, keep it up.
I know everyone already told you how good of a teacher you are. BUT i gonna say it again , YOU ARE A GREAT TEACHER , glad i found you. Thanks for theentire playlist.
PHP needs courses like this! PHP is the king of bad learning videos and low quality infos, and I don't know actually why. So many awful code practices everywhere, so many anti-patterns (with globals, without composer, without namespaces, with mixing buisness logic with presentation layer, with only one file functions.php "for everything", etc.). This is not my first language and I see that these code practices are really bad and smelling, but many-many newbies may find it helpful... Gio, really thank you for such quality course. Only suggestions - please, give us more practical exercises. Keep up your awesome work!
Just found you, and man i can say your way of teaching makes it very easy to follow whats going on. Thank you, I'll be following your tutorial and subscribed.
Thanks for the video, Gio! I had to take a lengthy Docker course before proceeding but I now see the utility of containerization, it's really cool. The only thing I still can't wrap my head around is data transfer between the server and PHP-FPM. So you've got 2 separate containers running, one with the PHP-FPM installed and the other with the server that doesn't automatically pass requests to .php files over to any interpreter. These containers essentially share one interface though, which is the src directory on the Docker host. Still I don't get the mechanics of this all. Suppose you initiate an HTTP request on your Docker host (via browser) and the destination is the loopback address with the 8000 port attached to it. The OS on the Docker host parses the request and since 8000 is the port one of our containers listens on, that container gets that request. This container is running Nginx and it sees that it's a request to a .php file. Okay, what next? In the config file it says "fastcgi_pass app:9000" so I understand that this is the part responsible for forwarding the request to the PHP interpreter. However, what does "app" stand for? Through deduction I conclude that's the reference to the container (service) running PHP-FPM but the name of that service is actually "programwith-gio" as indicated in the .yml file. So I'm confused. TL;DR: how does PHP-FPM communicate with Nginx when they're running in separate containers?
Glad you took the additional course for the Docker, it does come in handy. So the 'app' is not the container name but the service name, if you check the docker-compose programwithgio-app is the container name but the service name right under services is app.
@ProgramWithGio thank you, I'm almost finished with your truly awesome series, and I've also recommended it to my dev friends. Now I decided to backtrack some crucial things in your code that I still am not quite comfortable with in terms of understanding, however. Right now it's some of Nginx config blocks. I'd be grateful if you could point out the flaws in my logic here. So here goes. If you use an arbitrary endpoint to make a request to the app, e.g. localhost:8000/foo it's going to be handled by the second location block first. The request URI is /foo, and I assume that's what should be in the $query_string variable. However, the variable is empty as I checked it by sending a header with its contents back as a response via the add_header directive inside the second location block. So how does the request URI persist through to the point of being processed by index.php?
Sir, can you teach me how to download and setup docker compose and nginx the right way. i am a begginer and have been struggling with this for 3 days, i looked at many tutorials but they did not help.
Yess. Ahh thats headache.. Starts from installing docker on ubuntu and continues with attempts to force it work, changing configurations that was in the video, sending energy in space and stuff like this. But now it works somehow! Almost understand how exactly. Thanks for work.
I hope I can finish you php tutorial at some point and then your hopefully finished laravel tutorial. Atm I do a lot of python, data science / AI stuff, I just can't find the time :'(
Thank you. That is correct, I just prefer to have it in both cases in case you only work with docker-compose.yml and abstract away the Dockerfile somewhere else. Just a habit I guess
Great. I need to watch it again so I can set docker up. I downloaded docker composer before but I don't know what went wrong. For one I didn't even know how to integrate with the any server and then I was also installing wsl2 and the whole thing made my computer so slow that I had to remove them all and technically re-install my OS. But from what you showed, it seems easy if I follow what you demonstrated (I hope).
Thank you, great lessons. I have a suggestion: In new videos. If you please, make the File/ Settings/ Appearance & Behavior/ Appearance: use custom font size: 16, so the menus look a bit clearer. Also, Editor/ Color Scheme/ Cobalt, has a clearer contrast than Darcula when presenting code to others. Thank you again, and please keep on.
Thank you and yes I agree. I'm going to increase the font, in later videos I started zooming in on important parts but increasing font should help. Will test the cobalt theme 👍
Gio, I need your help. when i type docker-compose up in the terminal I get, "no configuration file provided: not found" I don't know what to do, I have tried everything I searched on Google except changing to linux. What should I do?
Like everyone else I'm also enjoying this series. I just had a couple of questions about the docker setup: (1) Why is the bind mount ("- ../src:/var/www") required for both the app and nginx services? Shouldn't it only be necessary for the app service? (2) Why is there a ".d" at the end of the nginx config path in the docker-compose.yml file? I've tried everything and it works great; I just don't understand how it works.
My advice would be to leave your folder structure in git for others to copy cause writing by hand can lead to typos :D I don't understand all of the things in your docker files but i think that is normal, cause I only used XAMPP and I didn't need to write anything there. Last question would be why are we writing /var/www directories in a lot of places?
My reply was removed by TH-cam. Not sure if you had the chance to see it. /var/www contains your source code in docker container but if you don't mount the volume it will just be empty. So we map the local source directory to the /var/www. Not understanding everything is perfectly normal, you'll learn along the way. If you like Docker I would suggest watching some docker tutorial and then a lot of things will make sense. You can DM me on twitter in case my reply gets deleted again if you have follow up questions. Idk what's up with TH-cam deleting my replies ☹️
most likely a configuration issue. I would need to see your code & configuration to be able to assist. You can DM me on Twitter (X) your github repo link@@DavidKwadwoArthur
I'm done. My docker is up and running with all the other hassles inbtwn. Local Host is running now. Thanks a lot Gio. But if I close my text editor after the container is up will it still run? And if it doesn't still run how do I get it up again?
That's great, good job. When you close the editor it doesn't stop containers. You need to run docker-compose down, if you want to start containers again just run docker-compose up -d
Hi Gio, you are a great teacher! In this video however I want to give my constructive mentions. While for most this kind of product information seems to be normal and just informative, my brain plays games with me in such "close-to-advertisement" features. I recognize that you prefer these products and you not only mention the benefits and features in you really fantastic way but give me and many others a clear idea of what we can expect from these. Thats great and please don't change this attitude! But would you mind to include some sort of advanced environment recommendation in general? However that might be because I am not a professional programmer but for me environment means feeling comfortable with a (one) solution. That has not to be all-in-one but a one(solution/combination)-for-all(long) time. I don't want to switch there and there and lose time to feel comfortable with the one and the other setting if you know what I mean. Of course and you tell this often in this video it depends on what you are working on. In my Idea a perfect environment would be to have the possibility to: - develop in the same way as I test (same IDE, same functionalities) - test with exactly same conditions as they run in production - ideally have at least one production setting on my own responsibility with the possibility to adjust this to fit to comparable production settings and to enable Closed Beta Testing. As I like to have the final app to have two different versions "test" and "production". I would like to have this "test" at least to have the same opportunities as full production and full development. Wouldn't it make sense then to have the development environment be the same as the production environment? And if so, why should I always use Environment for my development where everyone's clear this is for development, not for production? What would you recommend to me? Especially if I prefer to use free/open source products?
Thank you. Docker is the best way to achieve what you described. I just covered the basics for it since this course is not about docker but if you want to learn more you could watch some advanced Docker courses.
Awesome course so far. Sorry if you already mentioned but I can't find it. Do you have the source code posted somewhere? I find it specially useful to copypaste the configuration files and avoid typos.
HI there Gio. I have attempted to get nginx up and running with docker. But it's not worked for me somehow. It could just be a typo. Is there any chance of zipping up the docker directory and posting it to git hub. Many many many thanks for your great teaching.
You can just share your code repository that includes the Dockerfile & docker-compose as well as nginx configuration. Any specific errors you are facing? Try checking logs using docker logs command for nginx container
Hello Thank you for the great course. I've been learning for a month or so, but I could not get the docker working. Every parameter is working fine but when I reach localhost:8000 it doesnt work. Can you help me plz? ofc I have modified some addresses in your files including ../src/
Hello. For me to be able to help I need to see the code and some screenshots. Reach out to me on Twitter and send me your Dockerfile, docker-compose and screenshot of your code structure
I would like to use docker. But on windows it works too slow. I've got problems with installation already. It downloads very slow. So thank you for advicing laragon
Thanks a lot sir. I have a question, where can we find the php.ini file or the services that we installed via docker-compose.yml file like server directory etc?
It's usually under: /usr/local/etc/php/conf.d directory within the container. You can create a custom php.ini within your docker folder where your docker-compose.yml is for example and then modify docker-compose.yml and add the following line: - ./local.ini:/usr/local/etc/php/conf.d/local.ini under the volumes section right under where you map the source directory to the /var/www Rebuild the containers and it should use your custom ini. Note that your custom ini does not have to be a full PHP.ini it can just contain the changes you want to make.
I feel like installing extensions in official php images is a lot of pain. Had to install php-redis, imagick, mysql pdo and their dependencies from like 5 different places. What's the advantage of official images, comparing to apt-ing out all the stuff in a bare linux image?
@@ProgramWithGio Thank you for the answer. My main goal is to build a local dev environment quickly, and won't ship containers to production or testing yet, so that's not too bad. I think the configuration thing depends, the official image doesn't maintain extensions in one place or with one tool, and has permission issues sometime (too much security), both which I hardly encounter with an apt install
Thank you so much Mr. Gio! I have a question, after the release of Laravel herd, is docker still necessary? Since Herd allows for multiple sites at a time
Some features in Herd are behind paywall. Honestly, if Herd works for you then yea you dont need Docker. If you want/need more control then sail & docker is better.
Hello and thanks for this tutorial. I am just learning Nginx. Do you have a video where laravel is used with docker and apache? Can you pls point me to it?
The latest and recommended version of the Compose file format is defined by the updated Compose Specification Those who might use this video, use “Docker compose up” And name your file “compose.yml” over "docker-compose.yml" even though backwards compatibility is kept And don’t pass a version header this is the updated way at time of writing
Sir, can you teach me how to download and setup docker compose and nginx the right way. i am a begginer and have been struggling with this for 3 days, i looked at many tutorials but they did not help.
Hello first of all, thank you for all this courses. My question is about the docker, with xamp you show how to configure but with docker I try since 2 days but I am so lost.
@@ProgramWithGio after 5:42 minutes I cannot follow because I dont know how did you put the docker and src on the code editor. What condiguration you do on the doxker logiciel?
@@veyspixelboy there are two ways you can do it. One is have your source code on your computer C drive or whatever drive, doesn't matter, and open it in editor that way. Another way is to put your source code to WSL distribution and you should be able to open that from editor as well. Having source files in WSL is better because it is faster due to less disk IO. You can try the other way first. Also I would recommend watching docker for beginners tutorial if you want to use Docker. If it's too much then I would just stick with XAMPP or Laragon, it doesn't matter what you use locally, use whatever makes you productive. Docker is not a requirement, I am just showing it as an alternative because we already covered XAMPP.
Would be cool to know how to use cdn with apache, everywhere I look for this there's "that's a topic for another video" but pretty much every server I work with have apache not nginx.
Whenever I say "that's topic for another video", I actually cover it in another video. I can't fit everything into one video, otherwise it would be a giant video. We used Apache in the beginning of the series & since this series is all about learning PHP "the right way" it was important to cover some alternatives to apache, so I decided to cover nginx in second section. We are going to work on a final project at the end of the series & deploy it. I plan on setting up CDN as well there and that's probably where I'll talk about CDN.
Hi Gio How are you? Hope you are well. Just a question, I'm new in docker. I install docker desktop, pull php and nginx image in my docker desktop, download your source code Open it VS code and run docker-compose up. it says no configuration file provided: not found, please help me?
@@mdsirazul9231 how did it work with you? i did all of that and got into the docker directory and ran the command docker-compose up and i'm getting this error: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory any help from you guys would be appreciated
Wow so far i only played with Xamp, when i run on this tutorial i feel like i receive a Rock on my Face.. hahaha impossible to graps that in 15min hahahha... will go over tutorial and tutorial later about it since docker is not essential to keep going in the course i hope lol ;)
@@ProgramWithGio yes I meant hotreload, smashing F5 is not elegant :D btw your response time is awesome. A rough workaround could be adding header("Refresh:1"), so the page refreshes itself. Can be problematic at some point I guess.
@@drgregoryhouse1470 Vite has that built in I think for front-end, so you could give it a try. Yea adding refresh every second isn't that good, will become annoying very fast 😁
Hi, these days I am trying to configure Xdebug inside the php composer. I'm following several tutorials but none of these are exhaustive and above all working ... Do you intend to dedicate a video on Xdebug? (in my case I use vscode as ide)
I did not quite understand why there are two seperate containers for the application and for the apache daemon. If i understand the .yml file correctly, the whole project will be mounted into the nginx container and the nginx deamon will process all the requests. And also the whole project will be mounted in the app container. Since the nginx container will not access files from the nginx container, I don't understand whats the purpose of the app container in the first place. Thanks in advance ! :)
Hello, Teacher Geo, I hope you can help me. “I have Windows 7 and I cannot install Windows 10-11 because my device is weak. I downloaded and installed dockertoolbox and downloaded the container images nginx, alpine, php, redis, but when I do the docker-compose up command in vcod, an error appears even though I wrote The file docker-compose.yml & nginx.conf & dockerfile correctly, so I decided to move to larvel homestead. What do you think of it? Will I be able to create an online store with it and transfer it to Hostinger hosting without problems? If you have another suggestion, let me know.”
That is, when I upload the site to hosting, there will be no errors and it will work well. I plan to build an online store with Larvel and React. It will not crash and will work well if I built it with Laragon.
Not sure if Laragon is meant for production, its just a local development environment. For production you can use something like Digital Ocean & if you need help provisioning, you can use Laravel Forge.
Hi Gio, first of all thank you for sharing knowledge in such a shining way! Can you please tell me (or redirect to other resources for me to understand) how to let nginx know what we usually tell to Apache through .htaccess in order to route any request to index.php? Thank you in advance for any explanation/suggestion and keep up the excellent job!
Hey, thank you. Check 10:06 time on this video. It's set to /var/www/public, so you place your index.php within /var/www/public & all requests go through there.
You will need to create php.ini in docker directory for example & copy it over from either Dockerfile or docker-compose. Google "custom php.ini docker-compose"
That was amazing , thanks. can't wait for the other videos. May I ask you to cover things like if we set .ini php config file for this docker container , how can we do that ? And also I would like to ask, is it possible to automatically get https certificates for these nginx php docker files for production, and the last question would be is it posdible to use docker for having multiple domains on the same nginx and php server ? If you cover any of these topics , I would appreciate it.
Thank you. I'll try to squeeze another lesson on these topics. Though it will probably be in third section of the course or towards the end of second section. I personally wouldn't have two sites on same nginx container, it's simpler to just have second site with different containers on different port, so one site on port 8000, another on port 8001 and so on.
@@ProgramWithGio that is indeed right. Honestly the last question was maybe just for my specific case. I have a saas service which is more like a shop maker. That users can set domains for their shops. So I've been thinking about solutions that can automate this process of having many domains on the same project.
@@peymanGhaderkurehpaz Got it, yea that makes sense. There are some services out there that let you do that and probably have API that you can integrate with to automate it.
Hi, can you explain how to run code from GitHub and connect everything to Docker in Windows? I tried docker-compose up in terminal, but all I get is error "no configuration file found". I'm thinking that maybe workdir isn't correct, but I don't know to what I need to change it to work. Thanks in advance!
Good video... thanks for your work. have you looked at the dddev project on this topic? For local projects I love ddev because it is Docker based and comes with some nice options and great features. This project is made for php developers like us…maybe another interesting idea for a short video?
Hi Gio, I''ve tripple checked the code and it seems to be the same as yours. Running docker-compose up in terminal was a success and now when I go to localhost:8000 I get a 404 not found /nginx message which is good I guess because I got the containers running but I can't execute anything from index.php. Any idea what might be the problem? (Just localhost doesn't work at all unless XAMP is on which makes sense to me..:D) I get this in my terminal everytime I try to connect: | 172.18.0.1 - - [10/Jan/2022:17:30:57 +0000] "GET / HTTP/1.1" 404 556 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gec ko) Chrome/97.0.4692.71 Safari/537.36"
SOLVED VIA TWITTER: My Index.php was located in the SRC folder only. I did not have it in the PUBLIC folder and the nginx config points to the PUBLIC folder.
We'll get to that once I cover composer. Basically you would install composer in your custom Dockerfile so something like: RUN curl -sS getcomposer.org/installer | php --install-dir=/usr/local/bin --filename=composer
@@s4f4y4t9 You need to run composer from container, so you run docker ps to see running containers, then copy the name of your container that has PHP in it & run this command: docker exec -it YOUR_DOCKER_CONTAINER_NAME bash and now you can run composer install once you are connected to your container. That will be covered in the lesson where I cover composer
I had this problem too - make sure the nginx.conf root and docker-compose volumes use the same location, they should both be /var/www. The nginx.conf was incorrectly set to var/www/public
was my comment deleted? with me comes an error and was after I enter docker-compose up comes the error ERROR: The Compose file '.\docker-compose.yml' is invalid because: 'nginx' does not match any of the regexes: '^x-'
This is considered intermediate, Section 1 is basic, Section 2 OOP (intermediate), Section 3 Advanced. Docker is not a requirement, its just an alternative to XAMPP, feel free to keep using XAMPP or Laragon depending on what you are currently using. You can come back to Docker later.
Gio, you are an awesome teacher. This whole course is GOLD. Thank you.
Thank you so much 🙏
@Samir Ibrahim Couldn't say it better!🤙
@@ProgramWithGio hi! I use devilbox how to alternative xammp
Many times I've tried and failed to understand what docker is. Now I have a basic but solid idea of what it is thanks to a PHP guide. Wasn't expecting that but thank you very much ^^
That is super awesome, really happy to hear that
I love how you explained Docker and its configuration. I've been trying to understand it for months but your content made me unify everything I read before and even get a project up and running within docker. I'm a seasoned PHP dev and I'm enjoying re-learning from your course coz its making me understand 'newer' concepts and expanding my thinking. Thanks Gio!
Super happy to hear this, thank you & good job
That 's a proper course.Every learning program should be like that.Learning the right syntaxe, the right architecture and the right way ;)
Thank you 💙
wow, It's been a while. I stopped watching you cause there were no more PHP videos. Tnx I will finish again today. Will wait for another 8-10 videos to watch. Thank you for this amazing course. I want to let you know that I got the job that I was telling you about. It's a PHP/Laravel Job. I have learnt so much from you about PHP. Thank you. I will be grateful forever :)
That's amazing. Im happy to hear that my videos were & are helpful. Thank you 🙏
@@ProgramWithGio This is an error i get got when i did docker-compose up, kindly assist services.app.build must be a string
@@omegajunior8963 DM me on Twitter and I'll help you troubleshoot it. If you can share your Dockerfile & docker-compose that will be better
@@ProgramWithGio I have been able to solved it. i didnt type the codes well. Thank you very much. I am enjoy this course by the time i get to video 70 i will be able write a complete program. you are blessing me
Even after 2 years of publishing the course, I managed to ask my questions and get my problems solved via twitter and discord. I mean it is not sth u get with ANY FREE COURSE out there. I just want to say Im rly grateful...
You're welcome 💙
Once you use docker (and get over the first headaches) you will never want go back to thing like XAMPP, docker, and specially docker-compose, are great for local development, even more for people who use Linux, in which docker runs at lightspeed.
Thanks for the tutorial, great video, keep it up.
Thank you. I agree 💯. I haven't used anything else since I started using Docker.
I know everyone already told you how good of a teacher you are. BUT i gonna say it again , YOU ARE A GREAT TEACHER , glad i found you. Thanks for theentire playlist.
Thank you very much
Many times I've tried and failed to understand what docker is. Now I have a basic but solid idea of what it is thanks to a PHP guide.
That's awesome, happy to hear
Loved the way you showed the way to configure docker & php ... just clear the missing information
👍👍
@ 12:31 "Now the cool thing about whatever we did" 🤣🤣 so general, I love it
🤣🤣
PHP needs courses like this!
PHP is the king of bad learning videos and low quality infos, and I don't know actually why. So many awful code practices everywhere, so many anti-patterns (with globals, without composer, without namespaces, with mixing buisness logic with presentation layer, with only one file functions.php "for everything", etc.). This is not my first language and I see that these code practices are really bad and smelling, but many-many newbies may find it helpful...
Gio, really thank you for such quality course. Only suggestions - please, give us more practical exercises.
Keep up your awesome work!
Thank you & thank you for the suggestion 🙌🙌
¡Gracias!
You're welcome 👍
Yay, I got Docker set up thanks to Mr. Gio!
Glad to hear that. You're welcome Miguel
Just found you, and man i can say your way of teaching makes it very easy to follow whats going on. Thank you, I'll be following your tutorial and subscribed.
Thank you 🙏
Awesome video as always, I wish all tutorials was this good.
Thank you 🙌
I like working with Docker as I use Windows. Thanks a lot!
Great to hear
OMG, u r the GOAT, so helpful, loving Docker now
Happy to hear that, thank you 💙
Thanks for the video, Gio! I had to take a lengthy Docker course before proceeding but I now see the utility of containerization, it's really cool.
The only thing I still can't wrap my head around is data transfer between the server and PHP-FPM. So you've got 2 separate containers running, one with the PHP-FPM installed and the other with the server that doesn't automatically pass requests to .php files over to any interpreter. These containers essentially share one interface though, which is the src directory on the Docker host. Still I don't get the mechanics of this all. Suppose you initiate an HTTP request on your Docker host (via browser) and the destination is the loopback address with the 8000 port attached to it. The OS on the Docker host parses the request and since 8000 is the port one of our containers listens on, that container gets that request. This container is running Nginx and it sees that it's a request to a .php file. Okay, what next? In the config file it says "fastcgi_pass app:9000" so I understand that this is the part responsible for forwarding the request to the PHP interpreter. However, what does "app" stand for? Through deduction I conclude that's the reference to the container (service) running PHP-FPM but the name of that service is actually "programwith-gio" as indicated in the .yml file. So I'm confused.
TL;DR: how does PHP-FPM communicate with Nginx when they're running in separate containers?
Glad you took the additional course for the Docker, it does come in handy. So the 'app' is not the container name but the service name, if you check the docker-compose programwithgio-app is the container name but the service name right under services is app.
@ProgramWithGio thank you, I'm almost finished with your truly awesome series, and I've also recommended it to my dev friends. Now I decided to backtrack some crucial things in your code that I still am not quite comfortable with in terms of understanding, however. Right now it's some of Nginx config blocks. I'd be grateful if you could point out the flaws in my logic here. So here goes.
If you use an arbitrary endpoint to make a request to the app, e.g. localhost:8000/foo it's going to be handled by the second location block first. The request URI is /foo, and I assume that's what should be in the $query_string variable. However, the variable is empty as I checked it by sending a header with its contents back as a response via the add_header directive inside the second location block. So how does the request URI persist through to the point of being processed by index.php?
That pucture on 0:22 made my day))
😄😄
شكرا لك جيو لقد كان الفصل الاول صعبا لكني سأواصل وسأقوم بأكمال جميع الفصول الى نهايتها انت الافضل
Thank you & good luck
really not a friend of php. Mostly writing in NodeJs. But this series is just amazing. Love it
Thank you
So useful videos with a friendly and one step up perspective! Thanks so much
Thank you, glad you like it 💙
Best course I've ever seen and learned from. Thank you for that GOLD
You're welcome and thank you 🙌
Liked before watching
Thank you 😏
Really appreciate the course. This video in particular helped me a lot.
Thank you very much Gio!
Sir, can you teach me how to download and setup docker compose and nginx the right way. i am a begginer and have been struggling with this for 3 days, i looked at many tutorials but they did not help.
What problems are you having?
@@rafaelmsalescom i am trying to setup and download the dockerfile, docker-compose.yml and nginx but i cannot figure it out
your help would be so greatly appreciated, as i have been trying to solve this for days
@@abduabdu7404 Following the video steps didn't work?
Yess. Ahh thats headache.. Starts from installing docker on ubuntu and continues with attempts to force it work, changing configurations that was in the video, sending energy in space and stuff like this. But now it works somehow! Almost understand how exactly. Thanks for work.
Congrats on making it work
Thanks for your good teaching.
This video was useful for me.
Happy to hear that, thank you 🙌
Great tutorial! Gio be making me feel like a pro👍
You are a pro! Thank you 🙌
I hope I can finish you php tutorial at some point and then your hopefully finished laravel tutorial.
Atm I do a lot of python, data science / AI stuff, I just can't find the time :'(
Take your time 💙
Great tutorial, thank you so much.
The working_dir doesn't need to be redefined in docker-compose file for app container.
Thank you. That is correct, I just prefer to have it in both cases in case you only work with docker-compose.yml and abstract away the Dockerfile somewhere else. Just a habit I guess
Thanks a lot for the wonderful video!
I can see that I need to become good with Docker fast!
You're welcome. It's not that bad once you play around with it.
Great. I need to watch it again so I can set docker up. I downloaded docker composer before but I don't know what went wrong. For one I didn't even know how to integrate with the any server and then I was also installing wsl2 and the whole thing made my computer so slow that I had to remove them all and technically re-install my OS. But from what you showed, it seems easy if I follow what you demonstrated (I hope).
Fingers crossed, hopefully it works out this time 🤞
best tutorial ever
Thank you 🙌
Thank you, great lessons.
I have a suggestion:
In new videos. If you please, make the File/ Settings/ Appearance & Behavior/ Appearance: use custom font size: 16, so the menus look a bit clearer. Also, Editor/ Color Scheme/ Cobalt, has a clearer contrast than Darcula when presenting code to others.
Thank you again, and please keep on.
Thank you and yes I agree. I'm going to increase the font, in later videos I started zooming in on important parts but increasing font should help. Will test the cobalt theme 👍
great lesson!
Thank you 💙
best php course
Thank you 🙌
Thanks for the video man ✨
You're welcome
Thank you for your job!
Thanks for the video
You're welcome
really good course!!
Thank you 💙
Gio, I need your help. when i type docker-compose up in the terminal I get, "no configuration file provided: not found" I don't know what to do, I have tried everything I searched on Google except changing to linux. What should I do?
cd into the directory that has the docker-compose.yml file and run the command from there
@@ProgramWithGio Thank you so much man ❤you're undoubtely the best php teacher I've seen
Like everyone else I'm also enjoying this series. I just had a couple of questions about the docker setup: (1) Why is the bind mount ("- ../src:/var/www") required for both the app and nginx services? Shouldn't it only be necessary for the app service? (2) Why is there a ".d" at the end of the nginx config path in the docker-compose.yml file? I've tried everything and it works great; I just don't understand how it works.
Thank you.
1. nginx might need access to the source as well to serve static assets etc
2. Its more like a convention
My advice would be to leave your folder structure in git for others to copy cause writing by hand can lead to typos :D I don't understand all of the things in your docker files but i think that is normal, cause I only used XAMPP and I didn't need to write anything there. Last question would be why are we writing /var/www directories in a lot of places?
My reply was removed by TH-cam. Not sure if you had the chance to see it. /var/www contains your source code in docker container but if you don't mount the volume it will just be empty. So we map the local source directory to the /var/www. Not understanding everything is perfectly normal, you'll learn along the way. If you like Docker I would suggest watching some docker tutorial and then a lot of things will make sense. You can DM me on twitter in case my reply gets deleted again if you have follow up questions. Idk what's up with TH-cam deleting my replies ☹️
wow ty aloot Gio u are t best ,i hope u make a video nginx enable https with dockerfile and php
Thank you
When i run docker-compose up it gives me an error that says : no configuration file provided: not found
cd into the directory that has the docker-compose file & run it there
How did you get the files in the docker and the src directories? What command would you run?
Not sure what you mean, I have all my source files on WSL & then open the directory from the code editor.
@@ProgramWithGio I got it figured out. The only problem is when I run localhost:8000, I get 502. Bad Gateway. How do I fix this, please?
most likely a configuration issue. I would need to see your code & configuration to be able to assist. You can DM me on Twitter (X) your github repo link@@DavidKwadwoArthur
Sure. On it@@ProgramWithGio
Great video, thanks! I was wondering why we connect the src folder to both containers?
One is for nginx & other is for php & php-fpm
I'm done. My docker is up and running with all the other hassles inbtwn. Local Host is running now. Thanks a lot Gio. But if I close my text editor after the container is up will it still run? And if it doesn't still run how do I get it up again?
That's great, good job. When you close the editor it doesn't stop containers. You need to run docker-compose down, if you want to start containers again just run docker-compose up -d
Hi Gio, you are a great teacher!
In this video however I want to give my constructive mentions. While for most this kind of product information seems to be normal and just informative, my brain plays games with me in such "close-to-advertisement" features. I recognize that you prefer these products and you not only mention the benefits and features in you really fantastic way but give me and many others a clear idea of what we can expect from these. Thats great and please don't change this attitude! But would you mind to include some sort of advanced environment recommendation in general?
However that might be because I am not a professional programmer but for me environment means feeling comfortable with a (one) solution. That has not to be all-in-one but a one(solution/combination)-for-all(long) time. I don't want to switch there and there and lose time to feel comfortable with the one and the other setting if you know what I mean. Of course and you tell this often in this video it depends on what you are working on.
In my Idea a perfect environment would be to have the possibility to:
- develop in the same way as I test (same IDE, same functionalities)
- test with exactly same conditions as they run in production
- ideally have at least one production setting on my own responsibility with the possibility to adjust this to fit to comparable production settings and to enable Closed Beta Testing.
As I like to have the final app to have two different versions "test" and "production". I would like to have this "test" at least to have the same opportunities as full production and full development. Wouldn't it make sense then to have the development environment be the same as the production environment? And if so, why should I always use Environment for my development where everyone's clear this is for development, not for production?
What would you recommend to me? Especially if I prefer to use free/open source products?
Thank you. Docker is the best way to achieve what you described. I just covered the basics for it since this course is not about docker but if you want to learn more you could watch some advanced Docker courses.
@@ProgramWithGio Thanks!
0:27... "And that's how docker was born" 😂
😁😁
Awesome course so far. Sorry if you already mentioned but I can't find it. Do you have the source code posted somewhere? I find it specially useful to copypaste the configuration files and avoid typos.
Thank you. Check description of the video, link to the source should be there
HI there Gio. I have attempted to get nginx up and running with docker. But it's not worked for me somehow. It could just be a typo. Is there any chance of zipping up the docker directory and posting it to git hub. Many many many thanks for your great teaching.
You can just share your code repository that includes the Dockerfile & docker-compose as well as nginx configuration.
Any specific errors you are facing? Try checking logs using docker logs command for nginx container
Will do@@ProgramWithGio
thank you!
You're welcome
Hello
Thank you for the great course. I've been learning for a month or so, but I could not get the docker working. Every parameter is working fine but when I reach localhost:8000 it doesnt work. Can you help me plz? ofc I have modified some addresses in your files including ../src/
Hello. For me to be able to help I need to see the code and some screenshots. Reach out to me on Twitter and send me your Dockerfile, docker-compose and screenshot of your code structure
I would like to use docker. But on windows it works too slow. I've got problems with installation already. It downloads very slow. So thank you for advicing laragon
Yup, use whatever works best for your environment
Thanks a lot sir. I have a question, where can we find the php.ini file or the services that we installed via docker-compose.yml file like server directory etc?
It's usually under: /usr/local/etc/php/conf.d directory within the container. You can create a custom php.ini within your docker folder where your docker-compose.yml is for example and then modify docker-compose.yml and add the following line:
- ./local.ini:/usr/local/etc/php/conf.d/local.ini
under the volumes section right under where you map the source directory to the /var/www
Rebuild the containers and it should use your custom ini. Note that your custom ini does not have to be a full PHP.ini it can just contain the changes you want to make.
I feel like installing extensions in official php images is a lot of pain. Had to install php-redis, imagick, mysql pdo and their dependencies from like 5 different places. What's the advantage of official images, comparing to apt-ing out all the stuff in a bare linux image?
Main advantages are security, consistency & most of the stuff are pre-configured. Going manual means you may need to do the configuration.
@@ProgramWithGio Thank you for the answer. My main goal is to build a local dev environment quickly, and won't ship containers to production or testing yet, so that's not too bad. I think the configuration thing depends, the official image doesn't maintain extensions in one place or with one tool, and has permission issues sometime (too much security), both which I hardly encounter with an apt install
Thank you so much Mr. Gio! I have a question, after the release of Laravel herd, is docker still necessary? Since Herd allows for multiple sites at a time
Some features in Herd are behind paywall. Honestly, if Herd works for you then yea you dont need Docker. If you want/need more control then sail & docker is better.
Great video Gio! Could you do a short one with xdebug capability inside the container some time please?
Thank you. I have xdebug video planned, hopefully I'll get to it soon
Hello and thanks for this tutorial. I am just learning Nginx. Do you have a video where laravel is used with docker and apache? Can you pls point me to it?
Hey, not really, I have a video about Laravel Sail but that does not include apache.
The latest and recommended version of the Compose file format is defined by the updated Compose Specification
Those who might use this video,
use “Docker compose up”
And name your file “compose.yml” over "docker-compose.yml" even though backwards compatibility is kept
And don’t pass a version header
this is the updated way at time of writing
Sir, can you teach me how to download and setup docker compose and nginx the right way. i am a begginer and have been struggling with this for 3 days, i looked at many tutorials but they did not help.
Hello first of all, thank you for all this courses.
My question is about the docker, with xamp you show how to configure but with docker I try since 2 days but I am so lost.
Hello. I also show how to configure with Docker. Any specific errors/issues you are having?
@@ProgramWithGio after 5:42 minutes I cannot follow because I dont know how did you put the docker and src on the code editor.
What condiguration you do on the doxker logiciel?
@@veyspixelboy there are two ways you can do it. One is have your source code on your computer C drive or whatever drive, doesn't matter, and open it in editor that way. Another way is to put your source code to WSL distribution and you should be able to open that from editor as well. Having source files in WSL is better because it is faster due to less disk IO. You can try the other way first.
Also I would recommend watching docker for beginners tutorial if you want to use Docker. If it's too much then I would just stick with XAMPP or Laragon, it doesn't matter what you use locally, use whatever makes you productive. Docker is not a requirement, I am just showing it as an alternative because we already covered XAMPP.
@@ProgramWithGio okei thank you so much, I wanted just follow like 100%, I am so happy of your work Thank you again
@@veyspixelboy no problem, good luck & thank you for following along 🙏💙
Would be cool to know how to use cdn with apache, everywhere I look for this there's "that's a topic for another video" but pretty much every server I work with have apache not nginx.
Whenever I say "that's topic for another video", I actually cover it in another video. I can't fit everything into one video, otherwise it would be a giant video. We used Apache in the beginning of the series & since this series is all about learning PHP "the right way" it was important to cover some alternatives to apache, so I decided to cover nginx in second section.
We are going to work on a final project at the end of the series & deploy it. I plan on setting up CDN as well there and that's probably where I'll talk about CDN.
Wow! 😍
🙌
im always getting the default nginx welcome messsage although i did the same thing in the video
Something is probably missing, I'd need to look at the code & configuration to be able to assist
Hi Gio How are you? Hope you are well. Just a question, I'm new in docker. I install docker desktop, pull php and nginx image in my docker desktop, download your source code Open it VS code and run docker-compose up. it says no configuration file provided: not found, please help me?
Hello. Where are you running docker compose up from? Cd into docker directory cause that's where the docker compose file is
@@ProgramWithGio Thank you so much Sir, you just save my day.
@@mdsirazul9231 how did it work with you? i did all of that and got into the docker directory and ran the command docker-compose up and i'm getting this error: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
any help from you guys would be appreciated
great vid! what settings are needed for deploying php in production using docker/docker-compose?
Thank you. That is a topic that would need it's own video. I would not recommend using development settings in production.
Wow so far i only played with Xamp, when i run on this tutorial i feel like i receive a Rock on my Face.. hahaha impossible to graps that in 15min hahahha... will go over tutorial and tutorial later about it since docker is not essential to keep going in the course i hope lol ;)
That's understandable and it's ok. Docker is not a requirement, keep using XAMPP or whatever makes your more productive 🙌
What are the technologies needed to build microservice with php
That is a broad question :). Depends on the application & goals/needs
Laracon is great but I normally use Devilbox which comes with lots of images ready to use and a nice dashboard to manage your containers projects
Nice. I haven't used Devilbox, but it sounds cool. Looks like devilbox uses docker.
@@ProgramWithGio give it a try.
awesome
Thanks
When developing in docker, how do you autoreload your browser on filechanges ?
You mean hot reload? I have not set that up with Docker, so I'm not sure to be honest.
@@ProgramWithGio yes I meant hotreload, smashing F5 is not elegant :D
btw your response time is awesome.
A rough workaround could be adding header("Refresh:1"), so the page refreshes itself. Can be problematic at some point I guess.
@@drgregoryhouse1470 Vite has that built in I think for front-end, so you could give it a try. Yea adding refresh every second isn't that good, will become annoying very fast 😁
Awesome can you show one how to in stall Laravel with docker without sail
Maybe 😏
Should we always redirect all requests to index file
Its up to you, though its good practice to have a single entry to the application.
Hi, these days I am trying to configure Xdebug inside the php composer. I'm following several tutorials but none of these are exhaustive and above all working ... Do you intend to dedicate a video on Xdebug? (in my case I use vscode as ide)
That's in my list, hopefully I'll be able to get to it. We'll see.
I did not quite understand why there are two seperate containers for the application and for the apache daemon. If i understand the .yml file correctly, the whole project will be mounted into the nginx container and the nginx deamon will process all the requests. And also the whole project will be mounted in the app container. Since the nginx container will not access files from the nginx container, I don't understand whats the purpose of the app container in the first place.
Thanks in advance ! :)
Don't forget about fpm, nginx is just webserver
I often hear about vanilla javascript, vanilla php, vanilla linux. what does the term vanilla mean ??
Means without frameworks/libraries, vanilla PHP is just plain PHP
Hello, Teacher Geo, I hope you can help me. “I have Windows 7 and I cannot install Windows 10-11 because my device is weak. I downloaded and installed dockertoolbox and downloaded the container images nginx, alpine, php, redis, but when I do the docker-compose up command in vcod, an error appears even though I wrote The file docker-compose.yml & nginx.conf & dockerfile correctly, so I decided to move to larvel homestead. What do you think of it? Will I be able to create an online store with it and transfer it to Hostinger hosting without problems? If you have another suggestion, let me know.”
For local development it's fine, you can try Laragon as well
That is, when I upload the site to hosting, there will be no errors and it will work well. I plan to build an online store with Larvel and React. It will not crash and will work well if I built it with Laragon.
Not sure if Laragon is meant for production, its just a local development environment. For production you can use something like Digital Ocean & if you need help provisioning, you can use Laravel Forge.
ok, thank you
why nginx service not have a build context like app services?
Not sure
can I install docker compose on Mac? or is it not necessary?
and also, from where can I find the contents of the dockerfile?
I don't know much about mac so cant say for sure. I would research online on how to get Docker installed, you should be able to.
@@ProgramWithGio will do, thank youu
Hi Gio, first of all thank you for sharing knowledge in such a shining way!
Can you please tell me (or redirect to other resources for me to understand) how to let nginx know what we usually tell to Apache through .htaccess in order to route any request to index.php?
Thank you in advance for any explanation/suggestion and keep up the excellent job!
Hey, thank you. Check 10:06 time on this video. It's set to /var/www/public, so you place your index.php within /var/www/public & all requests go through there.
@@ProgramWithGio many thanks for your prompt reply! Sorry for having missed the point while watching the video, previously 👌🙏
@@pasqualealfano6652 no worries 👍
any idea how to increate the memory limit of this ?. because I cannot find the php.ini in your tutorial...how to set that in docker?
You will need to create php.ini in docker directory for example & copy it over from either Dockerfile or docker-compose. Google "custom php.ini docker-compose"
That was amazing , thanks. can't wait for the other videos. May I ask you to cover things like if we set .ini php config file for this docker container , how can we do that ? And also I would like to ask, is it possible to automatically get https certificates for these nginx php docker files for production, and the last question would be is it posdible to use docker for having multiple domains on the same nginx and php server ? If you cover any of these topics , I would appreciate it.
Thank you. I'll try to squeeze another lesson on these topics. Though it will probably be in third section of the course or towards the end of second section. I personally wouldn't have two sites on same nginx container, it's simpler to just have second site with different containers on different port, so one site on port 8000, another on port 8001 and so on.
@@ProgramWithGio that is indeed right. Honestly the last question was maybe just for my specific case. I have a saas service which is more like a shop maker. That users can set domains for their shops. So I've been thinking about solutions that can automate this process of having many domains on the same project.
@@peymanGhaderkurehpaz Got it, yea that makes sense. There are some services out there that let you do that and probably have API that you can integrate with to automate it.
Thanks a lot , I will definitely look for it ❤👌
Hi, can you explain how to run code from GitHub and connect everything to Docker in Windows? I tried docker-compose up in terminal, but all I get is error "no configuration file found".
I'm thinking that maybe workdir isn't correct, but I don't know to what I need to change it to work.
Thanks in advance!
You need to execute docker-compose command where the docker-compose.yml is in. So cd in that directory and the run docker compose command
@@ProgramWithGio Thank you! That was really helpful, now I can proceed following this amazing tutorial.
Can I use php in-built server on php-fpm in docker without using Nginx as server?
I'm not sure to be honest, I have not used php's built-in server.
Sir how can we install php nginx with docker in windows 10 as you did in Linux?
Use wsl, I'm using windows in the video with wsl2
@@ProgramWithGio ok sir.
Good video... thanks for your work. have you looked at the dddev project on this topic? For local projects I love ddev because it is Docker based and comes with some nice options and great features. This project is made for php developers like us…maybe another interesting idea for a short video?
Thank you. No, I have not looked at ddev project, thanks for the suggestion
Hi Gio, can you recommend a good docker course for beginners? (short and synthesized like yours)
Hello. Techworld with Nana is a good channel. She has a 3hr course on Docker I believe.
Hi Gio, I''ve tripple checked the code and it seems to be the same as yours. Running docker-compose up in terminal was a success and now when I go to localhost:8000 I get a 404 not found /nginx message which is good I guess because I got the containers running but I can't execute anything from index.php.
Any idea what might be the problem?
(Just localhost doesn't work at all unless XAMP is on which makes sense to me..:D)
I get this in my terminal everytime I try to connect:
| 172.18.0.1 - - [10/Jan/2022:17:30:57 +0000] "GET / HTTP/1.1" 404 556 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gec
ko) Chrome/97.0.4692.71 Safari/537.36"
Can you share the nginx.conf & docker-compose as well as Docker file screenshots? You can send them on Twitter if you want and I can take a look.
@@ProgramWithGio Sent!
SOLVED VIA TWITTER: My Index.php was located in the SRC folder only. I did not have it in the PUBLIC folder and the nginx config points to the PUBLIC folder.
@@Sasha-li2bn Same issue, add a public folder. src/public/index.php 🌸
Hi, Jio. I'm using Xampp. Is there any need for using Docker to complete this series?
You can keep using XAMPP if that's what you are comfortable with
How to use composer with docker compose?
We'll get to that once I cover composer. Basically you would install composer in your custom Dockerfile so something like: RUN curl -sS getcomposer.org/installer | php --install-dir=/usr/local/bin --filename=composer
@@ProgramWithGio also cover docker compose please with composer
@@s4f4y4t9 I will but you don't install composer in docker-compose, you install composer in Dockerfile by adding the command in above comment
@@ProgramWithGio and how we put composer command?
@@s4f4y4t9 You need to run composer from container, so you run docker ps to see running containers, then copy the name of your container that has PHP in it & run this command: docker exec -it YOUR_DOCKER_CONTAINER_NAME bash
and now you can run composer install once you are connected to your container. That will be covered in the lesson where I cover composer
Sir, I have a problem, Docker is running fine but unable to access localhost:8000, please advice.
Check docker logs and confirm both nginx & fpm container are running
I had this problem too - make sure the nginx.conf root and docker-compose volumes use the same location, they should both be /var/www. The nginx.conf was incorrectly set to var/www/public
How can i create a docker image with Microsoft sql server, with exensions enabled php8, nginx? some one help please.
Through a command & some configuration most likely. Do research in google on "install microsoft sql server in docker" & try few options
I have tried several commands on Google but non works . I thought you could share a working command
Sir, can we follow the course on XAMPP, by not using Docker ?
Yes, you should be able to
was my comment deleted?
with me comes an error and was after I enter docker-compose up comes the error
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
'nginx' does not match any of the regexes: '^x-'
TH-cam sometimes removes comments if it thinks it's a spam. Looks like an error in docker-compose. Compare it to my file and see the difference.
Is this episode considered advanced level ? I do not understand most of it , Should I watch it more than one?
This is considered intermediate, Section 1 is basic, Section 2 OOP (intermediate), Section 3 Advanced. Docker is not a requirement, its just an alternative to XAMPP, feel free to keep using XAMPP or Laragon depending on what you are currently using. You can come back to Docker later.
@@ProgramWithGio got it 😁
Please could you kindly have a more detail tutorial on docker pleaseeee
Thanks, I have this in my list, hopefully I'll get to it one day
In traditional way if your nginx config file have error you must uninstall it sometime will raise error.But in docker you can delete it easily.
Thanks for the tip
I've downloaded github repo, but not working... 502 bad gateway error... can you help me?
Sure, ping me on Twitter and I can help troubleshoot the issue