Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

devcontainer will not start: 'buildx' is not a docker command

未关闭
#508 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
docker, docker-compose, shell, vscode

调研方向

先从 Flatpak 覆盖设置和 settings.json 中的路径入手,然后复现报告的 docker buildx version 失败。检查 .devcontainer/docker-compose.yml 和已有文档说明的主机启动脚本。当 devcontainer 能够在 Flatpak 中成功启动,且没有报告的 buildx 错误或启动挂起时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

It would be good to improve the documentation and the default experience for using devcontainers. I've made progress, but it doesn't seem like I have a working setup yet.

I have done the following in the process of trying to make it work in the flatpak (which appear to all be necessary to have got to this point):

Exposed /run/docker.sock to the container with:

flatpak override --user --filesystem=/run/docker.sock com.visualstudio.code

Changed the paths to docker and docker-compose in my settings.json, i.e.:

    "dev.containers.dockerComposePath": "/run/host/usr/bin/docker-compose",
    "dev.containers.dockerPath": "/run/host/usr/bin/docker",

But the devcontainer will not start because it cannot find buildx:

[918 ms] @devcontainers/cli 0.56.2. Node.js v18.17.1. linux 6.8.1-arch1-1 x64.
[918 ms] Start: Run: /run/host/usr/bin/docker buildx version
[931 ms] 
[931 ms] docker: 'buildx' is not a docker command.
See 'docker --help'

[931 ms] Exit code 1

I've also tried adding a link from /usr/bin to docker-buildx (there was already one there for docker-compose).

If I open an integrated terminal, I can reproduce the failure with:

$ /run/host/bin/docker buildx version
docker: 'buildx' is not a docker command.
See 'docker --help'

And then I got it to work by creating scripts in /usr/local/bin that I point to in my settings.json:

    "dev.containers.dockerComposePath": "/run/host/usr/local/bin/in-flatpak-do-host-spawn_docker-compose",
    "dev.containers.dockerPath": "/run/host/usr/local/bin/in-flatpak-do-host-spawn_docker",

The file contents are as follows:
/usr/local/bin/in-flatpak-do-host-spawn_docker

#!/bin/bash

/app/bin/host-spawn docker "$@"

/usr/local/bin/in-flatpak-do-host-spawn_docker-compose

#!/bin/bash

/app/bin/host-spawn docker-compose "$@"

But then the devcontainer startup process seems to hang here:

[1650 ms] Start: Run: /run/host/usr/local/bin/in-flatpak-do-host-spawn_docker-compose --project-name 28th-ces_devcontainer -f /home/sean/Making/RoleModel/28th-ces/.devcontainer/docker-compose.yml -f /home/sean/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1710714627644.yml -f /home/sean/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.containerFeatures-1710714765504.yml up -d --no-recreate
[+] Running 3/3
 ✔ Container 28th-ces_devcontainer-app-1    Started                        0.0s 
 ✔ Container 28th-ces_devcontainer-db-1     Running                        0.0s 
 ✔ Container 28th-ces_devcontainer-cache-1  Running                        0.0s 
[1985 ms] Start: Run: /run/host/usr/local/bin/in-flatpak-do-host-spawn_docker ps -q -a --filter label=com.docker.compose.project=28th-ces_devcontainer --filter label=com.docker.compose.service=app
[2021 ms] Start: Run: /run/host/usr/local/bin/in-flatpak-do-host-spawn_docker inspect --type container ab765af91650
[2062 ms] Start: Inspecting container
[2062 ms] Start: Run: /run/host/usr/local/bin/in-flatpak-do-host-spawn_docker inspect --type container ab765af916503e0639de70401328005369601b9e56890d74a52c0a9fab5e9139
[2104 ms] Start: Run in container: /bin/sh
[2112 ms] Start: Run in container: uname -m
主要语言
Shell
星标
216
派生
82
平均合并
1 天 7 小时
30 天内合并 PR
1

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

flathub/com.visualstudio.code 的其他 Issue

查看 flathub/com.visualstudio.code 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。