We were just talking about the differences between starting and creating a container.
Along the way we ran the command Docker create and then something like Busy Box echo Hi there.
We then got this print out of the container I.D. that was created and then we found that we could start
up the container by running Docker start and then pasting the ideas in.
However there is a real little catch to that.
We found that in order to actually see information being printed out from the container we had to add
in that dash a flag right there.
So what would happen if you wanted to get all the output from the container without having to add in
that dash a flag for example let's imagine that running Docker start like this was a really expensive
process and we started up a process inside there that would take many minutes to run.
Chances are if we forgot to add on the dash a flag to see the output from that we might be a little
bit frustrated with ourselves because then we would have to rerun Docker start dash Shea a second time
and wait another couple minutes in order to get around that we can make use of an additional command
of Docker logs and then the idea of the container that we want to get output from the logs command could
be used to look at a container and retrieve all the information that has been emitted from it.
Let's try using that Docker create start and then logs command again and see what happens.
So I will do Docker create busy box and I will echo Hi there.
I'll then take that idea and run a docker start and paste the idea that starts up the container it executes
echo high there inside of it and then it immediately exits.
And so now at this point I want to go back to that stopped container and get all the logs that have
been emitted inside of it.
So to do so I can run at Docker logs and then paste that idea in and I'll see that when the container
had been running it had printed out the string.
Hi there.
One thing to be really clear about is that by running Docker logs I'm not rerunning or restarting the
container to end in any way shape or form.
I'm just getting a record of all the logs that have been emitted from that container the docker logs
command is something that we're going to be using quite a bit as we are trying to debug or set up new
containers because as you can see it's a really good way to kind of inspect a container and see what's
going on inside of it.
All right.
Still a couple of more commands to get through.
So let's take another quick pause right here and continue in the next section.