issue closedapocas/dockerode
Running the example createContainer function
Hi,
I am using your API with Node.JS and I tried following the createContainer example:
// Trialling both dockerode-promise-wrapper and dockerode
const DockerCallback = require('dockerode');
const dockerOrigin = new DockerCallback();
dockerOrigin.createContainer({Image: 'ubuntu', Cmd: ['/bin/bash'], name: 'ubuntu-test'}, function (err, container) {
console.error(err);
console.log(container);
});
But I get the following error:
Error: (HTTP code 404) no such container - No such image: ubuntu:latest
at <project_dir>/node_modules/docker-modem/lib/modem.js:296:17
at getCause (<project_dir>/node_modules/docker-modem/lib/modem.js:326:7)
at Modem.buildPayload (<project_dir>/node_modules/docker-modem/lib/modem.js:295:5)
at IncomingMessage.<anonymous> (<project_dir>/node_modules/docker-modem/lib/modem.js:270:14)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
reason: 'no such container',
statusCode: 404,
json: { message: 'No such image: ubuntu:latest' }
}
Docker Version:
Client: Docker Engine - Community
Version: 19.03.4
API version: 1.40
Go version: go1.12.10
Git commit: 9013bf5
Built: Thu Oct 17 23:44:48 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.4
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: 9013bf5
Built: Thu Oct 17 23:50:38 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
Node Version: v12.8.0 NPM Version: 6.13.0
And then I am using macOS Mojave, Version 10.14.5
Thanks, Danny
closed time in 6 days
dannysmc95issue commentapocas/dockerode
Running the example createContainer function
Do you have the ubuntu image?
Pull the image before running that code: docker pull ubuntu
comment created time in 6 days
pull request commentapocas/docker-modem
Published in v2.0.4
comment created time in 10 days
push eventapocas/docker-modem
commit sha 419cd89ff7ea04289c132503bf4d429da13adbd4
version bump
push time in 10 days
pull request commentapocas/docker-modem
Going to publish it today.
On Fri, 1 Nov 2019 at 14:33, Brandon Waterloo [MSFT] < [email protected]> wrote:
@apocas https://github.com/apocas We're getting close to releasing our next extension version of vscode-docker, probably soon after VSCode 1.40 is out. Can you release the next version of docker-modem?
Thanks in advance, I really appreciate it!
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/apocas/docker-modem/pull/109?email_source=notifications&email_token=AAER3JLFJS7XTJDIJLCSZXDQRQ44VA5CNFSM4JB6YQGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC3C4AI#issuecomment-548810241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAER3JJFAFGHNHUIUOSPN4DQRQ44VANCNFSM4JB6YQGA .
-- Pedro Dias
comment created time in 11 days
issue commentapocas/dockerode
CreateContainer does not return container id.
There must be an error, how did you tried to catch the error? You need to catch it on the start.
comment created time in 19 days
issue commentapocas/dockerode
CreateContainer does not return container id.
You please print and check the start error? If no container id was returned, promise was rejected and there will an error.
comment created time in 20 days
issue commentapocas/dockerode
buildImage() stream silently fails when build context is too large
Is it only happening on v3.x?
Could be related to this: https://github.com/apocas/dockerode/pull/490
comment created time in 20 days
issue commentapocas/dockerode
buildImage() stream silently fails when build context is too large
Could you give more details about this? How so "too large"? Larger than what?
comment created time in 20 days
push eventapocas/docker-modem
commit sha 42939293aa42c6a7baaede30a667da65d68b0990
Merge pull request #2 from apocas/master Merge from apocas/docker-modem
commit sha d2f92b22cf284d537a57cc255ba11b4c4c5d7b61
Fix issue due to vscode-docker's usage of docker-modem
commit sha 3e3bb249d8e247af4c9aafba25c015d7488688f6
Merge pull request #109 from bwateratmsft/master Cache SSH auth agent
push time in a month
pull request commentapocas/docker-modem
Yeah, I completely missed that too. 👍
comment created time in a month
push eventapocas/docker-modem
commit sha 7f4d6aebe4c1df751b3e41ada24574c4cf915a6c
dockerode tests
push time in a month
push eventapocas/docker-modem
commit sha d19cd753950318ac065a9841f6089dc13a5a0b75
version bump
push time in a month
push eventapocas/docker-modem
commit sha 927b11f61bd86c16e54eb6ce3d4cb1190ba43c69
Merge pull request #1 from apocas/master Pull the latest from apocas/docker-modem
commit sha 05f4319aa070c74b967b3ad2342e4d2243980cbf
Support user from ssh://user@host, and agent from env
commit sha 3fb0bb59ead2f1d5343567a3cf31e091a8f88fc6
Fix bug
commit sha f3836543f808a015e073a1cb355698b9248425b0
Merge pull request #108 from bwateratmsft/master Accept username and agent for SSH
push time in a month
PR merged apocas/docker-modem
Resolves #107
- Allow SSH
DOCKER_HOSTURLs - Accept username in
DOCKER_HOST, i.e.ssh://user@host - Use
SSH_AUTH_SOCKenv var to determine auth agent (Docker CLI also requiresssh-agentto be set up)
pr closed time in a month
issue closedapocas/docker-modem
User is ignored in an SSH DOCKER_HOST
Due to a combination of defaultOpts (https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L16) and this line, any value passed in as the user in DOCKER_HOST would be ignored. I believe the behavior would be that the current user is used. There's a high chance that won't work, however--if the local username is not the same as the SSH username.
Ideally we should alter defaultOpts to permit things like ssh://user@host
closed time in a month
bwateratmsftpull request commentapocas/docker-modem
Accept username and agent for SSH
👍
comment created time in a month
issue commentapocas/docker-modem
User is ignored in an SSH DOCKER_HOST
You should be able to pass an "agent" to the Modem. https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L81
I simplified it, by using the already existing "host" and "port" from Modem's constructor. https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L72
comment created time in a month
push eventptisp/api-documentation
commit sha 5bb8f4bdb553472be6db81bfd1442e92246e07af
domain register - 4 nameservers
commit sha 588bafe7922a450658ee78334311e153b6891780
Merge pull request #2 from ptisp/joaograca domain register - 4 nameservers
push time in a month
push eventptisp/api-documentation
commit sha 0e84c6bcd115d73f3b5e6c14f46dd5cfaf5fbfbb
DNSSEC new endpoints
commit sha 1bba13ceca766ac9bc0b32c47cdae921c996d30b
Merge pull request #1 from ptisp/joaograca DNSSEC new endpoints
push time in a month
issue commentapocas/docker-modem
arrays within query parameters
But we can't just remove this condition because the are endpoints expecting the data "stringifed". Like https://github.com/apocas/dockerode/blob/master/test/docker.js#L658
On the other hand there are parameters that are expected by Docker to be repeated like "t" in imageBuild. https://docs.docker.com/engine/api/v1.40/#operation/ImageBuild "A name and optional tag to apply to the image in the name:tag format. If you omit the tag the default latest value is assumed. You can provide several t parameters."
If "extrahosts" is one of this cases we can add it to the exception list, like "t".
comment created time in a month
issue closedapocas/dockerode
Not honoring the Docker Desktop context for WSL 2
I'm on Windows 10 (18950) running WSL 2 with the Docker Desktop WSL 2 Technical Preview. The TP separates the Windows and WSL contexts to prevent destructive operations and Dockerode only accesses the Windows context. For example, on Windows, with WSL 2 enabled I see this (notice that wsl is active)

