docker-api icon indicating copy to clipboard operation
docker-api copied to clipboard

Each line in the logs begins with garbled characters.

Open isaced opened this issue 1 year ago • 0 comments

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/

isaced avatar Feb 13 '24 17:02 isaced