18
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Steve Wozniakはつまらなくない。 by docker

Last updated at Posted at 2014-12-19

Steve Wozniakはつまらなくない。

Dockerでcontainerを起動すると、勝手に名前がつきます。(指定しなければ)
その名前はどうやって付けられているのか、気になってコードを見てみました。

付けられる名前は例えば、

  • adoring_goldstine
  • angry_almeida

のように、 形容詞 + 人名 です。

形容詞は全部で57個
人名は全部で73個

ちなみに、 偉大な科学者とHackerの名前 です。
(コードのコメントに、人物の説明書きがあります!!)

その組み合わせは 57 x 73 = 4,161 個です。

ところが 、出てくる組み合わせは 4,160個
一つだけ、出ない組み合わせがあります

その理由は以下のコードにあります。

    if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
        goto begin
    }

それは、 boarning_wazniak なぜなら、Steve Wozniakはつまらなくないから。

備考

名前が作られてるコードはここです
https://github.com/docker/docker/blob/3c5155ac16bbf4d02d88ad5f2c4bfef7844dad4e/pkg/namesgenerator/names-generator.go

数字が最後につくこともあるみたいです。
https://github.com/docker/docker/blob/610842f906a942e9784bc16c201860dc89ba19ba/daemon/daemon.go#L491

以下のコミット時点での数です。https://github.com/docker/docker/blob/3c5155ac16bbf4d02d88ad5f2c4bfef7844dad4e/pkg/namesgenerator/names-generator.go

18
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?