devcontainers / devcontainers/spec

Clarity on how docker compose based devcontainers are built

オープン
#331 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
5.7k
フォーク
496
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。