0
0

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 3 years have passed since last update.

Dockerコマンドどこまで短く出来る?

Posted at

Dockerのコンテナ指定のために毎回長いコンテナ名を打つのはだるい

結論

識別子はハッシュ先頭2文字だけで良いみたい

$ docker run -d ubuntu sleep 600
0a800a0d3a084ad4ca9c76a5efdc69634c025a8a86a0a1374e862f50fea306b1

$ docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED         STATUS         PORTS     NAMES
0a800a0d3a08   ubuntu    "sleep 600"   7 seconds ago   Up 4 seconds             xenodochial_boyd

$ docker exec -it 0a bash
root@0a800a0d3a08:/#

$ docker stop 0a
0a

execの方がよく使うかも

参考

gitのコミットハッシュは4文字まで短く出来るらしい

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?