Laravel Docker Course | Complete Laravel Dockerization
Вставка
- Опубліковано 20 сер 2024
- Complete Laravel Docker implementation. Full course.
In this course, you will learn everything that you’ll need to know about Docker.
We will be building a new Laravel Docker template that you can use to run all your Laravel Projects.
Our implementation will include 6 containers:
1. PHP
2. WebSockets
3. Database
4. Redis
5. Queue
6. Node
I will also provide you a sample Laravel project that we built in our last tutorial. This is basically a chat application in real-time using and hosting our own web sockets.
Before we get started, don’t forget to Like and Subscribe to my channel, to stay up to date with my latest videos.
Github project (Use this for the tutorial): github.com/ema...
Github project (Final build): github.com/ema...
Install Docker on Windows
WSL2: docs.microsoft...
Docker: docs.docker.co...
Install Docker on Mac
Mac: docs.docker.co...
blog post www.ahtcloud.c...
wanna help support my channel ? buy me a coffee ☕️ www.buymeacoff...
Follow us
Github - github.com/ema...
This is on a much higher level than some of the paid laravel/docker courses I've seen.
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
I bought a 10 hour online course to try to learn what you showed in less than an hour, and you did it much more clearer and simple, why didnt I find you before? YOU ARE AMAZING!
True
me too with the difference that it's a week, it showed exactly to the thousandth my need
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
I must say, you have done a really great job with this tutorial. Don't know why UA-cam algorithm has not ranked your video better because I landed here by accident after searching for days for a tutorial like this. A very complex setup shown in under 1 hour 👏
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
In under an hour and for free, this delivers more than many paid courses that are several hours long. It really provided me with a solid foundation using Docker.
I will refer anyone who wants to learn Docker here. I have been trying for weeks now, but this tutorial did it in less than 2 hours.
You are awesome, This is the most valuable docker resources related to PHP and Laravel that helped me, Thanks man
Perfect timing, I have been learning docker for a month, with this I think I can break through lot problems, thank you so much!!
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
ohhh my god , , this is what i want, super detail, super friendly explanation, not in hurry , well done. Enjoying the explanation and understanding this tutorial is just like enjoying 5 star restaurant menu !
This channel is underrated, it has some most helpful videos, keep it up, bro.
i am new to docker and now i can use it and deploy my project via docker. May God bless you brother!
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
This is a very recent in April 2024 best tutorial that works even on laravel 11
Thank you so much brother.
Thank you for the lessons. My career is starting to move upwards since I began to watch your videos.
43 Min video i listen and implement in 2 days and project is succfully running thanks
Great tutorial! I'm using this right now as a reference. Hope you add timestamps so it's easier to navigate the sections. Thanks!
thank you my friend I learn a lot from your tutorial.. I really but my hand in How to Dockerize Laravel Projects..
It is the most perfect coursr I have ever seen. Thank you.
Salvou o meu dia !!! Muito obrigado !!! você é o cara !!! Se um dia você vier para o brasil eu te pago uma cerveja
Learnt a lot about Docker from this video. Thanks a lot
Such a great tutorial for docker beginners like me. This is awesome.
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
Thanks, this is the best yt channel for advanced laravel topics 🔥
just wanna say god bless you sir 🙏🙏🙏
Very well made, thank you for this. Hopefully you can make a video for people to add the artisan services too.
Thanks a lot, changing my skeleton docker now.
Docker looks like super easy after watching this video thanks so much you got a sub 👍
thank you for this lesson. It's very helpful and clear explanation
extremely helpful and straight to point. thank u
Super excited! great. This tutorial was so helpful.
Awesome content ❤️
Please try to add timestamp
This man should be protected!
Love your teaching style! It would be great to see a video on how to install laravel with docker and docker compose in ubuntu with digital ocean.. with nginx..
Thank you so much Emad.
Taking to production [ Deployment ] Tutorial would be highly appreciated [Nginx * Php * Laravel * Docker * Mysql and Ubuntu server instance
]
It should be noted that this setup is for development only. On production you'd need an extra webserver container (nginx or apache) to serve your website as relying on "php artisan serve" in production would be a terrible idea.
You just saved me at work👍
Thanks for your information and cooperation
Great job man! Worth watching.
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
Everything seems very clear to me, however when I run docker compose up , with the project you have finished, it sends me the error: docker endpoint for "default" not found
very useful tutorial, thank you very much.
It would be great having the nginx configuration as well
Very helpful!
Really great 👍
One qs when we change some code there is need to follow docker compose procedure or any other way direct reflect in docker ?
U really nailed it bravo !!
Thanks a lot you are awesome,great tutorial
superb tutorials, thank you.
Thank You , It was more helpful
Thank you, great job.
Thanks for the tutorial, was very informative but I could not get it to work...
I kept getting "php-1 | exec docker/entrypoint.sh: no such file or directory"
For some reason my container does not connect to laragon MySQL. I mean start the server as you do, but it says connection refused?
hello nice tutorial
i have some error\s when i try run doker-compose up -d
the page app error display :
RedisException
PHP 8.1.17
9.10.1
Connection refused
Great effort, Only one suggestion if you can explain the docker commands and files in more detail while using them, it will be perfect
extremely useful :) thank you :)
terimkasih sangat membantu
Thank you Emad
Thanks!
What is the process to dockerize a Laravel Api and Angular Frontend and upload the image to DockerHub? Please help me!😢
perfect!!!
Useful tutorial
thanks a lot!
Good explanation
using docker on windows getting this error
2023-02-15T02:11:55.460338Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker/entrypoint.sh": stat docker/entrypoint.sh: no such file or directory: unknown
thank you senpai, very helpful
6/11] RUN groupadd --force -g sail
Thanks alot. It helps alot :)
RedisException
PHP 8.1.15
9.10.1
Connection refused
seeing this while opening the app on browser...how do i resolve this? great tutorial though
if anyone encounter this same error, just change REDIS_PORT=6379 to
REDIS_HOST=redis on .env file
Thank you man
Respect!
I am getting the error "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: exec: "docker/entrypoint.sh": stat docker/entrypoint.sh: no such file or directory: unknown"
Did you fixed this issue ?
Thanks alot bro :)
excellent
Hello Sir,
when i try to do : "docker-composer up --build" it shows me "no configuration file provided: not found" (10:32)
can you also make a video which explains, how to deploy this app over aws ecs?
Hi, please move away from this block - I followed the whole video and it's really great, but after 42:29 min (rechecked the code several times) laravel-docker-websocket-1 not running but exited(1) and al docker logs: env file exists. Running the websocket server ...
ERROR There are no commands defined in the "websockets" namespace. I hope you can give me a hand
Queue container exits with status 0 always for me
How can we run multiple laravel projects in different ports at the same time?
If i need this in a interview i will open your github? ...
The video is very good, it helped me a lot. But I'm using Laravel with Vue, when I try to "RUN npm run dev" in the Dockerfile below the "RUN npm install" line to compile but it doesn't run, the error shows me "The Mix manifest does not exist."
How could I do it? help me
Did anyone had this error on ubuntu:
ERROR: for base_event_php_1 Cannot start service php: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker/entrypoint.sh": stat docker/entrypoint.sh: no such file or directory: unknown
Run the command in your terminal "chmod +x docker/entrypoint.sh" the hope will work
@@md.juyelrana22 same error
Add the following two line and rebuild it should work
RUN ["chmod","+x","Docker/entrypoint.sh"]
ENTRYPOINT [ "Docker/entrypoint.sh" ]
@@md.juyelrana22 I'm going with Laravel Sail it seems much easier to me... Thanks
@@md.juyelrana22 you saved my sorry ass... thanks great video though
I see this issue when i run docker-compose up
⠿ Container laravel_docker-php-1 Starting 2.4s
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker/entrypoint.sh": permission denied: unknown
Did you get a solution for this ?
Run the command in your terminal "chmod +x docker/entrypoint.sh" the hope will work
@@md.juyelrana22 Thank you . this resolved my issue
Why do we need Node container? Ultimately, the laravel project will be linked to ECR and ECS on AWS
Short answer: it depends. you dont need it on a seperate container. We still need it to build and compile our frontend assets.
You can install node and npm in the same php container. If your running some CI/CD pipelines then you can also compile them there instead and not need a seperate container for prod.
For local, seperate or same container not much of a difference.
I would argue that having node inside your php container would be better since it's one less container to run (less ram, cpu, memory etc ...)
On the other hand, if your project has a decoupled architecture (seperate UI and API) and let's say for example your UI uses Vue or React Next.JS (both running on node) and Laravel for the backend, then having seperate containers (servers) will make it easier to scale. Also, if your node server gets hacked, it wouldn't expose your backend (database and api logic). There's lots of good reasons.
But the point is it really depends on the project.
The reason why I made a seperate container for each part is just to help teach the material. More ports to expose, cleaner logic etc ...
is it advisable to run php artisan serve on in a prod environment?
Great tutorial, but after all of this you are deferring to the built in web server? Why not show the install and use of either apache or nginx?
Hello friend. This is a beginner course to introduce developers to docker.
If your looking for top performance prod build please check out this tutorial :)
We use nginx opcache php fpm to serve requests as fast as 5ms.
ua-cam.com/video/so50k0t7qWo/v-deo.html
i'm going to ask a really stupid question . do we need to have web server, php and composer already installed before all this
I've recently switched from windows where i have everything set up for projects to linux ubuntu i've nothing installed configuring all those old projects are headach i've access to many projects everytime i switched to new system cus i couldn't configure them all due to different version requirements
All the people under this video looks experienced i'm the only fool here
i've copied the old laravel project and installed docker ( have not any any docker compose file till now) i'm new to docker i dont know how to containerize different project tho i'm getting a bit of understanding but still had that stupid question
so Do i need to have apach, php, composer pre installed before creating container/image in docker-compose?
answer is YES. Laravel requires composer and PHP. And as far as the web server, you can set one up but in this example it's using PHP's (or artisan's) SERVE command. Using the SERVE command is not as ideal as having a webserver running. You can easily add a webserver to the docker-compose file, there are many examples online on how to do this.
very good. i have a question. could i to use redis just making composer require predis/predis inside laravel? without configure redis server in docker-compose.yml?
Yes you can. Just make sure to expose the redis ports inside your php container to make sure you can access it externally
RedisException
PHP 8.1.5
9.10.1
Connection refused
help me
Ser REDIS_PASSWORD=null to REDIS_PASSWORD=YourPassword
@@auriaksFLC hello sir, how do i get a password?
@@gonzalesstudio7723 You make one up :) make sure its secure once you move from development..
I have posted an error message on one of your channel today ,kindly assist how to resolve the problem once your free (DevOps Tutorial - Laravel Deployment Automation CI\CD using AWS RDS EC2 S3 CodeDeploy BitBucket)
why not using Sail ?
is it compulsory you setup the project before dockerizing it or you can create a container first and then move setup the project using composer?
Yes, you can create a Docker container first and then push your project into it. In fact, this is a common practice in Docker-based development workflows.
When you create a container, you are essentially creating a self-contained environment that includes all the dependencies and configurations needed to run your application. Once the container is created, you can push your project into it using a variety of methods, such as copying files into the container or using a tool like Git to clone your project repository inside the container.
By doing this, you can ensure that your project runs consistently across different environments and avoid issues with dependency conflicts or configuration mismatches.
💝💝
is it ok to use php artisan server in production ?
NO
Hey man, nice video. The services are running fine for me, laravel frontend pages are loading fine, but it seems there's an issue with connecting to the database as each time I tried to access a route that connects to a database in MYSQL, I'm always hitting this error message: SQLSTATE[HY000] [2002] No such file or directory
SELECT * FROM `users` WHERE `email` = Admin OR `name` = Admin OR `phone` = Admin limit 1
Awesome tutorial but for some reason, Laravel runs really slow on docker. is there a way I can fix that?
You need to use WSL2 it will be much faster than running directly on windows. I have a seperate video on that
@@emadzaamout can you please share that video
RedisException Connection refused how to solved?
Complete the tutorial. It resolved itself after the WebSocket part was configured
I got it fixed by copying the finished setup files. I had alot of typos and wrong space placements.
Can Laragon prevent Docker of working like it should?
Depends on your errors.
But if you have laragon running, maybe it's using the same ports as we are exposing. If that's the case, close laragon or change the ports in docker.
Also I highly recommand you use wsl2 if your running docker on windows.
I have a course on that
ua-cam.com/video/kaQQVoEBumY/v-deo.html
@@emadzaamout thanks it worked
You are awesome AHT
AM USING MONGODB INSTAD OF MYSQL BUT FACING EXTENTION ERROR:
[php 4/7] RUN docker-php-ext-install mongodb bcmath gd dev zip curl:
#8 2.691 error: /usr/src/php/ext/mongodb does not exist?
I have a laravel project built by my colleagues, which I want to dockerize. Aren't Dockerfile & buildspec.dev.yml enough?
Good day. I have been having this error for some days now. i am not sure how to resolve it: "failed to solve: process "/bin/sh -c docker-php-ext-install pdo pdo_mysql bcmatch" did not complete successfully: exit code"
RUN docker-php-ext-install pdo pdo_mysql bcmath
it's bcmath bcmatch
User@DESKTOP-PODAF8P MINGW64 ~/OneDrive/Desktop/LaravelProject (master)
$ docker-compose ps
services.database Additional property VOLUMES is not allowed
-------------------------why this error
This is happening because of the docker-compose file indentation. You should set the correct "tab" levels. I managed to make it right by setting the correct tab space.
Something like:
queue:
build:
context: .
target: php
args:
- APP_ENV=${APP_ENV}
environment:
- APP_ENV=${APP_ENV}
- CONTAINER_ROLE=queue
working_dir: /var/www
volumes:
- ./://var/www