Skip to content

[Feature Request] Allow "Run Service" codelens in Docker Compose to use custom --env-file #4674

@sxflynn

Description

@sxflynn

My Docker Compose uses environment variables inline.

ddb-startup:
        depends_on:
            dynamodb:
                condition: service_healthy
        image: ${AWS_CLI_IMAGE}:${AWS_CLI_VERSION}

This is my file .env.docker

AWS_CLI_IMAGE=amazon/aws-cli
AWS_CLI_VERSION=2.33.2

I have a Makefile target which runs this command: docker compose up --env-file .env.docker and it works great.

However, when I click the "Run Service" button in VS Code, I get this error:

 *  Executing task: docker compose -f 'docker-compose.yml' up -d --build 's3mock' 
WARN[0000] The "AWS_CLI_IMAGE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AWS_CLI_VERSION" variable is not set. Defaulting to a blank string. 
unable to get image ':': Error response from daemon: invalid reference format

It would be nice if there was a config option in settings.json to point to a custom --env-file flag. Otherwise I am unable to use this feature.

Edit: It seems like the issue is that --env-file is not one of the supported flags that is passed in, according to https://github.com/microsoft/vscode-containers/blob/main/src/commands/selectCommandTemplate.ts#L81

I do apologize if I'm in the wrong repo as I'm not fully sure the different between vscode-docker and vscode-containers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions