containers / containers/podman-compose
`yaml` converting the bool args into Python boolean types
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When we use boolean types in compose file, Python will convert them into its native boolean types. This means a value set as `test: true` in compose file will be stored at `{'value': True}` once it is loaded. If this value `test` is used inside the Dockerfile it will be eventually set as `True` while we set the value as `true` on compose file and we expect it to be set as `true` in the container.
**To Reproduce**
For instance for a compose file as follows:
```
services:
test:
container_name: 'test-app'
build:
context: ./config
args:
test: true
```
and in the `config` folder, a Dockerfile as follows:
```
FROM alpine:latest
ARG test=false
ENV TEST "${test}"
```
By starting the containers using `podman-compose up -d` and inspecting the container, we can see env var `TEST` will be set to `True` and not `true`.
**Expected behavior**
Arguments must be set the value defined in compose file.
**Actual behavior**
Boolean arguments getting capitalized.
**Output**
```
$ podman-compose version
podman-compose version 1.2.0
podman version 4.5.1
$ podman-compose up
...
STEP 1/3: FROM alpine:latest
Resolving "alpine" using unqualified-search registries (/home/paipuri/.config/containers/registries.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob c6a83fedfae6 skipped: already exists
Copying config 324bc02ae1 done
Writing manifest to image destination
Storing signatures
STEP 2/3: ARG test=false
--> 8168508479d3
STEP 3/3: ENV TEST "${test}"
COMMIT bool_bug_test
--> 7de87c86cee5
Successfully tagged localhost/bool_bug_test:latest
7de87c86cee513da2f78db19b01f2b2f096f175aec0f5755bb9b7c0e5f3dd689
fa2cd312f440b67f0ad0bb0aa6830700ab0eff757fc637dfe49a22a13c3ed78b
405becfd2a257ef7c3c055f2baf5ad4ca3d9f7ebb37a50473bcec92a5e29aa8f
$ podman inspect test-app
[redacted output]
"Config": {
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm",
"container=podman",
"TEST=True",
"HOME=/root",
"HOSTNAME=405becfd2a25"
],
}
**Environment:**
- OS: Linux
- podman version: 4.5.1
- podman compose version: 1.2.0
Contributor guide
Assessment
This issue has not been assessed yet.