Vscode-docker: Allow custom file names

Created on 21 Jul 2017  路  9Comments  路  Source: microsoft/vscode-docker

Right now, COMPOSE_FILE_GLOB_PATTERN and DOCKERFILE_GLOB_PATTERN are hardcoded patterns.

We'd need a way to configure those, either by user or by project.

Thanks!

P2 fix released

Most helpful comment

@rodrigodiez Please not that you can in fact do this already for Dockerfiles (but not compose files) - see https://github.com/Microsoft/vscode-docker/pull/248#issuecomment-391539247:

{
"files.associations": {
"Dockerfile*": "dockerfile"
}
}

All 9 comments

would a free form text entry be sufficient?

or, the ability to right click on any file to build (today the context menu only shows for files that match these patterns):

image

Just now I tried on this project and right-clicking on any of the dockerfiles there shows that menu item, although running Docker: Build from the command palette only shows the main Dockerfile. I think the DOCKERFILE_GLOB_PATTERN should be more like *.Dockerfile,Dockerfile.* (not sure if that's the syntax, but you get it), or simply let vscode detect those, since it does it pretty well.

I also tried on this another project where we have 5 valid docker-compose files (although common.yaml shouldn't be used by itself) and none matches this module's regexps. You can't use any docker-compose features from this module (unless you symlink any of those with the right names). Also I don't think those file names should be treated by default as docker-compose files, because they are very project-specific, but it would be perfect to be able to have a setting that lets the project define its environments, like being able to add to ./.vscode/config.json:

{
    "docker.compose.fileGlobs": ["*.yaml"]
}

馃憤 on the idea of settings to override the glob patterns.

I agree with the requests to allow changing the globs.

Can docker-compose be added as an available language? At least this would allow manually selecting it when working with a "unique-named" docker-compose file.

Would also love to see this implemented. I have some Golang repositories with multiple binaries and I'd like to have a Dockerfile for each of them. Unfortunately at the moment I have to manage the build manually because these Docker files are not recognized

@rodrigodiez Please not that you can in fact do this already for Dockerfiles (but not compose files) - see https://github.com/Microsoft/vscode-docker/pull/248#issuecomment-391539247:

{
"files.associations": {
"Dockerfile*": "dockerfile"
}
}

@StephenWeatherford while the association is a great start for syntax highlighting and such, the commands provided to vscode do not work. An error is given that it cannot find any Dockerfile in the work space.

@crstamps2 Thanks, will see if there's anything we can do.

To recap since this has been around a while--the files.associations setting helps by adding syntax highlighting, but the extension commands (e.g. "Compose Up", "Build Docker Image", etc.) do not recognize all docker-compose YML files and Dockerfiles. It would require code changes for these commands to work; in particular settings for controlling the glob patterns would work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thernstig picture thernstig  路  3Comments

gngchrs picture gngchrs  路  3Comments

tecandrew picture tecandrew  路  6Comments

oberfoerster picture oberfoerster  路  6Comments

Szauka picture Szauka  路  6Comments