"names generator" gives docker container default name which randomized but uniqued.
Use binary file in this GIST repository.
$ git clone https://gist.github.com/YumaInaura/0c8de43e3342db53059584661d0b491e names-generator
$ ./names-generator/names-generator
affectionate_matsumoto
$ ./names-generator/names-generator
recursing_vaughan
( moby/LICENSE at master · moby/moby )
For example you can see default names in docker ps
.
In below case docker contaners were named as …
- quizzical_payne
- sharp_pike
- optimistic_kepler
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dbd46a366aa3 alpine "sleep 100" 2 seconds ago Up 1 second optimistic_kepler
454ee02db352 alpine "sleep 100" 3 seconds ago Up 2 seconds sharp_pike
1d19cef9660b alpine "sleep 100" 4 seconds ago Up 3 seconds quizzical_payne
Include one humour in codes.
...
// GetRandomName generates a random name from the list of adjectives and surnames in this package
// formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random
// integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
func GetRandomName(retry int) string {
begin:
name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))])
if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
goto begin
}
if retry > 0 {
name = fmt.Sprintf("%s%d", name, rand.Intn(10))
}
return name
}
- moby/names-generator.go at master · moby/moby
- moby/names-generator.go at 1fd7e4c28d3a4a21c3540f03a045f96a4190b527 · moby/moby
Probably it will take long time for downloading because docker/docker
is large repository.
$ go get -v github.com/docker/docker/
github.com/docker/docker (download)
$ cd $(go env GOPATH)/src/github.com/docker/docker/pkg/namesgenerator/
$ go run cmd/names-generator/main.go
hungry_mccarthy
$ go run cmd/names-generator/main.go
mystifying_bhaskara
$ go build -o ~/tmp/names-generator cmd/names-generator/main.go
$ ~/tmp/names-generator
quirky_lederberg
$ ~/tmp/names-generator
zen_torvalds
- Docker version 18.06.0-ce, build 0ffa825
- go version go1.10.3 darwin/amd64