microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.69k stars 296 forks source link

"This is a recovery container that allows you to edit your Dockerfile. Use 'Reopen in Container' to retry." #7803

Closed cpoptic closed 1 year ago

cpoptic commented 1 year ago

I'm using the latest version of VS Code with the latest Dev Containers extension installed.

Trying to create a dev container by cloning from a public Github repo.

Screen Shot 2022-12-09 at 11 56 13 AM

But I get an error: An error occurred setting up the container.

Screen Shot 2022-12-09 at 11 59 14 AM

Retrying doesn't fix the issue. But choosing "Edit devcontainer.json in Recovery Container" does indeed open the remote dev container "correctly", albeit with the green "Recovery Container" in the lower left corner.

The repo doesn't have a .devcontainer folder so VS Code creates one, along with a Dockerfile and devcontainer.json file.

There were several options for which base image to use for Python (e.g. Anaconda, Miniconda, Miniconda+PostgreSQL, etc), but I just used the "Miniconda (Python 3) & PostgreSQL" since this project uses PostgreSQL and Python.

The contents of the devcontainer.json are this:

{
    "name": "Python 3 & PostgreSQL",
    "dockerComposeFile": "docker-compose.yml",
    "service": "app",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
    "features": {
        "ghcr.io/devcontainers-contrib/features/black:1": {},
        "ghcr.io/devcontainers-contrib/features/mypy:1": {}
    }
}

and the newly created Dockerfile is just 2 lines:

FROM mcr.microsoft.com/devcontainers/python:0-3.11

ENV PYTHONUNBUFFERED 1

What's strange is that I get an error message after the recovery container opens: This is a recovery container that allows you to edit your Dockerfile. Use 'Reopen in Container' to retry.

Screen Shot 2022-12-09 at 11 43 58 AM

That error message seems to imply there's something wrong with the Dockerfile, but I've not modified it at all; just using the stock Dockerfile that VS Code created in the .devcontainer folder.

When I click the lower left green "Recovery Container" to "Create Dev Container",

Screen Shot 2022-12-09 at 11 52 45 AM

