Search code examples
dockerwebsocketdocker-apixtermjs

Docker xterm.js attach


I'm trying to build a simple in-browser shell using Docker and xterm.js. I've correctly hooked up the frontend using xterm.js's attach addon.

How does one connect to Docker via websockets?


Solution

  • If you are using a Docker API >= 1.28, you cannot connect straight to it with xterm.js, since Docker changed their WebSocket protocol from text to binary 😞.

    There is an open xterm.js issue for that: https://github.com/xtermjs/xterm.js/issues/883.