vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

SSH fails to build container with feature property in devcontainer.json

Open sladiri opened this issue 2 years ago • 2 comments

Error happens with Alpine, Debian and Ubuntu containers.

  • VSCode Version: 1.70.1, 1.71.0-insider has same issue
  • Local OS Version: Fedora release 36
  • Remote OS Version: Windows 11 (inside KVM virtual machine)
  • Remote Extension/Connection Type: SSH
  • Logs:
[+] Building 40.9s (2/3)                                                        
[+] Building 40.9s (3/3) FINISHED                                               
 => [internal] load build definition from Dockerfile-with-features         0.0s
 => => transferring dockerfile: 900B                                       0.0s
 => [internal] load .dockerignore                                          0.1s
 => => transferring context: 2B                                            0.0s
 => ERROR resolve image config for docker.io/docker/dockerfile:1.4        40.8s
------
 > resolve image config for docker.io/docker/dockerfile:1.4:
------
error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``

Dockerfile (generated by Code):

# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/debian/.devcontainer/base.Dockerfile

# [Choice] Debian version (use bullseye on local arm64/Apple Silicon): bullseye, buster
ARG VARIANT="buster"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# ** [Optional] Uncomment this section to install additional packages. **
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
#     && apt-get -y install --no-install-recommends <your-package-list-here>

I noticed that build runs fine if I do not select Node.js as feature. Also, the error happens if the features property is an empty object (I commented out node). When I comment out the features object entirely, then the build runs fine.

failing devcontainer.json section:

{
        ...
	"features": {
		"node": "10"
	}
}

failing devcontainer.json section:

{
        ...
	"features": {
		// "node": "10"
	}
}

working devcontainer.json section:

{
        ...
	//"features": {
		//"node": "10"
	//}
}

complete failing (generated by Code) devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/debian
{
	"name": "Debian",
	"build": {
		"dockerfile": "Dockerfile",
		// Update 'VARIANT' to pick an Debian version: bullseye, buster
		// Use bullseye on local arm64/Apple Silicon.
		"args": { "VARIANT": "bullseye" }
	},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
	// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

	// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode",
	"features": {
		"node": "10"
	}
}

Steps to Reproduce:

  1. open remote folder via SSH
  2. add container configuration files, e.g. Debian and add Node.js
  3. execute "reopen in container"

Does this issue occur when you try this locally?: No. When I build the same containers in a local folder, instead on the remote host via SSH, they build fine.

I found another new issue with a similar error log: https://github.com/microsoft/vscode-remote-release/issues/6920

sladiri avatar Aug 12 '22 10:08 sladiri

Could you run docker pull docker.io/docker/dockerfile:1.4 on the command line and then retry? (Suggested in https://github.com/microsoft/vscode-remote-release/issues/6920#issuecomment-1234414151.)

chrmarti avatar Sep 13 '22 07:09 chrmarti

Thanks, I can pull the image beforhand and then the container builds fine.

sladiri avatar Sep 14 '22 12:09 sladiri

Tracking as https://github.com/microsoft/vscode-remote-release/issues/6920. Thanks.

chrmarti avatar Oct 06 '22 07:10 chrmarti