简体   繁体   中英

Why are there differences in docker pull and docker build in IBM Container Service?

We're using the IBM Container Service on Bluemix and have discovered an oddity that we can't quite explain -- it seems that docker pull and docker build act differently with regard to authentication.

First, the obligatory version information:

$ docker -v
Docker version 1.7.0, build 0baf609
$ ice version
ICE CLI Version        : 3.0 598 2015-07-02T19:39:30
$ cf -v
cf version 6.12.1-56792aa-2015-07-06T22:48:00+00:00

This is a brand new Ubuntu VM with only docker, ice (and it's prereqs) and the cf tools installed on it. I built a simple little Node example to show the problem. Just create this app.js and Dockerfile and put them in a directory somewhere (I used Dev/node-hello) then cd to the directory.

app.js

var http = require('http');
var appport = 9085;
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(appport);
console.log("Server running at port");
console.log(appport);

Dockerfile

# sample dockerfile for demonstration
FROM registry.ng.bluemix.net/ibmnode:latest
RUN apt-get -y update
ADD app.js /app.js
EXPOSE 9085
CMD  ["node", "app.js"]

Now, after doing a ice login, which logs you into the cf tools as well, try the following:

sudo docker build -t <your_namespace>/node-hello

The docker build will die with the last line being:

Authentication is required.

That's not very helpful, so if you restart the docker daemon in debug mode using:

sudo /usr/bin/docker -d -D &

And then rerun the build, you'll find that docker had encountered some errors prior to putting out the authentication error:

DEBU[2494] Error unmarshalling the _ping RegistryInfo: invalid character 'U' after top-level value

Which may be related or may be a red herring.

Now, the odd part is that if you then do a:

sudo docker pull registry.ng.bluemix.net/ibmnode

It will pull the image locally without a problem, and then if you issue your docker build command again, it will run fine! Are we just using docker build incorrectly somehow (I don't think so...this always worked before...) or is there an odd difference between the way pulls and builds are managed?

This appears to be due to a known bug in Docker. It looks like they have issued a fix in 1.7.1.

Can you upgrade your client and try again?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM