holms@debian ~/D/c/s/app-prebid-config> code-insiders --version
1.44.0-insider
2aae1f26c72891c399f860409176fe435a154b13
x64
- Local OS Version: Debian latest
- Name of Dev Container Definition with Issue: go
Steps to Reproduce:
- Create custom Dockerfile in
.devcontainer folder.
- Uncomment step which says
context: . in .devcontainer/docker-compose.yml
|
# Uncomment if you want to add a different Dockerfile in the .devcontainer folder |
|
# build: |
|
# context: . |
|
# dockerfile: Dockerfile |
- Launch
docker-compose -f docker-compose.yml -f .devcontainer/docker-compose.yml build
- See the world burn:
ERROR: Cannot locate specified Dockerfile: Dockerfile
This seems to be a bug in a docker-compose. I've already registered in here: docker/compose#7350
I'm not sure is this indented behavior, or not. What is happening is that if you'd do docker-compose -f docker-compose.yml -f .devcontainer/docker-compose.yml config you'd see build context showing to a folder where docker-compose.yml is located, although in my opinion context should point to CWD of the config which overrides previous one. I'm pretty sure you've though it's using CWD (or maybe it was working this way before).
This is an issue on RC and also latest stable release. So if I use your provided build context: . this won't work, Dockerfile won't be found, you need to put into build context this:./.devcontainer/, then it works fine.
Here's first config docker-compose.yml
app-prebid-config:
container_name: app-prebid-config
build:
context: app
dockerfile: Dockerfile
volumes:
- ./app:/app/prebid-config
Here's .devcontainer/docker-compose.yml
version: '3.7'
services:
app-prebid-config:
build:
context: .
dockerfile: Dockerfile
volumes:
- ./app:/workspace:cached
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
command: /bin/sh -c "while sleep 1000; do:; done"
Now let's see what config command shows:
$ docker-compose --project-name app-prebid-config -f docker-compose.yml -f .devcontainer/docker-compose.extend.yml config
....
app-prebid-config:
build:
context: /home/holms/Dev/contracts/setupad/app-prebid-config
dockerfile: Dockerfile
...
And of course the build would fail:
holms@debian ~/D/c/s/app-prebid-config> docker-compose --project-name app-prebid-config -f docker-compose.yml -f .devcontainer/docker-compose.extend.yml build
Building app-prebid-config
ERROR: Cannot locate specified Dockerfile: Dockerfile
As no Dockerfile exist near docker-compose.yml. And I believe anyone would want to use .devcontainer/Dockerfile in the first place in your overriden docker-compose config, as it contains all custom tools for debuging golang specifically for vscode. In docker-compose.yml I'm using default Dockerfile location which is a Dockerfile for CI only, and checking it it's builds locally is quite healthy for a developer I believe after coding job is done, at least checking does it compile on a build stage is extremely useful.
Also created this issue in release microsoft/vscode-remote-release#2681 but I'm not sure if it's their fault, it's this template fault or docker-compose itself.
This btw might be related: #247
Steps to Reproduce:
.devcontainerfolder.context: .in.devcontainer/docker-compose.ymlvscode-dev-containers/containers/docker-existing-docker-compose/.devcontainer/docker-compose.yml
Lines 18 to 21 in bf82fa0
docker-compose -f docker-compose.yml -f .devcontainer/docker-compose.yml buildERROR: Cannot locate specified Dockerfile: DockerfileThis seems to be a bug in a docker-compose. I've already registered in here: docker/compose#7350
I'm not sure is this indented behavior, or not. What is happening is that if you'd do
docker-compose -f docker-compose.yml -f .devcontainer/docker-compose.yml configyou'd see build context showing to a folder wheredocker-compose.ymlis located, although in my opinion context should point to CWD of the config which overrides previous one. I'm pretty sure you've though it's using CWD (or maybe it was working this way before).This is an issue on RC and also latest stable release. So if I use your provided
build context: .this won't work,Dockerfilewon't be found, you need to put into build context this:./.devcontainer/, then it works fine.Here's first config
docker-compose.ymlHere's
.devcontainer/docker-compose.ymlNow let's see what config command shows:
And of course the build would fail:
As no Dockerfile exist near
docker-compose.yml. And I believe anyone would want to use.devcontainer/Dockerfilein the first place in your overriden docker-compose config, as it contains all custom tools for debuging golang specifically for vscode. In docker-compose.yml I'm using default Dockerfile location which is a Dockerfile for CI only, and checking it it's builds locally is quite healthy for a developer I believe after coding job is done, at least checking does it compile on a build stage is extremely useful.Also created this issue in release microsoft/vscode-remote-release#2681 but I'm not sure if it's their fault, it's this template fault or docker-compose itself.
This btw might be related: #247