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

`stream` config option changes `docker.cli.exec()` behavior

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

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, typescript
领域
api, cli

调研方向

Start at the docker.cli.exec() implementation and reproduce the two calls shown in the issue, comparing argument escaping with and without the stream option. Done means streaming stdio preserves the escaping used by the non-streaming call and returns the expected file contents without the Docker mount-argument error.

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

描述

bug

Describe the bug
In the docker.cli.exec() function, the third argument allows specifying options. Using a truthy object option for { stream: {} } changes how the args are escaped. This means I'm unable to escape paths for bind mounts when streaming stdio.

Steps to reproduce the behavior:

  1. Run a demo extension
  2. In frontend, use
const client = createDockerDesktopClient();
  1. Verify the following works:
client.docker.cli.exec('run', ['--mount', `type=bind,source="some-path-with-quotes",target=/file`, 'alpine:latest', 'sh', '-c', `"cat file"`]).then(console.log).catch(console.error)
  1. Try the same command with stream set
client.docker.cli.exec('run', ['--mount', `type=bind,source="some-path-with-quotes",target=/file`, 'alpine:latest', 'sh', '-c', `"cat file"`], {
  stream: {
    onError(e) {
      console.error(e)
    }
  }
})

Describe the expected behavior
Normally, the function will run and return file contents via output.stdout as you would expect. However, when you specify anything for stream, we see

invalid argument "type=bind,source=\"/Users/$USER/my-file.json\",target=/config.json" for "--mount" flag: parse error on line 1, column 18: bare " in non-quoted-field
See 'docker run --help'.

Optional: Add screenshots
If applicable, add screenshots to help explain your problem.

**Output of docker extension version:

Client Version: v0.2.27
Server API Version: 0.3.4

Output of docker version:

Client:
 Version:           27.5.1
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        9f9e405
 Built:             Wed Jan 22 13:37:19 2025
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.38.0 (181016)
 Engine:
  Version:          27.5.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.11
  Git commit:       4c9b3b0
  Built:            Wed Jan 22 13:41:25 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e946
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
主要语言
没有语言数据
星标
157
派生
56
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

docker/extensions-sdk 的其他 Issue

查看 docker/extensions-sdk 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

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