Join our Discord Server
Docker Content Trust

Pulling Images by Tags

Estimated reading: 2 minutes 62 views

The most common and basic way to pull Docker images is by tag. The is where you specify an image name followed by an alphanumeric tag. The image name and tag are separated by a colon :. For example:

   $ docker pull alpine:edge

This command will pull the Alpine image tagged as edge. The corresponding image can be found here on Docker Store.

If no tag is specified, Docker will pull the image with the latest tag.

  1. Pull the Alpine image with the edge tag.

    $ docker pull alpine:edge
    
    edge: Pulling from library/alpine
    e587fa4f6e1f: Pull complete
    Digest: sha256:e5ab6f0941eb01c41595d35856f16215021a941e9893501d632ed4c0ee4e53a6
    Status: Downloaded newer image for alpine:edge
    
  2. Confirm that the pull was successful.

    $ docker images
    
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    alpine              edge                3fc33d6d5e74        4 weeks ago         4.799 MB
    
  3. Run a new container from the image and ping www.docker.com.

    $ docker run --rm -it alpine:edge sh
    
    / # ping www.docker.com
    PING www.docker.com (104.239.220.248): 56 data bytes
    64 bytes from 104.239.220.248: seq=0 ttl=40 time=94.424 ms
    64 bytes from 104.239.220.248: seq=1 ttl=40 time=94.549 ms
    64 bytes from 104.239.220.248: seq=2 ttl=40 time=94.455 ms
    ^C
    
  4. Exit the container.

In this step you pulled an image by tag and verified the pull by running a container from it.

Share this Doc

Pulling Images by Tags

Or copy link

CONTENTS
Join our Discord Server