What's the container of a base docker image? -
i learning use docker. know each docker image build on base image doesn't have parent.
then base image, can customize stuff via containers (maybe short life container) commit new image.
so understand process this: base image -> container -> new image 1 -> container -> new image 2
however, inspect json data of base image. still can see has container's information:
[{ "architecture": "amd64", "author": "", "comment": "", "config": { "attachstderr": false, "attachstdin": false, "attachstdout": false, "cmd": null, "cpushares": 0, "cpuset": "", "domainname": "", "entrypoint": null, "env": null, "exposedports": null, "hostname": "3f37dbc61890", "image": "", "labels": null, "macaddress": "", "memory": 0, "memoryswap": 0, "networkdisabled": false, "onbuild": null, "openstdin": false, "portspecs": null, "stdinonce": false, "tty": false, "user": "", "volumes": null, "workingdir": "" }, "container": "3f37dbc61890b0bb37cc8479db94602bcc2d6e177d76c0f3d7d53346c0dc580c", "containerconfig": { "attachstderr": false, "attachstdin": false, "attachstdout": false, "cmd": [ "/bin/sh", "-c", "#(nop) add file:777fad733fc954c0c161670c48c10ea1787a6e5d544daa20e55d593279df3fa3 in /" ], "cpushares": 0, "cpuset": "", "domainname": "", "entrypoint": null, "env": null, "exposedports": null, "hostname": "3f37dbc61890", "image": "", "labels": null, "macaddress": "", "memory": 0, "memoryswap": 0, "networkdisabled": false, "onbuild": null, "openstdin": false, "portspecs": null, "stdinonce": false, "tty": false, "user": "", "volumes": null, "workingdir": "" }, "created": "2015-04-21t22:18:45.67739694z", "dockerversion": "1.6.0", "id": "706766fe101906a1a6628173c2677173a5f8c6c469075083f3cf3a8f5e5eb367", "os": "linux", "parent": "", "size": 188104128, "virtualsize": 188104128 }]
3f37dbc61890b0bb37cc8479db94602bcc2d6e177d76c0f3d7d53346c0dc580c container id of base image.
what container of base image? feel becomes hostname. hostname actually?
i'm not sure of terminology. if base image definition image has no parent, image in example not base image.
but image may have no parent. scratch
, example, has no parent:
$ docker inspect -f '{{.container}}' ubuntu a4c15f8c80978475a53f96721f935de5823bc8c29aff14eb00a15f9b9d96cddd $ docker inspect -f '{{.container}}' scratch $
you can create image has no parent using import
:
$ echo hello world > foo && tar -cf- foo | docker import - 3e8fc0cb69fae0bd3f9711031df6d3b7bf6a7e8c9745657d9261e7b803718c67 $ docker inspect -f '{{.container}}' 3e8fc0c $
unlike scratch
, image may have files in it. in fact, can flatten complex image using technique.
$ docker create ubuntu # create container image 6b90bf145c193ef8e4ecb789372d2fd619769a20d96c8f3f586dcfbc501b0611 $ docker export 6b90bf1 > ubuntu.tar # export container fs tarball $ docker import - flat_ubuntu < ubuntu.tar 4ef4ffb9514212acf6a19b2eeda8855b8c0445924311043ba5cba6574d40d772 $ docker inspect -f '{{.container}}' 4ef4ffb $
it's important note while new image has exact same files original image, doesn't have other docker features environment, volume, entrypoint, etc.
i not call "base" image. call "flat" image. base image image indicate in dockerfile from
directive. in terminology base image need not flat.
Comments
Post a Comment