Pull a docker image from a registry using node
npm install docker-pull
var pull = require('docker-pull')
pull('ubuntu', function (err) {
console.log('was pulled?', !err)
})
var p = pull('ubuntu:14.04')
p.on('progress', function () {
console.log('pulled %d new layers and %d/%d bytes', p.layers, p.transferred, p.length)
})
p.on('end', function () {
console.log('pull is done')
})
Pull a docker image. Returns an EventEmitter
. Optionally you can specify the following options:
{
host: 'registry.example.com', // docker registry
version: 'v2', // defaults to 'v1.15'
username: 'user', // defaults to 'anon'
password: 'pwd', // defaults to ''
email: '[email protected]' // no default
}
Emitted for each data chunk.
Emitted when the operation has ended.
Emitted when an error happens during communication with the registry.
There is also a command line tool
npm install -g docker-pull
docker-pull ubuntu:14.04
MIT