In our work environment, it is important to familiarize ourselves with those commands that will make our lives easier and optimize our workflow, that is why you cannot miss this shortcut that will change the way you use Docker.

Docker ID

In general, we are always making the complete call of the container id with the typical copy-paste, but enough of that, because just by writing the initials of the container ID, Docker will automatically recognize and identify the said call, is important clarify, we must write the ID long enough to make it different from the other IDs, this is necessary since it can happen that several IDs start in the same way and conflict is generated when making an ambiguous call trying to call multiple IDs, in the following example we will see a practical case and how to prevent this conflict from happening.

Containers ID Example:

2e195a97ce37

2e70cdc279bc

cfd00a153492

To make a call to the first ID it would be done as follows:

Structure:

docker <command> <id_container>

Called:

docker start 2e1

In this way, we would see all the logs corresponding to the container 2e195a97ce37 and at the same time we can notice that the call of 2e would be redundant between both ID that starts similar, but when adding the 1 we have a differential factor between both ID.

Called with ID conflicts starting like:

Differential factor:

Thanks to this shortcut we will have a better ability to move between the commands by avoiding all the steps that involve copy paste and we will save a great amount of time in verifying that everything is in order with our containers.


Posted by

Carlos Ayala Visbal – DevOps Developer

CALL YOUR DOCKER CONTAINERS, EASILY | LA ELECTRONIC
Technology

CALL YOUR DOCKER CONTAINERS, EASILY

In our work environment, it is important to familiarize ourselves with those commands that will make our lives easier and optimize our workflow, that is why you cannot miss this shortcut that will change the way you use Docker.

Docker ID

In general, we are always making the complete call of the container id with the typical copy-paste, but enough of that, because just by writing the initials of the container ID, Docker will automatically recognize and identify the said call, is important clarify, we must write the ID long enough to make it different from the other IDs, this is necessary since it can happen that several IDs start in the same way and conflict is generated when making an ambiguous call trying to call multiple IDs, in the following example we will see a practical case and how to prevent this conflict from happening.

Containers ID Example:

2e195a97ce37

2e70cdc279bc

cfd00a153492

To make a call to the first ID it would be done as follows:

Structure:

docker <command> <id_container>

Called:

docker start 2e1

In this way, we would see all the logs corresponding to the container 2e195a97ce37 and at the same time we can notice that the call of 2e would be redundant between both ID that starts similar, but when adding the 1 we have a differential factor between both ID.

Called with ID conflicts starting like:

Differential factor:

Thanks to this shortcut we will have a better ability to move between the commands by avoiding all the steps that involve copy paste and we will save a great amount of time in verifying that everything is in order with our containers.


Posted by

Carlos Ayala Visbal – DevOps Developer