devcontainers / devcontainers/spec
Clarity on how docker compose based devcontainers are built
- Dominant language
- No language data
- Stars
- 5.7k
- Forks
- 496
- PR merge metrics
- No merged PRs in 30d
Description
The spec does not provide clarity on how to specify the build context for a Docker compose build. Considering the following project structure
```
| .devcontainer
| devcontainer.json
| docker-compose.yml
| Dockerfile
| requirements.txt
```
How should I specify the build context? This is a sample repository: https://github.com/amitds1997/devpod-cache-issue.
Reference `devcontainer.json`:
```json
{
"name": "Debug service",
"dockerComposeFile": "../docker-compose.yml",
"service": "main-app",
"workspaceFolder": "/root",
"shutdownAction": "stopCompose",
}
```
Should it be specified as:
1. In `.devcontainer.json` file, or
```json
{
"build": {
"context": ".."
},
}
```
2. In `docker-compose.yml` file (to indicate that it is one directory above from `devcontainer.json` file where it is used)
```yaml
version: '3'
services:
main-app:
build:
context: ..
restart: always
ports:
- "5003:5000"
command: python -m http.server 5000
```
3. Or, should it be assumed to be running from the `docker-compose.yml`'s directory?
Contributor guide
Research direction
Start by reading the spec guidance for dockerComposeFile and the build section in the referenced devcontainer.json and docker-compose.yml. Compare the three possible build-context interpretations against the sample repository, then document one normative rule with an example; done means the spec removes the ambiguity for this project structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose, dockerfile
- Domain
- devops, documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100