gpt4 book ai didi

docker - 使用 Docker 部署时的容器名称

转载 作者:行者123 更新时间:2023-12-02 06:30:36 27 4
gpt4 key购买 nike

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

docker ps -a

我得到这个输出

docker output

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

最佳答案

这些是为您运行的每个容器生成的随机名称。
您可以在 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 to your docker run commands 来固定名称.

这种做法是在commit 0d29244中引入的。通过 Michael Crosby (crosbymichael)对于 2013 年 10 月的 docker 0.6.5:

Add -name for docker run

Remove docker link
Do not add container id as default name
Create an auto generated container name if not specified at runtime.

Solomon Hykes (shykes)在 docker 0.7 中通过 commit 5d6ef317 改进了这种做法:

New collection of random names for 0.7:

mood + famous inventor.
Eg. 'sad-tesla' or 'naughty-turing'

关于docker - 使用 Docker 部署时的容器名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34132237/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com