Home  >  Q&A  >  body text

linux - Docker中镜像和容器的关系是什么?

Docker中镜像和容器的关系是什么?
看了几个版本,有点不太清晰。
是容器里面放置镜像?
还是镜像本身就是一个容器?

迷茫迷茫2744 days ago1050

reply all(12)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 15:08:47

    A container is an instance of an image. First declare (describe) the image and then create the container, so there can be multiple containers;
    The image is a read-only file system that will be shared locally, mainly through signatures. , similar to De-dup technology in storage. Every time a container is run, a writable layer is added to the image, but this layer does not change the image itself. This is why sometimes if you use the same image to start multiple containers, the contents inside are different. It will change. If you want to persist the writable layer, you need to use the commit command to write the writable layer to the disk, that is, to generate a new image. To fully understand Docker, you can read more Docker information to deepen your understanding.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:08:47

    One image can create multiple containers, am I right?

    reply
    0
  • Cancelreply