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.attach writes attachOptions into container's stdin #777

Closed
NoOneHardy opened this issue Aug 3, 2024 · 4 comments
Closed

container.attach writes attachOptions into container's stdin #777

NoOneHardy opened this issue Aug 3, 2024 · 4 comments

Comments

@NoOneHardy
Copy link

When writing into container's stdin sometimes dockerode automatically writes attachOptions infront of the actual input.
Does anybody have the same issue and a possible solution?

Input

{"stream":true,"stdin":true,"stdout":true,"stderr":true,"hijack":true,"logs":false}say hello

Code

const container = docker.getContainer('720736bad7ecc2f1ced7364366a69e240d1a6ad5dea02f9a77f3c2b0bb7990ae')

container.attach({
  stream: true,
  stdin: true,
  stdout: true,
  stderr: true,
  hijack: true,
  logs: false
}, (_, stream) => {
  // Map output to console
  stream.pipe(process.stdout)

  const string = 'say hello\n'
  // Write data to the container's stdin
  stream.write(string)
})```
@Luluno01
Copy link

Hi! We are also having the same issue. Any updates in the past 4 months? Are you using a Mac by any chance?

@NoOneHardy
Copy link
Author

@Luluno01 No unfortunately not.
I ended up writing it myself from scratch with the Docker API

Are you trying to connect to a Minecraft Server in a docker container?
I think the problem only occurs in this specific case.

@NoOneHardy NoOneHardy reopened this Dec 25, 2024
@NoOneHardy NoOneHardy reopened this Dec 25, 2024
@NoOneHardy NoOneHardy closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2024
@Luluno01
Copy link

@Luluno01 No unfortunately not. I ended up writing it myself from scratch with the Docker API

Are you trying to connect to a Minecraft Server in a docker container? I think the problem only occurs in this specific case.

Thanks for the information. No, I'm just spinning up a container running a Node.js application and writing some inputs via stdin. I would not call my case as some "specific" case, though.

@Luluno01
Copy link

Hi, I find this problem might relate to docker version. Would you mind sharing your docker version? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants