Skip to content

Manage "." volumes in docker-compose #7924

Description

@jehon

In a docker-compose, we can have multiple volumes mapping relative to the project folder:

Example with an httpd server aside the code:

test:
   volumes:
      - ./:/workspace
httpd:
   volumes:
       - ./www:/usr/local/apache2/htdocs/

Problem:

In a devcontainer, the "." is mapped on the host, where the folder does not exsits

Possible solutions:

  • We can remap the "." to the data volume holding the code with the syntax ${WORKSPACE_SOURCE:-.}, but we need to define the code_volume variable
  • We can add a docker-compose.override.yml generated automatically by devcontainer

While the second solution seems cleaner for newbies, the first solution seems easier to implement and more transparent for the average user (it requires a bit of documentation though).

Inspirations:

Metadata

Metadata

Labels

containersIssue in vscode-remote containersfeature-requestRequest for new features or functionalityvolumeDev Container mounting a Docker volume

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions