本文介绍了使用Docker部署时的容器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行此命令以查看最新进程的状态时,我刚刚完成了我的第一个Docker部署...

I've just done my first ever Docker deployment, when i run this command to see the status of recent processes...

docker ps -a

我得到这个输出

我的问题是;这些名字指的是什么?

My question is; what are those name referring to?

推荐答案

这些是为您正在运行的每个容器生成的随机名称.
您可以在 pkg/namesgenerator中看到这些名称/names-generator.go .

Those are random names generated for each container you are running.
You can see those names at pkg/namesgenerator/names-generator.go.

// Docker, starting from 0.7.x, generates names from notable scientists and hackers.
// Please, for any amazing man that you add to the list, consider adding an equally amazing woman to it, and vice versa.
right = [...]string{
    // Muhammad ibn Jābir al-Ḥarrānī al-Battānī was a founding father of astronomy. https://en.wikipedia.org/wiki/Mu%E1%B8%A5ammad_ibn_J%C4%81bir_al-%E1%B8%A4arr%C4%81n%C4%AB_al-Batt%C4%81n%C4%AB
    "albattani",

    // Frances E. Allen, became the first female IBM Fellow in 1989. In 2006, she became the first female recipient of the ACM's Turing Award. https://en.wikipedia.org/wiki/Frances_E._Allen
    "allen",
...

您可以通过添加 -name docker run 命令.

You could have fixed name by adding --name to your docker run commands.

这种做法是 commit 0d29244 中引入的://github.com/crosbymichael"rel =" nofollow noreferrer> Michael Crosby( crosbymichael ) for docker 0.6.5 in 2013. October:

That practice was introduced in commit 0d29244 by Michael Crosby (crosbymichael) for docker 0.6.5 in Oct. 2013:

Solomon Hykes( shykes )演变为在docker 0.7中使用提交5d6ef317 :

这篇关于使用Docker部署时的容器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:15
查看更多