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

Open
NoOneHardy opened this issue Aug 3, 2024 · 0 comments
Open

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

NoOneHardy opened this issue Aug 3, 2024 · 0 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)
})```
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

1 participant