-: In the last section,
I showed you how I had multiple terminal windows open,
and between the different terminal windows,
I had reconfigured my copy of Docker client.
And so in this section I'm gonna show you
how you can do the same thing,
and then we'll talk a little bit about
why you would want to do this at all.
All right.
So here's what we're gonna do,
anytime that you want to configure
your local copy of the Docker CLI,
remember that's the thing that we are accessing
inside of our terminal.
This is Docker CLI right here.
If you want to reconfigure your copy of Docker CLI
to communicate with a copy of Docker server
inside of the virtual machine
we're going to run this command right here.
So I'm gonna copy that command.
I'm gonna go over to a new terminal window,
and over here when I do a docker ps,
you'll see that I am clearly connected
to my local copy of Docker server.
Now, I'm going to run
that command right there.
I'll leave it on the screen so you can read it
and you can type it inside of your terminal, if you want to.
So when I run this command right here,
it's going to, very temporarily,
reconfigure my copy of Docker client
or Docker CLI to connect to the Docker server
inside of my Kubernetes node.
So after running that command, I can now do a docker ps
and I'll see the print up from all the different containers
that are running inside of my virtual machine.
Now, quick note here,
and this is an extremely important thing to understand,
anytime that you run that eval command right there,
it is a very temporary reconfiguration of your Docker CLI.
So when you run this command,
it's only going to reconfigure your Docker CLI
in your current terminal window.
What that means is,
right here if I do a docker ps,
I clearly am working with the reconfigured version
of the Docker client,
but as soon as I open up a new terminal window,
it goes back to its old behavior.
So when you run that command, two things to be aware of;
first off, it is not a permanent change,
you're not permanently reconfiguring
your copy of Docker client.
The other thing to remember
is that if you decide to close down your terminal window,
maybe you take a break from Docker,
or something like that, or you turn off your computer
and close all the programs running on it.
If for whatever reason, you close that terminal window,
you have to rerun this command right here
to reconfigure your Docker CLI again.
All right, So just to really make sure that's very clear,
I'm gonna show you one more time.
I know this is getting a little bit repetitive,
but I can just about guarantee you
that at some point in time
you're gonna run docker ps and say,
"Hey, wait why am I not seeing everything
inside the virtual machine?"
So when I run that command and do a docker ps,
I see everything inside of the virtual machine.
As soon as I open up a new terminal window
and do a docker ps, again. Back to old behavior.
So throughout the rest of this course,
if I ever say to you,
"Hey, let's see what Docker
inside the virtual machine is doing,"
you need to make sure that you first run
that command right there.
Otherwise, you're not going to be able
to look inside of the virtual machine and figure out
what the copy of Docker inside there is doing.
Now, just in case you're curious
about what exactly this command right here is doing,
you can actually take
just the minikube docker-env command right there,
and run it by itself.
When you do so,
you'll see that it's actually
just exporting a couple of environment variables.
So just so you know, whenever you use a Docker CLI command
like say docker ps right here.
When Docker is invoked,
it's going to look at a set of environment variables
to decide what copy of Docker server
it is supposed to connect to
and attempt to execute this command on.
So when we run this minikube docker-env command,
with the eval command especially,
it's gonna set up some new environment variables
that are going to tell Docker CLI
to reach into the virtual machine
to find the copy of Docker server
that it's supposed to work with.
And if you look at this Docker host variable right here,
you might even be able to recognize the IP address.
It's actually the IP address of your Minikube server.
For example, if you do minikube ip right now,
you'll see it prints out the identical IP address
to what we're telling the Docker client
to attempt to connect to.
All right.
Now, one last thing I wanna mention here.
It's kind of hard to remember this entire command by itself.
You know, it's kind of hard to remember this
and have to recall it at some point in the future
when you want to reconfigure your shell.
I found that a very easy way to remember this command
is to instead memorize the command,
minikube docker-env, by itself.
Remember that's what we just ran two seconds ago
to print out all those environment variables.
When you run just minikube docker-env by itself,
it will actually tell you,
"Hey, if you want to configure your shell,
or essentially your current terminal window,
here is what you need to run."
And it's the full length command
with the eval on there as well.
So a very easy way of memorizing how to do this
is not to memorize the eval part
just memorize minikube docker-env.
That's all you have to remember.
And as long as you can remember that, type that in,
and then it will tell you exactly what to type right here.
So you can copy, paste that in, and boom, you're good to go.
All right, so that is what is going on,
when we run that docker ps
and see a listing of all the containers
inside the virtual machine.
Now, the very last thing I wanna tell you is
why we would want to do this, right?
Why would we ever want to look at the copy of Docker
running inside of the virtual machine?
Especially since I told you,
when we first started looking at Kubernetes,
that you and I as developers,
do not mess around with the inner workings
of the virtual machine.
Remember, I told you,
We don't mess around with the virtual machine ourselves.
We leave it up to the master to change the configuration
of the virtual machine,
or change the different containers running inside there.
So let's take a quick pause right now.
When we come back in the next section,
we'll talk about why we might want to reach into this thing
and inspect the different containers that are running
and kind of mess around with them a little bit.
All right. So quick pause and I'll see you in just a minute.