How do I see extra tags on a local Docker image?How is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow does one remove an image in Docker?How to deal with persistent storage (e.g. databases) in DockerWhere are Docker images stored on the host machine?What is the difference between “expose” and “publish” in Docker?How to copy Docker images from one host to another without using a repositoryHow to remove old and unused Docker images

Repeated! Factorials!

What's going on with an item that starts with an hbox?

Why is the Vasa Museum in Stockholm so Popular?

What was the role of Commodore-West Germany?

A Checkmate of Dubious Legality

Why is Chromosome 1 called Chromosome 1?

Did Captain America make out with his niece?

Is there a way to improve my grade after graduation?

What are the function of EM and EN spaces?

Pronouns when writing from the point of view of a robot

Why did the US Airways Flight 1549 passengers stay on the wings?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

If the interviewer says "We have other interviews to conduct and then back to you in few days", is it a bad sign to not get the job?

List: Behavioural characteristics of key Ito processes used in finance

Why does capacitance not depend on the material of the plates?

Is it double speak?

Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?

Is space radiation a risk for space film photography, and how is this prevented?

Does a humanoid possessed by a ghost register as undead to a paladin's Divine Sense?

Do some languages mention the top limit of a range first?

Examples of hyperbolic groups

Definitional equality of two propositions about propositional equality

Vibration on the guitar when playing two strings

How easy is it to get a gun illegally in the United States?



How do I see extra tags on a local Docker image?


How is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow does one remove an image in Docker?How to deal with persistent storage (e.g. databases) in DockerWhere are Docker images stored on the host machine?What is the difference between “expose” and “publish” in Docker?How to copy Docker images from one host to another without using a repositoryHow to remove old and unused Docker images






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















When I build a Docker image locally with a tag, then assign a secondary tag, I am unable to list all of the tags for that image.



I'm losing tags either on the build, save or load of docker images and I'm trying to track the state of my image at every step. Please note that this is a local Docker file (as in on my laptop), and can't be sent to a remote repository. When I run docker images I can see the image created with one of the tags, but not all of them.



$ docker build -t my/repo:first_tag
$ docker tag my/repo:first_tag my/repo:second_tag


When I run docker images I only see the first tag shown as the tag.



$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
my/repo first_tag abcd1234 6 seconds ago 100MB


I would like to have some way of showing that image with all of the tags, something like:



my/repo:
first_tag
second_tag


Does a command like this exist and, if so, what is it?



EDIT: It turns out I was adding tags wrong and the code show above wasn't representative of it. What I was doing was actually:



$ docker build -t my/repo:first_tag
$ docker tag my/repo:first_tag my/repo


Note that the second tag doesn't have an actual tag on it. When I actually run the code in the question I get the following output:



$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
my/repo second_tag abcd1234 6 seconds ago 100MB
my/repo first_tag abcd1234 6 seconds ago 100MB









share|improve this question
































    1















    When I build a Docker image locally with a tag, then assign a secondary tag, I am unable to list all of the tags for that image.



    I'm losing tags either on the build, save or load of docker images and I'm trying to track the state of my image at every step. Please note that this is a local Docker file (as in on my laptop), and can't be sent to a remote repository. When I run docker images I can see the image created with one of the tags, but not all of them.



    $ docker build -t my/repo:first_tag
    $ docker tag my/repo:first_tag my/repo:second_tag


    When I run docker images I only see the first tag shown as the tag.



    $ docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    my/repo first_tag abcd1234 6 seconds ago 100MB


    I would like to have some way of showing that image with all of the tags, something like:



    my/repo:
    first_tag
    second_tag


    Does a command like this exist and, if so, what is it?



    EDIT: It turns out I was adding tags wrong and the code show above wasn't representative of it. What I was doing was actually:



    $ docker build -t my/repo:first_tag
    $ docker tag my/repo:first_tag my/repo


    Note that the second tag doesn't have an actual tag on it. When I actually run the code in the question I get the following output:



    $ docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    my/repo second_tag abcd1234 6 seconds ago 100MB
    my/repo first_tag abcd1234 6 seconds ago 100MB









    share|improve this question




























      1












      1








      1


      1






      When I build a Docker image locally with a tag, then assign a secondary tag, I am unable to list all of the tags for that image.



      I'm losing tags either on the build, save or load of docker images and I'm trying to track the state of my image at every step. Please note that this is a local Docker file (as in on my laptop), and can't be sent to a remote repository. When I run docker images I can see the image created with one of the tags, but not all of them.



      $ docker build -t my/repo:first_tag
      $ docker tag my/repo:first_tag my/repo:second_tag


      When I run docker images I only see the first tag shown as the tag.



      $ docker images
      REPOSITORY TAG IMAGE ID CREATED SIZE
      my/repo first_tag abcd1234 6 seconds ago 100MB


      I would like to have some way of showing that image with all of the tags, something like:



      my/repo:
      first_tag
      second_tag


      Does a command like this exist and, if so, what is it?



      EDIT: It turns out I was adding tags wrong and the code show above wasn't representative of it. What I was doing was actually:



      $ docker build -t my/repo:first_tag
      $ docker tag my/repo:first_tag my/repo


      Note that the second tag doesn't have an actual tag on it. When I actually run the code in the question I get the following output:



      $ docker images
      REPOSITORY TAG IMAGE ID CREATED SIZE
      my/repo second_tag abcd1234 6 seconds ago 100MB
      my/repo first_tag abcd1234 6 seconds ago 100MB









      share|improve this question
















      When I build a Docker image locally with a tag, then assign a secondary tag, I am unable to list all of the tags for that image.



      I'm losing tags either on the build, save or load of docker images and I'm trying to track the state of my image at every step. Please note that this is a local Docker file (as in on my laptop), and can't be sent to a remote repository. When I run docker images I can see the image created with one of the tags, but not all of them.



      $ docker build -t my/repo:first_tag
      $ docker tag my/repo:first_tag my/repo:second_tag


      When I run docker images I only see the first tag shown as the tag.



      $ docker images
      REPOSITORY TAG IMAGE ID CREATED SIZE
      my/repo first_tag abcd1234 6 seconds ago 100MB


      I would like to have some way of showing that image with all of the tags, something like:



      my/repo:
      first_tag
      second_tag


      Does a command like this exist and, if so, what is it?



      EDIT: It turns out I was adding tags wrong and the code show above wasn't representative of it. What I was doing was actually:



      $ docker build -t my/repo:first_tag
      $ docker tag my/repo:first_tag my/repo


      Note that the second tag doesn't have an actual tag on it. When I actually run the code in the question I get the following output:



      $ docker images
      REPOSITORY TAG IMAGE ID CREATED SIZE
      my/repo second_tag abcd1234 6 seconds ago 100MB
      my/repo first_tag abcd1234 6 seconds ago 100MB






      docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 4:13







      TinyDancer

















      asked Mar 27 at 3:52









      TinyDancerTinyDancer

      1111 silver badge13 bronze badges




      1111 silver badge13 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          If you want to list tags for a particular image, you can run :



          docker images my/repo --format=" .Tag "


          --format is used here to only keep interesting columns. By default, docker images my/repo will return all info about my/repo (repository, tag, image id, created and size), like docker images (without filtering repository) does.



          Edit : group images by tags



          Since --format option placeholders are limited (https://docs.docker.com/engine/reference/commandline/images/#format-the-output), you cannot access some interesting properties as .RepoTags to retrieve all tags associated with an image digest. However, you could do this by docker inspecting desired images and using some shell and jq magic (jq is a tool to manipulate JSON) :



          docker images my/repo --format=" .ID " | 
          sort | uniq |
          xargs docker inspect |
          jq -r '.[] | [ .Id, (.RepoTags | join(",")) ] | @csv'


          Explanations :



          • first, retrieve all images IDs (--format=" .ID ") related to my/repo

          • remove duplicates (sort | uniq) if any (because of multiple tags per image ID)

          • for each image (xargs), inspect that image (docker inspect) :

            • use jq to retrieve a string like <id of the image>,<tags related to the image>. Tags related to this image are separated by a comma (join(","))


          Example result :



          "sha256:abcd1234...","my/repo:v1"
          "sha256:abcd2345...","my/repo:v2"
          "sha256:abcd3456...","my/repo:v3,my/repo:tag"





          share|improve this answer



























          • So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

            – TinyDancer
            Mar 28 at 5:43











          • It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

            – norbjd
            Mar 28 at 11:57











          • Wow, thank you for the deep dive, really appreciated ^_^

            – TinyDancer
            Mar 29 at 7:51










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369528%2fhow-do-i-see-extra-tags-on-a-local-docker-image%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          If you want to list tags for a particular image, you can run :



          docker images my/repo --format=" .Tag "


          --format is used here to only keep interesting columns. By default, docker images my/repo will return all info about my/repo (repository, tag, image id, created and size), like docker images (without filtering repository) does.



          Edit : group images by tags



          Since --format option placeholders are limited (https://docs.docker.com/engine/reference/commandline/images/#format-the-output), you cannot access some interesting properties as .RepoTags to retrieve all tags associated with an image digest. However, you could do this by docker inspecting desired images and using some shell and jq magic (jq is a tool to manipulate JSON) :



          docker images my/repo --format=" .ID " | 
          sort | uniq |
          xargs docker inspect |
          jq -r '.[] | [ .Id, (.RepoTags | join(",")) ] | @csv'


          Explanations :



          • first, retrieve all images IDs (--format=" .ID ") related to my/repo

          • remove duplicates (sort | uniq) if any (because of multiple tags per image ID)

          • for each image (xargs), inspect that image (docker inspect) :

            • use jq to retrieve a string like <id of the image>,<tags related to the image>. Tags related to this image are separated by a comma (join(","))


          Example result :



          "sha256:abcd1234...","my/repo:v1"
          "sha256:abcd2345...","my/repo:v2"
          "sha256:abcd3456...","my/repo:v3,my/repo:tag"





          share|improve this answer



























          • So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

            – TinyDancer
            Mar 28 at 5:43











          • It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

            – norbjd
            Mar 28 at 11:57











          • Wow, thank you for the deep dive, really appreciated ^_^

            – TinyDancer
            Mar 29 at 7:51















          1














          If you want to list tags for a particular image, you can run :



          docker images my/repo --format=" .Tag "


          --format is used here to only keep interesting columns. By default, docker images my/repo will return all info about my/repo (repository, tag, image id, created and size), like docker images (without filtering repository) does.



          Edit : group images by tags



          Since --format option placeholders are limited (https://docs.docker.com/engine/reference/commandline/images/#format-the-output), you cannot access some interesting properties as .RepoTags to retrieve all tags associated with an image digest. However, you could do this by docker inspecting desired images and using some shell and jq magic (jq is a tool to manipulate JSON) :



          docker images my/repo --format=" .ID " | 
          sort | uniq |
          xargs docker inspect |
          jq -r '.[] | [ .Id, (.RepoTags | join(",")) ] | @csv'


          Explanations :



          • first, retrieve all images IDs (--format=" .ID ") related to my/repo

          • remove duplicates (sort | uniq) if any (because of multiple tags per image ID)

          • for each image (xargs), inspect that image (docker inspect) :

            • use jq to retrieve a string like <id of the image>,<tags related to the image>. Tags related to this image are separated by a comma (join(","))


          Example result :



          "sha256:abcd1234...","my/repo:v1"
          "sha256:abcd2345...","my/repo:v2"
          "sha256:abcd3456...","my/repo:v3,my/repo:tag"





          share|improve this answer



























          • So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

            – TinyDancer
            Mar 28 at 5:43











          • It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

            – norbjd
            Mar 28 at 11:57











          • Wow, thank you for the deep dive, really appreciated ^_^

            – TinyDancer
            Mar 29 at 7:51













          1












          1








          1







          If you want to list tags for a particular image, you can run :



          docker images my/repo --format=" .Tag "


          --format is used here to only keep interesting columns. By default, docker images my/repo will return all info about my/repo (repository, tag, image id, created and size), like docker images (without filtering repository) does.



          Edit : group images by tags



          Since --format option placeholders are limited (https://docs.docker.com/engine/reference/commandline/images/#format-the-output), you cannot access some interesting properties as .RepoTags to retrieve all tags associated with an image digest. However, you could do this by docker inspecting desired images and using some shell and jq magic (jq is a tool to manipulate JSON) :



          docker images my/repo --format=" .ID " | 
          sort | uniq |
          xargs docker inspect |
          jq -r '.[] | [ .Id, (.RepoTags | join(",")) ] | @csv'


          Explanations :



          • first, retrieve all images IDs (--format=" .ID ") related to my/repo

          • remove duplicates (sort | uniq) if any (because of multiple tags per image ID)

          • for each image (xargs), inspect that image (docker inspect) :

            • use jq to retrieve a string like <id of the image>,<tags related to the image>. Tags related to this image are separated by a comma (join(","))


          Example result :



          "sha256:abcd1234...","my/repo:v1"
          "sha256:abcd2345...","my/repo:v2"
          "sha256:abcd3456...","my/repo:v3,my/repo:tag"





          share|improve this answer















          If you want to list tags for a particular image, you can run :



          docker images my/repo --format=" .Tag "


          --format is used here to only keep interesting columns. By default, docker images my/repo will return all info about my/repo (repository, tag, image id, created and size), like docker images (without filtering repository) does.



          Edit : group images by tags



          Since --format option placeholders are limited (https://docs.docker.com/engine/reference/commandline/images/#format-the-output), you cannot access some interesting properties as .RepoTags to retrieve all tags associated with an image digest. However, you could do this by docker inspecting desired images and using some shell and jq magic (jq is a tool to manipulate JSON) :



          docker images my/repo --format=" .ID " | 
          sort | uniq |
          xargs docker inspect |
          jq -r '.[] | [ .Id, (.RepoTags | join(",")) ] | @csv'


          Explanations :



          • first, retrieve all images IDs (--format=" .ID ") related to my/repo

          • remove duplicates (sort | uniq) if any (because of multiple tags per image ID)

          • for each image (xargs), inspect that image (docker inspect) :

            • use jq to retrieve a string like <id of the image>,<tags related to the image>. Tags related to this image are separated by a comma (join(","))


          Example result :



          "sha256:abcd1234...","my/repo:v1"
          "sha256:abcd2345...","my/repo:v2"
          "sha256:abcd3456...","my/repo:v3,my/repo:tag"






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 28 at 11:57

























          answered Mar 27 at 12:18









          norbjdnorbjd

          3,0712 gold badges9 silver badges34 bronze badges




          3,0712 gold badges9 silver badges34 bronze badges















          • So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

            – TinyDancer
            Mar 28 at 5:43











          • It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

            – norbjd
            Mar 28 at 11:57











          • Wow, thank you for the deep dive, really appreciated ^_^

            – TinyDancer
            Mar 29 at 7:51

















          • So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

            – TinyDancer
            Mar 28 at 5:43











          • It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

            – norbjd
            Mar 28 at 11:57











          • Wow, thank you for the deep dive, really appreciated ^_^

            – TinyDancer
            Mar 29 at 7:51
















          So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

          – TinyDancer
          Mar 28 at 5:43





          So is there a way of differentiating between multiple tags for different versions of an image, to multiple tags for a specific version of an image? So if I build an image (my/repo:123) and assign a second tag to it (my/repo:456), then build a second, different, image (my/repo:789), this will return 123, 456 and 789, despite two of those being for the same version of an image, and the third being for the second version of the image.

          – TinyDancer
          Mar 28 at 5:43













          It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

          – norbjd
          Mar 28 at 11:57





          It's not possible to do this using the --format option, because placeholders are limited (docs.docker.com/engine/reference/commandline/images/…), so you can't access to .RepoTags property which contains all tags related to the image. However, you can docker inspect all your images to get that .RepoTags (see my updated answer).

          – norbjd
          Mar 28 at 11:57













          Wow, thank you for the deep dive, really appreciated ^_^

          – TinyDancer
          Mar 29 at 7:51





          Wow, thank you for the deep dive, really appreciated ^_^

          – TinyDancer
          Mar 29 at 7:51








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369528%2fhow-do-i-see-extra-tags-on-a-local-docker-image%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript