hi guys this is Leela welcome to my channel Leela webd in the previous video we have seen the Practical implementation of installing how we can install the WordPress and also the mySQL database in our Docker container so in this video we will try to see the Practical implementation of installing the WordPress and also the mySQL database in our Docker container so right now here I'm using the docker container so you need to understand that uh let's check my IP address what is the IP address for this one I'm checking the IP address for this one IP address show so here if you try to check the IP address so this is my static IP address which can be accessed outside of the docker machine and 172. 101 is the docker Zero by default interface IP address so that means whenever you are trying to create the container so the docker the docker will be assigning the IP address to this one that is nothing but 170. 17.
0. 2 0. 3 like that so now we need to install the WordPress and also the MySQL so which one we need to install first WordPress or the MySQL so let's try to see here so if I go into here and let's go to the docker Hub okay so I will try to check the docker Hub in the docker Hub container so what is the first one which I need to download that is nothing but WordPress let's try to open this one yeah here I will be searching for WordPress WordPress I have searched it and if you try to see here here the docker official image so I will be checking for the docker official image and this is the docker official image for the WordPress now if I try to open this WordPress and here you will be able to see the WordPress and so it will be used is using the PHP and we already know fast CGI and the Apache server it is using in the back end and the PHP version is 8.
3 so that's it so now if you try to see bottom so you'll be able to see what press is a free source 22% of the website are used by WordPress only and this is the and this is the command we need to run so how so do we need to run this command first let's try to see Docker container run so they are giving the container name and giving some Network and also highend WordPress they doing and if you try to see bottom and if you like to access the instance from the host without a container IP address means so we will be doing the put forwarding so that's a different thing so fine so for here we need to have a DB host DB username DB password and also DB name and also table prefix prefix so that means so in order to install the database so we need to have a datab in order to install the WordPress we need to have a database first so that I can provide the DB host DB user as enironment variables or otherwise the WordPress will be asking randomly so that means we need to install the MySQL first so database first then afterwards by using that mySQL database we will we will be installing the WordPress container and and in the WordPress so we can give this all my SQL database credentials so let's try to install the my SQL first so depending on the situation which one we need to install the container we need to understand so here in the docker Hub I will be searching for the uh my SQL so already we have the image I think my SQL just I'm opening it in order to have environment variable spot we need to submit it so my SQL if I try to press my SQL and also we need to have a Docker official image so that is nothing but this is the my SQL Docker official image now if you try to see here my SQL let's go down and this is the content this is the thing we need to run and here we need to provide the MySQL root password so if we come down here the environment variables so here you'll be able to see MySQL root password we need to give and also the mySQL database we need to create and if you want other than root password if you want to create any other users means you can give the MySQL user and the MySQL password so that's it so we have already in our previous videos we have installed this my SQL container right so in the same scenario we will be creating the my SQL container now let's go to the mobile exr so that is nothing but here I have already connected to my server now here let's try to see whether any available or not if you try to see here so we are having some engine X container and Apache container so what I will try to do is I will try to delete remove these two containers so I will clean up these two containers so Docker container RM Apache container Apache container yeah and also engine X container so I'll be deleting this INX container so press enter so all the things will be all the containers is deleted so if you try to check my container so nothing is there so fine so first what is the container we need to create that is nothing but my SQL container so for for my SQ container let's check that whether image is available or not you'll be able to see that my SQL image is available so let's try to create the container my by using the my SQL image so Docker container run iph D in the detach mode and we will be not using the port forwarding why because we we don't want this my SQL to be exposed to the outsite now hyund D is there run hyund is there and we need to give the name of the container that is nothing but my SQL container I will give and another one what we need to give if you try to check here the environment variables first my SQL root _ password and my SQL _ database okay so here I can give Hy e my SQL _ root root _ password is equal to test 1 2 3 4 so just I'm giving test 1 2 3 4 for the demo purpose only so now my _ database so for the database I'm giving the WordPress so you can give whatever the database name you want you can give it but at the time of Wordpress installation if you if you WordPress ask what is the database I need to means you need to give the WordPress whatever the database name you have given it here that the same name only you need to provide it there also that's it so these are the thing and at last what we need to do is we need to give the container name that's it now when I try to press enter automatically the container will be created so container will be created within no time so Docker container PS I a now you'll be able to see my SQL container has been created and it it is listening to the P 3306 let's see that whether I can able to connect to this container or not so my SQL so we know that my SQL client is installed in this one so hyph H 1727 do 17. 0 do2 this is the uh thing and hyphen U root and hyphen P so it ask for the password there is nothing 1 2 3 4 and cannot connect to the my SQL Server so why it is cannot able to connect it 3306 it is there right so equal container it is up okay so let's try to check Docker container inspect equal container okay let's try to check it and the IP address it is end is 172 17. 02 only so fine without any problem let's try to check it again so maybe the container immediately got started right try to connect again so my SQL hyphen H 17270 do2 and hyphen U root and hyphen P password test 1 2 34 so now it is connected see so we are able to connect it so fine now let's try to check the databases show databases so we are able to see a WordPress database has been created there and if you try to use the database use database WordPress so I'm use WordPress let's try to use it directly uh WordPress has been used now if you try to check the tables in this one so nothing nothing tables are there so now my SQL has been successfully installed now it's time for us to install the WordPress also so exit so fine now the second image which we need to install is the WordPress so if I go into this WordPress so this is the WordPress we need to install it and everything is there so where we can create this WordPress so now we have the DB user and all those things right so one thing is so you know about the DB user that is nothing but WordPress DB user is uh root and DB password is test 1 2 3 4 which we have created and DB name is the WordPress and we doesn't have any table prefix like wpor or some prefix we can add it at the starting of the table so that that prefix will be there so we haven't added any prefix for that one so these all the things we can provide it as an envirment variables or otherwise after installing of the container the WordPress also will ask you these all the things so let's try to do it in the so instead of providing the environment variables let's try to provide it through the U dashboard only so here I am creating the uh container so something like Docker so right now I don't have the image right so right now I don't have the image of the WordPress so first I need to download the image right Docker pull so I'm not pulling the image directly I'm creating the container without having the image so that means what will try to do first it will try to check in locally whether the WordPress image is there or not if it is not there means then it will download the WordPress image and then it will try to create the container so let's try to do the second version so Docker container run iph D iph iph name WordPress iph container that's it so this is the name I have given and uh this is the thing I have given now what I will try to do is I will give the put forwarding so iph P 1890 should be listen to the 80 okay so we should give Gap or not I don't remember exactly yeah so that's it so 8090 Port will be accessed from the 192.
168. 0. 1 and 80 Port is the default Port of this container fine so that's it and I will give the last is the WordPress image so it's enough so these are these are more than enough and if I click here unable to find the image WordPress latest locally and it is pulling from the uh from the docker Hub so it will take some time to download this WordPress as that WordPress image is little bit larger in size than other images so depending on your internet connection the WordPress image will be downloaded so let it download so it will take some time so now the docker server has been sorry not the the WordPress has been installed so if you try to check the status of container if you try to check the status of this one Docker container PS I a now you'll be able to see both the WordPress and also the my sqls containers are started so now let's check the image also whether the image is available or not if you try to see the WordPress image is also available that the total size is around 685 MB L pretty much big that one so fine so now we got the WordPress image also and also we have did the put forwarding with the 8090 put okay now what is the IP address of this Docker host machine so do Docker sorry I will try to do not Docker IP address show and this Docker host machine so here the docker zero host machine is 1 1721 17.
01 and it is listening to and the docker host machine is 192. 168. 0.
1 so now I can use something like in the browser if I go into this browser and here I can search for 192. 168. 0.
1 column 1890 and if I try to press enter automatically the WordPress installation will open see here it is asking you English continue and here it is telling that welcome to Wordpress so the database is not existed so do you want to create the database okay okay let's go and here it is asking you the details database name we know that we have given the name as WordPress only and the username is root and the password is test 1 2 3 4 and the database host is not Local Host that is nothing but 172 17. 0.