Open benoitf opened 1 year ago
That can be a real problem when trying to work with images that expect some meaningful input in stdin.
We've implemented workaround using proxy object:
container.modem = new Proxy(container.modem, {
get(target, prop) {
const origMethod = target[prop];
if (prop === "dial") {
return function (...args) {
if (args[0].path.endsWith("/attach?")) {
// make request body empty
args[0].file = new Buffer("")
}
return origMethod.apply(target, args)
}
} else {
return origMethod
}
}
})
Hello,
When trying to use dockerode with podman engine, I noticed that I received echo of queries when using attach on a container.
Reading https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerAttach we can see that parameters like stdin, stdout, stream, etc are all query parameters like
/v1.43/containers/{id}/attach?stdin=...&stdout=...
but dockerode also send the options as a JSON payload{"stream": true, "stdin":true, "stdout":true}
the API don't mention a payload so for attach API, dockerode shouldn't send any body on the REST API call.