stream
config option changes docker.cli.exec()
behavior #303
Open
Description
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:
- Run a demo extension
- In frontend, use
const client = createDockerDesktopClient();
- 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)
- 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