containers / containers/podman-compose

not passing variables from .env through as environment

Open
#610 5 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

I'm currently running an application with two services, one of them is postgres, defined as a docker-compose.yaml, formerly working well with docker-compose, now trying to use podman-compose 1.0.3 with podman 3.4.4.

The docker-compose.yaml contains

services:

postgres:
image: postgres:14-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD

and the .env contains
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password

docker-compose is passing these variables as environment to the postgres container.

podman-compose doesn't. postgres does not start and complains that the password is not set. podman is run with ... -e POSTGRES_PASSWORD ... but no value is passed through. podman-compose seems to use the variables only for expansion in docker-compose.yaml. Therefore,

- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}

instead of just

- POSTGRES_PASSWORD

works, but reveals the password to anyone beeing able to list processes. So this actually consists of two problems:

1. Environment variables without any value (i.e. just a name without =...) are not expanded from the .env
2. Secret values are passed as commonly readable command line parameters.

regards and Happy New Year.

**Describe the bug**
A clear and concise description of what the bug is.

Please make sure it's not a bug in podman (in that case report it to podman)
or your understanding of docker-compose or how rootless containers work (for example, it's normal for rootless container not to be able to listen for port less than 1024 like 80)

please try to reproduce the bug in latest devel branch

**To Reproduce**
Steps to reproduce the behavior:
1. what is the content of the current working directory (ex. `docker-compose.yml`, `.env`, `Dockerfile`, ...etc.)
3. what is the sequence of commands you typed

please use [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) for example give me a small busybox-based compose yaml

**Expected behavior**
A clear and concise description of what you expected to happen.

**Actual behavior**
What is the behavior you actually got and that should not happen.

**Output**

```
$ podman-compose version
using podman version: 3.4.0
podman-compose version 0.1.7dev
podman --version
podman version 3.4.0

$ podman-compose up
...

```

**Environment:**
- OS: Linux / WSL / Mac
- podman version:
- podman compose version: (git hex)

**Additional context**

Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.