We have just successfully created phpMyAdmin with additional environment variable called underscore
host.
And in that variable we have set IP address of the MySQL server.
And finally you have seen that we were able to connect to MySQL database using phpMyAdmin.
And again, main idea here is that we are running phpMyAdmin and MySQL on two different containers.
Please notice that such approach is exactly the same for other containers that you want to connect together.
Now let me get back to two BusyBox containers and explain you concept of the custom networks and explain
you how you are able to communicate between containers using their names instead of IP addresses.
But before doing that, let me quickly take notes of the commands that we have used here for start of
the phpMyAdmin, this command and MySQL container Command.
This one.
And for that, let me go to Visual Studio code here and let me minify this folder and let's create a
new folder called MySQL here near those folders, let's click on new folder icon and here will be MySQL
like so.
And here inside of this folder let me create new file called commands dot txt.
And here let me have a note of those commands that we have used for start of the MySQL container.
Let me copy this command copy.
Go to Visual Studio code and here let me add a comment.
Start MySQL server with custom root password.
Let me hide this pain.
And here, let me paste this command.
And next, let me type.
Start phpMyAdmin with a host variable and let me copy this command from here.
Like so and paste here.
Great.
Here we have two comments on the list.
And with this command we're able to start MySQL server and with this command we're able to start phpMyAdmin.
But basically for better readability, let me split those commands into multiple lines and for that
I could use here Backslashes like so here I could use tab if you want.
And here let's also add backslash and add new line like so.
Again, there is no difference in previous command and in such command because backslash is actually
just a splitter for large command.
And here let's also split this command like so next, split this command as well, and let's add backslash
here and create this command like so.
Great.
Now those commands are more readable.
And here actually let me add comment over Ipaddress, because here we have connected to MySQL server
using is IP address.
And again, that is not the best approach because IP addresses are usually dynamic, they may change
and that's why it is much better to use hostnames for connection between different servers.
It is a general approach.
Great.
Let me save the file and go back to terminal.
Now let me stop those containers, stop this one and actually stop MySQL as well.
Ctrl C.
It seems it doesn't accept the Ctrl key combination.
Probably Q also doesn't work.
All right.
Let me then go to Docker PS.
Docker PS and here use Docker kill and here will be ID of the MySQL container.
And let's prune all containers.
Docker Container.
Prune.
Yes.
All right.
Let's now proceed.
And next, let's get back to two BusyBox containers.
And let me explain you how you are able to communicate over hostnames instead of IP addresses.
I'll see you in the next lecture.
Bye bye.