microsoft / microsoft/vscode-remote-release

Dockerfile with image from scratch fails to build from devcontainer.json

Open
#9,799 2 comments 13 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Apr 19, 2024.

bug containers
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

VSCode Version: 1.88.1
Local OS Version: Windows 10 Pro 22H2
Remote OS Version: docker container
Remote Extension/Connection Type: Containers

Steps to Reproduce:

Given this Dockerfile

FROM wordpress:php8.1-apache as wordpress-stripped

RUN set -eux; \
    rm -Rf \
    /usr/local/bin/docker-entrypoint.sh \
    /usr/src \
    /var/www/*


FROM scratch as wordpress-devcontainer
COPY --from=wordpress-stripped / /
ENV PHP_INI_DIR /usr/local/etc/php
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
EXPOSE 80
WORKDIR /var/www
CMD ["apache2-foreground"]

And this .devcontainer.json file

{
    "build": { "dockerfile": "Dockerfile" }
}

I get this error:
image

Workaround

Change the .devcontainer.json file to this:

{
    "initializeCommand": "docker build --tag wordpress-devcontainer:latest .",
    "image": "wordpress-devcontainer:latest"
}

Logs

full logfile: remoteContainers-2024-04-19T19-16-59.736Z.log

[2024-04-19T19:17:05.067Z] Start: Run: docker inspect --type image scratch
[2024-04-19T19:17:05.371Z] Stop (304 ms): Run: docker inspect --type image scratch
[2024-04-19T19:17:05.375Z] Loading 53 extra certificates from C:\Users\Gerwin\AppData\Local\Temp\vsch\certificates-80a0b5eac2ebcc7d1b062f7bbb7841837a07131ceefa857109ba5977eec4fae9.pem.
[2024-04-19T19:17:05.783Z] Start: Run: docker-credential-desktop get
[2024-04-19T19:17:05.972Z] Stop (189 ms): Run: docker-credential-desktop get
[2024-04-19T19:17:07.241Z] Error fetching image details: No manifest found for docker.io/library/scratch.
[2024-04-19T19:17:07.242Z] Start: Run: docker pull scratch
[2024-04-19T19:17:07.675Z] 
[2024-04-19T19:17:07.740Z] Using default tag: latest
[2024-04-19T19:17:07.908Z] Error response from daemon: 'scratch' is a reserved name
[2024-04-19T19:17:08.001Z] Stop (759 ms): Run: docker pull scratch
[2024-04-19T19:17:08.004Z] []
[2024-04-19T19:17:08.004Z] Error response from daemon: No such image: scratch:latest

[2024-04-19T19:17:08.006Z] Error: Command failed: docker inspect --type image scratch
[2024-04-19T19:17:08.006Z]     at htA (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:464:1260)
[2024-04-19T19:17:08.006Z]     at kH (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:464:1002)
[2024-04-19T19:17:08.006Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-04-19T19:17:08.006Z]     at async UtA (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:481:3692)
[2024-04-19T19:17:08.007Z]     at async $C (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:481:4807)
[2024-04-19T19:17:08.007Z]     at async QrA (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:661:13255)
[2024-04-19T19:17:08.007Z]     at async urA (c:\Users\Gerwin\.vscode\extensions\ms-vscode-remote.remote-containers-0.354.0\dist\spec-node\devContainersSpecCLI.js:661:12996)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.