Skip to content

can't use dev container offline #10173

Open

Description

I'm always on the travel, and whenever I'm on travel and want to use my devcontainer the annoying inspect command fails to let an image that already available on my machine run. this behavior contradict with the purpose of a container for development.

here is the log

[28853 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/typescript-node:1-22-bullseye
[38885 ms] Error fetching image details: getaddrinfo EAI_AGAIN mcr.microsoft.com
[38886 ms] Start: Run: docker pull mcr.microsoft.com/devcontainers/typescript-node:1-22-bullseye
Error response from daemon: Get "https://mcr.microsoft.com/v2/": dialing mcr.microsoft.com:443 container via direct connection because  has no HTTPS proxy: resolving host mcr.microsoft.com: lookup mcr.microsoft.com: no such host
[49177 ms] []
[49177 ms] Error response from daemon: No such image: mcr.microsoft.com/devcontainers/typescript-node:1-22-bullseye

[49178 ms] Error: Command failed: docker inspect --type image mcr.microsoft.com/devcontainers/typescript-node:1-22-bullseye
[49178 ms]     at utA (/home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:410:3925)
[49178 ms]     at async KtA (/home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:3944)
[49178 ms]     at async eB (/home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:4886)
[49178 ms]     at async hrA (/home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:663:200)
[49178 ms]     at async lrA (/home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:662:13452)
[49182 ms] Exit code 1
[49183 ms] Command failed: /home/me-wsl-ubuntu/.vscode-server/bin/fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/node /home/me-wsl-ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-39052ba1-5800-4957-8a44-73151d8d99941723878744611 --workspace-folder /home/me-wsl-ubuntu/thetutr/t1 --workspace-mount-consistency cached --id-label devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\me-wsl-ubuntu\thetutr\t1 --id-label devcontainer.config_file=/home/me-wsl-ubuntu/thetutr/t1/.devcontainer/frontend-container/devcontainer.json --log-level debug --log-format json --config /home/me-wsl-ubuntu/thetutr/t1/.devcontainer/frontend-container/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-c739e546-90e1-48b4-b14a-acec85b609fb.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[49183 ms] Exit code 1

Activity

  1. added
    containers
    on Aug 17, 2024
  2. chrmarti commented on Aug 19, 2024

    @chrmarti
    Contributor

    Related: #9034

  3. added
    feature-request
    on Aug 19, 2024
  4. dslatkin commented on Sep 28, 2024

    @dslatkin

    Big +1 to this.

    One of the major selling points of dev containers was that it worked without an internet connection. My entire app has been architected to work offline for development - but now with the dev containers change that broke this functionality, all that effort no longer has any value because an internet connection is needed to start/connect to an already-created container.

  5. parkeraddison commented on Oct 10, 2024

    @parkeraddison

    Related to #1242, not sure we'll see a fix, but there may be some workarounds to try.

  6. dslatkin commented on Oct 10, 2024

    @dslatkin

    This is the error message I see when I disconnect and reconnect without an internet connection to a dev container that has already been created:

    [16 ms] Dev Containers 0.388.0 in VS Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511).
    [15 ms] Start: Resolving Remote
    [21 ms] Start: Check Docker is running
    [21 ms] Start: Run: docker version
    [50 ms] Client:
     Version:           27.2.0
     API version:       1.47
     Go version:        go1.21.13
     Git commit:        3ab4256
     Built:             
    [51 ms] Tue Aug 27 14:14:45 2024
     OS/Arch:           darwin/arm64
     Context:           desktop-linux
    
    Server: Docker Desktop 4.34.2 (167172)
     Engine:
      Version:          27.2.0
      API version:      1.47 (minimum version 1.24)
      Go version:       go1.21.13
      Git commit:       3ab5c7d
      Built:            Tue Aug 27 14:15:41 2024
      OS/Arch:          linux/arm64
      Experimental:     false
     containerd:
      Version:          1.7.20
      GitCommit:        8fc6bcff51318944179630522a095cc9dbf9f353
     runc:
      Version:          1.1.13
      GitCommit:        v1.1.13-0-g58aa920
     docker-init:
      Version:          0.19.0
      GitCommit:        de40ad0
    [54 ms] Start: Run: docker volume ls -q
    [89 ms] ProxyResolver#loadSystemCertificates count
    [90 ms] ProxyResolver#loadSystemCertificates count filtered
    [91 ms] Start: Run: docker build -f /var/folders/kk/q1f_p26n7656d89rxwppvd700000gn/T/vsch/bootstrap-image/0.388.0/bootstrap.Dockerfile -t vsc-volume-bootstrap /var/folders/kk/q1f_p26n7656d89rxwppvd700000gn/T/vsch/bootstrap-image/0.388.0
    [+] Building 0.0s (2/2) FINISHED                           docker:desktop-linux
     => [internal] load build definition from bootstrap.Dockerfile             0.0s
     => => transferring dockerfile: 1.02kB                                     0.0s
     => ERROR [internal] load metadata for mcr.microsoft.com/devcontainers/ba  0.0s
    ------
     > [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-alpine-3.20:
    ------
    bootstrap.Dockerfile:1
    --------------------
       1 | >>> FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.20
       2 |     
       3 |     COPY host-ca-certificates.crt /tmp/host-ca-certificates.crt
    --------------------
    ERROR: failed to solve: mcr.microsoft.com/devcontainers/base:0-alpine-3.20: failed to resolve source metadata for mcr.microsoft.com/devcontainers/base:0-alpine-3.20: failed to do request: Head "https://mcr.microsoft.com/v2/devcontainers/base/manifests/0-alpine-3.20": dialing mcr.microsoft.com:443 container via direct connection because  has no HTTPS proxy: connecting to mcr.microsoft.com:443: dial tcp: lookup mcr.microsoft.com: no such host
    [527 ms] Command failed: docker build -f /var/folders/kk/q1f_p26n7656d89rxwppvd700000gn/T/vsch/bootstrap-image/0.388.0/bootstrap.Dockerfile -t vsc-volume-bootstrap /var/folders/kk/q1f_p26n7656d89rxwppvd700000gn/T/vsch/bootstrap-image/0.388.0
    [527 ms] Exit code 1

    FYI Christof Marti (@chrmarti)

    It used to be that I could at least connect to an already-created container while offline. Not sure if this is a separate issue from this which seems more like a general feature request when trying to build a container, whereas this might be a regression?

  7. andreujuanc commented on Mar 26, 2025

    @andreujuanc

    This should have been fixed years ago. Please. If the docker image is present, there is no need for any internet connection. Simple.

  8. dslatkin commented on Mar 27, 2025

    @dslatkin

    This should have been fixed years ago. Please. If the docker image is present, there is no need for any internet connection. Simple.

    Agreed. It still pains me whenever I realize I've closed/disconnected my VS Code window and I don't have an internet connection, especially when on a flight. Hours of potential productivity gone.

  9. westurner commented on May 21, 2025

    @westurner

    Does it need to cache the downloaded copy of vscode and then check the signature of the cached download before every install?

  10. reenberg commented on Jul 2, 2025

    @reenberg

    As far as I can see, then the code server binary is downloaded to /tmp, at least for the remote-container extension.
    Would this issue not be fixed if the all the remote extensions just downloaded the binary to ~/.cache/Microsoft/... which already exists on my machine, and then defaulted to use the binary from there if the remote URL wasn't available?

    It seems that when the code server binary is downloaded, then it is for example stored as vscode-server-linux-x64.tar.gz. Keeping this, would ensure that the cache folder only retains one version of the code server per architecture and operating system, and thus it would not grow unneeded.

    As long as this issue is purely related to users being offline due to being on the move, then this would seem like a "limited" period of time that the user is offline, for which a local cache would seem like a reasonable solution, as the user is very unlikely to update the OS, VS Code, or any extensions during this period.
    Issue #6146 would then fix the scenario where the user is constantly disconnected/offline.

    Am I missing something big that makes this a non trivial thing?

    1. Change the download location from /tmp to the users cache folder
    2. If download failue, only fail if the binary is not present in the cache folder.
  11. max06 commented on Mar 14, 2026

    @max06

    Just to extend this issue a little bit:

    The requirement to check for image updates (not even using "Rebuild without cache") also prevents us from using local images.

    Example: I have a bakefile for docker, which is (still) not supported by this extension. This bakefile has a "dev"-target producing a local docker image with a specified tag, example "local/myproject:dev". After running docker buildx build dev a regular docker image with that defined tag is stored in docker. Specifying that image in my devcontainer.json as image: "local/myproject:dev" causes the devcontainer build to fail - because it's looking up that image on docker.io, without ever being asked to do that.

    There is no need to do/force the lookup on the registry by yourself. You have a dockerfile-template that you fill with the content of image, you run docker build. Docker itself decides if pulling an image is necessary based on the existence of that image in the local cache.

    You can still to the docker pull if the user selects "Rebuild without cache", but please stick to the default logic by letting docker do its job.

    In this case it's just about removing a line, in the devcontainer-cli repo, if I'm not mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

containersfeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions