使用Docker部署时的容器名称 [英] Container NAMES when deploying with Docker

查看:55
本文介绍了使用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:

docker run

添加-名称

删除docker链接
不要将容器ID添加为默认名称
如果在运行时未指定,请创建一个自动生成的容器名称.

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中使用提交5d6ef317 :

新的0.7随机名称集合:

心情+著名发明家.
例如.伤心的特斯拉"或顽皮的图灵"

New collection of random names for 0.7:

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