Difficulty: beginner
Estimated Time: 10 minutes

In this scenario, we'll learn how to name a container and use that name to refer the container in various operations. We'll also learn how to inspect a container to get various details and parse them for some field.

In this scenario we learned about how to name container and use that name to refer container in various operations. We also learned how to retrieve details of container using docker inspect command.

Naming and Inspecting

Step 1 of 2

Step 1

Name a container

So far we have referenced containers only with their ID or with a prefix, but containers can also be referenced by their names also.

Create a new container with name counter from image loodse/counter using docker run -d -it --name counter loodse/counter.

Now the container with name counter is started, you can perform various operations on containers by using its name.

Check the logs using docker logs counter.