Open twodayslate opened 4 years ago
For example if I run
'use strict'; const {Docker} = require('node-docker-api'); const promisifyStream = stream => new Promise((resolve, reject) => { stream.on('data', data => console.log(data.toString())) stream.on('end', resolve) stream.on('error', reject) }); const docker = new Docker({ socketPath: '/var/run/docker.sock' }); let _container; docker.container.create({ Image: 'ubuntu', Cmd: [ '/bin/bash', '-c', 'tail -f /var/log/dmesg' ], name: 'test' }) .then(container => container.start()) .then(container => { _container = container return container.exec.create({ AttachStdout: true, AttachStderr: true, Cmd: [ 'echo', 'test' ] }) }) .then(exec => { return exec.start({ Detach: false }) }) .then(stream => promisifyStream(stream)) .then(() => _container.kill()) .catch(error => console.log(error));
I get the following:
% uname -a Darwin ME 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64 % node --version v12.8.0 % node test.js )cannot exec in a stopped state: unknown
the same
For example if I run
I get the following: