We have just assigned two busy books contain those two newly created custom breach network and we can
verify that we are able now to communicate between containers using their host names but drawback is
that the host names are randomly generated.
They are based on ideas of containers and it's really not convenient to use those randomly generated
ideas.
Also we have found out that we are not able to communicate between containers using names or randomly
generated names for those containers.
Wonderful.
Let's now try to create the same two containers but now with custom names let's do that.
Let's exit from this container and let's exit from this container like so and let's around new container
here.
Dr. Ron this idea does desk network.
Same as before.
Here we'll be custom network.
Next let's.
Because if I custom name there is this name here will be a Busy Box one.
And next the common name of the image busy box.
Like so let's lounge it and let's do the same with second Busy Box container dock.
Wrong desk idea.
There's this network custom there's this name and name.
We'll be a busy books too.
And here will be the name of the image.
Same as before.
Busy Box.
Let's start it.
We are in C H shell and now let's try it to being a fairly busy box container using its name Busy Box
one being busy box one and now I get a response.
It means that now we are able to communicate between containers using data custom names not random names
with random names.
It doesn't work but with custom does.
Also let's go to first visible container and verify all positive connectivity of being busy books too.
And I'll get the response.
Same as before.
Again notice that we are using names not host names you file.
Have a look at hostname.
It will be again randomly assigned like this.
And again you are still able to connect to this container using its hostname but it's not convenient.
Let's go to these CBC Books.
I have copied to that idea and use it in command and I'll get a response as well.
Wonderful.
Let's now use Docker inspired comment in order to read the tales about specific contain that is currently
run.
Let's go to this last step and let's actually forced to read again details about custom network.
Let's clear timing no Docker or network inspect custom and here I I'll see two containers that are currently
assigned to this custom network heroes heroes container and here was second container.
And now you see those customarily assigned names busy bookstore and busy box one.
Let's now have a look at containers door on B.S. And now let's use Docker inspect command in order to
read the tales about busy books.
One container busy books one.
And here in this output you'll see the tales about specific container.
It is in my case busy books.
One container here is its IP address.
It is assigned from the costume breach network range.
Here is Gateway and this IP address is assigned actually to Docker host that acts as a gateway for all
containers that are attached to this custom breached network.
And also if I'll scroll up you should see L.A. has a section and now it is not empty.
Here you see actually hostname of this specific container.
But name of the container is not listed here in this output.
I would actually listed here as well because as we have verified we are able now to communicate with
container using its name.
And under the hood actually there was additional alias for this container and this alias is its name.
But it is for some reason not listed here.
But anyway we are able to communicate now between containers using ice on day of names or host names
and it is a great benefit of using custom networks.
Also in the same way you are able to inspect the second container using Docker inspect Busy Box to command
and you'll see the dailies about this second container here was its IP address.
Same gateway as for Busy Box one container.
And also you'll see LDS that holds the idea of this container and the somewhere above.
You should also find the hostname sorry name of this container.
Let me look somewhere at the beginning of this output a bit down.
Yes.
Here with this name of this container is listed here.
Busy Box too wonderful.
This how we we are able to create connectivity between two containers in the custom network.
And again now we are able to communicate between containers using their names.
And let me show you why it is important.
Let me exits from this container.
It is a busy box one.
Let's now list containers Docker because there was only one busier box to contain the running but there
was no stopped.
Busy Box the one container.
Dr. Pierce this a here was stopped on the least busy box.
One this one.
And now let's try to start over this busy box.
One container using Docker start to come and start this idea basically before starting.
Let me go to visit book store and try it to be in a busy box now being busy books one.
And of course I'll get the response bat address because now busy box one is not reachable but no less
thought container over again Docker I'll start this idea and here it will be simply the name of the
container.
We don't need to specify in network settings or custom name because this container already exists.
We are using local start command in order to start over again.
Look I start this idea and here will be the name of the container in our case busy box one.
It seems that I need to use only this AI option like so and now this container was started again.
Let's go back to a second busy box and try again to busy box one and now it works again.
What I did.
I have actually arrest thought it contained the same container.
Busy Box one with same IP address and same name music box one and now connectivity is restored.
And that means that we are able to use this approach in order to create stable connectivity between
different containers in the same custom network.
And let's use this approach in order to create connectivity between BHP my admin container and my Eskil
container.
For now let's exit from all those containers exit from this one exit from this one as well.
And let's remove all stop containers docker container prune yes and no we're good to go and we are ready
to adjust so top of BHP my Edmond and my all containers.
I'll see you just in a moment.
My.