I discovered this while attending DockerCon last year while a Docker engineer performed a demo. I'm a big fan of saving time especially when it comes to typing and was instantly in shocked to see this timesaver. I have yet to find this documented somewhere so best share this knowledge, right?
Have you ever encountered having to type or copy a bunch of ID's of either a container or image? In the Hello World example below you see a Hexadecimal number 690ed74de00f in the output of $ docker ps.
hello-world latest 690ed74de00f 4 months ago 960 B
Instead of copying or typing the entire ID number type only the first two characters. In the example above just typing 69 in a docker command will fetch your results.
$ docker inspect 69
In the event you have two containers or images with the same first 2 characters which if you do it's best to go buy a lottery ticket right away and type one more character. That's it I just saved you from having to type the extra 10 characters or copying and pasting.
Now with all this time you will save be sure to sign-up to my newsletter or check out my GitHub projects.
If you liked this article be sure to Follow Me on Twitter to stay updated!