I choose the simple Alpine container with Git installed (because frankly I'm not really sure which Dev Container config I should choose):

Screen Shot 2022-12-09 at 11 53 21 AM

It then Opens Remote and starts the Dev Container

What's going on here? Is there an error in the Dockerfile or in the devcontainer.json file? Or something else entirely?

I'm just trying to create a Dev Container from a Github repo, save it, and be able to reopen that Dev Container later to resume working on that project.

I have log files but honestly I'm not sure which are the relevant parts of the log file to include, so here's all ~300 lines:

LOG FILE CONTENTS BELOW:

[2022-12-09T16:58:44.155Z] Dev Containers 0.266.1 in VS Code 1.74.0 (5235c6bb189b60b01b1f49062f4ffa42384f8c91). [2022-12-09T16:58:44.155Z] Start: Resolving Remote [2022-12-09T16:58:44.180Z] Start: Check Docker is running [2022-12-09T16:58:44.180Z] Start: Run: docker version --format {{.Server.APIVersion}} [2022-12-09T16:58:44.315Z] Stop (135 ms): Run: docker version --format {{.Server.APIVersion}} [2022-12-09T16:58:44.315Z] Server API version: 1.41 [2022-12-09T16:58:44.315Z] Stop (135 ms): Check Docker is running [2022-12-09T16:58:44.317Z] Start: Run: docker volume ls -q [2022-12-09T16:58:44.413Z] Stop (96 ms): Run: docker volume ls -q [2022-12-09T16:58:44.414Z] Start: Run: docker build -f /var/folders/0d/1xlwpj7h13qg7hbml8zk640000gp/T/vsch/bootstrap-image/0.266.1/bootstrap.Dockerfile -t vsc-volume-bootstrap /var/folders/0d/1xlwpj7h13qg7hbml8zk640000gp/T/vsch/bootstrap-image/0.266.1 [2022-12-09T16:58:45.156Z] [+] Building 0.0s (0/1)
[2022-12-09T16:58:45.287Z] [+] Building 0.1s (2/2)
=> [internal] load build definition from bootstrap.Dockerfile 0.0s => => transferring dockerfile: 47B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s [2022-12-09T16:58:45.438Z] [+] Building 0.3s (2/3)
=> [internal] load build definition from bootstrap.Dockerfile 0.0s => => transferring dockerfile: 47B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s => [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-a 0.1s [2022-12-09T16:58:45.588Z] [2022-12-09T16:58:45.589Z] [+] Building 0.4s (2/3)
=> [internal] load build definition from bootstrap.Dockerfile 0.0s => => transferring dockerfile: 47B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s => [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-a 0.2s [2022-12-09T16:58:45.695Z] [+] Building 0.5s (3/3)
=> [internal] load build definition from bootstrap.Dockerfile 0.0s => => transferring dockerfile: 47B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s => [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-a 0.4s [2022-12-09T16:58:45.762Z] [+] Building 0.6s (9/9) FINISHED
=> [internal] load build definition from bootstrap.Dockerfile 0.0s => => transferring dockerfile: 47B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s [2022-12-09T16:58:45.763Z] => [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-a 0.4s => [1/4] FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.16@sha256: 0.0s => [internal] load build context 0.0s => => transferring context: 5.90kB 0.0s => CACHED [2/4] RUN apk add --no-cache nodejs python3 npm make g++ 0.0s => CACHED [3/4] RUN cd && npm i node-pty 0.0s => CACHED [4/4] COPY .vscode-remote-containers /root/.vscode-remote-cont 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:6ca760a5bc3367569bfbb0aeda56592be5782b4e3d912 0.0s => => naming to docker.io/library/vsc-volume-bootstrap 0.0s [2022-12-09T16:58:46.689Z] Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them [2022-12-09T16:58:46.726Z] Stop (2312 ms): Run: docker build -f /var/folders/0d/1xlwpj7h13qg7hbml8zk640000gp/T/vsch/bootstrap-image/0.266.1/bootstrap.Dockerfile -t vsc-volume-bootstrap /var/folders/0d/1xlwpj7h13qg7hbml8zk640000gp/T/vsch/bootstrap-image/0.266.1 [2022-12-09T16:58:46.727Z] Cloning Github repository: hackingthemarkets/wallstreetbets-tracker into /workspaces/wallstreetbets-tracker

[2022-12-09T16:58:46.728Z] Start: Run: docker run -d --mount type=volume,src=vsc-remote-containers,dst=/workspaces -v /var/run/docker.sock:/var/run/docker.sock vsc-volume-bootstrap sleep infinity [2022-12-09T16:58:47.242Z] Stop (514 ms): Run: docker run -d --mount type=volume,src=vsc-remote-containers,dst=/workspaces -v /var/run/docker.sock:/var/run/docker.sock vsc-volume-bootstrap sleep infinity [2022-12-09T16:58:47.244Z] Start: Run in container: /bin/sh [2022-12-09T16:58:47.246Z] Start: Launching Dev Containers helper. [2022-12-09T16:58:47.247Z] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-7951f99283cdb3297c7f31f40db490f393319948.sock) forwarded to local host (/private/tmp/com.apple.launchd.us5RuSyLnx/Listeners). [2022-12-09T16:58:47.248Z] Start: Run: gpgconf --list-dir agent-extra-socket [2022-12-09T16:58:47.255Z] Stop (7 ms): Run: gpgconf --list-dir agent-extra-socket [2022-12-09T16:58:47.255Z] Start: Run in container: /bin/sh [2022-12-09T16:58:47.256Z] Stop (10 ms): Launching Dev Containers helper. [2022-12-09T16:58:47.258Z] Start: Run in container: echo ~ [2022-12-09T16:58:47.259Z] Stop (11 ms): Run: gpgconf --list-dir agent-extra-socket [2022-12-09T16:58:47.483Z] /root [2022-12-09T16:58:47.483Z] [2022-12-09T16:58:47.483Z] Stop (225 ms): Run in container: echo ~ [2022-12-09T16:58:47.483Z] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js' >/tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js [2022-12-09T16:58:47.487Z] [2022-12-09T16:58:47.487Z] [2022-12-09T16:58:47.488Z] Stop (5 ms): Run in container: cat <<'EOF-/tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js' >/tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js [2022-12-09T16:58:47.488Z] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-7951f99283cdb3297c7f31f40db490f393319948.js' >/tmp/vscode-remote-containers-server-7951f99283cdb3297c7f31f40db490f393319948.js_1670605127488 [2022-12-09T16:58:47.516Z] [2022-12-09T16:58:47.516Z] [2022-12-09T16:58:47.516Z] Stop (28 ms): Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-7951f99283cdb3297c7f31f40db490f393319948.js' >/tmp/vscode-remote-containers-server-7951f99283cdb3297c7f31f40db490f393319948.js_1670605127488 [2022-12-09T16:58:47.523Z] Start: Run in container: # Test for /root/.gitconfig and git [2022-12-09T16:58:47.571Z] [2022-12-09T16:58:47.571Z] [2022-12-09T16:58:47.571Z] Stop (48 ms): Run in container: # Test for /root/.gitconfig and git [2022-12-09T16:58:47.571Z] Start: Run in container: # Copy /Users/popticc/.gitconfig to /root/.gitconfig [2022-12-09T16:58:47.577Z] [2022-12-09T16:58:47.577Z] [2022-12-09T16:58:47.577Z] Stop (6 ms): Run in container: # Copy /Users/popticc/.gitconfig to /root/.gitconfig [2022-12-09T16:58:47.577Z] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { node /tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js $; }; f' || true [2022-12-09T16:58:47.582Z] [2022-12-09T16:58:47.582Z] [2022-12-09T16:58:47.582Z] Stop (5 ms): Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { node /tmp/vscode-remote-containers-7951f99283cdb3297c7f31f40db490f393319948.js $; }; f' || true [2022-12-09T16:58:47.583Z] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh [2022-12-09T16:58:47.590Z] [2022-12-09T16:58:47.590Z] [2022-12-09T16:58:47.590Z] Stop (7 ms): Run in container: # Test for /root/.ssh/known_hosts and ssh [2022-12-09T16:58:47.591Z] Start: Run in container: # Copy /Users/popticc/.ssh/known_hosts to /root/.ssh/known_hosts [2022-12-09T16:58:47.598Z] [2022-12-09T16:58:47.598Z] [2022-12-09T16:58:47.598Z] Stop (7 ms): Run in container: # Copy /Users/popticc/.ssh/known_hosts to /root/.ssh/known_hosts [2022-12-09T16:58:47.667Z] Start: Run in container: cat /workspaces/wallstreetbets-tracker/.devcontainer/devcontainer.json 2>/dev/null [2022-12-09T16:58:47.672Z] Stop (5 ms): Run in container: cat /workspaces/wallstreetbets-tracker/.devcontainer/devcontainer.json 2>/dev/null [2022-12-09T16:58:47.674Z] Start: Run in container: cat /workspaces/wallstreetbets-tracker/.devcontainer/devcontainer.json 2>/dev/null [2022-12-09T16:58:47.680Z] Stop (6 ms): Run in container: cat /workspaces/wallstreetbets-tracker/.devcontainer/devcontainer.json 2>/dev/null [2022-12-09T16:58:47.681Z] The options 'workspaceMount' or 'workspaceFolder' are ignored when cloning a repository into a volume. [2022-12-09T16:58:47.682Z] Start: Run in container: cat <<'EOF-/tmp/devcontainer-40780ff1-5663-442f-aadd-7aa22aabd92f.json' >/tmp/devcontainer-40780ff1-5663-442f-aadd-7aa22aabd92f.json_1670605127682 [2022-12-09T16:58:47.689Z] [2022-12-09T16:58:47.689Z] [2022-12-09T16:58:47.689Z] Stop (7 ms): Run in container: cat <<'EOF-/tmp/devcontainer-40780ff1-5663-442f-aadd-7aa22aabd92f.json' >/tmp/devcontainer-40780ff1-5663-442f-aadd-7aa22aabd92f.json_1670605127682 [2022-12-09T16:58:47.690Z] Start: Run in container: docker volume ls -q [2022-12-09T16:58:47.899Z] Stop (209 ms): Run in container: docker volume ls -q [2022-12-09T16:58:48.209Z] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/hackingthemarkets/wallstreetbets-tracker.git/tree/main --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=wallstreetbets-tracker --filter label=vsch.quality=stable [2022-12-09T16:58:48.450Z] Stop (241 ms): Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/hackingthemarkets/wallstreetbets-tracker.git/tree/main --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=wallstreetbets-tracker --filter label=vsch.quality=stable [2022-12-09T16:58:48.451Z] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/hackingthemarkets/wallstreetbets-tracker.git/tree/main --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=wallstreetbets-tracker [2022-12-09T16:58:48.732Z] Stop (281 ms): Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/hackingthemarkets/wallstreetbets-tracker.git/tree/main --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=wallstreetbets-tracker [2022-12-09T16:58:49.101Z] Start: Run in container: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.266.1/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /workspaces/wallstreetbets-tracker --workspace-mount-consistency cached --id-label vsch.local.repository=https://github.com/hackingthemarkets/wallstreetbets-tracker.git/tree/main --id-label vsch.local.repository.volume=vsc-remote-containers --id-label vsch.local.repository.folder=wallstreetbets-tracker --log-level debug --log-format json --config /workspaces/wallstreetbets-tracker/.devcontainer/devcontainer.json --override-config /tmp/devcontainer-40780ff1-5663-442f-aadd-7aa22aabd92f.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vsc-remote-containers,target=/workspaces,external=true --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default off --mount-workspace-git-root true [2022-12-09T16:58:49.655Z] (node:113) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. [2022-12-09T16:58:49.655Z] (Use node --trace-deprecation ... to show where the warning was created) [2022-12-09T16:58:49.663Z] @devcontainers/cli 0.25.2. Node.js v16.17.1. linux 5.15.49-linuxkit x64. [2022-12-09T16:58:49.663Z] Start: Run: docker buildx version [2022-12-09T16:58:49.872Z] Stop (209 ms): Run: docker buildx version [2022-12-09T16:58:49.874Z] github.com/docker/buildx v0.8.2 6224def4dd2c3d347eee19db595348c50d7cb491 [2022-12-09T16:58:49.874Z] [2022-12-09T16:58:49.875Z] Start: Resolving Remote [2022-12-09T16:58:49.886Z] Start: Run: docker-compose version --short [2022-12-09T16:58:49.891Z] Stop (5 ms): Run: docker-compose version --short [2022-12-09T16:58:49.891Z] Start: Run: docker compose version --short [2022-12-09T16:58:49.895Z] Stop (9 ms): Run: docker-compose version --short [2022-12-09T16:58:50.009Z] Stop (118 ms): Run: docker compose version --short [2022-12-09T16:58:50.009Z] Docker Compose version: 2.12.2 [2022-12-09T16:58:50.011Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=wallstreetbets-tracker_devcontainer --filter label=com.docker.compose.service=app [2022-12-09T16:58:50.060Z] Stop (49 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=wallstreetbets-tracker_devcontainer --filter label=com.docker.compose.service=app [2022-12-09T16:58:50.061Z] Start: Run: docker inspect --type container 6887ee78f77b [2022-12-09T16:58:50.103Z] Stop (42 ms): Run: docker inspect --type container 6887ee78f77b [2022-12-09T16:58:50.106Z] Start: Run: docker compose -f /workspaces/wallstreetbets-tracker/.devcontainer/docker-compose.yml --profile config [2022-12-09T16:58:50.237Z] Stop (131 ms): Run: docker compose -f /workspaces/wallstreetbets-tracker/.devcontainer/docker-compose.yml --profile config [2022-12-09T16:58:50.238Z] name: devcontainer services: app: build: context: /workspaces/wallstreetbets-tracker dockerfile: .devcontainer/Dockerfile command:

services: app: build: dockerfile: /tmp/devcontainercli-root/container-features/0.25.2-1670605131588/Dockerfile-with-features args:

[2022-12-09T16:58:54.564Z] Start: Run: docker inspect --type image wallstreetbets-tracker_devcontainer-app [2022-12-09T16:58:54.669Z] Stop (105 ms): Run: docker inspect --type image wallstreetbets-tracker_devcontainer-app [2022-12-09T16:58:54.670Z] Docker Compose override file for creating container: version: '3.8'

services: 'app': entrypoint: ["/bin/sh", "-c", "echo Container started\n trap \"exit 0\" 15\n \n exec \"$$@\"\n while sleep 1 & wait $$!; do :; done", "-"] labels:

chrmarti commented 1 year ago

There appear to be two networks with the same name, please check with docker network ls.

To resolve the issue, you can remove one or both of them with docker network rm <ids> (see https://stackoverflow.com/questions/63776518/error-2-matches-found-based-on-name-network-nameofservice-default-is-ambiguo).

Not sure why two networks of the same name were created.

On "Recovery Container": That's a temporary dev container using a built-in configuration, so you can fix your configuration. (Though in this case the problem is not with your configuration.)

On "Create Dev Container": This command creates an empty dev container not containing your repository. We could make this clearer in the UI. Needs more thinking and feedback.

Does that help?

github-actions[bot] commented 1 year ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!