Okay, to start a container based on an Nginx image, and also with some port accessibility,
we need docker run, minus D for the detached mode, minus P 80 88 colon 80, because Nginx
by default listens on port 80, Nginx. And then docker ps is showing that the container
is running. And I'm looking for vigilant Antonelli, which we can see right here, started four
seconds ago. So if I want, I can use docker stop, vigilant Antonelli, that will stop it.
And then remove the container image. Now if I use docker images, I can see all the images.
And if I use docker image, remove Nginx, do you think that's going to work? No, it's
not for the simple reason that we have another container that is currently running based
on that image. Now, it's not a very good idea to remove the image, not even a force remove,
because that will crash the other image. But if you want to, I can show you how to remove
another image, docker image remove, or docker RMI, that will also work. Docker image remove
is the new command, docker RMI is the old way. So I'm going to use docker image remove
on busy box. And oh no, there we can also see it's used by a container. But this time,
it's a container that's no longer running. So docker RMI minus minus force is what you
can do to force it off. That will remove the container and also the container image.