도커(docker) 이미지의 내용이 궁금할 때

Kubernetes|2018. 5. 5. 14:12

도커(docker) 이미지가 어떻게 만들어졌는지 궁금한데 소스가 없는 경우에는 어떻게 할까? 이럴 때는 docker inspect 명령을 사용한다.

면저 분석하려는 이미지를 pull한다.

$ docker pull tensorflow/tensorflow:latest-gpu
latest-gpu: Pulling from tensorflow/tensorflow
d3938036b19c: Pull complete
a9b30c108bda: Pull complete
67de21feec18: Pull complete
817da545be2b: Pull complete
d967c497ce23: Pull complete
5ddeb439bad8: Pull complete
c6496427ad3b: Pull complete
360fde1360ca: Pull complete
1c3227e49e63: Pull complete
ec2edd14d4b6: Pull complete
96c7a24a6f0c: Pull complete
dee49a23eeb6: Pull complete
3c5ca73fbac5: Pull complete
50f4e1802dc1: Pull complete
316fabb600d5: Pull complete
62c1e601d7a6: Pull complete
Digest: sha256:d31c50ce2d31a21cb5396be59fcab4f8dba405dda2fcaf0f747a407ca277c9f0
Status: Downloaded newer image for tensorflow/tensorflow:latest-gpu

inspect 명령으로 상세한 내용을 살펴본다.

$ docker inspect tensorflow/tensorflow:latest-gpu
[
    {
        "Id": "sha256:e93ab8001bbf2743d82ed90e3735e44615aafd23e794f5561cb510379c8ad869",
        "RepoTags": [
            "tensorflow/tensorflow:latest-gpu"
        ],
        "RepoDigests": [
            "tensorflow/tensorflow@sha256:d31c50ce2d31a21cb5396be59fcab4f8dba405dda2fcaf0f747a407ca277c9f0"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2018-04-28T00:40:03.186381907Z",
        "Container": "e26d7da89405f94fa446e4f03d45a43cbf09e7c26ba544ade272f5570aeab553",
        "Config": {
            "Env": [
                "PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "CUDA_VERSION=9.0.176",
                "CUDA_PKG_VERSION=9-0=9.0.176-1",
                "LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64",
                "NVIDIA_VISIBLE_DEVICES=all",
                "NVIDIA_DRIVER_CAPABILITIES=compute,utility",
                "NVIDIA_REQUIRE_CUDA=cuda>=9.0"
            ],
            "Cmd": [
                "/run_jupyter.sh",
                "--allow-root"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:3dda217166b30645da5f5a71aad7d1e895b86a2235b62856f54494e9b23f2de4",
            "Volumes": null,
            "WorkingDir": "/notebooks",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "com.nvidia.build.id": "63756748",
                "com.nvidia.build.ref": "2b1c8edf8d79830ad811baff9630adb3bcb5db46",
                "com.nvidia.cuda.version": "9.0.176",
                "com.nvidia.volumes.needed": "nvidia_driver",
                "maintainer": "Craig Citro <craigcitro@google.com>"
            }
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

비록 소스 파일(Dockerfile)을 얻을 수 있는 건 아니지만 출력된 내용을 잘 보면 충분히 유추가 가능한다.


EOF

댓글()