Monday, 22 July 2019

Docker Command Part-24 By Raj Gupta

                                    WordPress By using Docker Container

We are going to create 2-tiers container  ( web and database ) like WordPress

Database :-

[root@ip-172-31-95-65 ~]# docker container run --name some-mysql -e MYSQL_ROOT_PASSWORD=mypassword -d mysql:5.7

061d5275947a25c9b3ae75d3cefb2cb97f5e65246c6dd86b72bd71bb73942c52
[root@ip-172-31-95-65 ~]# docker container inspect 061

So database IP is  "IPAddress": "172.17.0.2",

Now Web tiers

[root@ip-172-31-95-65 ~]# docker container run --name some-wordpress -e WORDPRESS_DB_HOST=172.17.0.2:3306 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=mypassword -d wordpress

30e5b2fc98ee47d9f63ca52b85dae9ee294e14a8fae91b2e70294bc8b7213dae

[root@ip-172-31-95-65 ~]# docker container inspect 30e

So WordPress IP is "IPAddress": "172.17.0.3",

So WordPress installation done by using container
Now to access this container from outside we need to do port mapping



No comments:

Post a Comment