Giter Site home page Giter Site logo

Docker compose config with profiles hangs indefinitely when combining "--no-interpolate" and "--resolve-image-digests" about compose HOT 5 OPEN

b-enigma-con avatar b-enigma-con commented on June 21, 2024
Docker compose config with profiles hangs indefinitely when combining "--no-interpolate" and "--resolve-image-digests"

from compose.

Comments (5)

ndeloof avatar ndeloof commented on June 21, 2024 1

I didn't read carefully and didn't noticed you are using both variables in image tags and ask for digests to be resolved.
What are you trying to achieve? Without interpolation image tags is invalid and obviously command can't succeed. I would expect command to fail and not hang, which is a bug then, still I'd like to better understand your usage

from compose.

ndeloof avatar ndeloof commented on June 21, 2024

Can you replicate this issue by running this same command locally?
Have you tried using latest release v2.27.0?

from compose.

b-enigma-con avatar b-enigma-con commented on June 21, 2024

I tried several things this morning. It seems that the combination of commands is causing issues.

When using variables in the image property, such as "image: ${DOCKER_REGISTRY-}/${NAMESPACE-}/workerservice", it seems that "no interpolate" and "--resolve-image-digests" clash when using profiles somehow.

It seems that the variables in the image property are properly interpolated according to the profile. Services that are excluded by the profile won't get a correctly interpolated image property. The resolving of the image digests will try to resolve all images of all services. If one image property still contains variables and not a correct URL, the command hangs indefinitely.

So it seems that in this command chain, profiles are interpreted different, leading to some image properties being interpolated, some don't. If one image property is not interpolated, the problem arises.

from compose.

b-enigma-con avatar b-enigma-con commented on June 21, 2024

What I'm trying to achieve is:

A DevOps build pipeline which builds all services in a docker-compose file and pushes them to a registry. I then want someone to be able to do a release using a release pipeline, thereby using the artifact of the build pipeline (which is a docker-compose file containing a reference to the built images). During release, I have different variables depending on the specific environment it is released to.

So I have a build pipeline now, which builds and pushes all images. The image digests are then retrieved and put in the service image properties of the docker-compose file (using devops task "dockercompose@0"). By default, all variables in the docker compose file are interpolated by this task, and if a variable value is not defined, it is substituted by an empty string. By default, at the end of a build, all my variable tokens are substituted by empty strings, so I can't use the variables anymore in a release pipeline.

  1. Have a docker-compose file containing several variables.
  2. Build services
  3. Push services
  4. Action "Write service image digests" of task "dockercompose@0", which creates a separate docker-compose file containing only the image references using the digests.
  5. I then combine the original docker-compose file with the newly generated docker-compose file without interpolation. The result is a docker-compose file with concrete references to the images (digests), but still all variable tokens present.
  6. Push the resulting file as a build artifact.

I now can use variables in my release pipelines depending on the stage/environment, but I'm also sure that I'm using the correct images.

from compose.

ndeloof avatar ndeloof commented on June 21, 2024

Ok. It seems what you would like is some docker compose config --resolve-image-digests --images command (not yet implemented) to list images with digest, you could format into some compose-with-digests override file

from compose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.