Learning Docker (Part 2)
- Published on
- • 2 min read

Container Management Commands
To view all the docker management commands, run
docker run --help
Running Various commands
docker ps
The hello-world container we previously ran stopped because its only job was to output text. There is no output because there is no container currently running on your machine. Now run the following command on a command-line:
docker ps -a
You should see a table containng the Container Id, Image, Status...
Run the following command replacing the ID with your container ID:
docker logs 586067abdeac
The above command outputs exactly the same text you saw when you ran the container. This is the standard output of the container. In real-world scenarios, you’ll have containers running in the background (web servers for instance) and this command will allow you to have a look at their output.
docker inspect 586067abdeac
The above command gets you an abundance of information about many aspects of the container - whether it is still running or stopped. Again, in real-world scenarios, this may prove useful for understanding what happens inside your containers.
All of the information you obtain from the above commands takes up space, and once you’re completely done with a stopped container, you may want to reclaim that space. This is where the docker rm command comes in.
docker rm 586067abdeac
The container with the ID you ran the above command on, should now be deleted. To confirm that the container does not exist anymore, run the following commands replacing the ID with your container ID:
docker ps -adocker logs 586067abdeacdocker inspect 586067abdeacDocker doesn't know about that container anymore.