Translate

2018年6月18日月曜日

今頃、docker image ls と docker images ls の違いに気づく

Dockerを我流で学んで使いだして1年以上立つのだけど、
勉強が我流なだけに、たまにとんでもない「抜け」がでてくる..


先日ふとローカルPC上のDockerイメージを一覧させようと以下のコマンドを実行してみた

PS C:\Users\XXXXX> docker images ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

PS C:\Users\XXXXX>

..あれ、あるはずのイメージがないぞ..

もう一回..

PS C:\Users\XXXXX> docker image ls
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
tensorflow/tensorflow      1.8.0-py3           a83a3dd79ff9        7 weeks ago         1.33GB
hello-world                latest              e38bc07ac18e        2 months ago        1.85kB
docker4w/nsenter-dockerd   latest              cae870735e91        7 months ago        187kB

PS C:\Users\XXXXX>

よかったよかったでてきたよ..

..あれ?


でようやく docker image lsdocker images ls の違いに気づいた。

docker image ls を実行すると中間イメージ含めて表示するけど
docker images ls はインスタンス状態のイメージしか表示しないのか..

ねんのためふたつのhelpをだしてみる。

まずdocker images
PS C:\Users\xxxxx> docker images --help

Usage:  docker images [OPTIONS] [REPOSITORY[:TAG]]

List images

Options:
  -a, --all             Show all images (default hides intermediate images)
      --digests         Show digests
  -f, --filter filter   Filter output based on conditions provided
      --format string   Pretty-print images using a Go template
      --no-trunc        Don't truncate output
  -q, --quiet           Only show numeric IDs

そしてこっちがdocker image
PS C:\Users\xxxxx> docker image --help

Usage:  docker image COMMAND

Manage images

Options:


Commands:
  build       Build an image from a Dockerfile
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Display detailed information on one or more images
  load        Load an image from a tar archive or STDIN
  ls          List images
  prune       Remove unused images
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rm          Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Run 'docker image COMMAND --help' for more information on a command.

docker images は基本イメージ一覧専用のコマンドで
docker image はコマンドによっていろんな操作が可能な万能コマンドというわけか。
で、
docker images には ls というコマンド..というかコマンド自体取らないから
ls を無視していたのね..
..そこはエラー出さないとだめじゃないのかな..


..恥かく前に自分で気づいて、良かったよ..


0 件のコメント:

既存アプリケーションをK8s上でコンテナ化して動かす場合の設計注意事項メモ

既存アプリをK8sなどのコンテナにして動かすには、どこを注意すればいいか..ちょっと調べたときの注意事項をメモにした。   1. The Twelve Factors (日本語訳からの転記) コードベース   バージョン管理されている1つのコードベースと複数のデプロイ 依存関係 ...