AgustinCB / docker-api

Docker Remote API driver for node.js. It uses the same modem than dockerode, but the interface is promisified and with a fancier syntax.
GNU General Public License v3.0
306 stars 50 forks source link

Each line in the logs begins with garbled characters. #86

Open isaced opened 8 months ago

isaced commented 8 months ago

I don't know why, but there are always a few garbled characters at the beginning of each line in the output log.

Here is my code:

// init
var docker = new Docker({ socketPath: "/var/run/docker.sock" });

// create container
const container = await docker.container.create({ Image: "hello-world" })

// start container
await container.start();

// logs
const logStream = (await container.logs({ follow: true, stdout: true, stderr: true })) as Stream;
logStream.on('data', (info) => {
    console.log(info.toString('utf-8'))
})

Output:

Hello from Docker!
KThis message shows that your installation appears to be working correctly.

;To generate this message, Docker took the following steps:
3 1. The Docker client contacted the Docker daemon.
J 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
M 3. The Docker daemon created a new container from that image which runs the
C    executable that produces the output you are currently reading.
O 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

GTo try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

BShare images, automate workflows, and more with a free Docker ID:
ttps://cloud.docker.com/

$For more examples and ideas, visit:
+ https://docs.docker.com/engine/userguide/