devcontainers / devcontainers/spec

Clarity on how docker compose based devcontainers are built

Đang mở
#331 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
5.7k
Fork
496
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc hướng dẫn trong đặc tả về dockerComposeFile và phần build trong devcontainer.json và docker-compose.yml được tham chiếu. So sánh ba cách diễn giải khả dĩ về build-context với repository mẫu, sau đó ghi lại một quy tắc mang tính chuẩn tắc kèm một ví dụ; công việc được coi là hoàn tất khi đặc tả loại bỏ sự mơ hồ đối với cấu trúc project này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker-compose, dockerfile
Lĩnh vực
devops, documentation
Loại issue
Tài liệu
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.