Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Add warnings for env_file entries not copied #676

Conversation

ulyssessouza
Copy link
Contributor

'env_file' entries now removed and we
warn the user that the its contents are merged
into the 'environment' section.

Signed-off-by: Ulysses Souza ulysses.souza@docker.com

- What I did

- How I did it
By using Load and Render method from the CLI in the init command to resolve the environment section

- How to verify it
Create docker-compose.yml by running:

cat << 'EOF' > docker-compose.yml
version: "3.7"

services:
  db:
    image: postgres:9.6
    env_file:
      - myvars.env
    environment:
      - ENVVAR=myenvvalue
EOF

Create myvars.env by running:

cat << 'EOF' > myvars.env
FOO=fooVal
BAR=barVal
EOF

Then init your docker app with:

$ docker app init --compose-file docker-compose.yml testapp

Check the WARNING message saying:
WARNING: "env_file: myvars.env" entry in service "db" has been translated to the "environment" section. Note that your environment files will not be copied!.

Note also that the contents of your env file is now merged into the "environment" section of the services. Also, the "env_file" section from the original docker-compose.yml was removed from the migrated file.

Check the resulting file with:

$ cat testapp.dockerapp/docker-compose.yml

It should look like:

version: "3.7"
services:
  db:
    environment:
      BAR: barVal
      ENVVAR: myenvvalue
      FOO: fooVal
    image: postgres:9.6

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

'env_file' entries now removed and we
warn the user that the its contents are merged
into the 'environment' section.

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
@ulyssessouza ulyssessouza force-pushed the add-env_file-warning-with-render branch from 6fc33c4 to 2732217 Compare October 8, 2019 09:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants