You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the shell default value syntax, the default is not always interpreted. Oddly, it does work if the source variable name doesn't match the destination variable name.
This works as expected with docker compose.
To Reproduce
Steps to reproduce the behavior:
Dockerfile:
FROM docker.io/library/busybox:latest
CMD ["/bin/sh"]
TEST_EXPECT_WORKING: ${TEST_EXPECT_WORKING:-working} is a common pattern for allowing user-set environment variables to be passed through, while also setting a default. This is working fine with docker compose.
Actual behavior
TEST_EXPECT_WORKING is set to ${TEST_EXPECT_WORKING:-working} not working or previously set $TEST_EXPECT_WORKING.
Output
Versions:
$ podman-compose version
podman-compose version 1.3.0
podman version 5.3.1
Defaults expected:
$ podman compose run test
TEST_EXPECT_EMPTY=
TEST_ODDLY_WORKING=working
TEST_EXPECT_ONE=1
TEST_EXPECT_WORKING=${TEST_EXPECT_WORKING:-working}
User-set expected:
$ TEST_EXPECT_WORKING='cli-working' podman compose run test
TEST_EXPECT_EMPTY=
TEST_ODDLY_WORKING=working
TEST_EXPECT_ONE=1
TEST_EXPECT_WORKING=cli-working
Environment:
OS: Linux
podman version: 5.3.1
podman compose version: 1.3.0
Additional context
This might have been working previously as I'm just now noticing it.
The text was updated successfully, but these errors were encountered:
I've confirmed this is a bug with podman-compose 1.3.0. The following is working with 1.2.0:
Versions:
$ podman-compose version
podman-compose version 1.2.0
podman version 5.3.1
Defaults expected:
$ podman compose run test
TEST_EXPECT_ONE=1
TEST_EXPECT_WORKING=working
TEST_ODDLY_WORKING=working
TEST_EXPECT_EMPTY=
User-set expected:
$ TEST_EXPECT_WORKING='cli-working' podman compose run test
TEST_EXPECT_ONE=1
TEST_EXPECT_WORKING=cli-working
TEST_ODDLY_WORKING=working
TEST_EXPECT_EMPTY=
damaestro
changed the title
Environment Variable Default Not Working Correctly
Environment Variable Default Not Working Correctly v1.3.0
Jan 12, 2025
Describe the bug
When using the shell default value syntax, the default is not always interpreted. Oddly, it does work if the source variable name doesn't match the destination variable name.
This works as expected with
docker compose
.To Reproduce
Steps to reproduce the behavior:
Dockerfile
:docker-compose.yaml
:Expected behavior
TEST_EXPECT_WORKING: ${TEST_EXPECT_WORKING:-working}
is a common pattern for allowing user-set environment variables to be passed through, while also setting a default. This is working fine withdocker compose
.Actual behavior
TEST_EXPECT_WORKING
is set to${TEST_EXPECT_WORKING:-working}
notworking
or previously set$TEST_EXPECT_WORKING
.Output
Versions:
Defaults expected:
User-set expected:
Environment:
Additional context
This might have been working previously as I'm just now noticing it.
The text was updated successfully, but these errors were encountered: