Before submitting
Problem or motivation
I want to use .devcontainer.json together with docker compose files that already specify a local development environment.
Currently devsy doesn't match the workspace name with the configured docker compose project name via the .env file inside dockerfiles.
The the projects layout looks like:
- .devcontainer.json
- dockerfiles
|-- .env
|-- docker-compose.yml
|-- docker-compose.dev.yml
The contents of .devcontainer.json is
{
"name": "foobar",
"dockerComposeFile": ["dockerfiles/docker-compose.yml", "dockerfiles/docker-compose.dev.yml"],
"service": "backend"
}
The dockerfiles/.env contains COMPOSE_PROJECT_NAME=foobar.
When executing devsy workspace up . using docker provider, it ignores both name and COMPOSE_PROJECT_NAME and creates the container using a random id as project name.
This also applies even when adding this to any docker-compose.yml
name: foobar
services:
frontend:
...
backend:
...
It only works when exporting COMPOSE_PROJECT_NAME to the current shell session.
Tested on fedora using v1.15.0
Proposed solution
- Respect
name inside .devcontainer.json for workspace name when using compose project.
- Override with
name property of merged dockerComposeFile for workspace name
- Override with config of
.env files at following locations: .devcontainer/.env, folder of specified dockerComposeFiles to override via COMPOSE_PROJECT_NAME
- (already implemented) Current sessions'
COMPOSE_PROJECT_NAME should override all configs
Alternatives considered
No response
Area
Dev containers, CLI
Acceptance criteria
Not spawning a seperate compose project when using devsy workspace up ., when a project is already running and configured via docker compose.
Additional context
VS Code remote extension describes it behavior here https://code.visualstudio.com/remote/advancedcontainers/set-docker-compose-project-name
Before submitting
Problem or motivation
I want to use
.devcontainer.jsontogether with docker compose files that already specify a local development environment.Currently
devsydoesn't match the workspace name with the configured docker compose project name via the.envfile insidedockerfiles.The the projects layout looks like:
The contents of
.devcontainer.jsonis{ "name": "foobar", "dockerComposeFile": ["dockerfiles/docker-compose.yml", "dockerfiles/docker-compose.dev.yml"], "service": "backend" }The
dockerfiles/.envcontainsCOMPOSE_PROJECT_NAME=foobar.When executing
devsy workspace up .usingdockerprovider, it ignores bothnameandCOMPOSE_PROJECT_NAMEand creates the container using a random id as project name.This also applies even when adding this to any
docker-compose.ymlIt only works when exporting
COMPOSE_PROJECT_NAMEto the current shell session.Tested on fedora using v1.15.0
Proposed solution
nameinside.devcontainer.jsonfor workspace name when using compose project.nameproperty of mergeddockerComposeFilefor workspace name.envfiles at following locations:.devcontainer/.env, folder of specifieddockerComposeFiles to override viaCOMPOSE_PROJECT_NAMECOMPOSE_PROJECT_NAMEshould override all configsAlternatives considered
No response
Area
Dev containers, CLI
Acceptance criteria
Not spawning a seperate compose project when using
devsy workspace up ., when a project is already running and configured viadocker compose.Additional context
VS Code remote extension describes it behavior here https://code.visualstudio.com/remote/advancedcontainers/set-docker-compose-project-name