Docker and PHP Complete Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ม.ค. 2025

ความคิดเห็น • 140

  • @tonyhomfray
    @tonyhomfray ปีที่แล้ว +11

    This is so great. You provide really thorough, detailed and clear explanations. And it is so refreshing to see modern PHP development being taken seriously. Thank you!

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Cheers Tony...glad it was helpful!

  • @pasizdobrekuce
    @pasizdobrekuce 2 ปีที่แล้ว +4

    Your newsletter is probably the most useful one I have ever subscribed to. Thanks!

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      I really appreciate that! People rarely unsub so I must be getting something right!

    • @pasizdobrekuce
      @pasizdobrekuce 2 ปีที่แล้ว +1

      @@GaryClarkeTech 💪

  • @StewartCambridge-iu5sw
    @StewartCambridge-iu5sw หลายเดือนก่อน +1

    This is an outstanding video. Some paid courses on Udemy are not as clear and helpful as this. You really get the idea that Gary wants you to understand what's happening, not just copy like a code monkey.

  • @PriyabrataDasTutes
    @PriyabrataDasTutes 25 วันที่ผ่านมา

    Thanks for this wonderful video. Will definitely use docker from now on.

  • @RogerHolden
    @RogerHolden ปีที่แล้ว

    Thanks. I've watched umpteen videos on Docker but they all miss out, or fail to explain, key parts. Yours has finally made Docker understandable (ish!)

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      That's great to hear! I hope that you're able to adapt what you've learned into your own stuff.

  • @slydiogenes8796
    @slydiogenes8796 หลายเดือนก่อน +1

    1:32:29 How do you do this with a powershell terminal on windows?

  • @ronaldoriosespindola3716
    @ronaldoriosespindola3716 ปีที่แล้ว

    You really have the best teaching skills. I always had difficulty understanding the concept of construction (especially X-debug and Composer). Now I understand and I was able to apply it perfectly. Thanks!

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Great to hear! Thanks for the kind words.

  • @karlisbrakis2324
    @karlisbrakis2324 ปีที่แล้ว

    I have no idea how youtube keeps giving these insanely good recommendations, thanks for the video

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Thanks very much for the kind words and thanks for watching!

  • @mcoria74
    @mcoria74 2 ปีที่แล้ว +2

    Awesome, to be honest for me It was a course of 3 days but with a lot of knowledge gained. Thanks for this video and as soon as possible the next course will be OOP. Regards form México :)

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว +1

      Great to hear, Miguel..keep going! Respect from UK 🤝

  • @bartoszyn1
    @bartoszyn1 ปีที่แล้ว

    Amazing, thank you for this easy yet comprehensive tutorial. It helped me grasp certain concepts my brain refused to digest previously.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Great..I'm glad it worked for you!

  • @AceMartinov
    @AceMartinov ปีที่แล้ว +1

    This is such a great resource! I'm not even half way through but I love the pace and the content. Spot on dude! I've been working with DevOps for a few months now, and this seems like a great way to get the basics covered after diving head-in to multi-stage builds and Kubernetes deployments :)

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +1

      Thanks buddy...I just wanted to get something out there that us regular PHP devs could understand...felt it was missing from the internet!

  • @alexkiiru1283
    @alexkiiru1283 11 หลายเดือนก่อน +2

    Container docker-php-web-1
    Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/home/alexkiirundemi/Desktop/docker-php/nginx/conf.d/default.conf" to rootfs at "/etc/nginx/conf.d/default.conf":
    29:55

    • @DavidGudovic-p3s
      @DavidGudovic-p3s หลายเดือนก่อน

      I have the exact same issue, have you fixed yours?

  • @sjankarcher
    @sjankarcher 2 ปีที่แล้ว +1

    I already like it as I see the video description

  • @MoonyWolf2002
    @MoonyWolf2002 ปีที่แล้ว

    Super helpful and helping the community and me a ton. Thank you so much. Literally saving my life.
    I've never used docker before and I just started in a development apprenticeship and could skip the first year but last time I coded anything was a few years ago and I never knew docker existed till recently through my boss wanting me to develop a app... using docker. So this is helping me out so much. Even if its nearly 2am

  • @shashikantmarskole
    @shashikantmarskole 2 ปีที่แล้ว +2

    Thanks Gary 🙏 , Nicely and step by step explain. nice work done and keep it up. thank you once angain creating such quality content.

  • @cherishkansara7851
    @cherishkansara7851 หลายเดือนก่อน +1

    Which ide u r using?

  • @christopheryongo6113
    @christopheryongo6113 ปีที่แล้ว +1

    A true gem, so detailed and easy to comprehend.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Glad you enjoyed it... I appreciate the kind words

  • @hypodrone6198
    @hypodrone6198 8 หลายเดือนก่อน

    ...another great video by Gary. Looking forward to see Symfony (simple dev "quickstart" version) dockerized :)

  • @ayenikehinde2917
    @ayenikehinde2917 10 หลายเดือนก่อน

    Great tutorial. I was able to follow you from start till end doing it with laravel app.

    • @GaryClarkeTech
      @GaryClarkeTech  10 หลายเดือนก่อน

      Nice work...hope you can put all to practical use!

  • @LiveDimi
    @LiveDimi ปีที่แล้ว +1

    On 1:02 Hours of the course there is a command called "composer install". I do not have composer locally installed and I don't want to install locally on the MAC OS php and composer. Is there another way to get this up and running? Thanks a lot so far for this great tutorial.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +1

      Yes you can execute this inside the container..which is actually the best way to do it
      docker compose exec app composer install

  • @dma98
    @dma98 ปีที่แล้ว

    This video has greatly helped me. Thank you Gary, this was really helpful

  • @doxaanthony6262
    @doxaanthony6262 3 หลายเดือนก่อน

    Hi Gary, great content so far. My issue is that when I shell into my docker container my path is simply '/'. I've followed everything you've done and I still don't have var/www

  • @StewartCambridge-iu5sw
    @StewartCambridge-iu5sw หลายเดือนก่อน

    At 36:07, what is the reason the port numbers need to be in quotes? I don't see how it is different to when you specified the Nginx port mapping.

    • @GaryClarkeTech
      @GaryClarkeTech  หลายเดือนก่อน +1

      You can do it with or without quotes...I usually use quotes just as a habit but I guess I'm not always consistent!

  • @okeregodspowerkelsey4217
    @okeregodspowerkelsey4217 2 ปีที่แล้ว +1

    Nice tutorial sir, your courses have really been of immense value to me sir. Keep up the good work.

  • @user-lu1er6qp2q
    @user-lu1er6qp2q ปีที่แล้ว +2

    Hi Gary, thanks for this video, it's just what I was looking for. A question: to install imagick adding "nstall-php-extensions imagick;" is enough ? Thanks

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Yeah think that will be ok, it's on the list for mlocati/php-extension-installer
      Just check this list when you need to see if an extension is possible:
      github.com/mlocati/docker-php-extension-installer#supported-php-extensions

  • @arjan127
    @arjan127 2 ปีที่แล้ว +1

    You are a legend for this. Thanks so much, it's very easy to follow and understand.

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      Ah you're welcome...you're a legend for watching it! Cheers

  • @ytalodev
    @ytalodev ปีที่แล้ว

    Sensational content, it was not difficult to understand, everything went well here, congratulations.

  • @Danyruddy7
    @Danyruddy7 3 หลายเดือนก่อน +1

    The way you explain it, simple and to the point. This is a great resource. Thank you.

    • @GaryClarkeTech
      @GaryClarkeTech  3 หลายเดือนก่อน

      You're very welcome!

  • @DemianRodriguez-wt5wk
    @DemianRodriguez-wt5wk 2 ปีที่แล้ว

    Great tutorial, great and understandable explanations and practical cases, you got a new happy follower, thanks man!

  • @jasongoossens
    @jasongoossens 2 ปีที่แล้ว +1

    Thanks for yet another great tutorial!

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว +1

      You're welcome..thanks for watching it!

  • @RobertoDeMontecarlo
    @RobertoDeMontecarlo ปีที่แล้ว

    Love this channel! Wonderful resource... I'm learning a lot!

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      That's great news...keep going 💪

  • @JonibekJ
    @JonibekJ 2 ปีที่แล้ว +3

    Wow! the video i was looking for. Absolutely awesome tutorials!! Gary can you also make a complete tutorial on making a php MVC framework from scratch, please. Cause this is also a undertought topic. You make easy to understand videos.

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      Kind words...thanks very much. Yes my next full course for garyclarke.tech will be create a php framework. The preview will be on TH-cam

  • @Valantir007
    @Valantir007 ปีที่แล้ว +1

    Is necessary to keep volumes in web section for the production environment? .conf files are copied in nginx dockerfile so I think it's not but I preferred to ask.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +1

      Not necessary for prod but handy to have during development cos it means no need to rebuild when you make changes

    • @Valantir007
      @Valantir007 ปีที่แล้ว

      Ohh... Of course... Thank you very much@@GaryClarkeTech
      Realy good video and the course. 🤝👍

  • @aurelprogramator-c7z
    @aurelprogramator-c7z หลายเดือนก่อน

    Hey Gary, would you dockerize an application before you actually start coding at all or is it an acceptable scenario to dockerize an app after you did some coding? I'm trying to dockerize a symfony application that I wrote but it seems that my code changes do not reflect on the container even though I'm using volumes. What do you think about this or what is the first thing that you would check up on in this regard? Thanks for the great content

    • @GaryClarkeTech
      @GaryClarkeTech  28 วันที่ผ่านมา

      It will always be easier to dockerize from the start but lots of applications get dockerized after a lot of code has been written. Most of the Symfony apps that I'm responsible for are dockerized.

  • @Hevletica
    @Hevletica 2 ปีที่แล้ว +1

    Just what I was looking for!!

  • @kevinflorenzdaus
    @kevinflorenzdaus 2 ปีที่แล้ว +1

    woah! this is HUGE!
    kudos!

  • @jochenkohler6721
    @jochenkohler6721 2 ปีที่แล้ว +1

    Very good! Thanks Gary!

  • @n1027
    @n1027 2 ปีที่แล้ว +1

    This video is useful for me. Thank you.

  • @mktNo1
    @mktNo1 ปีที่แล้ว +1

    Awesome. Thank you so much. It's very helpful.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      You're welcome...glad I could help.

  • @LotusSoftPvtLtd
    @LotusSoftPvtLtd ปีที่แล้ว

    Thank you for such great video Gary Clarke.

  • @secure73
    @secure73 ปีที่แล้ว

    would you please kindly make one short course with swoole instead of nginx ? thanx

  • @erickbianes7513
    @erickbianes7513 ปีที่แล้ว +1

    Thank you for this tutorial. For some odd reason the nginx/default.conf only works for me if I exclude the server_name directive.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Ah ok..could be interesting. Wanna share your setup and I'll look into it?

  • @WernerHelbig
    @WernerHelbig 2 ปีที่แล้ว +1

    Thank you Gary, I completed this super course entirely on an Apple Silicon. An immense value to me! It was so far the best course I've seen on the subject and the nicest thing, it's tailored exactly to my needs. Not too little, but not too much either. Just great! Please don't stop developing courses like this, I'm looking forward to the next one, maybe a detailed XDebug with all the subtleties for once?

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      Great job! You'll be building all your own images before you know it! Lots more to come.

  • @kunyuchang
    @kunyuchang 2 ปีที่แล้ว +2

    Hi Gary, your website course looks great, but to me it's missing an auto-translated subtitle (like udemy or youtuber)

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว +1

      Fair feedback...we'll look at what options there are available.

    • @kunyuchang
      @kunyuchang 2 ปีที่แล้ว

      @@GaryClarkeTech Thank You

  • @arunkumark1596
    @arunkumark1596 ปีที่แล้ว

    Nice video, thanks for the great work

  • @popov654
    @popov654 ปีที่แล้ว

    Very nice video, thank you! It is really even better than the official quick course on Docker site (though the latter one is meant for dummies like me).
    I wanted to ask you, if you don't mind: I set up xdebug (not using your video, by using the guide from docker site), used "host.docker.internal" value, installed the same Chrome extension you are using in the tutorial, changed the IDE key in the extension to vsc (also tried another way - changing this parameter in VSCode settings), tried even adding port 9003 to ports section as "9003:9003" (though that does not seem necessary because I have not seen many tutorials mention this step) - but still xdebug is not working for me.
    I have Windows 10 22H2 in VMware, latest version of VSCode, PHP 8.3 and xdebug 3. What is most important, xdebug is working for me locally without Docker. Also, PHP Info page lists xdebug as enabled inside docker, so I guess it IS installed, but my IDE cannot receive the connection for some reason.
    My networking mode is "mirror host adapter", because it's the only way I can access my home Windows SMB share.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      I've not done it in VSCode personally but give the XDebug playlist by @DerickRethansXdebug a go
      th-cam.com/video/MmyxWy8jl7U/w-d-xo.html
      Loads of useful vids there. Derick created XDebug and he'll be happy to help you out.

  • @user-lu1er6qp2q
    @user-lu1er6qp2q ปีที่แล้ว

    Hallo Gary!. I am having a problem with the execution time of "imagecreationfromjpeg" (using php:8.1-fpm-alpine); it take minutes to do a jb that usually takes 100 milliseconds (create a jpg image from an url); I ried to install imagi in several ways but nothing change, so I am wondering if it could be a problem of php image. Have you any suggestion ? Many thanks in advance, Pierluigi

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Yes..it could well be related to the php image. PHP and Docker have a history of performance issues but I don't know the solution to your problem off the top of my head.
      But my next steps would be chatgpt / google

  • @secure73
    @secure73 ปีที่แล้ว

    thank you very much Sir. I learned a lot

  • @fredrickquansah3607
    @fredrickquansah3607 ปีที่แล้ว

    Thank you very much. But please i have an error. When i try to test the mysql connection. I get this error. "Access denied for user 'user'@'%' to database 'my-db'"

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Are your files the same as mine?

    • @fredrickquansah3607
      @fredrickquansah3607 ปีที่แล้ว

      @@GaryClarkeTech please yes. I have checked.

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Can you show me your docker compose file?

    • @fredrickquansah3607
      @fredrickquansah3607 ปีที่แล้ว

      @@GaryClarkeTech Please here is the docker compose file codes
      services:
      # server
      webserver:
      image: nginx:latest
      ports:
      - "9000:80"
      volumes:
      - ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
      # php
      app:
      build:
      dockerfile: ./docker/Dockerfile
      volumes:
      - ./app:/app
      # db
      db:
      image: mysql:8.0
      #preserving development data /var/lib/mysql is a folder in the mysql container
      volumes:
      - mysqldata:/var/lib/mysql
      ports:
      - "4306:3306"
      restart: unless-stopped
      environment:
      MYSQL_ROOT_PASSWORD: p@ssw0rd
      MYSQL_USER: user
      MYSQL_PASSWORD: p@ssw0rd
      MYSQL_DATABASE: docker-db
      volumes:
      mysqldata:
      Initially, I was running it on windows and it was not working. But I just run it on mac and the connection is successful

    • @fredrickquansah3607
      @fredrickquansah3607 ปีที่แล้ว

      Thank you for patience and support

  • @RichardBlezer
    @RichardBlezer ปีที่แล้ว

    Why are you using tables plus as you are working with php-storm. Database editor is built right in

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +1

      I've never liked the phpstorm one..don't find it easy to work with

  • @amazinggameplays2693
    @amazinggameplays2693 2 ปีที่แล้ว +2

    Watched till 17:05 (In case youtube doesn't remember)

  • @mehmetaydar_QXyGeN
    @mehmetaydar_QXyGeN ปีที่แล้ว

    Thank you very much. this lesson is great ❤

  • @scotttresor
    @scotttresor 2 ปีที่แล้ว +1

    Thanks for your video

  • @petritmekuli
    @petritmekuli ปีที่แล้ว

    Great tutorial.

  • @alterX2ego
    @alterX2ego 4 หลายเดือนก่อน

    great! thank you!

  • @folomba
    @folomba ปีที่แล้ว +1

    Hello, bro! I learn to PHP!

  • @karuifeather
    @karuifeather ปีที่แล้ว

    what's the code editor?

  • @Hevletica
    @Hevletica 2 ปีที่แล้ว +1

    Composer finally meets Compose 😄

  • @mlsandreas
    @mlsandreas 2 ปีที่แล้ว +1

    Thank you!!

  • @nicolasromero6144
    @nicolasromero6144 ปีที่แล้ว

    Nice content thank you for share

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Thanks for watching

    • @nicolasromero6144
      @nicolasromero6144 ปีที่แล้ว

      If you have time create a content on dockers and permission and users on docker, for example: linux users for nginx, apache, laravel app and others. Anyway thank you

  • @albouchioussema702
    @albouchioussema702 2 ปีที่แล้ว +1

    Thank you

  • @AshukaMadeIt
    @AshukaMadeIt 2 ปีที่แล้ว +1

    Yes Sir !

  • @remymoro1854
    @remymoro1854 2 ปีที่แล้ว +1

    Thanks ! ! !

  • @aamthanh4471
    @aamthanh4471 2 ปีที่แล้ว +1

    super!

  • @vmvm9758
    @vmvm9758 2 ปีที่แล้ว +1

    It doesn’t work without context: .
    You can’t compose up

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      Possibly your version of docker compose. I used v2. You can check by going to the settings ⚙️ in the Docker Desktop panel

    • @vmvm9758
      @vmvm9758 2 ปีที่แล้ว

      @@GaryClarkeTech Thank you.

  • @tbiro3478
    @tbiro3478 ปีที่แล้ว

    muito bom

  • @user-lu1er6qp2q
    @user-lu1er6qp2q ปีที่แล้ว

    Hi Gary, I am having toubles with a simple php curl call to get mime type of a public file. From inside the container it seems tha curl is unable to access the file, like it was unable to resolve the url address:
    $ch = curl_init(".....something....);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $curlExec = curl_exec($ch);
    $curlExec is FALSE. Is there a setting to access public internet address I am missing ?

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Is it the same for all outbound addresses?

    • @user-lu1er6qp2q
      @user-lu1er6qp2q ปีที่แล้ว

      @@GaryClarkeTech Yes, different address, same error

    • @user-lu1er6qp2q
      @user-lu1er6qp2q ปีที่แล้ว

      @@GaryClarkeTech I solved adding dns section in docker-compose file, app section. Now I upload wxternal files, but functions like "imagecreatefromjpeg" take ages to load this file; very boring. Thanks.

  • @quaap
    @quaap ปีที่แล้ว +1

    Hi Gary, Great video! I have followed this docker tutorial with great interest, and have already used the knowledge in several projects. However, there is something I can't figure out. My css and js files, loaded via a Link or Script tag, result in a 404. FYI I load the css file with the full link ("css/style.css" doesn't work either) I can't really figure out where the problem lies. Do you perhaps have an idea?

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      What folder have you put them in? They will need to go in the public folder. They won't be accessible in outside of here.

    • @EHeins-hg4tn
      @EHeins-hg4tn ปีที่แล้ว

      @@GaryClarkeTech The files are indeed in folders that are in the public folder. That's why I find it so strange that they can't be opened, but index.php can...

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +1

      You could try keeping them in an assets folder and adding an additional location entry to your default.conf file, like so:
      location /assets {
      alias /var/www/html/public/assets;
      }
      Then to reference that file in your html, use this:
      You will need to rebuild your web container after this change.

    • @EHeins-hg4tn
      @EHeins-hg4tn ปีที่แล้ว

      @@GaryClarkeTech Thanks Gary for this solution, this does indeed work. I have now found the cause why it did not work before. You have to be pretty precise when it comes to docker file layout, I discovered through trial and error. But thanks for your solution, now I can move on to the actual development. ;-)

    • @ytalodev
      @ytalodev ปีที่แล้ว

      @@GaryClarkeTech
      can I just put it like this?, because my css for example is at the root of the project.
      location /css {
      alias /var/www/html/css;
      }
      In the HTML:
      is it right?