Docker Images vs. Containers

Docker Images vs. Containers

IMAGE :- An image is an inert, immutable, file that’s essentially a snapshot of a container. Images are created with the build command, and they’ll produce a container when started with run. Images are stored in a Docker registry such as registry.hub.docker.com. Because they can become quite large, images are designed to be composed of layers of other images, allowing a miminal amount of data to be sent when transferring images over the network.

  • IMAGE ID is the first 12 characters of the true identifier for an image. You can create many tags of a given image, but their IDs will all be the same (as above).
  • VIRTUAL SIZE is virtual because its adding up the sizes of all the distinct underlying layers. This means that the sum of all the values in that column is probably much larger than the disk space used by all of those images.
  • The value in the REPOSITORY column comes from the -t flag of the docker buildcommand, or from docker tag-ing an existing image. You’re free to tag images using a nomenclature that makes sense to you, but know that docker will use the tag as the registry location in a docker push or docker pull.
  • The full form of a tag is [REGISTRYHOST/][USERNAME/]NAME[:TAG]. For ubuntu above, REGISTRYHOST is inferred to be registry.hub.docker.com. So if you plan on storing your image called my-application in a registry at docker.example.com, you should tag that image docker.example.com/my-application.
  • The TAG column is just the [:TAG] part of the full tag. This is unfortunate terminology
  • The latest tag is not magical, it’s simply the default tag when you don’t specify a tag.
  • You can have untagged images only identifiable by their IMAGE IDs. These will get the <none> TAG and REPOSITORY. It’s easy to forget about them.
  •  CONTAINER :- To use a programming metaphor, if an image is a class, then a container is an instance of a class—a runtime object. Containers are hopefully why you’re using Docker; they’re lightweight and portable encapsulations of an environment in which to run applications.

    • Like IMAGE ID, CONTAINER ID is the true identifier for the container. It has the same form, but it identifies a different kind of object.
    • docker ps only outputs running containers. You can view stopped containers with docker ps -a.
    • NAMES can be used to identify a started container via the --name flag.

    2 thoughts on “Docker Images vs. Containers

    • September 28, 2017 at 12:50 pm
      Permalink

      Hi there to every body, it’s my first go to
      see of this webpage; this weblog consists of amazing
      and genuinely excellent information in support of visitors.

      Reply
    • September 28, 2017 at 9:31 pm
      Permalink

      I reаlly like it when people come together and sһare thoughts.
      Great website, keep it up!

      Reply

    Leave a Reply

    Your email address will not be published. Required fields are marked *