All right.
We have just made the notes of two comments that we have used for lounge of my Skrill and BHP my Edmond
containers and we will get back to them a bit later.
For now let's again greed to busy box containers and less try to perform communication between them
using host names or names or doors containers.
Let's do that.
Let's lounge first.
Busy Box container here Docker around this idea busy box with me open up new tab and here will be another
busy box container dock out Ron that's a deep Busy Box and let me verify which IP addresses we're assigned
to those containers hostname.
This I actually those IP addresses are the same as well signed before but again the reason for that
is that there are no other containers currently running in our setup.
If they are where additional containers with IP addresses that are used to here now for example this
one then a NAS or IP addresses will get assigned to those busy box containers like 17 or 517 or 6 and
so on.
All right let's check the IP address of this container hostname.
This I and it has address one hundred seventy two 17 0 2.
And if you will type hostname like so you could get hostname of this container of the Sarah.
Also same here host name.
And let's not try to be in this busy box Sarah by using its hostname this one.
Let me quote this hostname from here.
Go to this busy box container and use same command but base now hostname instead of APL address let's
press enter and I see answer best address and that means that we are not able to connect to this busy
box container using its hostname.
Let me also show you something.
Let's open up new type and docker P.S. here and let's use Docker inspect command and the type here.
Idea of for example this container 3 9 like so and you'll see again IP address of this container.
Here what is Gateway default gateway that is the same for both containers and here above.
You'll see also fueled cold aliases and now with a set to No no let me show you how we're able to set
custom alias for this container actually let's go back here and let's exit from this container and eggs
it from this container as well and now let me type Docker on Iran.
Does this help.
And the here in this output you should see one option gold age.
Here it is somewhere above that age and here you see the screen it does contain the hostname it means
that using this option you are able to override default hostname that will be assigned to a specific
container.
Also you are able as you already know using option does desk name it is somewhere here.
And yes here it is.
There's this name you are able to assign custom name to the container kept that by default Docker a
science randomly generated name container.
And now let's try to use both options.
Does that name and dash H hostname and assign custom names hostname and the container name to those
busy box containers and verify whether Sampson will change and whether we will be able to connect being
one container from a NAS or using AIS or container name or hostname or not.
Let's do that.
Let me clear a terminal and here will be busy Box 1 Docker run this idea let's use first option does
this name here let's named busier books 1 and next let's use this H option stands for hostname and he'll
let's say I'll use hostname busy books this one I have used different names in order to distinguish
between hostname and the name of the container.
And finally let's use the name of the image it just busy box let's press enter and now we are in CHL
instead of this busy box one container and you file and our host name I should see busy books this one
and if I'll answer hostname this I host name this I I should see IP address of this busy box one container
let's do the same and let's create in similar way second busy books to container let's do that here.
Dr. Ron this idea there's this name name will be busy books doom and hostname will be busy books that
do and here will the name of the image busy box let's press enter and we are now in CHL here in the
second container hostname we'll provide those hostname of the second container busy bookstore and the
host name this I will provide us a biologist on this container let's as before try to pin the good thoughts
to busy box container using its API address this one in order to verify connection between those two
containers being one hundred seventy two seventeen oh two I'll get a response of course but if I'll
try to be in good by hostname busy books this one I'll get better arduous busy books 1 Same response
I'll get if I'll try it to be by using the name of this container its name is busy books 1 Let's do
that.
Been busy books one like so and again but arduous busy books 1 if I go to this the last step and enter
here again Docker appears and afterwords enter Docker inspect Docker inspect and here let's inspect
busy box one container by the way notice here custom names that were assigned to those containers and
desert because we have used their desk name option when we have started those two containers and here
let's inspect for example busy box one busy box one I could use eyes or name or I.D. of the container
let's press enter and I see IPR there's this container but aliases is still set to know if I'll go to
this four step and try to perform same action as with it on busy book storm for example Bianca busy
books to or been busy books this too I'll get same response but address and the reason for that is that
by default in default breach network you are not able to communicate between different containers using
their names or horse names but as a rule in Docker I don't know whether it will change in the future
or not but at the moment it is like this actually if you want to perform communication between a container
of using their names you need to create first custom breach network and then create containers inside
of debt custom breach network and let me next explain you how you're able to create custom network using
the Docker and the create new containers inside of that custom network I'll see you next.
Bye bye.