GithubHelp home page GithubHelp logo

Comments (4)

jolmg avatar jolmg commented on July 28, 2024

As an additional check (since the linked commit mentions empty environment variables), changing docker compose config for FOO=/dev/zero docker compose config in each of the above reproduction scripts gives the same results. Same errors. The only difference is that, in the successful one, source: /dev/zero rather than source: /dev/null, of course.

from compose.

idsulik avatar idsulik commented on July 28, 2024

@jolmg hi! I think the issue with the yaml, you should put empty space after ":"

- ${FOO:-/dev/null}: /tmp/foo:to
                    ^ here

from compose.

jolmg avatar jolmg commented on July 28, 2024

@idsulik This is the short syntax for volumes.. If I added a space, it wouldn't be a yaml string; it'd a mapping, and I'd get this error:

validating /tmp/docker-compose-interpolation-test-t9H5/docker-compose.yml: services.foo.volumes.0 type is required

Because it's then expecting the different syntax with specific keys.

from compose.

jolmg avatar jolmg commented on July 28, 2024

@idsulik Thank you, though. Your comment does show that switching to long syntax is a good workaround for this bug.

d=/tmp/docker-compose-interpolation-test-long-syntax

set -e
mkdir "$d"
cd "$d"

cat > docker-compose.yml <<EOF
services:
  foo:
    extends: { file: other.yml, service: foo }
EOF

cat > other.yml <<EOF
services:
  foo:
    image: bash
    volumes:
      - type: bind
        source: \${FOO:-/dev/null}
        target: /tmp/foo
        read_only: true
EOF

docker compose config

Result:

name: docker-compose-interpolation-test-long-syntax
services:
  foo:
    image: bash
    networks:
      default: null
    volumes:
      - type: bind
        source: /dev/null
        target: /tmp/foo
        read_only: true
networks:
  default:
    name: docker-compose-interpolation-test-long-syntax_default

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.