-
-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot pull image on windows #347
Comments
Same problem here using dockerode 2.4.3 and docker 17.04.0-ce-rc2 |
+1 |
Same issue |
Same issue. Same config as @pashist |
I'm still baffled with this. I'm not sure if it's an issue from dockerode or docker-modem or Docker itself. If I try again and again, sometimes images will pull successfully. But most of the time (9 times out of 10) it fails with context canceled. I also tried without using modem.followProgress and the error still happens. |
This also happens in "node-docker-api" npm package that uses docker-modem, so i think this issue is a docker-modem issue. |
I was playing around with the modem.js to see why the pull function from dockerode was giving me a 'Error: context canceled' message. I got the pull to work with various images by commenting out req.end() on line 238. The typeof data === "string" was evaluating to true for the if-statement req.end() was in. Not sure what repercussions this will have, but hope it gives the contributors an idea where to start to fix this correctly. |
Tried commenting out req.end() as suggested by @xblackhand but it broke other functionality like listing images & containers (timeout). BTW on docker-modem v1.0.0, the line # is 234 and not 238. BTW the context canceled error can be seen in Docker's logs:
|
Maybe this is related to this docker-modem issue (Requests that return HttpDuplex (eg docker exec start) hang when using named pipe on windows.)? |
Any update on this? |
Not 100% sure, but I think the issue might be that you actually have to wait for the response output from HTTP request to finish before you can consider the image to have been fully pulled. I have a Docker client library that I autogenerate from the Docker swagger API here and ran into the same issue: I was assuming the moment I got a response from the server I was good to go, whereas in fact I need to consume the output stream and only once that is done can I consider the image pulled. |
+1 |
1 similar comment
+1 |
This was plaguing our Windows builds so I dug a bit, the results can be found here as it's an issue w/ docker-modem. Super interesting the Docker daemon seems to respond differently on win vs osx, but I assume that's due to HyperV differences? Either way, if you're hurting for a solution you can just do pulls with plain ol' node const http = require('http');
const options = {
socketPath: '//./pipe/docker_engine',
path: '/v1.37/images/create?fromImage=coinstac%2Fcoinstac-base',
method: 'POST',
};
const callback = res => {
console.log(`STATUS: ${res.statusCode}`);
res.setEncoding('utf8');
res.on('data', data => console.log(data));
res.on('error', data => console.error(data));
};
const clientRequest = http.request(options, callback);
clientRequest.end(); Hope that helps! |
Here the great workaround described by @rssk using basic authentication and private registry: var clientRequest = http.request({
socketPath: '//./pipe/docker_engine',
path: '/images/create?fromImage=' + REGISTRY_HOST + '%2F' + IMAGE_NAME + '&tag=' + IMAGE_TAG,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Registry-Auth': new Buffer(JSON.stringify({ username: REGISTRY_USERNAME, password: REGISTRY_PASSOWRD, serveraddress: REGISTRY_HOST})).toString('base64')
}
}, (res) => {
res.setEncoding('utf8');
res.on('data', data => console.log(data));
res.on('error', data => console.error(data));
});
clientRequest.end(); |
Is this still an issue? I'm able to run the image pull test on Windows. Using Windows 10 and latest Docker version. |
I believe it may have been resolved. I was also experiencing this error previously, but with everything at the latest version it now works. |
@apocas still an issue for me. |
Can confirm this issue with Docker Version 2.0.0.0-win81 (29211) (Engine 18.09.0) too |
* 📦 NEW: add unit test for config utils * 👌 IMPROVE: config-util test cases * 👌 IMPROVE: add seperate error types for empty array and empty file * 📦 NEW: add test cases for settings * 👌 IMPROVE: change operation class to abstract class and implement all operations * 📦 NEW: add test cases for common list methods * 👌 IMPROVE: add npm test for ci * 📦 NEW: add github action for testing * 🐛 FIX: pull test image before running list test cases * 🐛 FIX: run suiteSetup via dockerode image pull callback * 🐛 FIX: change nginx:alpine to nginx:latest to support windows * 🐛 FIX: remove macos from github runner os as docker support is missing * 🐛 FIX: change nginx:alpine to m4rcu5/lighttpd to support windows * 👌 IMPROVE: remove windows from test cases run due to apocas/dockerode#347
Closing this one, reopen if needed. |
This snippet:
always rejects on windows with "context canceled" as error message. The Docker logs show something like this:
Normal
docker pull imagename
works inside powershellLatest Docker for Windows.
It might be a problem with Docker for Windows itself, but any help would be really appreciated. Same snippet works correctly on mac and linux
The text was updated successfully, but these errors were encountered: