skip to Main Content

Example:

version: ‘2’
services:
    mysql:
        image: mysql:8.0

I see two parts in the image value, Example: flask-redis:1.0 or mysql:8.0. This is understood that the second part is the Version. However, in one tutorial I just found the image section is written as
Image: tut:php_img

What does this indicate, because there is no mention of version.

2

Answers


  1. The second part (the one after :) is not version. While it can indicate a version, it is just a tag that can contain numbers as well as letters, in this case php_img (it just needs to comply with standard DNS naming rules).

    So mysql:8.0 is exactly the same as tut:php_img, where tut is equivalent to mysql and php_img is equivalent to 8.0 as long as you are working with them locally (there is a difference between them if you want to push them to a repository though).

    Login or Signup to reply.
  2. An image name is made up of slash-separated name components, optionally prefixed by a registry hostname.

    A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.

    So technically, if the two rules above are followed, the [IMAGE]:[TAG] is valid. Further on, it is just a matter of preference.

    I believe the most popular convention is Semantic Versioning. In some cases, semver is enhanced by adding other relevant metadata about architecture or the base-image used (nginx:1.19.1-alpine-perl).
    Conversely, any convention can be ignored and the images can be tagged conveniently with the build-number or other identifiers that can be handy in a CI/CD pipeline for example.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search