Docker and PHP Complete Tutorial

Поділитися
Вставка
  • Опубліковано 6 січ 2025

КОМЕНТАРІ • 140

  • @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.

  • @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!

  • @PriyabrataDasTutes
    @PriyabrataDasTutes 12 днів тому

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

  • @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 💪

  • @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.

  • @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!

  • @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!

  • @Danyruddy7
    @Danyruddy7 3 місяці тому +1

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

  • @alexkiiru1283
    @alexkiiru1283 10 місяців тому +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?

  • @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

  • @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 🤝

  • @sjankarcher
    @sjankarcher 2 роки тому +1

    I already like it as I see the video description

  • @LiveDimi
    @LiveDimi 11 місяців тому +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  11 місяців тому +1

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

  • @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.

  • @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!

  • @dma98
    @dma98 Рік тому

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

  • @ayenikehinde2917
    @ayenikehinde2917 9 місяців тому

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

    • @GaryClarkeTech
      @GaryClarkeTech  9 місяців тому

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

  • @christopheryongo6113
    @christopheryongo6113 Рік тому +1

    A true gem, so detailed and easy to comprehend.

    • @GaryClarkeTech
      @GaryClarkeTech  Рік тому

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

  • @bartoszyn1
    @bartoszyn1 Рік тому

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

  • @hypodrone6198
    @hypodrone6198 8 місяців тому

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

  • @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.

  • @ytalodev
    @ytalodev Рік тому

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

  • @arjan127
    @arjan127 Рік тому +1

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

    • @GaryClarkeTech
      @GaryClarkeTech  Рік тому

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

  • @cherishkansara7851
    @cherishkansara7851 Місяць тому +1

    Which ide u r using?

  • @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

  • @DemianRodriguez-wt5wk
    @DemianRodriguez-wt5wk 2 роки тому

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

  • @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

  • @jasongoossens
    @jasongoossens 2 роки тому +1

    Thanks for yet another great tutorial!

  • @kevinflorenzdaus
    @kevinflorenzdaus 2 роки тому +1

    woah! this is HUGE!
    kudos!

  • @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 UA-cam

  • @jochenkohler6721
    @jochenkohler6721 2 роки тому +1

    Very good! Thanks Gary!

  • @RobertoDeMontecarlo
    @RobertoDeMontecarlo Рік тому

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

  • @n1027
    @n1027 2 роки тому +1

    This video is useful for me. Thank you.

  • @Hevletica
    @Hevletica 2 роки тому +1

    Just what I was looking for!!

  • @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?

  • @LotusSoftPvtLtd
    @LotusSoftPvtLtd Рік тому

    Thank you for such great video Gary Clarke.

  • @mktNo1
    @mktNo1 Рік тому +1

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

  • @secure73
    @secure73 Рік тому

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

  • @aurelprogramator-c7z
    @aurelprogramator-c7z 21 день тому

    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  16 днів тому

      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.

  • @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
      ua-cam.com/video/MmyxWy8jl7U/v-deo.html
      Loads of useful vids there. Derick created XDebug and he'll be happy to help you out.

  • @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. 🤝👍

  • @arunkumark1596
    @arunkumark1596 Рік тому

    Nice video, thanks for the great work

  • @secure73
    @secure73 Рік тому

    thank you very much Sir. I learned a lot

  • @mehmetaydar_QXyGeN
    @mehmetaydar_QXyGeN Рік тому

    Thank you very much. this lesson is great ❤

  • @amazinggameplays2693
    @amazinggameplays2693 2 роки тому +2

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

  • @scotttresor
    @scotttresor 2 роки тому +1

    Thanks for your video

  • @petritmekuli
    @petritmekuli Рік тому

    Great tutorial.

  • @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.

  • @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

  • @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

  • @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

  • @alterX2ego
    @alterX2ego 4 місяці тому

    great! thank you!

  • @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

  • @mlsandreas
    @mlsandreas 2 роки тому +1

    Thank you!!

  • @albouchioussema702
    @albouchioussema702 2 роки тому +1

    Thank you

  • @AshukaMadeIt
    @AshukaMadeIt 2 роки тому +1

    Yes Sir !

  • @folomba
    @folomba Рік тому +1

    Hello, bro! I learn to PHP!

  • @karuifeather
    @karuifeather Рік тому

    what's the code editor?

  • @remymoro1854
    @remymoro1854 2 роки тому +1

    Thanks ! ! !

  • @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

  • @Hevletica
    @Hevletica 2 роки тому +1

    Composer finally meets Compose 😄

  • @aamthanh4471
    @aamthanh4471 2 роки тому +1

    super!

  • @tbiro3478
    @tbiro3478 Рік тому

    muito bom

  • @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.

  • @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?