- All right, let's run some containers.
The Podman command provides
nearly all functionality that is provided by Docker.
Actually, the Podman command is easy to get started with
and for that reason, in the remainder of this lesson
I will use the Podman command only.
If you want to use Docker, that's okay.
Just replace Docker with Podman and it will work.
Because in fact the Podman project
contains features that are available
in Docker and not in Podman.
They consider that Burkes and they will fix that.
And that is why they are very similar.
That's also why all commands in this lesson
are completely compatible
with the equivalent Docker command.
And as I mentioned, if you're on Docker
just replace Podman with Docker.
One tip, if you're going to use a Podman command
options that are passed to the Podman command
need to be specified before the name of the image.
That's a very common error
and I wanted to mention that separately.
And that is because anything specified
after the name of the image is interpreted
as an argument to the command
that runs inside the container.
Let's run some containers.
So to start with, I'm using Podman alone
minus D ends in X minus minus name is my-web.
And then what do we see? We see a lot,
but let's figure out what's going on. Podman PS
and oh boy, Podman PS isn't showing anything.
What is going on? Well, Podman logs minus L
allows us to investigate the logs. And what do we see here?
These are the logs that were generated
by the container application
and the logs are telling me
name my-web not found.
Now what is wrong here? Well, the wrong part is
where I'm specifying minus minus name is my-web
all the way to the end of the command.
Minus, minus name is my-web is an argument to podman-run.
And arguments to podman-run should always come before
the name of the container image and not after.
So if you run it again then we should be better
and Podman PS is showing that right now
it is, it is running and that's good.
Next I want to use Podman and run Busybox.
Busybox is a minimal cloud image
and is minimal cloud image can be used
as a foundation for your own images.
So here we can see it's trying to pull
Docker dot IO library Busybox,
that's the fully qualified container name.
And that seems to be okay.
And what happens if you use Podman PS?
Now Podman PS is only showing ends in X.
Now in order to further investigate,
we need Podman PS minus A
because Podman PS is showing currently running containers
Podman PS minus A is showing also containers
that have been started in the past.
And there on the last line
we can see that this Busybox container
was created 17 seconds ago and exited 18 seconds ago.
Now what is going on?
Well the Busybox container is configured
to run an SH command.
That's a default command and that is running a shell.
But if you run a shell, it needs to be connected
to standard input, standard output, standard error.
And neither of these is the case.
Well just running Podman run Busybox.
That is why the Busybox container
has been started and immediately exited.
If you wanted to do something
then you rather use Podman run minus IT.
Where minus IT is opening an interactive terminal
on Busybox and we are using SH and there we go.
Here we are inside the Busybox environment.
So if I use a command like PS AUX,
which happens to be available in this container image.
I see what is visible from within the name space
that is started by this container,
the restricted environment. That is what this is all about.
Now let me use Control P, Control Q to disconnect
and let's do Podman exec minus IT my-web at SH.
Hey, what is that?
Well, we previously have already started
the my-web container and now I'm using
Podman exec to run SH inside my web
in an interactive terminal.
So right now we are in my-web
and if I use PS AUX then what do we see?
We see CPS command not found.
Now that is something that you will
very commonly come across while running containers.
A container is not a full Linux installation.
A container is an application, and within that application
common Linux tools are not always available.
And that is why I see PS command not found.
This container image doesn't have the PS utility.
The only way to figure out what is going on
is when you type LS on PROC where on the left hand side
you see the PID directory,
so one the 24, the 25, the 26.
These are the processes that are running.
And if you wanna know what is going on
well try proc one CMD line do a kettle net
and there you will see that this is an Nginx master process.
Nginx minus G daemon off that's the process.
That's how it works in containers.
Containers are a restricted environments.
I'm using exit in order to close the shell
that I just started with Podman exec
and adjust the Podman PS to verify that my Nginx
as well as my Busybox are still running.
They are and now I can use Podman inspect on my-web
as the last command.
What is that?
Podman inspect is a nice command
that will show you different details
about currently running containers.
Normally a lot of output will follow,
so just pipe the output through the less command
and there you can see everything that is going on.
As I told you, a lot of output
telling you exactly what this container is doing.
This is the most important part
where we can see the path and the arguments.
Giving information about the default command
that was started by this container.