devcontainers / devcontainers/cli

devcontainer build fails when using FROM scratch

Abierto
#239 4 comentarios 7 reacciones 1 asignado Reclamado por @chrmarti Ver en GitHub
bug
Lenguaje dominante
TypeScript
Estrellas
3k
Forks
457
Merge medio
13 h 17 min
PR fusionados (30 d)
6

Descripción

Given a `.devcontainer/Dockerfile`:

```dockerfile
FROM ubuntu as stage1

RUN apt-get update && apt-get install -y vim

FROM scratch as stage2

COPY --from=stage1 / /

RUN which vim
```

and a `.devcontainer/devcontainer.json`:

```json
{
"name": "my-image",
"build": {
"dockerfile": "Dockerfile"
}
}
```

Building the devcontainer results in the following error:

```
devcontainer build --workspace-folder . --log-level trace
[10 ms] @devcontainers/cli 0.21.0. Node.js v16.18.0. darwin 21.6.0 arm64.
[10 ms] Start: Run: docker buildx version
[98 ms] Stop (88 ms): Run: docker buildx version
[98 ms] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
[98 ms]
[101 ms] Start: Run: docker inspect --type image scratch
[163 ms] Stop (62 ms): Run: docker inspect --type image scratch
[163 ms] resource: docker.io/library/scratch
[163 ms] id: scratch
[164 ms] version: latest
[164 ms] owner: library
[164 ms] namespace: library
[164 ms] registry: docker.io
[164 ms] path: library/scratch
[164 ms] No oauth authentication credentials found.
[164 ms] url: https://auth.docker.io/token?scope=repository:library/scratch:pull&service=registry.docker.io
[429 ms] manifest url: https://registry-1.docker.io/v2/library/scratch/manifests/latest
[690 ms] Error fetching image details: No manifest found for docker.io/library/scratch.
[691 ms] Start: Run: docker pull scratch
Using default tag: latest
Error response from daemon: 'scratch' is a reserved name
[835 ms] Stop (144 ms): Run: docker pull scratch
[835 ms] []
[835 ms] Error: No such image: scratch

{"outcome":"error","message":"Command failed: docker inspect --type image scratch","description":"An error occurred building the container."}
```

However, building the Dockerfile using `docker build` works fine. It seems that the devcontainer CLI doesn't support `FROM scratch` within a Dockerfile.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.