Running $ docker ps and $ docker images shows containers and images that are currently running within the WSL 2 context while Dockerode continues to use the default context and shows containers and images in the Windows context.
Is there a way to specify the context or use whatever is active in Docker Desktop?
closed time in a month
fiveisprimeissue commentapocas/dockerode
Not honoring the Docker Desktop context for WSL 2
https://github.com/apocas/docker-modem/pull/106
comment created time in a month
PR merged apocas/dockerode
Thanks for this!
Just noticed a small typo. Here is a pr fixing that
pr closed time in a month
push eventapocas/dockerode
commit sha b5aea3de6856896c71728529c984f9929edf47ab
Fix typo in comment
commit sha 005830dd2ab54d37b5024196d947f31d7bc6671a
Merge pull request #537 from eiriksm/patch-1 Fix typo in comment
push time in a month
issue commentapocas/docker-modem
arrays within query parameters
Passes: https://github.com/apocas/dockerode/blob/master/test/docker.js#L648 Fails: https://github.com/apocas/dockerode/blob/master/test/docker.js#L658
So we can't just remove the stringify. Add that parameter as an exception?
comment created time in a month
issue commentapocas/docker-modem
arrays within query parameters
Missed that. Can't remember why that was done. I suspect that endpoints didn't behave the same way, regarding input.
Will check if removing the stringify doesn't break anything.
comment created time in a month
push eventapocas/dockerode
commit sha b2b3ab67ce04a634188e130690e9a01fc2fa8ad2
ubuntu test image
push time in a month
push eventapocas/dockerode
commit sha 05e15d015a91c4bb9a3e489cc811dc860630161c
package-lock.json
push time in a month
pull request commentapocas/docker-modem
Support npipe:// in DOCKER_HOST
Just published docker-modem v2.0.2. It's available now, just update dockerode dependencies via npm :)
comment created time in a month
push eventapocas/docker-modem
commit sha 2a3899a7a2223d54f61dcc3221e16e0e7386be6a
Version bump
commit sha d75a96a02b6c6f1a1ac88bfc4f2b82a1f02c2dfd
Merge branch 'master' of https://github.com/apocas/docker-modem
push time in a month
push eventapocas/docker-modem
commit sha b851133fb18c2e413d3d9de5589c33a5930110ba
Support npipe:// in DOCKER_HOST In Windows, `DOCKER_HOST` can contain things like `npipe:////./pipe/docker_engine` or `npipe:////./pipe/docker_wsl`. Currently it isn't possible to use `DOCKER_HOST` = `npipe:////./pipe/docker_wsl` to use the WSL2 Docker engine; rather, you must pass in `socketPath` to dockerode. If you try using the above for `DOCKER_HOST` you'll get an error.
commit sha 70bbfccac011b428b9fc5eb7d0b378e6ece7bb0f
Merge pull request #106 from bwateratmsft/patch-1 Support npipe:// in DOCKER_HOST
push time in a month
PR merged apocas/docker-modem
In Windows, DOCKER_HOST can contain things like npipe:////./pipe/docker_engine or npipe:////./pipe/docker_wsl.
Currently it isn't possible to use DOCKER_HOST = npipe:////./pipe/docker_wsl to use the WSL2 Docker engine; rather, you must pass in socketPath to dockerode. If you try using the above for DOCKER_HOST you'll get an error.
pr closed time in a month
pull request commentapocas/docker-modem
Support npipe:// in DOCKER_HOST
👍 Will publish it tonight.
comment created time in a month
issue commentapocas/docker-modem
arrays within query parameters
I can't replicated this, there's even a test for this.
https://github.com/apocas/docker-modem/blob/master/test/modem_test.js#L109
´´´ var opts = { "limit": 12, "filters": { "label": ["staging", "env=green"] }, "t": ["repo:latest", "repo:1.0.0"] }; ´´´ limit=12&filters={"label":["staging","env=green"]}&t=repo:latest&t=repo:1.0.0
The array "t" was properly converted.
comment created time in a month
issue closedapocas/docker-modem
The regex parsing the DOCKER_HOST URI does not support IPv6 IP addresses: https://github.com/apocas/docker-modem/blob/99fcf0d10521f974dbe335a47a09ecf30ca6c1a2/lib/modem.js#L28
E.g., 'tcp://[::1]:12345' would split at the second colon instead of the last. You could use Node.js' 'url' module instead of a regex.
closed time in a month
chrmartipush eventapocas/docker-modem
commit sha 7f0f0af8bf8bfb59c450e724070a586dfcd8d575
version bump
push time in a month
created tagapocas/dockerode
Docker + Node = Dockerode (Node.js module for Docker's Remote API)
created time in a month
push eventapocas/dockerode
commit sha 6f24ecd8d7107d2614b9149705c186958f2972d4
min noder version
push time in a month
push eventapocas/docker-modem
commit sha aad7d9b808045740921e7040a978e06364ba36ee
require for node v8
push time in a month
issue commentapocas/docker-modem
Just pushed a fix to master. Will publish it later tonight :)
Node.js's url module doesn't handle strings without a protocol specified. (which is used in a few use cases in Docker) When a protocol isn't specified, docker-modem defaults to tcp:// then it used Node.js URL.
comment created time in a month
push eventapocas/docker-modem
commit sha a161b7acbc3bbaa52236fd1b7864508523d7a4c1
https://github.com/apocas/docker-modem/issues/105 https://github.com/apocas/docker-modem/issues/105
push time in a month
issue commentmicrosoft/vscode-remote-release
VSCode Freezes During Dev Containers Initialization with Docker Desktop WSL 2 Tech Preview
Hi guys, dockerode developer here.
@Chuxel Do you want to contribute your hack to docker-modem? :)
https://github.com/Chuxel/docker-modem/commit/47e7a97a53b4a915e9a01d01e83421a0074b1e59
comment created time in 2 months
issue closedapocas/dockerode
putArchive processing tar file(exit status 1): unexpected EOF
have an issue when trying to copy a file from my node server which is created from a string using 'fs' in a tmp dir but keep getting the same error.
Error processing tar file(exit status 1): unexpected EOF 0, json: null } [Node] at \node_modules\docker-modem\lib\modem.js:257:17
here is the code im using to create the docker container and then create and copy the file into the container.
fs.writeFile('./tmp/attempt.java', code, (async (err) => { console.log(err); if (err) { return } let container = await docker.createContainer({ Image: 'openjdk', Tty: true, StdinOnce: true }); await container.start(); try { await container.putArchive('./tmp/attempt.java', { path: '/' }); } catch (error) { console.log(error); } }));
closed time in 2 months
andydean565issue commentapocas/dockerode
putArchive processing tar file(exit status 1): unexpected EOF
Docker's putArchive expects a .tar file :)
https://docs.docker.com/engine/api/v1.40/#operation/PutContainerArchive
"The input stream must be a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz."
comment created time in 2 months
issue closedapocas/dockerode
equivalent of 'docker stats' in dockerode?
Title says it all I think... couldn't find anything about it in the docs. Thanks
closed time in 2 months
jhiverissue closedapocas/dockerode
Snyk says dockerode has a vulnerability
See https://snyk.io/test/github/apocas/dockerode
The vulnerability: https://snyk.io/vuln/npm:chownr:20180731
closed time in 2 months
nt1missue commentapocas/dockerode
Snyk says dockerode has a vulnerability
Nothing being reported on snyk atm.
comment created time in 2 months
issue closedapocas/docker-modem
Docker image pulls fail on Windows due to bad Content-Type/Length
Problem
This is the same as the issue here, on a pull the docker daemon responds to with an error: context cancelled. The issues seems to be a couple of things:
- the
Content-Lengthis calculated using adatapayload that is never sent in the request. Perhaps the query string should be used https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L167 ? undefinedoptsare passed in as'undefined'strings, eg:tag, leading to empty query params- the
Content-Typeis set asapplication/jsonthough no json payload is sent, maybeapplication/x-www-form-urlencodedortext/plain?
Here is an example failing request options, changing the type to text/plain or removing the Content-length fixes the issue.
{ path: '/images/create?fromImage=coinstac%2Fcoinstac-base&tag=',
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Content-Length': 38 },
key: undefined,
cert: undefined,
ca: undefined,
socketPath: '//./pipe/docker_engine' }
closed time in 2 months
rsskissue commentapocas/docker-modem
Docker image pulls fail on Windows due to bad Content-Type/Length
Will close this one for now. Will reopen if more info is provided.
comment created time in 2 months
issue commentapocas/docker-modem
arrays within query parameters
Interesting, will check this one.
comment created time in 2 months
issue commentapocas/docker-modem
stream is null during docker pull and not handled
Could you give more details? Can't replicate this.
comment created time in 2 months
issue commentapocas/docker-modem
Query string parameters are only added if the URL contains a '?'
This comes from way back. At the time the Docker API was very young. There were endpoints sending/posting data in very different ways and different signatures everywhere. Question mark was used in order to easily identify which ones used query string :)
comment created time in 2 months
created tagapocas/dockerode
Docker + Node = Dockerode (Node.js module for Docker's Remote API)
created time in 2 months
push eventapocas/dockerode
commit sha 57ec21c35a4533e004becb71054f0a88f8272317
version dump - docker-modem
push time in 2 months
push eventapocas/docker-modem
commit sha 99fcf0d10521f974dbe335a47a09ecf30ca6c1a2
Convert new Buffer()
push time in 2 months
push eventapocas/docker-modem
commit sha 816da19d86055acdf450db9604f87d70666e27e0
Demux now works using `.on('data')` which prevents read from being called while the stream is in `flowing` mode which can cause the internal buffer to already be drained while trying to read.
commit sha 9bc4d3c31a6b5d5350183680d2f64de8e60fc170
Fixed bug in processing of buffers where we weren't recursively checking to see if there is a new chunk to process.
commit sha 0353288f810e64dd88a6a7fc1ce4c07c865f655b
Added check to handle when there is no data.
commit sha e2d16d647838745476964fcb9c3048d331434be1
Merge pull request #60 from Myztiq/demux-fix Converted demux to work on.('data')
push time in 2 months
PR merged apocas/docker-modem
Demux now works using .on('data') which prevents read from being called while the stream is in flowing mode which can cause the internal buffer to already be drained while trying to read. This implementation borrows heavily from https://github.com/Nathan219/docker-stream-cleanser but is reduced to try to match this use-case as much as possible.
https://nodejs.org/api/stream.html#stream_readable_read_size
This method should only be called in paused mode. In flowing mode, this method is called automatically until the internal buffer is drained.
pr closed time in 2 months
created tagapocas/dockerode
Docker + Node = Dockerode (Node.js module for Docker's Remote API)
created time in 2 months
PR closed apocas/dockerode
- gets the json for a given image
pr closed time in 2 months
pull request commentapocas/dockerode
feat(image): get json of image
Revisiting this one. Hummm this will make the "Image" object behave in a non-standard way, because then some functions may refer to a different image.
Let's keep this under the radar for now and check if it affects more people.
For now you could also specify the image name string with whatever you want (containing the version) this every function refers to the same image.
comment created time in 2 months
pull request commentapocas/docker-modem
Introduce a Connection Timeout for connecting to Docker
👍
comment created time in 2 months
issue closedapocas/docker-modem
At the moment if Docker connection fails then the modem can hang requests. However when using timeout combine with Attach then the two seem to conflict. Having set my timeout to 1000, it will also still the on-going attach connection even if it has successfully connected.
The node.js documentation says: "Sets the socket to timeout after timeout milliseconds of inactivity on the socket" where as I want the timeout to be on the initial connection.
Proposed Solution: On Connect / Data / Error we clear the timeout.
Debug log: modem Sending: { path: '/containers/create?Image=', method: 'POST', port: '2376' } +0ms modem Received: {"Id":"a54e6dc2a17dd84493bf1a9335e499bb80a659be990d268cf2e9185cd99db28f","Warnings":null} +154ms modem Sending: { path: '/containers/a54e6dc2a17dd84493bf1a9335e499bb80a659be990d268cf2e9185cd99db28f/attach?stream=true&stdin=true&stdout=true&stderr=true', method: 'POST', port: '2376' } +3ms modem Sending: { path: '/containers/a54e6dc2a17dd84493bf1a9335e499bb80a659be990d268cf2e9185cd99db28f/start', port: '2376' } +29ms modem Received: +199ms modem Sending: { path: '/containers/a54e6dc2a17dd84493bf1a9335e499bb80a659be990d268cf2e9185cd99db28f/resize?w=100&h=25', method: 'POST', port: '2376' } +2ms modem Sending: { path: '/containers/a54e6dc2a17dd84493bf1a9335e499bb80a659be990d268cf2e9185cd99db28f/resize?w=118&h=25', method: 'POST', port: '2376' } +5ms modem Received: +47ms modem Received: +15ms modem Timeout of 1000 ms exceeded +971ms
closed time in 2 months
BenHallpush eventapocas/docker-modem
commit sha 513d8a19d6a00ed1a6fa038f828798ba3cc79de0
Introduce a Connection Timeout for connecting to Docker
commit sha 36b35223477c85e60fa779bff75c93c930d670fb
Merge branch 'connection-timeout' of https://github.com/BenHall/docker-modem into BenHall-connection-timeout
commit sha bbef4cafca03fd7a85b7a312d6e5cbc5f0f7bbc5
Merge branch 'BenHall-connection-timeout'
push time in 2 months
pull request commentapocas/dockerode
Fix for Issue#442. allow empty body for container start to avoid docker error
Couldn't replicate this. Will reopen if an example is provided.
comment created time in 2 months
push eventapocas/dockerode
commit sha 7a5aefcf021dfb6293ae8893bf6ca11e31ac8885
Test for https://github.com/apocas/dockerode/pull/490
push time in 2 months
push eventapocas/dockerode
commit sha 4c921ffe911068cc405fe46ebfbc2471a96940e9
handle stream errors
commit sha ad4c54f567642941ca9d6f08dee5da599b1e5700
Merge pull request #490 from neophob/handle-strem-error-event handle stream errors
push time in 2 months
issue closedapocas/dockerode
docker.buildImage(imageContent, imageOptions) - uncaught exception if Dockerfile does not exists
I use this code the create a new Docker image:
const imageOptions = { t: 'imagename' };
const imageContent = {
context: '/path/to/docker/content',
src: ['Dockerfile'],
};
return dockerode.buildImage(imageContent, imageOptions)
I use the promise style calls and catch this call in case of an error. So I was testing my code when the needed files are missing and boom - I got this error (catched by the global uncaught exception handler):
UNCAUGHT_EXCEPTION {"error":"ENOENT: no such file or directory, lstat '/path/to/docker/content/Dockerfile'","stack":"Error: ENOENT: no such file or directory, lstat '/path/to/docker/content/Dockerfile'"}
It looks like dockerode does not handle the stream error when using tar-fs:
pack = tar.pack(file.context, {
entries: file.src
});
//next lines are missing
pack.on('error', function(error) {
//handle error
});
closed time in 2 months
neophobissue commentapocas/node-whmcs
Sure, I can even make you contributor :)
comment created time in 2 months
push eventapocas/node-whmcs
commit sha e162a6253627bf852ae88a9ba987990bdb140bda
readme update
push time in 2 months
push eventapocas/node-whmcs
commit sha 96003da1a543dd1e748386e198b8990fe7bb4f1b
packages bump
push time in 2 months
push eventapocas/node-whmcs
commit sha 7abc7e210c4ac408fbec8b584ac1eac6728c8d0d
Support licenseapi
push time in 2 months
push eventapocas/node-whmcs
commit sha 1cb99cba30102795474f1c77c556e36a00e78cf1
Update utils.js changed result.licenseapi to result.whmcsapi
commit sha fcdbd87cafb6dbabb89e5ec1e8145bdf0faa16ce
Merge pull request #28 from maddog986/patch-1 Update utils.js
push time in 2 months
PR merged apocas/node-whmcs
changed result.licenseapi to result.whmcsapi
pr closed time in 2 months
pull request commentapocas/node-whmcs
👍 Will a small tweak to this fix, in order to also support the licenses API. Will ping when published.
comment created time in 2 months