How to Dockerize Laravel APP (PHP, Nginx, MySQL, PhpMyAdmin, and Redis.)

Поделиться
HTML-код
  • Опубликовано: 7 фев 2025
  • BUY ME A COFFEE 🔥 : buymeacoffee.c...
    Welcome to our comprehensive tutorial on how to dockerize a Laravel application! In this video, I will guide you step-by-step through setting up a Docker environment for your Laravel project.
    What You'll Learn:
    1. Setting up a multi-container Docker environment for a Laravel application.
    2. Configuring services such as PHP, Nginx, MySQL, PhpMyAdmin, and Redis.
    3. Writing and understanding the docker-compose.yml file.
    4. Building and running Docker containers for Laravel development.
    5. Managing volumes and networks in Docker Compose.
    By the end of this video, you'll have a fully functional Docker environment for your Laravel application, making development and deployment smoother and more efficient.
    Links:
    gist.github.co...
    #Docker #Laravel #DockerCompose #DevOps #WebDevelopment #PHP #MySQL #Nginx #Redis #PhpMyAdmin
    Feel free to share your thoughts and ask questions in the comments below. Happy coding!
    github.com/har...
    BUY ME A COFFEE 🔥 : buymeacoffee.c...

Комментарии • 50

  • @ibagitated
    @ibagitated 3 месяца назад +1

    I am really enjoying your video - you explain every step so I that, as a beginner with Docker, I get to understand why I'm doing what you're asking me to do. Keep up the great service to our community!

    • @codewithtee
      @codewithtee  3 месяца назад

      @@ibagitated I am happy you enjoyed it. Let me know what you would like me to publish

  • @abdallaramadan3690
    @abdallaramadan3690 18 дней назад

    I'm your fan!

  • @JailadinShaik8897
    @JailadinShaik8897 4 месяца назад +1

    very helpful video, thanks

  • @famakinwatemitope8983
    @famakinwatemitope8983 6 месяцев назад +1

    God bless you for the video

    • @codewithtee
      @codewithtee  6 месяцев назад

      Thank you very much, I am happy you found it helpful

    • @codewithtee
      @codewithtee  6 месяцев назад

      Yes, it will..
      Just be sure the php version matches the laravel version

  • @cristianbarrios5519
    @cristianbarrios5519 3 месяца назад +1

    I really appreciate it

  • @ungueie
    @ungueie Месяц назад

    Thanks for the video! A couple questions:
    1) why dont you use the default ports? ie. for mysql, redis, etc.
    2) wouldn't it be more efficient to put all the services in a single docker file? instead of a container for each, which I imagine would require more resources if you want to use this ie. on a cheap VPS

    • @codewithtee
      @codewithtee  Месяц назад

      @@ungueie I have redis ant MySQL on my local machine and it also a way to let you know you can customize it if you already have an instance of those services running.
      Customization is not easy in docker file and it can quite difficult to understand.. Docker compose file provides the flexibility you need and this does not affect the size of your docker containers.

    • @ungueie
      @ungueie Месяц назад +1

      @@codewithtee Thanks! Have a nice rest of the weekend!

  • @so1vaso6
    @so1vaso6 Месяц назад

    Nice video! Can you add video deploy laravel project to vps linux with docker? Thanks so much🎉

  • @sidalifetoumi
    @sidalifetoumi Месяц назад

    do you know how can i run "npm run dev" while the container is working ?

    • @codewithtee
      @codewithtee  Месяц назад

      @@sidalifetoumi open another terminal run your npm there

    • @sidalifetoumi
      @sidalifetoumi Месяц назад

      @@codewithtee im using nginx also

  • @Noaman2022
    @Noaman2022 4 месяца назад +1

    Can this work for laravel 10 ?

  • @AlirezaPd-j8v
    @AlirezaPd-j8v 4 месяца назад

    thanks for your great video.i get this error when i run docker-compose build command:
    services.laravel_eleven_app.build must be a string.
    could you plz give me a solution how to fix this??

    • @codewithtee
      @codewithtee  4 месяца назад +1

      @@AlirezaPd-j8v invite me to the repo, I need to see your docker and docker compose file #harmlessprince

    • @femiolayemi5902
      @femiolayemi5902 Месяц назад

      got these errors too, ensure that there is space after a hyphen and a colon in your docker-compose file. for the error services.laravel_eleven_app, find that location in the docker file and fix the - and :

  • @charles-harisbouassebukomb8133
    @charles-harisbouassebukomb8133 5 месяцев назад

    do you think that with apache it will be the same process???

    • @codewithtee
      @codewithtee  5 месяцев назад

      @charles-harisbouassebukomb8133@@charles-harisbouassebukomb8133 apache will be quite different, you will need another Dockerfile for that

    • @codewithtee
      @codewithtee  5 месяцев назад

      I will try to create one for apache

    • @charles-harisbouassebukomb8133
      @charles-harisbouassebukomb8133 5 месяцев назад

      @@codewithtee okay, I’m currently working on it, your video was really helpful, but I am still stacked because the conf file in my local sever was not transferred to the container

    • @codewithtee
      @codewithtee  5 месяцев назад

      make sure you are mounting your config in the right path.. If you still can't figure it out.. Shoot me a mail realolamilekan@gmail.com

    • @charles-harisbouassebukomb8133
      @charles-harisbouassebukomb8133 5 месяцев назад

      @@codewithtee alright

  • @famakinwatemitope8983
    @famakinwatemitope8983 6 месяцев назад

    Will the setup work with laravel 8 too?

  • @albaprogrammer2710
    @albaprogrammer2710 4 месяца назад

    thanks for your tutorial sir. how about dockerize laravel in production environment ? can you give best practice for it?
    i would be happy if you colud make the video tutorial 😊🙏

    • @codewithtee
      @codewithtee  4 месяца назад

      @@albaprogrammer2710 this works in production as well... The only difference is, in production you just swap your database credentials and all..
      Also in production you will run your docker in detached mode.

    • @albaprogrammer2710
      @albaprogrammer2710 4 месяца назад

      ​@@codewithtee hmmm okey, but what about optimization ? maybe we can more optimize the Dockerfile, ex we can use php:8.3-alpine, also remove useless code like tests folder, etc. or maybe we use the multistage
      sorry if i'm wrong 🙏

    • @albaprogrammer2710
      @albaprogrammer2710 4 месяца назад

      i try to build the image from your Dockerfile, and the size of image is 740MB. is that normal ? or maybe it can still be optimized again ?

    • @codewithtee
      @codewithtee  4 месяца назад

      @@albaprogrammer2710 php apline is only lighter in terms of size, tests folders are never going to be the reason your application is slow....

    • @codewithtee
      @codewithtee  4 месяца назад

      @@albaprogrammer2710 I don't think you need to push to docker image, it is not a necessity...
      If you want a docker file or configuration specific for prod, you can create another docker compose file that you will only run in production, you can pass the name of your docker compose file

  • @leinah3671
    @leinah3671 2 месяца назад

    Is it necessary to have arg user and uid??

    • @codewithtee
      @codewithtee  2 месяца назад

      @@leinah3671 if you don't, the root user owns the files and you will start facing permission issue later.

    • @leinah3671
      @leinah3671 2 месяца назад +1

      @@codewithtee Thanks for explanation

    • @leinah3671
      @leinah3671 2 месяца назад

      @@codewithtee Do you think, you method can be also doable with react?

    • @codewithtee
      @codewithtee  2 месяца назад

      @@leinah3671 follow this tutorial ruclips.net/video/ZCLRgor-WZ8/видео.htmlsi=cfzlXBU6SFavoI2v
      It is compatible to react

    • @leinah3671
      @leinah3671 2 месяца назад

      @@codewithtee Funny thing I did this tutorial and finished it. But the port 6162 was white only. I think i should also add the react here