Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Container] Fail to build a devcontainer: ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF #7958

Closed
jaudiger opened this issue Feb 3, 2023 · 38 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers upstream Issue identified as 'upstream' component related (exists outside of VS Code Remote)

Comments

@jaudiger
Copy link

jaudiger commented Feb 3, 2023

  • VSCode Version: 1.75

  • Local OS Version: Fedora 37

  • Remote OS Version: Fedora 37

  • Remote Extension/Connection Type: Containers

  • Logs:

[2023-02-03T08:26:11.196Z] Dev Containers 0.276.0 in VS Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164).
[2023-02-03T08:26:11.196Z] Start: Resolving Remote
[2023-02-03T08:26:11.217Z] Setting up container for folder or workspace: /home/foo/bar
[2023-02-03T08:26:11.222Z] Start: Check Docker is running
[2023-02-03T08:26:11.223Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2023-02-03T08:26:11.280Z] Stop (57 ms): Run: docker version --format {{.Server.APIVersion}}
[2023-02-03T08:26:11.281Z] Server API version: 1.42
[2023-02-03T08:26:11.281Z] Stop (59 ms): Check Docker is running
[2023-02-03T08:26:11.282Z] Start: Run: docker volume ls -q
[2023-02-03T08:26:11.332Z] Stop (50 ms): Run: docker volume ls -q
[2023-02-03T08:26:11.333Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=/home/foo/bar --filter label=vsch.quality=stable
[2023-02-03T08:26:11.386Z] Stop (53 ms): Run: docker ps -q -a --filter label=vsch.local.folder=/home/foo/bar --filter label=vsch.quality=stable
[2023-02-03T08:26:11.386Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar --filter label=devcontainer.config_file=/home/foo/bar/.devcontainer/devcontainer.json
[2023-02-03T08:26:11.436Z] Stop (50 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar --filter label=devcontainer.config_file=/home/foo/bar/.devcontainer/devcontainer.json
[2023-02-03T08:26:11.437Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar
[2023-02-03T08:26:11.487Z] Stop (50 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar
[2023-02-03T08:26:11.488Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar
[2023-02-03T08:26:11.537Z] Stop (49 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar
[2023-02-03T08:26:11.538Z] Start: Run: /usr/share/code/code --ms-enable-electron-run-as-node /home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/foo/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder tmp/devcontainers-62a0e236-7d04-4ae3-9796-8b1ec8d2c4a91675412770316 --workspace-folder /home/foo/bar --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/foo/bar --id-label devcontainer.config_file=/home/foo/bar/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/foo/bar/.devcontainer/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-352c4678588e167720eb909b8010065c301da55a.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-02-03T08:26:11.791Z] (node:8185) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2023-02-03T08:26:11.791Z] (Use `code --trace-deprecation ...` to show where the warning was created)
[2023-02-03T08:26:11.792Z] @devcontainers/cli 0.29.0. Node.js v16.14.2. linux 6.1.8-200.fc37.x86_64 x64.
[2023-02-03T08:26:11.792Z] Start: Run: docker buildx version
[2023-02-03T08:26:11.870Z] Stop (78 ms): Run: docker buildx version
[2023-02-03T08:26:11.871Z] github.com/docker/buildx v0.10.2 00ed17d
[2023-02-03T08:26:11.871Z] 
[2023-02-03T08:26:11.871Z] Start: Resolving Remote
[2023-02-03T08:26:11.873Z] Start: Run: git rev-parse --show-cdup
[2023-02-03T08:26:11.878Z] Stop (5 ms): Run: git rev-parse --show-cdup
[2023-02-03T08:26:11.879Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar --filter label=devcontainer.config_file=/home/foo/bar/.devcontainer/devcontainer.json
[2023-02-03T08:26:11.928Z] Stop (49 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/home/foo/bar --filter label=devcontainer.config_file=/home/foo/bar/.devcontainer/devcontainer.json
[2023-02-03T08:26:11.931Z] Start: Run: docker inspect --type image fedora-base-image:latest
[2023-02-03T08:26:11.980Z] Stop (49 ms): Run: docker inspect --type image fedora-base-image:latest
[2023-02-03T08:26:11.981Z] local container features stored at: /home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/node_modules/vscode-dev-containers/container-features
[2023-02-03T08:26:11.982Z] Start: Run: tar --no-same-owner -x -f -
[2023-02-03T08:26:12.000Z] Stop (18 ms): Run: tar --no-same-owner -x -f -
[2023-02-03T08:26:12.002Z] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-foo/container-features/0.29.0-1675412771981/Dockerfile-with-features -t vsc-foo-d59d9b82524cc32346608bd4ab3ef08d --target dev_containers_target_stage --build-arg ADDITIONAL_PACKAGES= --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/foo/bar/.devcontainer
[2023-02-03T08:26:12.196Z] 
[2023-02-03T08:26:12.196Z] [+] Building 0.0s (0/1)                                                         
[2023-02-03T08:26:12.335Z] [+] Building 0.1s (5/6)                                                         
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
[2023-02-03T08:26:12.335Z]  => [internal] load build definition from Dockerfile-with-features         0.0s
 => => transferring dockerfile: 1.37kB                                     0.0s
 => [internal] load metadata for docker.io/library/fedora-base-image  0.0s
 => [dev_container_auto_added_stage_label 1/2] FROM docker.io/library/fed  0.0s
 => CACHED [dev_container_auto_added_stage_label 2/2] RUN [[ ! -z "" ]]    0.0s
 => preparing layers for inline cache                                      0.1s
ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF
[2023-02-03T08:26:12.540Z] Stop (538 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-foo/container-features/0.29.0-1675412771981/Dockerfile-with-features -t vsc-foo-d59d9b82524cc32346608bd4ab3ef08d --target dev_containers_target_stage --build-arg ADDITIONAL_PACKAGES= --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/foo/bar/.devcontainer
[2023-02-03T08:26:12.541Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-foo/container-features/0.29.0-1675412771981/Dockerfile-with-features -t vsc-foo-d59d9b82524cc32346608bd4ab3ef08d --target dev_containers_target_stage --build-arg ADDITIONAL_PACKAGES= --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/foo/bar/.devcontainer
[2023-02-03T08:26:12.542Z]     at pie (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:1916:1698)
[2023-02-03T08:26:12.543Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-02-03T08:26:12.543Z]     at async vF (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:1915:1972)
[2023-02-03T08:26:12.544Z]     at async P7 (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:1915:901)
[2023-02-03T08:26:12.545Z]     at async Fie (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:1921:2093)
[2023-02-03T08:26:12.545Z]     at async Vf (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:1921:3241)
[2023-02-03T08:26:12.546Z]     at async eoe (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:2045:17324)
[2023-02-03T08:26:12.546Z]     at async Qse (/home/foo/.vscode/extensions/ms-vscode-remote.remote-containers-0.276.0/dist/spec-node/devContainersSpecCLI.js:2045:17065)

Steps to Reproduce:

  1. Trying to create a dev container

I don't know what is causing this issue, this morning I upgraded at the same time, VSCode to 1.75 and Docker to 23.0.0. I think one of them seems to have triggered this issue I didn't have yesterday.

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Feb 3, 2023
@pglira
Copy link

pglira commented Feb 3, 2023

Same here.

@pglira
Copy link

pglira commented Feb 3, 2023

It seems to be the docker upgrade, see #7955

@rneuter
Copy link

rneuter commented Feb 3, 2023

Same here, glad I'm not alone, it was driving me crazy.

I succeed to make it works by disabling all Dev Container Features in my .devcontainer.json configuration file. Do you have the same behavior?

@pglira
Copy link

pglira commented Feb 3, 2023

I've tried to deactivate almost everything, but in my case the error still occurs.

@jaudiger
Copy link
Author

jaudiger commented Feb 3, 2023

Same here, the issue comes from the upgrade of Docker, thanks @pglira to point me out the closed issue.

Maybe the issue comes from the new default builder, I don't know:

image

As for now, I'll leave this issue opened, just to continue to investigate.

@jaudiger
Copy link
Author

jaudiger commented Feb 3, 2023

I found maybe a possible relating problem while digging into buildx issues: docker/buildx#1325.

@pglira
Copy link

pglira commented Feb 3, 2023

I downgraded docker to 20.10.23 and now it works again.

For this I followed the instructions here: https://docs.docker.com/engine/install/ubuntu/ (I'm on Ubuntu 22.04)

2023_02_03_12_54_51

(However, it did not work immediately. For some reason I needed to reinstall also docker-desktop and to restart my pc twice but this might not be necessary in other cases.)

@chrmarti chrmarti self-assigned this Feb 3, 2023
@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code Remote) labels Feb 3, 2023
@chrmarti
Copy link
Contributor

chrmarti commented Feb 3, 2023

Tracking devcontainers/cli#398.

@mmmherma
Copy link

mmmherma commented Feb 3, 2023

Same here 🥲

@dlangerm
Copy link

dlangerm commented Feb 3, 2023

same :(

@antonioconselheiro
Copy link

same here (on my open source project: https://github.com/antonioconselheiro/bater-ponto)

@stratmm
Copy link

stratmm commented Feb 3, 2023

Had the same problem, docker-compose build worked but vscode devcontainers builds are failing with the same issue. Downgrading to 20.10.23 fixed the problem

@mwinters-stuff
Copy link

Workaround without changing docker version, if using linux is to add
export DOCKER_BUILDKIT=0
to your ~/.profile

Restart vscode and I was able to build the container again.

@jensenbox
Copy link

Plopping in a snippet of the error for search engines in case other people run into this:

 => preparing layers for inline cache                                                                                                                                                                                                        0.2s
ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF

I hope there is a fix soon!

@jaudiger
Copy link
Author

jaudiger commented Feb 3, 2023

We got an answer in docker buildx project, a fix is in the pipe: docker/buildx#1325 (comment)

@elcojacobs
Copy link

Easy workaround until the fix is live is to disable inline cache in devcontainer.json :

  "build": {
    "dockerfile": "Dockerfile",
    "cacheFrom": "brewblox/firmware-devcontainer:bullseye",
    "args": {
      "USERNAME": "vscode",
      "BUILDKIT_INLINE_CACHE": "0"
    }
  },

@mksmtn
Copy link

mksmtn commented Feb 4, 2023

@elcojacobs 's workaround worked for me

@elcojacobs
Copy link

I also found out that the slowest part of a container rebuild here was pushing it to the inline cache, which somehow took 10 minutes. Just rebuilding from the registry cache finishes in 10 seconds, so I might leave the inline cache disabled. Not sure what the benefit would be if we keep a registry container up-to-date.

@telam
Copy link

telam commented Feb 6, 2023

Plopping in a snippet of the error for search engines in case other people run into this:

 => preparing layers for inline cache                                                                                                                                                                                                        0.2s
ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF

I hope there is a fix soon!

Doing the community a service. Thank you!

@revliscano
Copy link

Same error here. After three hours of frustration I finally found this issue. I'm gonna downgrade Docker now to see if I'm lucky

@lucasmelogithub
Copy link

Same error, downgraded to v20 and it fixed it.
https://docs.docker.com/engine/install/ubuntu/

@ankudinov
Copy link

Same problem on Ubuntu with Docker v23 today. Downgrade to v20 resolved the problem.
Another workaround stolen from #173311 is sudo apt remove docker-buildx-plugin. Have not tested myself, just adding to this thread for convenience.
I'm curious to see if that impacts Docker desktop as well, but holding the upgrade for now.

@KaiSchwarz-cnic
Copy link

Easy workaround until the fix is live is to disable inline cache in devcontainer.json :

  "build": {
    "dockerfile": "Dockerfile",
    "cacheFrom": "brewblox/firmware-devcontainer:bullseye",
    "args": {
      "USERNAME": "vscode",
      "BUILDKIT_INLINE_CACHE": "0"
    }
  },

this one works perfectly fine as tmp. solution. Thanks @elcojacobs !

@filunK
Copy link

filunK commented Feb 7, 2023

I faced the same problem and resolved by executing command docker buildx create.

docker buildx create --name container-builder --use

Docker v23 uses BuildKit to build container images as default, and uses docker-own fallback instanse if no buildkit instance created. I think the fallbak instance has some problems...

@DitherWither
Copy link

The downgrade worked on fedora too.
The dnf commands for downgrade are:

sudo dnf swap docker-ce-23.0.0 docker-ce-20.10.23
sudo dnf swap docker-ce-cli-23.0.0 docker-ce-cli-20.10.23

replace the first package on both lines with the current docker version

@newx666
Copy link

newx666 commented Feb 7, 2023

Another workaround stolen from #173311 is sudo apt remove docker-buildx-plugin.

It's work! Thanks a lot!

@Uguudei
Copy link

Uguudei commented Feb 8, 2023

For a remote machine with multiple users, doing the following two fixed it for now:

  1. As mwinters-stuff mentioned
# add the following line in /etc/bash.bashrc
export DOCKER_BUILDKIT=0
  1. elcojacobs's workaround:
    "args": {
      "BUILDKIT_INLINE_CACHE": "0"
    }

I didn't remove docker-buildx-plugin or downgrade Docker. Just restarted vscode after settings the two.
Still waiting for the fix from Docker.

@Oblynx
Copy link

Oblynx commented Feb 8, 2023

Spent a day with the same problem. My devcontainer builds a docker-compose stack, not a Dockerfile.

The solution for me was to do both actions mentioned by @Uguudei (just 1 was not enough). For reference if you're using docker-compose too, the BUILDKIT_INLINE_CACHE flag needs to be added in docker-compose.yml, not in devcontainer.yml.

@akhildevelops
Copy link

akhildevelops commented Feb 8, 2023

Easy workaround until the fix is live is to disable inline cache in devcontainer.json :

  "build": {
    "dockerfile": "Dockerfile",
    "cacheFrom": "brewblox/firmware-devcontainer:bullseye",
    "args": {
      "USERNAME": "vscode",
      "BUILDKIT_INLINE_CACHE": "0"
    }
  },

Omg! I was trying to debug this issue by manually running the docker buildx build ... still can't find the problem. The above snippet of devcontainer.json really helped to solve the issue temporarily.

@raucha
Copy link

raucha commented Feb 8, 2023

I faced the same problem and resolved by executing command docker buildx create.

docker buildx create --name container-builder --use

Docker v23 uses BuildKit to build container images as default, and uses docker-own fallback instanse if no buildkit instance created. I think the fallbak instance has some problems...

I used docker-compose for devcontainer so build args option in devcontainer.json didnt works,
but this solution works for me.

@SabriMahmoud
Copy link

@akhildevelops Yes same here, adding "BUILDKIT_INLINE_CACHE": "0" to args in the devcontainer.json solved the problem for me to this is the only error that I found printed in journalctl after starting the devcontainer
dockerd[83419]: panic: runtime error: invalid memory address or nil pointer dereference

@algodave
Copy link

algodave commented Feb 8, 2023

@Oblynx Where exactly in your docker-compose.yml did you set BUILDKIT_INLINE_CACHE? I set it here but didn't work:

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        BUILDKIT_INLINE_CACHE: 0

@Haimrich
Copy link

Haimrich commented Feb 9, 2023

@algodave For me it worked adding export DOCKER_BUILDKIT=0 to .bashrc and without changing docker-compose.yml:

echo 'export DOCKER_BUILDKIT=0' >> ~/.bashrc

Also, remove previous containers with docker container prune and restart vscode.

@Uguudei
Copy link

Uguudei commented Feb 10, 2023

It is fixed in Docker v23.0.1. Just update docker and it works fine.
new release: https://github.com/moby/moby/releases/tag/v23.0.1

@akhildevelops
Copy link

Ref: #7958 (comment)

Thanks upgrading to v23.0.1 worked.

@jehon
Copy link

jehon commented Feb 10, 2023

Seems that we could close this bug now?

@jaudiger
Copy link
Author

I guess we can, since the new version of Docker 23.0.1 has been released.

@Oblynx
Copy link

Oblynx commented Feb 15, 2023

@Oblynx Where exactly in your docker-compose.yml did you set BUILDKIT_INLINE_CACHE? I set it here but didn't work:

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        BUILDKIT_INLINE_CACHE: 0

@algodave I think you're missing quotes, YAML might be messing up the parameter type otherwise. Try with BUILDKIT_INLINE_CACHE: "0"

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers upstream Issue identified as 'upstream' component related (exists outside of VS Code Remote)
Projects
None yet
Development

No branches or pull requests