这篇文章主要介绍了Docker中如何得到最后执行的容器ID,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
得到最后执行的容器的ID
$ ID=$(docker run ubuntu echo hello world)
hello world
$ docker commit $ID helloword
如果这样觉得麻烦,你可以这样:
$ alias dl='docker ps -l -q'
$ docker run ubuntu echo hello word
hello world
$ dl
1904cf045887
$ docker commit `dl` helloworld
fd08a884dc79
感谢你能够认真阅读完这篇文章,希望小编分享的“Docker中如何得到最后执行的容器ID”这篇文章对大家有帮助,同时也希望大家多多支持天达云,关注天达云行业资讯频道,更多相关知识等着你来学习!