In the last section we spoke about how we could open up a shell inside of a running container by using
Docker exact dash I.T. and then passing in shell or just simply SDH as the command that we want to execute.
We've been talking about all this in the context of the exact command which we can use to execute an
additional command inside of a container.
But if we wanted to we could also run Docker run the original Docker run command right here along with
that I.T. flag and start up a shell immediately when a container first starts up.
Now of course if we start up a shell right when the container first starts that's going to displace
or keep any other typical or default command from running but sometimes it is quite useful to get a
empty container with a shell inside of it and just be able to poke around and not have any other process
running.
So let's try that out right now at our command line.
I'm going to flip back over to my terminal.
I'm going to run it Docker run.
I'm going to put on the I.T. so that we can attach to standard in on the process that we're about to
start up.
I will run the busy box image and then the appropriate program or the primary command that we're going
to execute inside the container will be sdh.
So this means start up a new container out of the busy box image run the SDH program which is a shell
and attach to standard in of that program.
So when I run this I'll be presented with a command prompt and just like we saw a moment ago I can run
the Ellis command I can ping Google dot com and hit control C to stop it.
I can echo a message whatever I want to do.
Again this is a command that you might be using somewhat frequently.
Anytime that you want to poke around a container.
The downside to using Docker run with I.T. and SDH is that chances are you're not going to be running
any other process.
It's a little bit more common that you're going to want to start up your container with a primary process
of like maybe your web server or whatever it might be and then attached to it a running shell.
By using the docker exact command wherever it is right here.
But I just wanted you to be aware of this alternate use of Docker run.
All right.
Now one last thing I want to cover in the next section.
So quick break and I'll see you in just a minute.