",
- options: {
- disabled: false,
-
- // callbacks
- create: null
- },
- _createWidget: function( options, element ) {
- element = $( element || this.defaultElement || this )[ 0 ];
- this.element = $( element );
- this.uuid = widget_uuid++;
- this.eventNamespace = "." + this.widgetName + this.uuid;
-
- this.bindings = $();
- this.hoverable = $();
- this.focusable = $();
-
- if ( element !== this ) {
- $.data( element, this.widgetFullName, this );
- this._on( true, this.element, {
- remove: function( event ) {
- if ( event.target === element ) {
- this.destroy();
- }
- }
- });
- this.document = $( element.style ?
- // element within the document
- element.ownerDocument :
- // element is window or document
- element.document || element );
- this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
- }
-
- this.options = $.widget.extend( {},
- this.options,
- this._getCreateOptions(),
- options );
-
- this._create();
- this._trigger( "create", null, this._getCreateEventData() );
- this._init();
- },
- _getCreateOptions: $.noop,
- _getCreateEventData: $.noop,
- _create: $.noop,
- _init: $.noop,
-
- destroy: function() {
- this._destroy();
- // we can probably remove the unbind calls in 2.0
- // all event bindings should go through this._on()
- this.element
- .unbind( this.eventNamespace )
- .removeData( this.widgetFullName )
- // support: jquery <1.6.3
- // http://bugs.jquery.com/ticket/9413
- .removeData( $.camelCase( this.widgetFullName ) );
- this.widget()
- .unbind( this.eventNamespace )
- .removeAttr( "aria-disabled" )
- .removeClass(
- this.widgetFullName + "-disabled " +
- "ui-state-disabled" );
-
- // clean up events and states
- this.bindings.unbind( this.eventNamespace );
- this.hoverable.removeClass( "ui-state-hover" );
- this.focusable.removeClass( "ui-state-focus" );
- },
- _destroy: $.noop,
-
- widget: function() {
- return this.element;
- },
-
- option: function( key, value ) {
- var options = key,
- parts,
- curOption,
- i;
-
- if ( arguments.length === 0 ) {
- // don't return a reference to the internal hash
- return $.widget.extend( {}, this.options );
- }
-
- if ( typeof key === "string" ) {
- // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
- options = {};
- parts = key.split( "." );
- key = parts.shift();
- if ( parts.length ) {
- curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
- for ( i = 0; i < parts.length - 1; i++ ) {
- curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
- curOption = curOption[ parts[ i ] ];
- }
- key = parts.pop();
- if ( arguments.length === 1 ) {
- return curOption[ key ] === undefined ? null : curOption[ key ];
- }
- curOption[ key ] = value;
- } else {
- if ( arguments.length === 1 ) {
- return this.options[ key ] === undefined ? null : this.options[ key ];
- }
- options[ key ] = value;
- }
- }
-
- this._setOptions( options );
-
- return this;
- },
- _setOptions: function( options ) {
- var key;
-
- for ( key in options ) {
- this._setOption( key, options[ key ] );
- }
-
- return this;
- },
- _setOption: function( key, value ) {
- this.options[ key ] = value;
-
- if ( key === "disabled" ) {
- this.widget()
- .toggleClass( this.widgetFullName + "-disabled", !!value );
-
- // If the widget is becoming disabled, then nothing is interactive
- if ( value ) {
- this.hoverable.removeClass( "ui-state-hover" );
- this.focusable.removeClass( "ui-state-focus" );
- }
- }
-
- return this;
- },
-
- enable: function() {
- return this._setOptions({ disabled: false });
- },
- disable: function() {
- return this._setOptions({ disabled: true });
- },
-
- _on: function( suppressDisabledCheck, element, handlers ) {
- var delegateElement,
- instance = this;
-
- // no suppressDisabledCheck flag, shuffle arguments
- if ( typeof suppressDisabledCheck !== "boolean" ) {
- handlers = element;
- element = suppressDisabledCheck;
- suppressDisabledCheck = false;
- }
-
- // no element argument, shuffle and use this.element
- if ( !handlers ) {
- handlers = element;
- element = this.element;
- delegateElement = this.widget();
- } else {
- element = delegateElement = $( element );
- this.bindings = this.bindings.add( element );
- }
-
- $.each( handlers, function( event, handler ) {
- function handlerProxy() {
- // allow widgets to customize the disabled handling
- // - disabled as an array instead of boolean
- // - disabled class as method for disabling individual parts
- if ( !suppressDisabledCheck &&
- ( instance.options.disabled === true ||
- $( this ).hasClass( "ui-state-disabled" ) ) ) {
- return;
- }
- return ( typeof handler === "string" ? instance[ handler ] : handler )
- .apply( instance, arguments );
- }
-
- // copy the guid so direct unbinding works
- if ( typeof handler !== "string" ) {
- handlerProxy.guid = handler.guid =
- handler.guid || handlerProxy.guid || $.guid++;
- }
-
- var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
- eventName = match[1] + instance.eventNamespace,
- selector = match[2];
- if ( selector ) {
- delegateElement.delegate( selector, eventName, handlerProxy );
- } else {
- element.bind( eventName, handlerProxy );
- }
- });
- },
-
- _off: function( element, eventName ) {
- eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
- this.eventNamespace;
- element.unbind( eventName ).undelegate( eventName );
-
- // Clear the stack to avoid memory leaks (#10056)
- this.bindings = $( this.bindings.not( element ).get() );
- this.focusable = $( this.focusable.not( element ).get() );
- this.hoverable = $( this.hoverable.not( element ).get() );
- },
-
- _delay: function( handler, delay ) {
- function handlerProxy() {
- return ( typeof handler === "string" ? instance[ handler ] : handler )
- .apply( instance, arguments );
- }
- var instance = this;
- return setTimeout( handlerProxy, delay || 0 );
- },
-
- _hoverable: function( element ) {
- this.hoverable = this.hoverable.add( element );
- this._on( element, {
- mouseenter: function( event ) {
- $( event.currentTarget ).addClass( "ui-state-hover" );
- },
- mouseleave: function( event ) {
- $( event.currentTarget ).removeClass( "ui-state-hover" );
- }
- });
- },
-
- _focusable: function( element ) {
- this.focusable = this.focusable.add( element );
- this._on( element, {
- focusin: function( event ) {
- $( event.currentTarget ).addClass( "ui-state-focus" );
- },
- focusout: function( event ) {
- $( event.currentTarget ).removeClass( "ui-state-focus" );
- }
- });
- },
-
- _trigger: function( type, event, data ) {
- var prop, orig,
- callback = this.options[ type ];
-
- data = data || {};
- event = $.Event( event );
- event.type = ( type === this.widgetEventPrefix ?
- type :
- this.widgetEventPrefix + type ).toLowerCase();
- // the original event may come from any element
- // so we need to reset the target on the new event
- event.target = this.element[ 0 ];
-
- // copy original event properties over to the new event
- orig = event.originalEvent;
- if ( orig ) {
- for ( prop in orig ) {
- if ( !( prop in event ) ) {
- event[ prop ] = orig[ prop ];
- }
- }
- }
-
- this.element.trigger( event, data );
- return !( $.isFunction( callback ) &&
- callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
- event.isDefaultPrevented() );
- }
- };
-
- $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
- $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
- if ( typeof options === "string" ) {
- options = { effect: options };
- }
- var hasOptions,
- effectName = !options ?
- method :
- options === true || typeof options === "number" ?
- defaultEffect :
- options.effect || defaultEffect;
- options = options || {};
- if ( typeof options === "number" ) {
- options = { duration: options };
- }
- hasOptions = !$.isEmptyObject( options );
- options.complete = callback;
- if ( options.delay ) {
- element.delay( options.delay );
- }
- if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
- element[ method ]( options );
- } else if ( effectName !== method && element[ effectName ] ) {
- element[ effectName ]( options.duration, options.easing, callback );
- } else {
- element.queue(function( next ) {
- $( this )[ method ]();
- if ( callback ) {
- callback.call( element[ 0 ] );
- }
- next();
- });
- }
- };
- });
-
- var widget = $.widget;
-
-
-
-}));
diff --git a/apidocs/cloud-api-source/source/javascripts/lib/_lunr.js b/apidocs/cloud-api-source/source/javascripts/lib/_lunr.js
deleted file mode 100644
index 54457dab7a..0000000000
--- a/apidocs/cloud-api-source/source/javascripts/lib/_lunr.js
+++ /dev/null
@@ -1,1910 +0,0 @@
-/**
- * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.7
- * Copyright (C) 2014 Oliver Nightingale
- * MIT Licensed
- * @license
- */
-
-(function(){
-
- /**
- * Convenience function for instantiating a new lunr index and configuring it
- * with the default pipeline functions and the passed config function.
- *
- * When using this convenience function a new index will be created with the
- * following functions already in the pipeline:
- *
- * lunr.StopWordFilter - filters out any stop words before they enter the
- * index
- *
- * lunr.stemmer - stems the tokens before entering the index.
- *
- * Example:
- *
- * var idx = lunr(function () {
- * this.field('title', 10)
- * this.field('tags', 100)
- * this.field('body')
- *
- * this.ref('cid')
- *
- * this.pipeline.add(function () {
- * // some custom pipeline function
- * })
- *
- * })
- *
- * @param {Function} config A function that will be called with the new instance
- * of the lunr.Index as both its context and first parameter. It can be used to
- * customize the instance of new lunr.Index.
- * @namespace
- * @module
- * @returns {lunr.Index}
- *
- */
- var lunr = function (config) {
- var idx = new lunr.Index
-
- idx.pipeline.add(
- lunr.trimmer,
- lunr.stopWordFilter,
- lunr.stemmer
- )
-
- if (config) config.call(idx, idx)
-
- return idx
- }
-
- lunr.version = "0.5.7"
- /*!
- * lunr.utils
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * A namespace containing utils for the rest of the lunr library
- */
- lunr.utils = {}
-
- /**
- * Print a warning message to the console.
- *
- * @param {String} message The message to be printed.
- * @memberOf Utils
- */
- lunr.utils.warn = (function (global) {
- return function (message) {
- if (global.console && console.warn) {
- console.warn(message)
- }
- }
- })(this)
-
- /*!
- * lunr.EventEmitter
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.EventEmitter is an event emitter for lunr. It manages adding and removing event handlers and triggering events and their handlers.
- *
- * @constructor
- */
- lunr.EventEmitter = function () {
- this.events = {}
- }
-
- /**
- * Binds a handler function to a specific event(s).
- *
- * Can bind a single function to many different events in one call.
- *
- * @param {String} [eventName] The name(s) of events to bind this function to.
- * @param {Function} handler The function to call when an event is fired.
- * @memberOf EventEmitter
- */
- lunr.EventEmitter.prototype.addListener = function () {
- var args = Array.prototype.slice.call(arguments),
- fn = args.pop(),
- names = args
-
- if (typeof fn !== "function") throw new TypeError ("last argument must be a function")
-
- names.forEach(function (name) {
- if (!this.hasHandler(name)) this.events[name] = []
- this.events[name].push(fn)
- }, this)
- }
-
- /**
- * Removes a handler function from a specific event.
- *
- * @param {String} eventName The name of the event to remove this function from.
- * @param {Function} handler The function to remove from an event.
- * @memberOf EventEmitter
- */
- lunr.EventEmitter.prototype.removeListener = function (name, fn) {
- if (!this.hasHandler(name)) return
-
- var fnIndex = this.events[name].indexOf(fn)
- this.events[name].splice(fnIndex, 1)
-
- if (!this.events[name].length) delete this.events[name]
- }
-
- /**
- * Calls all functions bound to the given event.
- *
- * Additional data can be passed to the event handler as arguments to `emit`
- * after the event name.
- *
- * @param {String} eventName The name of the event to emit.
- * @memberOf EventEmitter
- */
- lunr.EventEmitter.prototype.emit = function (name) {
- if (!this.hasHandler(name)) return
-
- var args = Array.prototype.slice.call(arguments, 1)
-
- this.events[name].forEach(function (fn) {
- fn.apply(undefined, args)
- })
- }
-
- /**
- * Checks whether a handler has ever been stored against an event.
- *
- * @param {String} eventName The name of the event to check.
- * @private
- * @memberOf EventEmitter
- */
- lunr.EventEmitter.prototype.hasHandler = function (name) {
- return name in this.events
- }
-
- /*!
- * lunr.tokenizer
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * A function for splitting a string into tokens ready to be inserted into
- * the search index.
- *
- * @module
- * @param {String} obj The string to convert into tokens
- * @returns {Array}
- */
- lunr.tokenizer = function (obj) {
- if (!arguments.length || obj == null || obj == undefined) return []
- if (Array.isArray(obj)) return obj.map(function (t) { return t.toLowerCase() })
-
- var str = obj.toString().replace(/^\s+/, '')
-
- for (var i = str.length - 1; i >= 0; i--) {
- if (/\S/.test(str.charAt(i))) {
- str = str.substring(0, i + 1)
- break
- }
- }
-
- return str
- .split(/(?:\s+|\-)/)
- .filter(function (token) {
- return !!token
- })
- .map(function (token) {
- return token.toLowerCase()
- })
- }
- /*!
- * lunr.Pipeline
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.Pipelines maintain an ordered list of functions to be applied to all
- * tokens in documents entering the search index and queries being ran against
- * the index.
- *
- * An instance of lunr.Index created with the lunr shortcut will contain a
- * pipeline with a stop word filter and an English language stemmer. Extra
- * functions can be added before or after either of these functions or these
- * default functions can be removed.
- *
- * When run the pipeline will call each function in turn, passing a token, the
- * index of that token in the original list of all tokens and finally a list of
- * all the original tokens.
- *
- * The output of functions in the pipeline will be passed to the next function
- * in the pipeline. To exclude a token from entering the index the function
- * should return undefined, the rest of the pipeline will not be called with
- * this token.
- *
- * For serialisation of pipelines to work, all functions used in an instance of
- * a pipeline should be registered with lunr.Pipeline. Registered functions can
- * then be loaded. If trying to load a serialised pipeline that uses functions
- * that are not registered an error will be thrown.
- *
- * If not planning on serialising the pipeline then registering pipeline functions
- * is not necessary.
- *
- * @constructor
- */
- lunr.Pipeline = function () {
- this._stack = []
- }
-
- lunr.Pipeline.registeredFunctions = {}
-
- /**
- * Register a function with the pipeline.
- *
- * Functions that are used in the pipeline should be registered if the pipeline
- * needs to be serialised, or a serialised pipeline needs to be loaded.
- *
- * Registering a function does not add it to a pipeline, functions must still be
- * added to instances of the pipeline for them to be used when running a pipeline.
- *
- * @param {Function} fn The function to check for.
- * @param {String} label The label to register this function with
- * @memberOf Pipeline
- */
- lunr.Pipeline.registerFunction = function (fn, label) {
- if (label in this.registeredFunctions) {
- lunr.utils.warn('Overwriting existing registered function: ' + label)
- }
-
- fn.label = label
- lunr.Pipeline.registeredFunctions[fn.label] = fn
- }
-
- /**
- * Warns if the function is not registered as a Pipeline function.
- *
- * @param {Function} fn The function to check for.
- * @private
- * @memberOf Pipeline
- */
- lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
- var isRegistered = fn.label && (fn.label in this.registeredFunctions)
-
- if (!isRegistered) {
- lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
- }
- }
-
- /**
- * Loads a previously serialised pipeline.
- *
- * All functions to be loaded must already be registered with lunr.Pipeline.
- * If any function from the serialised data has not been registered then an
- * error will be thrown.
- *
- * @param {Object} serialised The serialised pipeline to load.
- * @returns {lunr.Pipeline}
- * @memberOf Pipeline
- */
- lunr.Pipeline.load = function (serialised) {
- var pipeline = new lunr.Pipeline
-
- serialised.forEach(function (fnName) {
- var fn = lunr.Pipeline.registeredFunctions[fnName]
-
- if (fn) {
- pipeline.add(fn)
- } else {
- throw new Error ('Cannot load un-registered function: ' + fnName)
- }
- })
-
- return pipeline
- }
-
- /**
- * Adds new functions to the end of the pipeline.
- *
- * Logs a warning if the function has not been registered.
- *
- * @param {Function} functions Any number of functions to add to the pipeline.
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.add = function () {
- var fns = Array.prototype.slice.call(arguments)
-
- fns.forEach(function (fn) {
- lunr.Pipeline.warnIfFunctionNotRegistered(fn)
- this._stack.push(fn)
- }, this)
- }
-
- /**
- * Adds a single function after a function that already exists in the
- * pipeline.
- *
- * Logs a warning if the function has not been registered.
- *
- * @param {Function} existingFn A function that already exists in the pipeline.
- * @param {Function} newFn The new function to add to the pipeline.
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.after = function (existingFn, newFn) {
- lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
-
- var pos = this._stack.indexOf(existingFn) + 1
- this._stack.splice(pos, 0, newFn)
- }
-
- /**
- * Adds a single function before a function that already exists in the
- * pipeline.
- *
- * Logs a warning if the function has not been registered.
- *
- * @param {Function} existingFn A function that already exists in the pipeline.
- * @param {Function} newFn The new function to add to the pipeline.
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.before = function (existingFn, newFn) {
- lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
-
- var pos = this._stack.indexOf(existingFn)
- this._stack.splice(pos, 0, newFn)
- }
-
- /**
- * Removes a function from the pipeline.
- *
- * @param {Function} fn The function to remove from the pipeline.
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.remove = function (fn) {
- var pos = this._stack.indexOf(fn)
- this._stack.splice(pos, 1)
- }
-
- /**
- * Runs the current list of functions that make up the pipeline against the
- * passed tokens.
- *
- * @param {Array} tokens The tokens to run through the pipeline.
- * @returns {Array}
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.run = function (tokens) {
- var out = [],
- tokenLength = tokens.length,
- stackLength = this._stack.length
-
- for (var i = 0; i < tokenLength; i++) {
- var token = tokens[i]
-
- for (var j = 0; j < stackLength; j++) {
- token = this._stack[j](token, i, tokens)
- if (token === void 0) break
- };
-
- if (token !== void 0) out.push(token)
- };
-
- return out
- }
-
- /**
- * Resets the pipeline by removing any existing processors.
- *
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.reset = function () {
- this._stack = []
- }
-
- /**
- * Returns a representation of the pipeline ready for serialisation.
- *
- * Logs a warning if the function has not been registered.
- *
- * @returns {Array}
- * @memberOf Pipeline
- */
- lunr.Pipeline.prototype.toJSON = function () {
- return this._stack.map(function (fn) {
- lunr.Pipeline.warnIfFunctionNotRegistered(fn)
-
- return fn.label
- })
- }
- /*!
- * lunr.Vector
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.Vectors implement vector related operations for
- * a series of elements.
- *
- * @constructor
- */
- lunr.Vector = function () {
- this._magnitude = null
- this.list = undefined
- this.length = 0
- }
-
- /**
- * lunr.Vector.Node is a simple struct for each node
- * in a lunr.Vector.
- *
- * @private
- * @param {Number} The index of the node in the vector.
- * @param {Object} The data at this node in the vector.
- * @param {lunr.Vector.Node} The node directly after this node in the vector.
- * @constructor
- * @memberOf Vector
- */
- lunr.Vector.Node = function (idx, val, next) {
- this.idx = idx
- this.val = val
- this.next = next
- }
-
- /**
- * Inserts a new value at a position in a vector.
- *
- * @param {Number} The index at which to insert a value.
- * @param {Object} The object to insert in the vector.
- * @memberOf Vector.
- */
- lunr.Vector.prototype.insert = function (idx, val) {
- var list = this.list
-
- if (!list) {
- this.list = new lunr.Vector.Node (idx, val, list)
- return this.length++
- }
-
- var prev = list,
- next = list.next
-
- while (next != undefined) {
- if (idx < next.idx) {
- prev.next = new lunr.Vector.Node (idx, val, next)
- return this.length++
- }
-
- prev = next, next = next.next
- }
-
- prev.next = new lunr.Vector.Node (idx, val, next)
- return this.length++
- }
-
- /**
- * Calculates the magnitude of this vector.
- *
- * @returns {Number}
- * @memberOf Vector
- */
- lunr.Vector.prototype.magnitude = function () {
- if (this._magniture) return this._magnitude
- var node = this.list,
- sumOfSquares = 0,
- val
-
- while (node) {
- val = node.val
- sumOfSquares += val * val
- node = node.next
- }
-
- return this._magnitude = Math.sqrt(sumOfSquares)
- }
-
- /**
- * Calculates the dot product of this vector and another vector.
- *
- * @param {lunr.Vector} otherVector The vector to compute the dot product with.
- * @returns {Number}
- * @memberOf Vector
- */
- lunr.Vector.prototype.dot = function (otherVector) {
- var node = this.list,
- otherNode = otherVector.list,
- dotProduct = 0
-
- while (node && otherNode) {
- if (node.idx < otherNode.idx) {
- node = node.next
- } else if (node.idx > otherNode.idx) {
- otherNode = otherNode.next
- } else {
- dotProduct += node.val * otherNode.val
- node = node.next
- otherNode = otherNode.next
- }
- }
-
- return dotProduct
- }
-
- /**
- * Calculates the cosine similarity between this vector and another
- * vector.
- *
- * @param {lunr.Vector} otherVector The other vector to calculate the
- * similarity with.
- * @returns {Number}
- * @memberOf Vector
- */
- lunr.Vector.prototype.similarity = function (otherVector) {
- return this.dot(otherVector) / (this.magnitude() * otherVector.magnitude())
- }
- /*!
- * lunr.SortedSet
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.SortedSets are used to maintain an array of uniq values in a sorted
- * order.
- *
- * @constructor
- */
- lunr.SortedSet = function () {
- this.length = 0
- this.elements = []
- }
-
- /**
- * Loads a previously serialised sorted set.
- *
- * @param {Array} serialisedData The serialised set to load.
- * @returns {lunr.SortedSet}
- * @memberOf SortedSet
- */
- lunr.SortedSet.load = function (serialisedData) {
- var set = new this
-
- set.elements = serialisedData
- set.length = serialisedData.length
-
- return set
- }
-
- /**
- * Inserts new items into the set in the correct position to maintain the
- * order.
- *
- * @param {Object} The objects to add to this set.
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.add = function () {
- Array.prototype.slice.call(arguments).forEach(function (element) {
- if (~this.indexOf(element)) return
- this.elements.splice(this.locationFor(element), 0, element)
- }, this)
-
- this.length = this.elements.length
- }
-
- /**
- * Converts this sorted set into an array.
- *
- * @returns {Array}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.toArray = function () {
- return this.elements.slice()
- }
-
- /**
- * Creates a new array with the results of calling a provided function on every
- * element in this sorted set.
- *
- * Delegates to Array.prototype.map and has the same signature.
- *
- * @param {Function} fn The function that is called on each element of the
- * set.
- * @param {Object} ctx An optional object that can be used as the context
- * for the function fn.
- * @returns {Array}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.map = function (fn, ctx) {
- return this.elements.map(fn, ctx)
- }
-
- /**
- * Executes a provided function once per sorted set element.
- *
- * Delegates to Array.prototype.forEach and has the same signature.
- *
- * @param {Function} fn The function that is called on each element of the
- * set.
- * @param {Object} ctx An optional object that can be used as the context
- * @memberOf SortedSet
- * for the function fn.
- */
- lunr.SortedSet.prototype.forEach = function (fn, ctx) {
- return this.elements.forEach(fn, ctx)
- }
-
- /**
- * Returns the index at which a given element can be found in the
- * sorted set, or -1 if it is not present.
- *
- * @param {Object} elem The object to locate in the sorted set.
- * @param {Number} start An optional index at which to start searching from
- * within the set.
- * @param {Number} end An optional index at which to stop search from within
- * the set.
- * @returns {Number}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.indexOf = function (elem, start, end) {
- var start = start || 0,
- end = end || this.elements.length,
- sectionLength = end - start,
- pivot = start + Math.floor(sectionLength / 2),
- pivotElem = this.elements[pivot]
-
- if (sectionLength <= 1) {
- if (pivotElem === elem) {
- return pivot
- } else {
- return -1
- }
- }
-
- if (pivotElem < elem) return this.indexOf(elem, pivot, end)
- if (pivotElem > elem) return this.indexOf(elem, start, pivot)
- if (pivotElem === elem) return pivot
- }
-
- /**
- * Returns the position within the sorted set that an element should be
- * inserted at to maintain the current order of the set.
- *
- * This function assumes that the element to search for does not already exist
- * in the sorted set.
- *
- * @param {Object} elem The elem to find the position for in the set
- * @param {Number} start An optional index at which to start searching from
- * within the set.
- * @param {Number} end An optional index at which to stop search from within
- * the set.
- * @returns {Number}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.locationFor = function (elem, start, end) {
- var start = start || 0,
- end = end || this.elements.length,
- sectionLength = end - start,
- pivot = start + Math.floor(sectionLength / 2),
- pivotElem = this.elements[pivot]
-
- if (sectionLength <= 1) {
- if (pivotElem > elem) return pivot
- if (pivotElem < elem) return pivot + 1
- }
-
- if (pivotElem < elem) return this.locationFor(elem, pivot, end)
- if (pivotElem > elem) return this.locationFor(elem, start, pivot)
- }
-
- /**
- * Creates a new lunr.SortedSet that contains the elements in the intersection
- * of this set and the passed set.
- *
- * @param {lunr.SortedSet} otherSet The set to intersect with this set.
- * @returns {lunr.SortedSet}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.intersect = function (otherSet) {
- var intersectSet = new lunr.SortedSet,
- i = 0, j = 0,
- a_len = this.length, b_len = otherSet.length,
- a = this.elements, b = otherSet.elements
-
- while (true) {
- if (i > a_len - 1 || j > b_len - 1) break
-
- if (a[i] === b[j]) {
- intersectSet.add(a[i])
- i++, j++
- continue
- }
-
- if (a[i] < b[j]) {
- i++
- continue
- }
-
- if (a[i] > b[j]) {
- j++
- continue
- }
- };
-
- return intersectSet
- }
-
- /**
- * Makes a copy of this set
- *
- * @returns {lunr.SortedSet}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.clone = function () {
- var clone = new lunr.SortedSet
-
- clone.elements = this.toArray()
- clone.length = clone.elements.length
-
- return clone
- }
-
- /**
- * Creates a new lunr.SortedSet that contains the elements in the union
- * of this set and the passed set.
- *
- * @param {lunr.SortedSet} otherSet The set to union with this set.
- * @returns {lunr.SortedSet}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.union = function (otherSet) {
- var longSet, shortSet, unionSet
-
- if (this.length >= otherSet.length) {
- longSet = this, shortSet = otherSet
- } else {
- longSet = otherSet, shortSet = this
- }
-
- unionSet = longSet.clone()
-
- unionSet.add.apply(unionSet, shortSet.toArray())
-
- return unionSet
- }
-
- /**
- * Returns a representation of the sorted set ready for serialisation.
- *
- * @returns {Array}
- * @memberOf SortedSet
- */
- lunr.SortedSet.prototype.toJSON = function () {
- return this.toArray()
- }
- /*!
- * lunr.Index
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.Index is object that manages a search index. It contains the indexes
- * and stores all the tokens and document lookups. It also provides the main
- * user facing API for the library.
- *
- * @constructor
- */
- lunr.Index = function () {
- this._fields = []
- this._ref = 'id'
- this.pipeline = new lunr.Pipeline
- this.documentStore = new lunr.Store
- this.tokenStore = new lunr.TokenStore
- this.corpusTokens = new lunr.SortedSet
- this.eventEmitter = new lunr.EventEmitter
-
- this._idfCache = {}
-
- this.on('add', 'remove', 'update', (function () {
- this._idfCache = {}
- }).bind(this))
- }
-
- /**
- * Bind a handler to events being emitted by the index.
- *
- * The handler can be bound to many events at the same time.
- *
- * @param {String} [eventName] The name(s) of events to bind the function to.
- * @param {Function} handler The serialised set to load.
- * @memberOf Index
- */
- lunr.Index.prototype.on = function () {
- var args = Array.prototype.slice.call(arguments)
- return this.eventEmitter.addListener.apply(this.eventEmitter, args)
- }
-
- /**
- * Removes a handler from an event being emitted by the index.
- *
- * @param {String} eventName The name of events to remove the function from.
- * @param {Function} handler The serialised set to load.
- * @memberOf Index
- */
- lunr.Index.prototype.off = function (name, fn) {
- return this.eventEmitter.removeListener(name, fn)
- }
-
- /**
- * Loads a previously serialised index.
- *
- * Issues a warning if the index being imported was serialised
- * by a different version of lunr.
- *
- * @param {Object} serialisedData The serialised set to load.
- * @returns {lunr.Index}
- * @memberOf Index
- */
- lunr.Index.load = function (serialisedData) {
- if (serialisedData.version !== lunr.version) {
- lunr.utils.warn('version mismatch: current ' + lunr.version + ' importing ' + serialisedData.version)
- }
-
- var idx = new this
-
- idx._fields = serialisedData.fields
- idx._ref = serialisedData.ref
-
- idx.documentStore = lunr.Store.load(serialisedData.documentStore)
- idx.tokenStore = lunr.TokenStore.load(serialisedData.tokenStore)
- idx.corpusTokens = lunr.SortedSet.load(serialisedData.corpusTokens)
- idx.pipeline = lunr.Pipeline.load(serialisedData.pipeline)
-
- return idx
- }
-
- /**
- * Adds a field to the list of fields that will be searchable within documents
- * in the index.
- *
- * An optional boost param can be passed to affect how much tokens in this field
- * rank in search results, by default the boost value is 1.
- *
- * Fields should be added before any documents are added to the index, fields
- * that are added after documents are added to the index will only apply to new
- * documents added to the index.
- *
- * @param {String} fieldName The name of the field within the document that
- * should be indexed
- * @param {Number} boost An optional boost that can be applied to terms in this
- * field.
- * @returns {lunr.Index}
- * @memberOf Index
- */
- lunr.Index.prototype.field = function (fieldName, opts) {
- var opts = opts || {},
- field = { name: fieldName, boost: opts.boost || 1 }
-
- this._fields.push(field)
- return this
- }
-
- /**
- * Sets the property used to uniquely identify documents added to the index,
- * by default this property is 'id'.
- *
- * This should only be changed before adding documents to the index, changing
- * the ref property without resetting the index can lead to unexpected results.
- *
- * @param {String} refName The property to use to uniquely identify the
- * documents in the index.
- * @param {Boolean} emitEvent Whether to emit add events, defaults to true
- * @returns {lunr.Index}
- * @memberOf Index
- */
- lunr.Index.prototype.ref = function (refName) {
- this._ref = refName
- return this
- }
-
- /**
- * Add a document to the index.
- *
- * This is the way new documents enter the index, this function will run the
- * fields from the document through the index's pipeline and then add it to
- * the index, it will then show up in search results.
- *
- * An 'add' event is emitted with the document that has been added and the index
- * the document has been added to. This event can be silenced by passing false
- * as the second argument to add.
- *
- * @param {Object} doc The document to add to the index.
- * @param {Boolean} emitEvent Whether or not to emit events, default true.
- * @memberOf Index
- */
- lunr.Index.prototype.add = function (doc, emitEvent) {
- var docTokens = {},
- allDocumentTokens = new lunr.SortedSet,
- docRef = doc[this._ref],
- emitEvent = emitEvent === undefined ? true : emitEvent
-
- this._fields.forEach(function (field) {
- var fieldTokens = this.pipeline.run(lunr.tokenizer(doc[field.name]))
-
- docTokens[field.name] = fieldTokens
- lunr.SortedSet.prototype.add.apply(allDocumentTokens, fieldTokens)
- }, this)
-
- this.documentStore.set(docRef, allDocumentTokens)
- lunr.SortedSet.prototype.add.apply(this.corpusTokens, allDocumentTokens.toArray())
-
- for (var i = 0; i < allDocumentTokens.length; i++) {
- var token = allDocumentTokens.elements[i]
- var tf = this._fields.reduce(function (memo, field) {
- var fieldLength = docTokens[field.name].length
-
- if (!fieldLength) return memo
-
- var tokenCount = docTokens[field.name].filter(function (t) { return t === token }).length
-
- return memo + (tokenCount / fieldLength * field.boost)
- }, 0)
-
- this.tokenStore.add(token, { ref: docRef, tf: tf })
- };
-
- if (emitEvent) this.eventEmitter.emit('add', doc, this)
- }
-
- /**
- * Removes a document from the index.
- *
- * To make sure documents no longer show up in search results they can be
- * removed from the index using this method.
- *
- * The document passed only needs to have the same ref property value as the
- * document that was added to the index, they could be completely different
- * objects.
- *
- * A 'remove' event is emitted with the document that has been removed and the index
- * the document has been removed from. This event can be silenced by passing false
- * as the second argument to remove.
- *
- * @param {Object} doc The document to remove from the index.
- * @param {Boolean} emitEvent Whether to emit remove events, defaults to true
- * @memberOf Index
- */
- lunr.Index.prototype.remove = function (doc, emitEvent) {
- var docRef = doc[this._ref],
- emitEvent = emitEvent === undefined ? true : emitEvent
-
- if (!this.documentStore.has(docRef)) return
-
- var docTokens = this.documentStore.get(docRef)
-
- this.documentStore.remove(docRef)
-
- docTokens.forEach(function (token) {
- this.tokenStore.remove(token, docRef)
- }, this)
-
- if (emitEvent) this.eventEmitter.emit('remove', doc, this)
- }
-
- /**
- * Updates a document in the index.
- *
- * When a document contained within the index gets updated, fields changed,
- * added or removed, to make sure it correctly matched against search queries,
- * it should be updated in the index.
- *
- * This method is just a wrapper around `remove` and `add`
- *
- * An 'update' event is emitted with the document that has been updated and the index.
- * This event can be silenced by passing false as the second argument to update. Only
- * an update event will be fired, the 'add' and 'remove' events of the underlying calls
- * are silenced.
- *
- * @param {Object} doc The document to update in the index.
- * @param {Boolean} emitEvent Whether to emit update events, defaults to true
- * @see Index.prototype.remove
- * @see Index.prototype.add
- * @memberOf Index
- */
- lunr.Index.prototype.update = function (doc, emitEvent) {
- var emitEvent = emitEvent === undefined ? true : emitEvent
-
- this.remove(doc, false)
- this.add(doc, false)
-
- if (emitEvent) this.eventEmitter.emit('update', doc, this)
- }
-
- /**
- * Calculates the inverse document frequency for a token within the index.
- *
- * @param {String} token The token to calculate the idf of.
- * @see Index.prototype.idf
- * @private
- * @memberOf Index
- */
- lunr.Index.prototype.idf = function (term) {
- var cacheKey = "@" + term
- if (Object.prototype.hasOwnProperty.call(this._idfCache, cacheKey)) return this._idfCache[cacheKey]
-
- var documentFrequency = this.tokenStore.count(term),
- idf = 1
-
- if (documentFrequency > 0) {
- idf = 1 + Math.log(this.tokenStore.length / documentFrequency)
- }
-
- return this._idfCache[cacheKey] = idf
- }
-
- /**
- * Searches the index using the passed query.
- *
- * Queries should be a string, multiple words are allowed and will lead to an
- * AND based query, e.g. `idx.search('foo bar')` will run a search for
- * documents containing both 'foo' and 'bar'.
- *
- * All query tokens are passed through the same pipeline that document tokens
- * are passed through, so any language processing involved will be run on every
- * query term.
- *
- * Each query term is expanded, so that the term 'he' might be expanded to
- * 'hello' and 'help' if those terms were already included in the index.
- *
- * Matching documents are returned as an array of objects, each object contains
- * the matching document ref, as set for this index, and the similarity score
- * for this document against the query.
- *
- * @param {String} query The query to search the index with.
- * @returns {Object}
- * @see Index.prototype.idf
- * @see Index.prototype.documentVector
- * @memberOf Index
- */
- lunr.Index.prototype.search = function (query) {
- var queryTokens = this.pipeline.run(lunr.tokenizer(query)),
- queryVector = new lunr.Vector,
- documentSets = [],
- fieldBoosts = this._fields.reduce(function (memo, f) { return memo + f.boost }, 0)
-
- var hasSomeToken = queryTokens.some(function (token) {
- return this.tokenStore.has(token)
- }, this)
-
- if (!hasSomeToken) return []
-
- queryTokens
- .forEach(function (token, i, tokens) {
- var tf = 1 / tokens.length * this._fields.length * fieldBoosts,
- self = this
-
- var set = this.tokenStore.expand(token).reduce(function (memo, key) {
- var pos = self.corpusTokens.indexOf(key),
- idf = self.idf(key),
- similarityBoost = 1,
- set = new lunr.SortedSet
-
- // if the expanded key is not an exact match to the token then
- // penalise the score for this key by how different the key is
- // to the token.
- if (key !== token) {
- var diff = Math.max(3, key.length - token.length)
- similarityBoost = 1 / Math.log(diff)
- }
-
- // calculate the query tf-idf score for this token
- // applying an similarityBoost to ensure exact matches
- // these rank higher than expanded terms
- if (pos > -1) queryVector.insert(pos, tf * idf * similarityBoost)
-
- // add all the documents that have this key into a set
- Object.keys(self.tokenStore.get(key)).forEach(function (ref) { set.add(ref) })
-
- return memo.union(set)
- }, new lunr.SortedSet)
-
- documentSets.push(set)
- }, this)
-
- var documentSet = documentSets.reduce(function (memo, set) {
- return memo.intersect(set)
- })
-
- return documentSet
- .map(function (ref) {
- return { ref: ref, score: queryVector.similarity(this.documentVector(ref)) }
- }, this)
- .sort(function (a, b) {
- return b.score - a.score
- })
- }
-
- /**
- * Generates a vector containing all the tokens in the document matching the
- * passed documentRef.
- *
- * The vector contains the tf-idf score for each token contained in the
- * document with the passed documentRef. The vector will contain an element
- * for every token in the indexes corpus, if the document does not contain that
- * token the element will be 0.
- *
- * @param {Object} documentRef The ref to find the document with.
- * @returns {lunr.Vector}
- * @private
- * @memberOf Index
- */
- lunr.Index.prototype.documentVector = function (documentRef) {
- var documentTokens = this.documentStore.get(documentRef),
- documentTokensLength = documentTokens.length,
- documentVector = new lunr.Vector
-
- for (var i = 0; i < documentTokensLength; i++) {
- var token = documentTokens.elements[i],
- tf = this.tokenStore.get(token)[documentRef].tf,
- idf = this.idf(token)
-
- documentVector.insert(this.corpusTokens.indexOf(token), tf * idf)
- };
-
- return documentVector
- }
-
- /**
- * Returns a representation of the index ready for serialisation.
- *
- * @returns {Object}
- * @memberOf Index
- */
- lunr.Index.prototype.toJSON = function () {
- return {
- version: lunr.version,
- fields: this._fields,
- ref: this._ref,
- documentStore: this.documentStore.toJSON(),
- tokenStore: this.tokenStore.toJSON(),
- corpusTokens: this.corpusTokens.toJSON(),
- pipeline: this.pipeline.toJSON()
- }
- }
-
- /**
- * Applies a plugin to the current index.
- *
- * A plugin is a function that is called with the index as its context.
- * Plugins can be used to customise or extend the behaviour the index
- * in some way. A plugin is just a function, that encapsulated the custom
- * behaviour that should be applied to the index.
- *
- * The plugin function will be called with the index as its argument, additional
- * arguments can also be passed when calling use. The function will be called
- * with the index as its context.
- *
- * Example:
- *
- * var myPlugin = function (idx, arg1, arg2) {
- * // `this` is the index to be extended
- * // apply any extensions etc here.
- * }
- *
- * var idx = lunr(function () {
- * this.use(myPlugin, 'arg1', 'arg2')
- * })
- *
- * @param {Function} plugin The plugin to apply.
- * @memberOf Index
- */
- lunr.Index.prototype.use = function (plugin) {
- var args = Array.prototype.slice.call(arguments, 1)
- args.unshift(this)
- plugin.apply(this, args)
- }
- /*!
- * lunr.Store
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.Store is a simple key-value store used for storing sets of tokens for
- * documents stored in index.
- *
- * @constructor
- * @module
- */
- lunr.Store = function () {
- this.store = {}
- this.length = 0
- }
-
- /**
- * Loads a previously serialised store
- *
- * @param {Object} serialisedData The serialised store to load.
- * @returns {lunr.Store}
- * @memberOf Store
- */
- lunr.Store.load = function (serialisedData) {
- var store = new this
-
- store.length = serialisedData.length
- store.store = Object.keys(serialisedData.store).reduce(function (memo, key) {
- memo[key] = lunr.SortedSet.load(serialisedData.store[key])
- return memo
- }, {})
-
- return store
- }
-
- /**
- * Stores the given tokens in the store against the given id.
- *
- * @param {Object} id The key used to store the tokens against.
- * @param {Object} tokens The tokens to store against the key.
- * @memberOf Store
- */
- lunr.Store.prototype.set = function (id, tokens) {
- if (!this.has(id)) this.length++
- this.store[id] = tokens
- }
-
- /**
- * Retrieves the tokens from the store for a given key.
- *
- * @param {Object} id The key to lookup and retrieve from the store.
- * @returns {Object}
- * @memberOf Store
- */
- lunr.Store.prototype.get = function (id) {
- return this.store[id]
- }
-
- /**
- * Checks whether the store contains a key.
- *
- * @param {Object} id The id to look up in the store.
- * @returns {Boolean}
- * @memberOf Store
- */
- lunr.Store.prototype.has = function (id) {
- return id in this.store
- }
-
- /**
- * Removes the value for a key in the store.
- *
- * @param {Object} id The id to remove from the store.
- * @memberOf Store
- */
- lunr.Store.prototype.remove = function (id) {
- if (!this.has(id)) return
-
- delete this.store[id]
- this.length--
- }
-
- /**
- * Returns a representation of the store ready for serialisation.
- *
- * @returns {Object}
- * @memberOf Store
- */
- lunr.Store.prototype.toJSON = function () {
- return {
- store: this.store,
- length: this.length
- }
- }
-
- /*!
- * lunr.stemmer
- * Copyright (C) 2014 Oliver Nightingale
- * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
- */
-
- /**
- * lunr.stemmer is an english language stemmer, this is a JavaScript
- * implementation of the PorterStemmer taken from http://tartaurs.org/~martin
- *
- * @module
- * @param {String} str The string to stem
- * @returns {String}
- * @see lunr.Pipeline
- */
- lunr.stemmer = (function(){
- var step2list = {
- "ational" : "ate",
- "tional" : "tion",
- "enci" : "ence",
- "anci" : "ance",
- "izer" : "ize",
- "bli" : "ble",
- "alli" : "al",
- "entli" : "ent",
- "eli" : "e",
- "ousli" : "ous",
- "ization" : "ize",
- "ation" : "ate",
- "ator" : "ate",
- "alism" : "al",
- "iveness" : "ive",
- "fulness" : "ful",
- "ousness" : "ous",
- "aliti" : "al",
- "iviti" : "ive",
- "biliti" : "ble",
- "logi" : "log"
- },
-
- step3list = {
- "icate" : "ic",
- "ative" : "",
- "alize" : "al",
- "iciti" : "ic",
- "ical" : "ic",
- "ful" : "",
- "ness" : ""
- },
-
- c = "[^aeiou]", // consonant
- v = "[aeiouy]", // vowel
- C = c + "[^aeiouy]*", // consonant sequence
- V = v + "[aeiou]*", // vowel sequence
-
- mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0
- meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1
- mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1
- s_v = "^(" + C + ")?" + v; // vowel in stem
-
- var re_mgr0 = new RegExp(mgr0);
- var re_mgr1 = new RegExp(mgr1);
- var re_meq1 = new RegExp(meq1);
- var re_s_v = new RegExp(s_v);
-
- var re_1a = /^(.+?)(ss|i)es$/;
- var re2_1a = /^(.+?)([^s])s$/;
- var re_1b = /^(.+?)eed$/;
- var re2_1b = /^(.+?)(ed|ing)$/;
- var re_1b_2 = /.$/;
- var re2_1b_2 = /(at|bl|iz)$/;
- var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
- var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
-
- var re_1c = /^(.+?[^aeiou])y$/;
- var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
-
- var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
-
- var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
- var re2_4 = /^(.+?)(s|t)(ion)$/;
-
- var re_5 = /^(.+?)e$/;
- var re_5_1 = /ll$/;
- var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
-
- var porterStemmer = function porterStemmer(w) {
- var stem,
- suffix,
- firstch,
- re,
- re2,
- re3,
- re4;
-
- if (w.length < 3) { return w; }
-
- firstch = w.substr(0,1);
- if (firstch == "y") {
- w = firstch.toUpperCase() + w.substr(1);
- }
-
- // Step 1a
- re = re_1a
- re2 = re2_1a;
-
- if (re.test(w)) { w = w.replace(re,"$1$2"); }
- else if (re2.test(w)) { w = w.replace(re2,"$1$2"); }
-
- // Step 1b
- re = re_1b;
- re2 = re2_1b;
- if (re.test(w)) {
- var fp = re.exec(w);
- re = re_mgr0;
- if (re.test(fp[1])) {
- re = re_1b_2;
- w = w.replace(re,"");
- }
- } else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1];
- re2 = re_s_v;
- if (re2.test(stem)) {
- w = stem;
- re2 = re2_1b_2;
- re3 = re3_1b_2;
- re4 = re4_1b_2;
- if (re2.test(w)) { w = w + "e"; }
- else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); }
- else if (re4.test(w)) { w = w + "e"; }
- }
- }
-
- // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)
- re = re_1c;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- w = stem + "i";
- }
-
- // Step 2
- re = re_2;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = re_mgr0;
- if (re.test(stem)) {
- w = stem + step2list[suffix];
- }
- }
-
- // Step 3
- re = re_3;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = re_mgr0;
- if (re.test(stem)) {
- w = stem + step3list[suffix];
- }
- }
-
- // Step 4
- re = re_4;
- re2 = re2_4;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = re_mgr1;
- if (re.test(stem)) {
- w = stem;
- }
- } else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1] + fp[2];
- re2 = re_mgr1;
- if (re2.test(stem)) {
- w = stem;
- }
- }
-
- // Step 5
- re = re_5;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = re_mgr1;
- re2 = re_meq1;
- re3 = re3_5;
- if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {
- w = stem;
- }
- }
-
- re = re_5_1;
- re2 = re_mgr1;
- if (re.test(w) && re2.test(w)) {
- re = re_1b_2;
- w = w.replace(re,"");
- }
-
- // and turn initial Y back to y
-
- if (firstch == "y") {
- w = firstch.toLowerCase() + w.substr(1);
- }
-
- return w;
- };
-
- return porterStemmer;
- })();
-
- lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')
- /*!
- * lunr.stopWordFilter
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.stopWordFilter is an English language stop word list filter, any words
- * contained in the list will not be passed through the filter.
- *
- * This is intended to be used in the Pipeline. If the token does not pass the
- * filter then undefined will be returned.
- *
- * @module
- * @param {String} token The token to pass through the filter
- * @returns {String}
- * @see lunr.Pipeline
- */
- lunr.stopWordFilter = function (token) {
- if (lunr.stopWordFilter.stopWords.indexOf(token) === -1) return token
- }
-
- lunr.stopWordFilter.stopWords = new lunr.SortedSet
- lunr.stopWordFilter.stopWords.length = 119
- lunr.stopWordFilter.stopWords.elements = [
- "",
- "a",
- "able",
- "about",
- "across",
- "after",
- "all",
- "almost",
- "also",
- "am",
- "among",
- "an",
- "and",
- "any",
- "are",
- "as",
- "at",
- "be",
- "because",
- "been",
- "but",
- "by",
- "can",
- "cannot",
- "could",
- "dear",
- "did",
- "do",
- "does",
- "either",
- "else",
- "ever",
- "every",
- "for",
- "from",
- "get",
- "got",
- "had",
- "has",
- "have",
- "he",
- "her",
- "hers",
- "him",
- "his",
- "how",
- "however",
- "i",
- "if",
- "in",
- "into",
- "is",
- "it",
- "its",
- "just",
- "least",
- "let",
- "like",
- "likely",
- "may",
- "me",
- "might",
- "most",
- "must",
- "my",
- "neither",
- "no",
- "nor",
- "not",
- "of",
- "off",
- "often",
- "on",
- "only",
- "or",
- "other",
- "our",
- "own",
- "rather",
- "said",
- "say",
- "says",
- "she",
- "should",
- "since",
- "so",
- "some",
- "than",
- "that",
- "the",
- "their",
- "them",
- "then",
- "there",
- "these",
- "they",
- "this",
- "tis",
- "to",
- "too",
- "twas",
- "us",
- "wants",
- "was",
- "we",
- "were",
- "what",
- "when",
- "where",
- "which",
- "while",
- "who",
- "whom",
- "why",
- "will",
- "with",
- "would",
- "yet",
- "you",
- "your"
- ]
-
- lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')
- /*!
- * lunr.trimmer
- * Copyright (C) 2014 Oliver Nightingale
- */
-
- /**
- * lunr.trimmer is a pipeline function for trimming non word
- * characters from the begining and end of tokens before they
- * enter the index.
- *
- * This implementation may not work correctly for non latin
- * characters and should either be removed or adapted for use
- * with languages with non-latin characters.
- *
- * @module
- * @param {String} token The token to pass through the filter
- * @returns {String}
- * @see lunr.Pipeline
- */
- lunr.trimmer = function (token) {
- return token
- .replace(/^\W+/, '')
- .replace(/\W+$/, '')
- }
-
- lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')
- /*!
- * lunr.stemmer
- * Copyright (C) 2014 Oliver Nightingale
- * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
- */
-
- /**
- * lunr.TokenStore is used for efficient storing and lookup of the reverse
- * index of token to document ref.
- *
- * @constructor
- */
- lunr.TokenStore = function () {
- this.root = { docs: {} }
- this.length = 0
- }
-
- /**
- * Loads a previously serialised token store
- *
- * @param {Object} serialisedData The serialised token store to load.
- * @returns {lunr.TokenStore}
- * @memberOf TokenStore
- */
- lunr.TokenStore.load = function (serialisedData) {
- var store = new this
-
- store.root = serialisedData.root
- store.length = serialisedData.length
-
- return store
- }
-
- /**
- * Adds a new token doc pair to the store.
- *
- * By default this function starts at the root of the current store, however
- * it can start at any node of any token store if required.
- *
- * @param {String} token The token to store the doc under
- * @param {Object} doc The doc to store against the token
- * @param {Object} root An optional node at which to start looking for the
- * correct place to enter the doc, by default the root of this lunr.TokenStore
- * is used.
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.add = function (token, doc, root) {
- var root = root || this.root,
- key = token[0],
- rest = token.slice(1)
-
- if (!(key in root)) root[key] = {docs: {}}
-
- if (rest.length === 0) {
- root[key].docs[doc.ref] = doc
- this.length += 1
- return
- } else {
- return this.add(rest, doc, root[key])
- }
- }
-
- /**
- * Checks whether this key is contained within this lunr.TokenStore.
- *
- * By default this function starts at the root of the current store, however
- * it can start at any node of any token store if required.
- *
- * @param {String} token The token to check for
- * @param {Object} root An optional node at which to start
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.has = function (token) {
- if (!token) return false
-
- var node = this.root
-
- for (var i = 0; i < token.length; i++) {
- if (!node[token[i]]) return false
-
- node = node[token[i]]
- }
-
- return true
- }
-
- /**
- * Retrieve a node from the token store for a given token.
- *
- * By default this function starts at the root of the current store, however
- * it can start at any node of any token store if required.
- *
- * @param {String} token The token to get the node for.
- * @param {Object} root An optional node at which to start.
- * @returns {Object}
- * @see TokenStore.prototype.get
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.getNode = function (token) {
- if (!token) return {}
-
- var node = this.root
-
- for (var i = 0; i < token.length; i++) {
- if (!node[token[i]]) return {}
-
- node = node[token[i]]
- }
-
- return node
- }
-
- /**
- * Retrieve the documents for a node for the given token.
- *
- * By default this function starts at the root of the current store, however
- * it can start at any node of any token store if required.
- *
- * @param {String} token The token to get the documents for.
- * @param {Object} root An optional node at which to start.
- * @returns {Object}
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.get = function (token, root) {
- return this.getNode(token, root).docs || {}
- }
-
- lunr.TokenStore.prototype.count = function (token, root) {
- return Object.keys(this.get(token, root)).length
- }
-
- /**
- * Remove the document identified by ref from the token in the store.
- *
- * By default this function starts at the root of the current store, however
- * it can start at any node of any token store if required.
- *
- * @param {String} token The token to get the documents for.
- * @param {String} ref The ref of the document to remove from this token.
- * @param {Object} root An optional node at which to start.
- * @returns {Object}
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.remove = function (token, ref) {
- if (!token) return
- var node = this.root
-
- for (var i = 0; i < token.length; i++) {
- if (!(token[i] in node)) return
- node = node[token[i]]
- }
-
- delete node.docs[ref]
- }
-
- /**
- * Find all the possible suffixes of the passed token using tokens
- * currently in the store.
- *
- * @param {String} token The token to expand.
- * @returns {Array}
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.expand = function (token, memo) {
- var root = this.getNode(token),
- docs = root.docs || {},
- memo = memo || []
-
- if (Object.keys(docs).length) memo.push(token)
-
- Object.keys(root)
- .forEach(function (key) {
- if (key === 'docs') return
-
- memo.concat(this.expand(token + key, memo))
- }, this)
-
- return memo
- }
-
- /**
- * Returns a representation of the token store ready for serialisation.
- *
- * @returns {Object}
- * @memberOf TokenStore
- */
- lunr.TokenStore.prototype.toJSON = function () {
- return {
- root: this.root,
- length: this.length
- }
- }
-
-
- /**
- * export the module via AMD, CommonJS or as a browser global
- * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
- */
- ;(function (root, factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define(factory)
- } else if (typeof exports === 'object') {
- /**
- * Node. Does not work with strict CommonJS, but
- * only CommonJS-like enviroments that support module.exports,
- * like Node.
- */
- module.exports = factory()
- } else {
- // Browser globals (root is window)
- root.lunr = factory()
- }
- }(this, function () {
- /**
- * Just return a value to define the module export.
- * This example returns an object, but the module
- * can return a function as the exported value.
- */
- return lunr
- }))
-})()
diff --git a/apidocs/cloud-api-source/source/layouts/layout.erb b/apidocs/cloud-api-source/source/layouts/layout.erb
deleted file mode 100644
index 9f8cc27c76..0000000000
--- a/apidocs/cloud-api-source/source/layouts/layout.erb
+++ /dev/null
@@ -1,108 +0,0 @@
-<%#
-Copyright 2008-2013 Concur Technologies, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may
-not use this file except in compliance with the License. You may obtain
-a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations
-under the License.
-%>
-<% language_tabs = current_page.data.language_tabs %>
-
-
-
-
-
-
-
<%= current_page.data.title || "API Documentation" %>
-
- <%= stylesheet_link_tag :screen, media: :screen %>
- <%= stylesheet_link_tag :print, media: :print %>
-
-
- <% if current_page.data.search %>
- <%= javascript_include_tag "all" %>
- <% else %>
- <%= javascript_include_tag "all_nosearch" %>
- <% end %>
-
- <% if language_tabs %>
-
- <% end %>
-
-
-
-
-
- NAV
- <%= image_tag('navbar.png') %>
-
-
-
- <%= image_tag "logo.png" %>
- <% if language_tabs %>
-
- <% end %>
- <% if current_page.data.search %>
-
-
-
-
- <% end %>
-
-
- <% if current_page.data.toc_footers %>
-
- <% end %>
-
-
-
-
- <%= yield %>
- <% current_page.data.includes && current_page.data.includes.each do |include| %>
- <%= partial "includes/#{include}" %>
- <% end %>
-
-
- <% if language_tabs %>
-
- <% end %>
-
-
-
-
diff --git a/apidocs/cloud-api-source/source/stylesheets/_icon-font.scss b/apidocs/cloud-api-source/source/stylesheets/_icon-font.scss
deleted file mode 100644
index b599483988..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/_icon-font.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-@font-face {
- font-family: 'slate';
- src:font-url('slate.eot?-syv14m');
- src:font-url('slate.eot?#iefix-syv14m') format('embedded-opentype'),
- font-url('slate.woff2?-syv14m') format('woff2'),
- font-url('slate.woff?-syv14m') format('woff'),
- font-url('slate.ttf?-syv14m') format('truetype'),
- font-url('slate.svg?-syv14m#slate') format('svg');
- font-weight: normal;
- font-style: normal;
-}
-
-%icon {
- font-family: 'slate';
- speak: none;
- font-style: normal;
- font-weight: normal;
- font-variant: normal;
- text-transform: none;
- line-height: 1;
-}
-
-%icon-exclamation-sign {
- @extend %icon;
- content: "\e600";
-}
-%icon-info-sign {
- @extend %icon;
- content: "\e602";
-}
-%icon-ok-sign {
- @extend %icon;
- content: "\e606";
-}
-%icon-search {
- @extend %icon;
- content: "\e607";
-}
diff --git a/apidocs/cloud-api-source/source/stylesheets/_normalize.css b/apidocs/cloud-api-source/source/stylesheets/_normalize.css
deleted file mode 100644
index 46f646a5c0..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/_normalize.css
+++ /dev/null
@@ -1,427 +0,0 @@
-/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
-
-/**
- * 1. Set default font family to sans-serif.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- * user zoom.
- */
-
-html {
- font-family: sans-serif; /* 1 */
- -ms-text-size-adjust: 100%; /* 2 */
- -webkit-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Remove default margin.
- */
-
-body {
- margin: 0;
-}
-
-/* HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined for any HTML5 element in IE 8/9.
- * Correct `block` display not defined for `details` or `summary` in IE 10/11
- * and Firefox.
- * Correct `block` display not defined for `main` in IE 11.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-menu,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * 1. Correct `inline-block` display not defined in IE 8/9.
- * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
- */
-
-audio,
-canvas,
-progress,
-video {
- display: inline-block; /* 1 */
- vertical-align: baseline; /* 2 */
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address `[hidden]` styling not present in IE 8/9/10.
- * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
- */
-
-[hidden],
-template {
- display: none;
-}
-
-/* Links
- ========================================================================== */
-
-/**
- * Remove the gray background color from active links in IE 10.
- */
-
-a {
- background-color: transparent;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* Text-level semantics
- ========================================================================== */
-
-/**
- * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-/**
- * Address styling not present in Safari and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address variable `h1` font-size and margin within `section` and `article`
- * contexts in Firefox 4+, Safari, and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-/**
- * Address styling not present in IE 8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* Embedded content
- ========================================================================== */
-
-/**
- * Remove border when inside `a` element in IE 8/9/10.
- */
-
-img {
- border: 0;
-}
-
-/**
- * Correct overflow not hidden in IE 9/10/11.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* Grouping content
- ========================================================================== */
-
-/**
- * Address margin not present in IE 8/9 and Safari.
- */
-
-figure {
- margin: 1em 40px;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- */
-
-hr {
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- height: 0;
-}
-
-/**
- * Contain overflow in all browsers.
- */
-
-pre {
- overflow: auto;
-}
-
-/**
- * Address odd `em`-unit font size rendering in all browsers.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, monospace;
- font-size: 1em;
-}
-
-/* Forms
- ========================================================================== */
-
-/**
- * Known limitation: by default, Chrome and Safari on OS X allow very limited
- * styling of `select`, unless a `border` property is set.
- */
-
-/**
- * 1. Correct color not being inherited.
- * Known issue: affects color of disabled elements.
- * 2. Correct font properties not being inherited.
- * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
- */
-
-button,
-input,
-optgroup,
-select,
-textarea {
- color: inherit; /* 1 */
- font: inherit; /* 2 */
- margin: 0; /* 3 */
-}
-
-/**
- * Address `overflow` set to `hidden` in IE 8/9/10/11.
- */
-
-button {
- overflow: visible;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
- * Correct `select` style inheritance in Firefox.
- */
-
-button,
-select {
- text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- -webkit-appearance: button; /* 2 */
- cursor: pointer; /* 3 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * Remove inner padding and border in Firefox 4+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * Address Firefox 4+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-input {
- line-height: normal;
-}
-
-/**
- * It's recommended that you don't attempt to style these elements.
- * Firefox's implementation doesn't respect box-sizing, padding, or width.
- *
- * 1. Address box sizing set to `content-box` in IE 8/9/10.
- * 2. Remove excess padding in IE 8/9/10.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Fix the cursor style for Chrome's increment/decrement buttons. For certain
- * `font-size` values of the `input`, it causes the cursor style of the
- * decrement button to change from `default` to `text`.
- */
-
-input[type="number"]::-webkit-inner-spin-button,
-input[type="number"]::-webkit-outer-spin-button {
- height: auto;
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
- * (include `-moz` to future-proof).
- */
-
-input[type="search"] {
- -webkit-appearance: textfield; /* 1 */
- -moz-box-sizing: content-box;
- -webkit-box-sizing: content-box; /* 2 */
- box-sizing: content-box;
-}
-
-/**
- * Remove inner padding and search cancel button in Safari and Chrome on OS X.
- * Safari (but not Chrome) clips the cancel button when the search input has
- * padding (and `textfield` appearance).
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct `color` not being inherited in IE 8/9/10/11.
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Remove default vertical scrollbar in IE 8/9/10/11.
- */
-
-textarea {
- overflow: auto;
-}
-
-/**
- * Don't inherit the `font-weight` (applied by a rule above).
- * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
- */
-
-optgroup {
- font-weight: bold;
-}
-
-/* Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-td,
-th {
- padding: 0;
-}
diff --git a/apidocs/cloud-api-source/source/stylesheets/_syntax.scss.erb b/apidocs/cloud-api-source/source/stylesheets/_syntax.scss.erb
deleted file mode 100644
index dfeb0c1524..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/_syntax.scss.erb
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2008-2013 Concur Technologies, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may
-not use this file except in compliance with the License. You may obtain
-a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations
-under the License.
-*/
-
-@import 'variables';
-
-<%= Rouge::Themes::Base16::Monokai.render(:scope => '.highlight') %>
-
-.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs {
- color: #909090;
-}
-
-.highlight, .highlight .w {
- background-color: $code-bg;
-}
\ No newline at end of file
diff --git a/apidocs/cloud-api-source/source/stylesheets/_variables.scss b/apidocs/cloud-api-source/source/stylesheets/_variables.scss
deleted file mode 100644
index 5fe64b1f30..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/_variables.scss
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-Copyright 2008-2013 Concur Technologies, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may
-not use this file except in compliance with the License. You may obtain
-a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations
-under the License.
-*/
-
-
-////////////////////////////////////////////////////////////////////////////////
-// CUSTOMIZE SLATE
-////////////////////////////////////////////////////////////////////////////////
-// Use these settings to help adjust the appearance of Slate
-
-
-// BACKGROUND COLORS
-////////////////////
-$nav-bg: #393939;
-$examples-bg: #393939;
-$code-bg: #292929;
-$code-annotation-bg: #1c1c1c;
-$nav-subitem-bg: #262626;
-$nav-active-bg: #2467af;
-$lang-select-border: #000;
-$lang-select-bg: #222;
-$lang-select-active-bg: $examples-bg; // feel free to change this to blue or something
-$lang-select-pressed-bg: #111; // color of language tab bg when mouse is pressed
-$main-bg: #eaf2f6;
-$aside-notice-bg: #8fbcd4;
-$aside-warning-bg: #c97a7e;
-$aside-success-bg: #6ac174;
-$search-notice-bg: #c97a7e;
-
-
-// TEXT COLORS
-////////////////////
-$main-text: #333; // main content text color
-$nav-text: #fff;
-$nav-active-text: #fff;
-$lang-select-text: #fff; // color of unselected language tab text
-$lang-select-active-text: #fff; // color of selected language tab text
-$lang-select-pressed-text: #fff; // color of language tab text when mouse is pressed
-
-
-// SIZES
-////////////////////
-$nav-width: 230px; // width of the navbar
-$examples-width: 50%; // portion of the screen taken up by code examples
-$logo-margin: 20px; // margin between nav items and logo, ignored if search is active
-$main-padding: 28px; // padding to left and right of content & examples
-$nav-padding: 15px; // padding to left and right of navbar
-$nav-v-padding: 10px; // padding used vertically around search boxes and results
-$nav-indent: 10px; // extra padding for ToC subitems
-$code-annotation-padding: 13px; // padding inside code annotations
-$h1-margin-bottom: 21px; // padding under the largest header tags
-$tablet-width: 930px; // min width before reverting to tablet size
-$phone-width: $tablet-width - $nav-width; // min width before reverting to mobile size
-
-
-// FONTS
-////////////////////
-%default-font {
- font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei","微软雅黑", STXihei, "华文细黑", sans-serif;
- font-size: 13px;
-}
-
-%header-font {
- @extend %default-font;
- font-weight: bold;
-}
-
-%code-font {
- font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif;
- font-size: 12px;
- line-height: 1.5;
-}
-
-
-// OTHER
-////////////////////
-$nav-active-shadow: #000;
-$nav-footer-border-color: #666;
-$nav-embossed-border-top: #000;
-$nav-embossed-border-bottom: #939393;
-$main-embossed-text-shadow: 0px 1px 0px #fff;
-$search-box-border-color: #666;
-
-
-////////////////////////////////////////////////////////////////////////////////
-// INTERNAL
-////////////////////////////////////////////////////////////////////////////////
-// These settings are probably best left alone.
-
-%break-words {
- word-break: break-all;
-
- /* Non standard for webkit */
- word-break: break-word;
-
- hyphens: auto;
-}
diff --git a/apidocs/cloud-api-source/source/stylesheets/print.css.scss b/apidocs/cloud-api-source/source/stylesheets/print.css.scss
deleted file mode 100644
index 4bda057f01..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/print.css.scss
+++ /dev/null
@@ -1,142 +0,0 @@
-@charset "utf-8";
-@import 'normalize';
-@import 'compass';
-@import 'variables';
-@import 'icon-font';
-
-/*
-Copyright 2008-2013 Concur Technologies, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may
-not use this file except in compliance with the License. You may obtain
-a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations
-under the License.
-*/
-
-$print-color: #999;
-$print-color-light: #ccc;
-$print-font-size: 12px;
-
-body {
- @extend %default-font;
-}
-
-.tocify, .toc-footer, .lang-selector, .search, #nav-button {
- display: none;
-}
-
-.tocify-wrapper>img {
- margin: 0 auto;
- display: block;
-}
-
-.content {
- font-size: 12px;
-
- pre, code {
- @extend %code-font;
- @extend %break-words;
- border: 1px solid $print-color;
- border-radius: 5px;
- font-size: 0.8em;
- }
-
- pre {
- padding: 1.3em;
- }
-
- code {
- padding: 0.2em;
- }
-
- table {
- border: 1px solid $print-color;
- tr {
- border-bottom: 1px solid $print-color;
- }
- td,th {
- padding: 0.7em;
- }
- }
-
- p {
- line-height: 1.5;
- }
-
- a {
- text-decoration: none;
- color: #000;
- }
-
- h1 {
- @extend %header-font;
- font-size: 2.5em;
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- margin-top: 1em;
- margin-bottom: $h1-margin-bottom;
- border: 2px solid $print-color-light;
- border-width: 2px 0;
- text-align: center;
- }
-
- h2 {
- @extend %header-font;
- font-size: 1.8em;
- margin-top: 2em;
- border-top: 2px solid $print-color-light;
- padding-top: 0.8em;
- }
-
- h1+h2, h1+div+h2 {
- border-top: none;
- padding-top: 0;
- margin-top: 0;
- }
-
- h3, h4 {
- @extend %header-font;
- font-size: 0.8em;
- margin-top: 1.5em;
- margin-bottom: 0.8em;
- text-transform: uppercase;
- }
-
- h5, h6 {
- text-transform: uppercase;
- }
-
- aside {
- padding: 1em;
- border: 1px solid $print-color-light;
- border-radius: 5px;
- margin-top: 1.5em;
- margin-bottom: 1.5em;
- line-height: 1.6;
- }
-
- aside:before {
- vertical-align: middle;
- padding-right: 0.5em;
- font-size: 14px;
- }
-
- aside.notice:before {
- @extend %icon-info-sign;
- }
-
- aside.warning:before {
- @extend %icon-exclamation-sign;
- }
-
- aside.success:before {
- @extend %icon-ok-sign;
- }
-}
\ No newline at end of file
diff --git a/apidocs/cloud-api-source/source/stylesheets/screen.css.scss b/apidocs/cloud-api-source/source/stylesheets/screen.css.scss
deleted file mode 100644
index e4b3ef82b2..0000000000
--- a/apidocs/cloud-api-source/source/stylesheets/screen.css.scss
+++ /dev/null
@@ -1,620 +0,0 @@
-@charset "utf-8";
-@import 'normalize';
-@import 'compass';
-@import 'variables';
-@import 'syntax';
-@import 'icon-font';
-
-/*
-Copyright 2008-2013 Concur Technologies, Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may
-not use this file except in compliance with the License. You may obtain
-a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations
-under the License.
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// GENERAL STUFF
-////////////////////////////////////////////////////////////////////////////////
-
-html, body {
- color: $main-text;
- padding: 0;
- margin: 0;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- @extend %default-font;
- background-color: $main-bg;
- height: 100%;
- -webkit-text-size-adjust: none; /* Never autoresize text */
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// TABLE OF CONTENTS
-////////////////////////////////////////////////////////////////////////////////
-
-#toc > ul > li > a > span {
- float: right;
- background-color: #2484FF;
- border-radius: 40px;
- width: 20px;
-}
-
-@mixin embossed-bg {
- background:
- linear-gradient(to bottom, rgba(#000, 0.2), rgba(#000, 0) 8px),
- linear-gradient(to top, rgba(#000, 0.2), rgba(#000, 0) 8px),
- linear-gradient(to bottom, rgba($nav-embossed-border-top, 1), rgba($nav-embossed-border-top, 0) 1.5px),
- linear-gradient(to top, rgba($nav-embossed-border-bottom, 1), rgba($nav-embossed-border-bottom, 0) 1.5px),
- $nav-subitem-bg;
-}
-
-.tocify-wrapper {
- transition: left 0.3s ease-in-out;
-
- overflow-y: auto;
- overflow-x: hidden;
- position: fixed;
- z-index: 30;
- top: 0;
- left: 0;
- bottom: 0;
- width: $nav-width;
- background-color: $nav-bg;
- font-size: 13px;
- font-weight: bold;
-
- // language selector for mobile devices
- .lang-selector {
- display: none;
- a {
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- }
- }
-
- // This is the logo at the top of the ToC
- &>img {
- display: block;
- }
-
- &>.search {
- position: relative;
-
- input {
- background: $nav-bg;
- border-width: 0 0 1px 0;
- border-color: $search-box-border-color;
- padding: 6px 0 6px 20px;
- box-sizing: border-box;
- margin: $nav-v-padding $nav-padding;
- width: $nav-width - 30;
- outline: none;
- color: $nav-text;
- border-radius: 0; /* ios has a default border radius */
- }
-
- &:before {
- position: absolute;
- top: 17px;
- left: $nav-padding;
- color: $nav-text;
- @extend %icon-search;
- }
- }
-
- img+.tocify {
- margin-top: $logo-margin;
- }
-
- .search-results {
- margin-top: 0;
- box-sizing: border-box;
- height: 0;
- overflow-y: auto;
- overflow-x: hidden;
- transition-property: height, margin;
- transition-duration: 180ms;
- transition-timing-function: ease-in-out;
- &.visible {
- height: 30%;
- margin-bottom: 1em;
- }
-
- @include embossed-bg;
-
- li {
- margin: 1em $nav-padding;
- line-height: 1;
- }
-
- a {
- color: $nav-text;
- text-decoration: none;
-
- &:hover {
- text-decoration: underline;
- }
- }
- }
-
-
- .tocify-item>a, .toc-footer li {
- padding: 0 $nav-padding 0 $nav-padding;
- display: block;
- overflow-x: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- // The Table of Contents is composed of multiple nested
- // unordered lists. These styles remove the default
- // styling of an unordered list because it is ugly.
- ul, li {
- list-style: none;
- margin: 0;
- padding: 0;
- line-height: 28px;
- }
-
- li {
- color: $nav-text;
- transition-property: background;
- transition-timing-function: linear;
- transition-duration: 230ms;
- }
-
- // This is the currently selected ToC entry
- .tocify-focus {
- box-shadow: 0px 1px 0px $nav-active-shadow;
- background-color: $nav-active-bg;
- color: $nav-active-text;
- }
-
- // Subheaders are the submenus that slide open
- // in the table of contents.
- .tocify-subheader {
- display: none; // tocify will override this when needed
- background-color: $nav-subitem-bg;
- font-weight: 500;
- .tocify-item>a {
- padding-left: $nav-padding + $nav-indent;
- font-size: 12px;
- }
-
- // for embossed look:
- @include embossed-bg;
- &>li:last-child {
- box-shadow: none; // otherwise it'll overflow out of the subheader
- }
- }
-
- .toc-footer {
- padding: 1em 0;
- margin-top: 1em;
- border-top: 1px dashed $nav-footer-border-color;
-
- li,a {
- color: $nav-text;
- text-decoration: none;
- }
-
- a:hover {
- text-decoration: underline;
- }
-
- li {
- font-size: 0.8em;
- line-height: 1.7;
- text-decoration: none;
- }
- }
-
-}
-
-// button to show navigation on mobile devices
-#nav-button {
- span {
- display: block;
- $side-pad: $main-padding / 2 - 8px;
- padding: $side-pad $side-pad $side-pad;
- background-color: rgba($main-bg, 0.7);
- transform-origin: 0 0;
- transform: rotate(-90deg) translate(-100%, 0);
- border-radius: 0 0 0 5px;
- }
- padding: 0 1.5em 5em 0; // increase touch size area
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 100;
- color: #000;
- text-decoration: none;
- font-weight: bold;
- opacity: 0.7;
- line-height: 16px;
- img {
- height: 16px;
- vertical-align: bottom;
- }
-
- transition: left 0.3s ease-in-out;
-
- &:hover { opacity: 1; }
- &.open {left: $nav-width}
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
-////////////////////////////////////////////////////////////////////////////////
-
-.page-wrapper {
- margin-left: $nav-width;
- position: relative;
- z-index: 10;
- background-color: $main-bg;
- min-height: 100%;
-
- padding-bottom: 1px; // prevent margin overflow
-
- // The dark box is what gives the code samples their dark background.
- // It sits essentially under the actual content block, which has a
- // transparent background.
- // I know, it's hackish, but it's the simplist way to make the left
- // half of the content always this background color.
- .dark-box {
- width: $examples-width;
- background-color: $examples-bg;
- position: absolute;
- right: 0;
- top: 0;
- bottom: 0;
- }
-
- .lang-selector {
- position: fixed;
- z-index: 50;
- border-bottom: 5px solid $lang-select-active-bg;
- }
-}
-
-.lang-selector {
- background-color: $lang-select-bg;
- width: 100%;
- font-weight: bold;
- a {
- display: block;
- float:left;
- color: $lang-select-text;
- text-decoration: none;
- padding: 0 10px;
- line-height: 30px;
- outline: 0;
-
- &:active, &:focus {
- background-color: $lang-select-pressed-bg;
- color: $lang-select-pressed-text;
- }
-
- &.active {
- background-color: $lang-select-active-bg;
- color: $lang-select-active-text;
- }
- }
-
- &:after {
- content: '';
- clear: both;
- display: block;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// CONTENT STYLES
-////////////////////////////////////////////////////////////////////////////////
-// This is all the stuff with the light background in the left half of the page
-
-.content {
- // to place content above the dark box
- position: relative;
- z-index: 30;
-
- &:after {
- content: '';
- display: block;
- clear: both;
- }
-
- &>h1, &>h2, &>h3, &>h4, &>h5, &>h6, &>p, &>table, &>ul, &>ol, &>aside, &>dl {
- margin-right: $examples-width;
- padding: 0 $main-padding;
- box-sizing: border-box;
- display: block;
- @include text-shadow($main-embossed-text-shadow);
-
- @extend %left-col;
- }
-
- &>ul, &>ol {
- padding-left: $main-padding + 15px;
- }
-
- // the div is the tocify hidden div for placeholding stuff
- &>h1, &>h2, &>div {
- clear:both;
- }
-
- h1 {
- @extend %header-font;
- font-size: 30px;
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- border-bottom: 1px solid #ccc;
- margin-bottom: $h1-margin-bottom;
- margin-top: 2em;
- border-top: 1px solid #ddd;
- background-image: linear-gradient(to bottom, #fff, #f9f9f9);
- }
-
- h1:first-child, div:first-child + h1 {
- border-top-width: 0;
- margin-top: 0;
- }
-
- h2 {
- @extend %header-font;
- font-size: 20px;
- margin-top: 4em;
- margin-bottom: 0;
- border-top: 1px solid #ccc;
- padding-top: 1.2em;
- padding-bottom: 1.2em;
- background-image: linear-gradient(to bottom, rgba(#fff, 0.4), rgba(#fff, 0));
- }
-
- // h2s right after h1s should bump right up
- // against the h1s.
- h1 + h2, h1 + div + h2 {
- margin-top: $h1-margin-bottom * -1;
- border-top: none;
- }
-
- h3, h4, h5, h6 {
- @extend %header-font;
- font-size: 15px;
- margin-top: 2.5em;
- margin-bottom: 0.8em;
- }
-
- h4, h5, h6 {
- font-size: 10px;
- }
-
- hr {
- margin: 2em 0;
- border-top: 2px solid $examples-bg;
- border-bottom: 2px solid $main-bg;
- }
-
- table {
- margin-bottom: 1em;
- overflow: auto;
- th,td {
- text-align: left;
- vertical-align: top;
- line-height: 1.6;
- }
-
- th {
- padding: 5px 10px;
- border-bottom: 1px solid #ccc;
- vertical-align: bottom;
- }
-
- td {
- padding: 10px;
- }
-
- tr:last-child {
- border-bottom: 1px solid #ccc;
- }
-
- tr:nth-child(odd)>td {
- background-color: lighten($main-bg,4.2%);
- }
-
- tr:nth-child(even)>td {
- background-color: lighten($main-bg,2.4%);
- }
- }
-
- dt {
- font-weight: bold;
- }
-
- dd {
- margin-left: 15px;
- }
-
- p, li, dt, dd {
- line-height: 1.6;
- margin-top: 0;
- }
-
- img {
- max-width: 100%;
- }
-
- code {
- background-color: rgba(0,0,0,0.05);
- padding: 3px;
- border-radius: 3px;
- @extend %break-words;
- @extend %code-font;
- }
-
- pre>code {
- background-color: transparent;
- padding: 0;
- }
-
- aside {
- padding-top: 1em;
- padding-bottom: 1em;
- @include text-shadow(0 1px 0 lighten($aside-notice-bg, 15%));
- margin-top: 1.5em;
- margin-bottom: 1.5em;
- background: $aside-notice-bg;
- line-height: 1.6;
-
- &.warning {
- background-color: $aside-warning-bg;
- @include text-shadow(0 1px 0 lighten($aside-warning-bg, 15%));
- }
-
- &.success {
- background-color: $aside-success-bg;
- @include text-shadow(0 1px 0 lighten($aside-success-bg, 15%));
- }
- }
-
- aside:before {
- vertical-align: middle;
- padding-right: 0.5em;
- font-size: 14px;
- }
-
- aside.notice:before {
- @extend %icon-info-sign;
- }
-
- aside.warning:before {
- @extend %icon-exclamation-sign;
- }
-
- aside.success:before {
- @extend %icon-ok-sign;
- }
-
- .search-highlight {
- padding: 2px;
- margin: -2px;
- border-radius: 4px;
- border: 1px solid #F7E633;
- @include text-shadow(1px 1px 0 #666);
- background: linear-gradient(to top left, #F7E633 0%, #F1D32F 100%);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// CODE SAMPLE STYLES
-////////////////////////////////////////////////////////////////////////////////
-// This is all the stuff that appears in the right half of the page
-
-.content {
- pre, blockquote {
- background-color: $code-bg;
- color: #fff;
-
- padding: 2em $main-padding;
- margin: 0;
- width: $examples-width;
-
- float:right;
- clear:right;
-
- box-sizing: border-box;
- @include text-shadow(0px 1px 2px rgba(0,0,0,0.4));
-
- @extend %right-col;
-
- &>p { margin: 0; }
-
- a {
- color: #fff;
- text-decoration: none;
- border-bottom: dashed 1px #ccc;
- }
- }
-
- pre {
- @extend %code-font;
- }
-
- blockquote {
- &>p {
- background-color: $code-annotation-bg;
- border-radius: 5px;
- padding: $code-annotation-padding;
- color: #ccc;
- border-top: 1px solid #000;
- border-bottom: 1px solid #404040;
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// RESPONSIVE DESIGN
-////////////////////////////////////////////////////////////////////////////////
-// These are the styles for phones and tablets
-// There are also a couple styles disperesed
-
-@media (max-width: $tablet-width) {
- .tocify-wrapper {
- left: -$nav-width;
-
- &.open {
- left: 0;
- }
- }
-
- .page-wrapper {
- margin-left: 0;
- }
-
- #nav-button {
- display: block;
- }
-
- .tocify-wrapper .tocify-item > a {
- padding-top: 0.3em;
- padding-bottom: 0.3em;
- }
-}
-
-@media (max-width: $phone-width) {
- .dark-box {
- display: none;
- }
-
- %left-col {
- margin-right: 0;
- }
-
- .tocify-wrapper .lang-selector {
- display: block;
- }
-
- .page-wrapper .lang-selector {
- display: none;
- }
-
- %right-col {
- width: auto;
- float: none;
- }
-
- %right-col + %left-col {
- margin-top: $main-padding;
- }
-}
diff --git a/edge/engine/reference/run.md b/edge/engine/reference/run.md
new file mode 100644
index 0000000000..f5deddfec6
--- /dev/null
+++ b/edge/engine/reference/run.md
@@ -0,0 +1,1601 @@
+---
+title: "Docker run reference"
+description: "Configure containers at runtime"
+keywords: "docker, run, configure, runtime"
+---
+
+
+
+# Docker run reference
+
+Docker runs processes in isolated containers. A container is a process
+which runs on a host. The host may be local or remote. When an operator
+executes `docker run`, the container process that runs is isolated in
+that it has its own file system, its own networking, and its own
+isolated process tree separate from the host.
+
+This page details how to use the `docker run` command to define the
+container's resources at runtime.
+
+## General form
+
+The basic `docker run` command takes this form:
+
+ $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
+
+The `docker run` command must specify an [*IMAGE*](glossary.md#image)
+to derive the container from. An image developer can define image
+defaults related to:
+
+ * detached or foreground running
+ * container identification
+ * network settings
+ * runtime constraints on CPU and memory
+
+With the `docker run [OPTIONS]` an operator can add to or override the
+image defaults set by a developer. And, additionally, operators can
+override nearly all the defaults set by the Docker runtime itself. The
+operator's ability to override image and Docker runtime defaults is why
+[*run*](commandline/run.md) has more options than any
+other `docker` command.
+
+To learn how to interpret the types of `[OPTIONS]`, see [*Option
+types*](commandline/cli.md#option-types).
+
+> **Note**: Depending on your Docker system configuration, you may be
+> required to preface the `docker run` command with `sudo`. To avoid
+> having to use `sudo` with the `docker` command, your system
+> administrator can create a Unix group called `docker` and add users to
+> it. For more information about this configuration, refer to the Docker
+> installation documentation for your operating system.
+
+
+## Operator exclusive options
+
+Only the operator (the person executing `docker run`) can set the
+following options.
+
+ - [Detached vs foreground](#detached-vs-foreground)
+ - [Detached (-d)](#detached--d)
+ - [Foreground](#foreground)
+ - [Container identification](#container-identification)
+ - [Name (--name)](#name---name)
+ - [PID equivalent](#pid-equivalent)
+ - [IPC settings (--ipc)](#ipc-settings---ipc)
+ - [Network settings](#network-settings)
+ - [Restart policies (--restart)](#restart-policies---restart)
+ - [Clean up (--rm)](#clean-up---rm)
+ - [Runtime constraints on resources](#runtime-constraints-on-resources)
+ - [Runtime privilege and Linux capabilities](#runtime-privilege-and-linux-capabilities)
+
+## Detached vs foreground
+
+When starting a Docker container, you must first decide if you want to
+run the container in the background in a "detached" mode or in the
+default foreground mode:
+
+ -d=false: Detached mode: Run container in the background, print new container id
+
+### Detached (-d)
+
+To start a container in detached mode, you use `-d=true` or just `-d` option. By
+design, containers started in detached mode exit when the root process used to
+run the container exits. A container in detached mode cannot be automatically
+removed when it stops, this means you cannot use the `--rm` option with `-d` option.
+
+Do not pass a `service x start` command to a detached container. For example, this
+command attempts to start the `nginx` service.
+
+ $ docker run -d -p 80:80 my_image service nginx start
+
+This succeeds in starting the `nginx` service inside the container. However, it
+fails the detached container paradigm in that, the root process (`service nginx
+start`) returns and the detached container stops as designed. As a result, the
+`nginx` service is started but could not be used. Instead, to start a process
+such as the `nginx` web server do the following:
+
+ $ docker run -d -p 80:80 my_image nginx -g 'daemon off;'
+
+To do input/output with a detached container use network connections or shared
+volumes. These are required because the container is no longer listening to the
+command line where `docker run` was run.
+
+To reattach to a detached container, use `docker`
+[*attach*](commandline/attach.md) command.
+
+### Foreground
+
+In foreground mode (the default when `-d` is not specified), `docker
+run` can start the process in the container and attach the console to
+the process's standard input, output, and standard error. It can even
+pretend to be a TTY (this is what most command line executables expect)
+and pass along signals. All of that is configurable:
+
+ -a=[] : Attach to `STDIN`, `STDOUT` and/or `STDERR`
+ -t : Allocate a pseudo-tty
+ --sig-proxy=true: Proxy all received signals to the process (non-TTY mode only)
+ -i : Keep STDIN open even if not attached
+
+If you do not specify `-a` then Docker will [attach to both stdout and stderr
+]( https://github.com/docker/docker/blob/4118e0c9eebda2412a09ae66e90c34b85fae3275/runconfig/opts/parse.go#L267).
+You can specify to which of the three standard streams (`STDIN`, `STDOUT`,
+`STDERR`) you'd like to connect instead, as in:
+
+ $ docker run -a stdin -a stdout -i -t ubuntu /bin/bash
+
+For interactive processes (like a shell), you must use `-i -t` together in
+order to allocate a tty for the container process. `-i -t` is often written `-it`
+as you'll see in later examples. Specifying `-t` is forbidden when the client
+standard output is redirected or piped, such as in:
+
+ $ echo test | docker run -i busybox cat
+
+>**Note**: A process running as PID 1 inside a container is treated
+>specially by Linux: it ignores any signal with the default action.
+>So, the process will not terminate on `SIGINT` or `SIGTERM` unless it is
+>coded to do so.
+
+## Container identification
+
+### Name (--name)
+
+The operator can identify a container in three ways:
+
+| Identifier type | Example value |
+| --------------------- | ------------------------------------------------------------------ |
+| UUID long identifier | "f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778" |
+| UUID short identifier | "f78375b1c487" |
+| Name | "evil_ptolemy" |
+
+The UUID identifiers come from the Docker daemon. If you do not assign a
+container name with the `--name` option, then the daemon generates a random
+string name for you. Defining a `name` can be a handy way to add meaning to a
+container. If you specify a `name`, you can use it when referencing the
+container within a Docker network. This works for both background and foreground
+Docker containers.
+
+> **Note**: Containers on the default bridge network must be linked to
+> communicate by name.
+
+### PID equivalent
+
+Finally, to help with automation, you can have Docker write the
+container ID out to a file of your choosing. This is similar to how some
+programs might write out their process ID to a file (you've seen them as
+PID files):
+
+ --cidfile="": Write the container ID to the file
+
+### Image[:tag]
+
+While not strictly a means of identifying a container, you can specify a version of an
+image you'd like to run the container with by adding `image[:tag]` to the command. For
+example, `docker run ubuntu:14.04`.
+
+### Image[@digest]
+
+Images using the v2 or later image format have a content-addressable identifier
+called a digest. As long as the input used to generate the image is unchanged,
+the digest value is predictable and referenceable.
+
+The following example runs a container from the `alpine` image with the
+`sha256:9cacb71397b640eca97488cf08582ae4e4068513101088e9f96c9814bfda95e0` digest:
+
+ $ docker run alpine@sha256:9cacb71397b640eca97488cf08582ae4e4068513101088e9f96c9814bfda95e0 date
+
+## PID settings (--pid)
+
+ --pid="" : Set the PID (Process) Namespace mode for the container,
+ 'container:
': joins another container's PID namespace
+ 'host': use the host's PID namespace inside the container
+
+By default, all containers have the PID namespace enabled.
+
+PID namespace provides separation of processes. The PID Namespace removes the
+view of the system processes, and allows process ids to be reused including
+pid 1.
+
+In certain cases you want your container to share the host's process namespace,
+basically allowing processes within the container to see all of the processes
+on the system. For example, you could build a container with debugging tools
+like `strace` or `gdb`, but want to use these tools when debugging processes
+within the container.
+
+### Example: run htop inside a container
+
+Create this Dockerfile:
+
+```
+FROM alpine:latest
+RUN apk add --update htop && rm -rf /var/cache/apk/*
+CMD ["htop"]
+```
+
+Build the Dockerfile and tag the image as `myhtop`:
+
+```bash
+$ docker build -t myhtop .
+```
+
+Use the following command to run `htop` inside a container:
+
+```
+$ docker run -it --rm --pid=host myhtop
+```
+
+Joining another container's pid namespace can be used for debugging that container.
+
+### Example
+
+Start a container running a redis server:
+
+```bash
+$ docker run --name my-redis -d redis
+```
+
+Debug the redis container by running another container that has strace in it:
+
+```bash
+$ docker run -it --pid=container:my-redis my_strace_docker_image bash
+$ strace -p 1
+```
+
+## UTS settings (--uts)
+
+ --uts="" : Set the UTS namespace mode for the container,
+ 'host': use the host's UTS namespace inside the container
+
+The UTS namespace is for setting the hostname and the domain that is visible
+to running processes in that namespace. By default, all containers, including
+those with `--network=host`, have their own UTS namespace. The `host` setting will
+result in the container using the same UTS namespace as the host. Note that
+`--hostname` is invalid in `host` UTS mode.
+
+You may wish to share the UTS namespace with the host if you would like the
+hostname of the container to change as the hostname of the host changes. A
+more advanced use case would be changing the host's hostname from a container.
+
+## IPC settings (--ipc)
+
+ --ipc="" : Set the IPC mode for the container,
+ 'container:': reuses another container's IPC namespace
+ 'host': use the host's IPC namespace inside the container
+
+By default, all containers have the IPC namespace enabled.
+
+IPC (POSIX/SysV IPC) namespace provides separation of named shared memory
+segments, semaphores and message queues.
+
+Shared memory segments are used to accelerate inter-process communication at
+memory speed, rather than through pipes or through the network stack. Shared
+memory is commonly used by databases and custom-built (typically C/OpenMPI,
+C++/using boost libraries) high performance applications for scientific
+computing and financial services industries. If these types of applications
+are broken into multiple containers, you might need to share the IPC mechanisms
+of the containers.
+
+## Network settings
+
+ --dns=[] : Set custom dns servers for the container
+ --network="bridge" : Connect a container to a network
+ 'bridge': create a network stack on the default Docker bridge
+ 'none': no networking
+ 'container:': reuse another container's network stack
+ 'host': use the Docker host network stack
+ '|': connect to a user-defined network
+ --network-alias=[] : Add network-scoped alias for the container
+ --add-host="" : Add a line to /etc/hosts (host:IP)
+ --mac-address="" : Sets the container's Ethernet device's MAC address
+ --ip="" : Sets the container's Ethernet device's IPv4 address
+ --ip6="" : Sets the container's Ethernet device's IPv6 address
+ --link-local-ip=[] : Sets one or more container's Ethernet device's link local IPv4/IPv6 addresses
+
+By default, all containers have networking enabled and they can make any
+outgoing connections. The operator can completely disable networking
+with `docker run --network none` which disables all incoming and outgoing
+networking. In cases like this, you would perform I/O through files or
+`STDIN` and `STDOUT` only.
+
+Publishing ports and linking to other containers only works with the default (bridge). The linking feature is a legacy feature. You should always prefer using Docker network drivers over linking.
+
+Your container will use the same DNS servers as the host by default, but
+you can override this with `--dns`.
+
+By default, the MAC address is generated using the IP address allocated to the
+container. You can set the container's MAC address explicitly by providing a
+MAC address via the `--mac-address` parameter (format:`12:34:56:78:9a:bc`).Be
+aware that Docker does not check if manually specified MAC addresses are unique.
+
+Supported networks :
+
+
+
+
+ Network
+ Description
+
+
+
+
+ none
+
+ No networking in the container.
+
+
+
+ bridge (default)
+
+ Connect the container to the bridge via veth interfaces.
+
+
+
+ host
+
+ Use the host's network stack inside the container.
+
+
+
+ container :<name|id>
+
+ Use the network stack of another container, specified via
+ its name or id .
+
+
+
+ NETWORK
+
+ Connects the container to a user created network (using docker network create command)
+
+
+
+
+
+#### Network: none
+
+With the network is `none` a container will not have
+access to any external routes. The container will still have a
+`loopback` interface enabled in the container but it does not have any
+routes to external traffic.
+
+#### Network: bridge
+
+With the network set to `bridge` a container will use docker's
+default networking setup. A bridge is setup on the host, commonly named
+`docker0`, and a pair of `veth` interfaces will be created for the
+container. One side of the `veth` pair will remain on the host attached
+to the bridge while the other side of the pair will be placed inside the
+container's namespaces in addition to the `loopback` interface. An IP
+address will be allocated for containers on the bridge's network and
+traffic will be routed though this bridge to the container.
+
+Containers can communicate via their IP addresses by default. To communicate by
+name, they must be linked.
+
+#### Network: host
+
+With the network set to `host` a container will share the host's
+network stack and all interfaces from the host will be available to the
+container. The container's hostname will match the hostname on the host
+system. Note that `--mac-address` is invalid in `host` netmode. Even in `host`
+network mode a container has its own UTS namespace by default. As such
+`--hostname` is allowed in `host` network mode and will only change the
+hostname inside the container.
+Similar to `--hostname`, the `--add-host`, `--dns`, `--dns-search`, and
+`--dns-option` options can be used in `host` network mode. These options update
+`/etc/hosts` or `/etc/resolv.conf` inside the container. No change are made to
+`/etc/hosts` and `/etc/resolv.conf` on the host.
+
+Compared to the default `bridge` mode, the `host` mode gives *significantly*
+better networking performance since it uses the host's native networking stack
+whereas the bridge has to go through one level of virtualization through the
+docker daemon. It is recommended to run containers in this mode when their
+networking performance is critical, for example, a production Load Balancer
+or a High Performance Web Server.
+
+> **Note**: `--network="host"` gives the container full access to local system
+> services such as D-bus and is therefore considered insecure.
+
+#### Network: container
+
+With the network set to `container` a container will share the
+network stack of another container. The other container's name must be
+provided in the format of `--network container:`. Note that `--add-host`
+`--hostname` `--dns` `--dns-search` `--dns-option` and `--mac-address` are
+invalid in `container` netmode, and `--publish` `--publish-all` `--expose` are
+also invalid in `container` netmode.
+
+Example running a Redis container with Redis binding to `localhost` then
+running the `redis-cli` command and connecting to the Redis server over the
+`localhost` interface.
+
+ $ docker run -d --name redis example/redis --bind 127.0.0.1
+ $ # use the redis container's network stack to access localhost
+ $ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1
+
+#### User-defined network
+
+You can create a network using a Docker network driver or an external network
+driver plugin. You can connect multiple containers to the same network. Once
+connected to a user-defined network, the containers can communicate easily using
+only another container's IP address or name.
+
+For `overlay` networks or custom plugins that support multi-host connectivity,
+containers connected to the same multi-host network but launched from different
+Engines can also communicate in this way.
+
+The following example creates a network using the built-in `bridge` network
+driver and running a container in the created network
+
+```
+$ docker network create -d bridge my-net
+$ docker run --network=my-net -itd --name=container3 busybox
+```
+
+### Managing /etc/hosts
+
+Your container will have lines in `/etc/hosts` which define the hostname of the
+container itself as well as `localhost` and a few other common things. The
+`--add-host` flag can be used to add additional lines to `/etc/hosts`.
+
+ $ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
+ 172.17.0.22 09d03f76bf2c
+ fe00::0 ip6-localnet
+ ff00::0 ip6-mcastprefix
+ ff02::1 ip6-allnodes
+ ff02::2 ip6-allrouters
+ 127.0.0.1 localhost
+ ::1 localhost ip6-localhost ip6-loopback
+ 86.75.30.9 db-static
+
+If a container is connected to the default bridge network and `linked`
+with other containers, then the container's `/etc/hosts` file is updated
+with the linked container's name.
+
+> **Note** Since Docker may live update the container’s `/etc/hosts` file, there
+may be situations when processes inside the container can end up reading an
+empty or incomplete `/etc/hosts` file. In most cases, retrying the read again
+should fix the problem.
+
+## Restart policies (--restart)
+
+Using the `--restart` flag on Docker run you can specify a restart policy for
+how a container should or should not be restarted on exit.
+
+When a restart policy is active on a container, it will be shown as either `Up`
+or `Restarting` in [`docker ps`](commandline/ps.md). It can also be
+useful to use [`docker events`](commandline/events.md) to see the
+restart policy in effect.
+
+Docker supports the following restart policies:
+
+
+
+
+ Policy
+ Result
+
+
+
+
+ no
+
+ Do not automatically restart the container when it exits. This is the
+ default.
+
+
+
+
+
+ on-failure [:max-retries]
+
+
+
+ Restart only if the container exits with a non-zero exit status.
+ Optionally, limit the number of restart retries the Docker
+ daemon attempts.
+
+
+
+ always
+
+ Always restart the container regardless of the exit status.
+ When you specify always, the Docker daemon will try to restart
+ the container indefinitely. The container will also always start
+ on daemon startup, regardless of the current state of the container.
+
+
+
+ unless-stopped
+
+ Always restart the container regardless of the exit status, but
+ do not start it on daemon startup if the container has been put
+ to a stopped state before.
+
+
+
+
+
+An ever increasing delay (double the previous delay, starting at 100
+milliseconds) is added before each restart to prevent flooding the server.
+This means the daemon will wait for 100 ms, then 200 ms, 400, 800, 1600,
+and so on until either the `on-failure` limit is hit, or when you `docker stop`
+or `docker rm -f` the container.
+
+If a container is successfully restarted (the container is started and runs
+for at least 10 seconds), the delay is reset to its default value of 100 ms.
+
+You can specify the maximum amount of times Docker will try to restart the
+container when using the **on-failure** policy. The default is that Docker
+will try forever to restart the container. The number of (attempted) restarts
+for a container can be obtained via [`docker inspect`](commandline/inspect.md). For example, to get the number of restarts
+for container "my-container";
+
+ {% raw %}
+ $ docker inspect -f "{{ .RestartCount }}" my-container
+ # 2
+ {% endraw %}
+
+Or, to get the last time the container was (re)started;
+
+ {% raw %}
+ $ docker inspect -f "{{ .State.StartedAt }}" my-container
+ # 2015-03-04T23:47:07.691840179Z
+ {% endraw %}
+
+
+Combining `--restart` (restart policy) with the `--rm` (clean up) flag results
+in an error. On container restart, attached clients are disconnected. See the
+examples on using the [`--rm` (clean up)](#clean-up-rm) flag later in this page.
+
+### Examples
+
+ $ docker run --restart=always redis
+
+This will run the `redis` container with a restart policy of **always**
+so that if the container exits, Docker will restart it.
+
+ $ docker run --restart=on-failure:10 redis
+
+This will run the `redis` container with a restart policy of **on-failure**
+and a maximum restart count of 10. If the `redis` container exits with a
+non-zero exit status more than 10 times in a row Docker will abort trying to
+restart the container. Providing a maximum restart limit is only valid for the
+**on-failure** policy.
+
+## Exit Status
+
+The exit code from `docker run` gives information about why the container
+failed to run or why it exited. When `docker run` exits with a non-zero code,
+the exit codes follow the `chroot` standard, see below:
+
+**_125_** if the error is with Docker daemon **_itself_**
+
+ $ docker run --foo busybox; echo $?
+ # flag provided but not defined: --foo
+ See 'docker run --help'.
+ 125
+
+**_126_** if the **_contained command_** cannot be invoked
+
+ $ docker run busybox /etc; echo $?
+ # docker: Error response from daemon: Container command '/etc' could not be invoked.
+ 126
+
+**_127_** if the **_contained command_** cannot be found
+
+ $ docker run busybox foo; echo $?
+ # docker: Error response from daemon: Container command 'foo' not found or does not exist.
+ 127
+
+**_Exit code_** of **_contained command_** otherwise
+
+ $ docker run busybox /bin/sh -c 'exit 3'; echo $?
+ # 3
+
+## Clean up (--rm)
+
+By default a container's file system persists even after the container
+exits. This makes debugging a lot easier (since you can inspect the
+final state) and you retain all your data by default. But if you are
+running short-term **foreground** processes, these container file
+systems can really pile up. If instead you'd like Docker to
+**automatically clean up the container and remove the file system when
+the container exits**, you can add the `--rm` flag:
+
+ --rm=false: Automatically remove the container when it exits (incompatible with -d)
+
+> **Note**: When you set the `--rm` flag, Docker also removes the volumes
+associated with the container when the container is removed. This is similar
+to running `docker rm -v my-container`. Only volumes that are specified without a
+name are removed. For example, with
+`docker run --rm -v /foo -v awesome:/bar busybox top`, the volume for `/foo` will be removed,
+but the volume for `/bar` will not. Volumes inherited via `--volumes-from` will be removed
+with the same logic -- if the original volume was specified with a name it will **not** be removed.
+
+## Security configuration
+ --security-opt="label=user:USER" : Set the label user for the container
+ --security-opt="label=role:ROLE" : Set the label role for the container
+ --security-opt="label=type:TYPE" : Set the label type for the container
+ --security-opt="label=level:LEVEL" : Set the label level for the container
+ --security-opt="label=disable" : Turn off label confinement for the container
+ --security-opt="apparmor=PROFILE" : Set the apparmor profile to be applied to the container
+ --security-opt="no-new-privileges:true|false" : Disable/enable container processes from gaining new privileges
+ --security-opt="seccomp=unconfined" : Turn off seccomp confinement for the container
+ --security-opt="seccomp=profile.json": White listed syscalls seccomp Json file to be used as a seccomp filter
+
+
+You can override the default labeling scheme for each container by specifying
+the `--security-opt` flag. Specifying the level in the following command
+allows you to share the same content between containers.
+
+ $ docker run --security-opt label=level:s0:c100,c200 -it fedora bash
+
+> **Note**: Automatic translation of MLS labels is not currently supported.
+
+To disable the security labeling for this container versus running with the
+`--privileged` flag, use the following command:
+
+ $ docker run --security-opt label=disable -it fedora bash
+
+If you want a tighter security policy on the processes within a container,
+you can specify an alternate type for the container. You could run a container
+that is only allowed to listen on Apache ports by executing the following
+command:
+
+ $ docker run --security-opt label=type:svirt_apache_t -it centos bash
+
+> **Note**: You would have to write policy defining a `svirt_apache_t` type.
+
+If you want to prevent your container processes from gaining additional
+privileges, you can execute the following command:
+
+ $ docker run --security-opt no-new-privileges -it centos bash
+
+This means that commands that raise privileges such as `su` or `sudo` will no longer work.
+It also causes any seccomp filters to be applied later, after privileges have been dropped
+which may mean you can have a more restrictive set of filters.
+For more details, see the [kernel documentation](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt).
+
+## Specify an init process
+
+You can use the `--init` flag to indicate that an init process should be used as
+the PID 1 in the container. Specifying an init process ensures the usual
+responsibilities of an init system, such as reaping zombie processes, are
+performed inside the created container.
+
+The default init process used is the first `docker-init` executable found in the
+system path of the Docker daemon process. This `docker-init` binary, included in
+the default installation, is backed by [tini](https://github.com/krallin/tini).
+
+## Specify custom cgroups
+
+Using the `--cgroup-parent` flag, you can pass a specific cgroup to run a
+container in. This allows you to create and manage cgroups on their own. You can
+define custom resources for those cgroups and put containers under a common
+parent group.
+
+## Runtime constraints on resources
+
+The operator can also adjust the performance parameters of the
+container:
+
+| Option | Description |
+| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| `-m`, `--memory=""` | Memory limit (format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. Minimum is 4M. |
+| `--memory-swap=""` | Total memory limit (memory + swap, format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. |
+| `--memory-reservation=""` | Memory soft limit (format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. |
+| `--kernel-memory=""` | Kernel memory limit (format: `[]`). Number is a positive integer. Unit can be one of `b`, `k`, `m`, or `g`. Minimum is 4M. |
+| `-c`, `--cpu-shares=0` | CPU shares (relative weight) |
+| `--cpus=0.000` | Number of CPUs. Number is a fractional number. 0.000 means no limit. |
+| `--cpu-period=0` | Limit the CPU CFS (Completely Fair Scheduler) period |
+| `--cpuset-cpus=""` | CPUs in which to allow execution (0-3, 0,1) |
+| `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. |
+| `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
+| `--cpu-rt-period=0` | Limit the CPU real-time period. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits. |
+| `--cpu-rt-runtime=0` | Limit the CPU real-time runtime. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits. |
+| `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. |
+| `--blkio-weight-device=""` | Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) |
+| `--device-read-bps=""` | Limit read rate from a device (format: `:[]`). Number is a positive integer. Unit can be one of `kb`, `mb`, or `gb`. |
+| `--device-write-bps=""` | Limit write rate to a device (format: `:[]`). Number is a positive integer. Unit can be one of `kb`, `mb`, or `gb`. |
+| `--device-read-iops="" ` | Limit read rate (IO per second) from a device (format: `:`). Number is a positive integer. |
+| `--device-write-iops="" ` | Limit write rate (IO per second) to a device (format: `:`). Number is a positive integer. |
+| `--oom-kill-disable=false` | Whether to disable OOM Killer for the container or not. |
+| `--oom-score-adj=0` | Tune container's OOM preferences (-1000 to 1000) |
+| `--memory-swappiness=""` | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. |
+| `--shm-size=""` | Size of `/dev/shm`. The format is ``. `number` must be greater than `0`. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`. |
+
+### User memory constraints
+
+We have four ways to set user memory usage:
+
+
+
+
+ Option
+ Result
+
+
+
+
+
+ memory=inf, memory-swap=inf (default)
+
+
+ There is no memory limit for the container. The container can use
+ as much memory as needed.
+
+
+
+ memory=L<inf, memory-swap=inf
+
+ (specify memory and set memory-swap as -1) The container is
+ not allowed to use more than L bytes of memory, but can use as much swap
+ as is needed (if the host supports swap memory).
+
+
+
+ memory=L<inf, memory-swap=2*L
+
+ (specify memory without memory-swap) The container is not allowed to
+ use more than L bytes of memory, swap plus memory usage is double
+ of that.
+
+
+
+
+ memory=L<inf, memory-swap=S<inf, L<=S
+
+
+ (specify both memory and memory-swap) The container is not allowed to
+ use more than L bytes of memory, swap plus memory usage is limited
+ by S.
+
+
+
+
+
+Examples:
+
+ $ docker run -it ubuntu:14.04 /bin/bash
+
+We set nothing about memory, this means the processes in the container can use
+as much memory and swap memory as they need.
+
+ $ docker run -it -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash
+
+We set memory limit and disabled swap memory limit, this means the processes in
+the container can use 300M memory and as much swap memory as they need (if the
+host supports swap memory).
+
+ $ docker run -it -m 300M ubuntu:14.04 /bin/bash
+
+We set memory limit only, this means the processes in the container can use
+300M memory and 300M swap memory, by default, the total virtual memory size
+(--memory-swap) will be set as double of memory, in this case, memory + swap
+would be 2*300M, so processes can use 300M swap memory as well.
+
+ $ docker run -it -m 300M --memory-swap 1G ubuntu:14.04 /bin/bash
+
+We set both memory and swap memory, so the processes in the container can use
+300M memory and 700M swap memory.
+
+Memory reservation is a kind of memory soft limit that allows for greater
+sharing of memory. Under normal circumstances, containers can use as much of
+the memory as needed and are constrained only by the hard limits set with the
+`-m`/`--memory` option. When memory reservation is set, Docker detects memory
+contention or low memory and forces containers to restrict their consumption to
+a reservation limit.
+
+Always set the memory reservation value below the hard limit, otherwise the hard
+limit takes precedence. A reservation of 0 is the same as setting no
+reservation. By default (without reservation set), memory reservation is the
+same as the hard memory limit.
+
+Memory reservation is a soft-limit feature and does not guarantee the limit
+won't be exceeded. Instead, the feature attempts to ensure that, when memory is
+heavily contended for, memory is allocated based on the reservation hints/setup.
+
+The following example limits the memory (`-m`) to 500M and sets the memory
+reservation to 200M.
+
+```bash
+$ docker run -it -m 500M --memory-reservation 200M ubuntu:14.04 /bin/bash
+```
+
+Under this configuration, when the container consumes memory more than 200M and
+less than 500M, the next system memory reclaim attempts to shrink container
+memory below 200M.
+
+The following example set memory reservation to 1G without a hard memory limit.
+
+```bash
+$ docker run -it --memory-reservation 1G ubuntu:14.04 /bin/bash
+```
+
+The container can use as much memory as it needs. The memory reservation setting
+ensures the container doesn't consume too much memory for long time, because
+every memory reclaim shrinks the container's consumption to the reservation.
+
+By default, kernel kills processes in a container if an out-of-memory (OOM)
+error occurs. To change this behaviour, use the `--oom-kill-disable` option.
+Only disable the OOM killer on containers where you have also set the
+`-m/--memory` option. If the `-m` flag is not set, this can result in the host
+running out of memory and require killing the host's system processes to free
+memory.
+
+The following example limits the memory to 100M and disables the OOM killer for
+this container:
+
+ $ docker run -it -m 100M --oom-kill-disable ubuntu:14.04 /bin/bash
+
+The following example, illustrates a dangerous way to use the flag:
+
+ $ docker run -it --oom-kill-disable ubuntu:14.04 /bin/bash
+
+The container has unlimited memory which can cause the host to run out memory
+and require killing system processes to free memory. The `--oom-score-adj`
+parameter can be changed to select the priority of which containers will
+be killed when the system is out of memory, with negative scores making them
+less likely to be killed, and positive scores more likely.
+
+### Kernel memory constraints
+
+Kernel memory is fundamentally different than user memory as kernel memory can't
+be swapped out. The inability to swap makes it possible for the container to
+block system services by consuming too much kernel memory. Kernel memory includes:
+
+ - stack pages
+ - slab pages
+ - sockets memory pressure
+ - tcp memory pressure
+
+You can setup kernel memory limit to constrain these kinds of memory. For example,
+every process consumes some stack pages. By limiting kernel memory, you can
+prevent new processes from being created when the kernel memory usage is too high.
+
+Kernel memory is never completely independent of user memory. Instead, you limit
+kernel memory in the context of the user memory limit. Assume "U" is the user memory
+limit and "K" the kernel limit. There are three possible ways to set limits:
+
+
+
+
+ Option
+ Result
+
+
+
+
+ U != 0, K = inf (default)
+
+ This is the standard memory limitation mechanism already present before using
+ kernel memory. Kernel memory is completely ignored.
+
+
+
+ U != 0, K < U
+
+ Kernel memory is a subset of the user memory. This setup is useful in
+ deployments where the total amount of memory per-cgroup is overcommitted.
+ Overcommitting kernel memory limits is definitely not recommended, since the
+ box can still run out of non-reclaimable memory.
+ In this case, you can configure K so that the sum of all groups is
+ never greater than the total memory. Then, freely set U at the expense of
+ the system's service quality.
+
+
+
+ U != 0, K > U
+
+ Since kernel memory charges are also fed to the user counter and reclamation
+ is triggered for the container for both kinds of memory. This configuration
+ gives the admin a unified view of memory. It is also useful for people
+ who just want to track kernel memory usage.
+
+
+
+
+
+Examples:
+
+ $ docker run -it -m 500M --kernel-memory 50M ubuntu:14.04 /bin/bash
+
+We set memory and kernel memory, so the processes in the container can use
+500M memory in total, in this 500M memory, it can be 50M kernel memory tops.
+
+ $ docker run -it --kernel-memory 50M ubuntu:14.04 /bin/bash
+
+We set kernel memory without **-m**, so the processes in the container can
+use as much memory as they want, but they can only use 50M kernel memory.
+
+### Swappiness constraint
+
+By default, a container's kernel can swap out a percentage of anonymous pages.
+To set this percentage for a container, specify a `--memory-swappiness` value
+between 0 and 100. A value of 0 turns off anonymous page swapping. A value of
+100 sets all anonymous pages as swappable. By default, if you are not using
+`--memory-swappiness`, memory swappiness value will be inherited from the parent.
+
+For example, you can set:
+
+ $ docker run -it --memory-swappiness=0 ubuntu:14.04 /bin/bash
+
+Setting the `--memory-swappiness` option is helpful when you want to retain the
+container's working set and to avoid swapping performance penalties.
+
+### CPU share constraint
+
+By default, all containers get the same proportion of CPU cycles. This proportion
+can be modified by changing the container's CPU share weighting relative
+to the weighting of all other running containers.
+
+To modify the proportion from the default of 1024, use the `-c` or `--cpu-shares`
+flag to set the weighting to 2 or higher. If 0 is set, the system will ignore the
+value and use the default of 1024.
+
+The proportion will only apply when CPU-intensive processes are running.
+When tasks in one container are idle, other containers can use the
+left-over CPU time. The actual amount of CPU time will vary depending on
+the number of containers running on the system.
+
+For example, consider three containers, one has a cpu-share of 1024 and
+two others have a cpu-share setting of 512. When processes in all three
+containers attempt to use 100% of CPU, the first container would receive
+50% of the total CPU time. If you add a fourth container with a cpu-share
+of 1024, the first container only gets 33% of the CPU. The remaining containers
+receive 16.5%, 16.5% and 33% of the CPU.
+
+On a multi-core system, the shares of CPU time are distributed over all CPU
+cores. Even if a container is limited to less than 100% of CPU time, it can
+use 100% of each individual CPU core.
+
+For example, consider a system with more than three cores. If you start one
+container `{C0}` with `-c=512` running one process, and another container
+`{C1}` with `-c=1024` running two processes, this can result in the following
+division of CPU shares:
+
+ PID container CPU CPU share
+ 100 {C0} 0 100% of CPU0
+ 101 {C1} 1 100% of CPU1
+ 102 {C1} 2 100% of CPU2
+
+### CPU period constraint
+
+The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use
+`--cpu-period` to set the period of CPUs to limit the container's CPU usage.
+And usually `--cpu-period` should work with `--cpu-quota`.
+
+Examples:
+
+ $ docker run -it --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash
+
+If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.
+
+In addition to use `--cpu-period` and `--cpu-quota` for setting CPU period constraints,
+it is possible to specify `--cpus` with a float number to achieve the same purpose.
+For example, if there is 1 CPU, then `--cpus=0.5` will achieve the same result as
+setting `--cpu-period=50000` and `--cpu-quota=25000` (50% CPU).
+
+The default value for `--cpus` is `0.000`, which means there is no limit.
+
+For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt).
+
+### Cpuset constraint
+
+We can set cpus in which to allow execution for containers.
+
+Examples:
+
+ $ docker run -it --cpuset-cpus="1,3" ubuntu:14.04 /bin/bash
+
+This means processes in container can be executed on cpu 1 and cpu 3.
+
+ $ docker run -it --cpuset-cpus="0-2" ubuntu:14.04 /bin/bash
+
+This means processes in container can be executed on cpu 0, cpu 1 and cpu 2.
+
+We can set mems in which to allow execution for containers. Only effective
+on NUMA systems.
+
+Examples:
+
+ $ docker run -it --cpuset-mems="1,3" ubuntu:14.04 /bin/bash
+
+This example restricts the processes in the container to only use memory from
+memory nodes 1 and 3.
+
+ $ docker run -it --cpuset-mems="0-2" ubuntu:14.04 /bin/bash
+
+This example restricts the processes in the container to only use memory from
+memory nodes 0, 1 and 2.
+
+### CPU quota constraint
+
+The `--cpu-quota` flag limits the container's CPU usage. The default 0 value
+allows the container to take 100% of a CPU resource (1 CPU). The CFS (Completely Fair
+Scheduler) handles resource allocation for executing processes and is default
+Linux Scheduler used by the kernel. Set this value to 50000 to limit the container
+to 50% of a CPU resource. For multiple CPUs, adjust the `--cpu-quota` as necessary.
+For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt).
+
+### Block IO bandwidth (Blkio) constraint
+
+By default, all containers get the same proportion of block IO bandwidth
+(blkio). This proportion is 500. To modify this proportion, change the
+container's blkio weight relative to the weighting of all other running
+containers using the `--blkio-weight` flag.
+
+> **Note:** The blkio weight setting is only available for direct IO. Buffered IO
+> is not currently supported.
+
+The `--blkio-weight` flag can set the weighting to a value between 10 to 1000.
+For example, the commands below create two containers with different blkio
+weight:
+
+ $ docker run -it --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
+ $ docker run -it --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash
+
+If you do block IO in the two containers at the same time, by, for example:
+
+ $ time dd if=/mnt/zerofile of=test.out bs=1M count=1024 oflag=direct
+
+You'll find that the proportion of time is the same as the proportion of blkio
+weights of the two containers.
+
+The `--blkio-weight-device="DEVICE_NAME:WEIGHT"` flag sets a specific device weight.
+The `DEVICE_NAME:WEIGHT` is a string containing a colon-separated device name and weight.
+For example, to set `/dev/sda` device weight to `200`:
+
+ $ docker run -it \
+ --blkio-weight-device "/dev/sda:200" \
+ ubuntu
+
+If you specify both the `--blkio-weight` and `--blkio-weight-device`, Docker
+uses the `--blkio-weight` as the default weight and uses `--blkio-weight-device`
+to override this default with a new value on a specific device.
+The following example uses a default weight of `300` and overrides this default
+on `/dev/sda` setting that weight to `200`:
+
+ $ docker run -it \
+ --blkio-weight 300 \
+ --blkio-weight-device "/dev/sda:200" \
+ ubuntu
+
+The `--device-read-bps` flag limits the read rate (bytes per second) from a device.
+For example, this command creates a container and limits the read rate to `1mb`
+per second from `/dev/sda`:
+
+ $ docker run -it --device-read-bps /dev/sda:1mb ubuntu
+
+The `--device-write-bps` flag limits the write rate (bytes per second)to a device.
+For example, this command creates a container and limits the write rate to `1mb`
+per second for `/dev/sda`:
+
+ $ docker run -it --device-write-bps /dev/sda:1mb ubuntu
+
+Both flags take limits in the `:[unit]` format. Both read
+and write rates must be a positive integer. You can specify the rate in `kb`
+(kilobytes), `mb` (megabytes), or `gb` (gigabytes).
+
+The `--device-read-iops` flag limits read rate (IO per second) from a device.
+For example, this command creates a container and limits the read rate to
+`1000` IO per second from `/dev/sda`:
+
+ $ docker run -ti --device-read-iops /dev/sda:1000 ubuntu
+
+The `--device-write-iops` flag limits write rate (IO per second) to a device.
+For example, this command creates a container and limits the write rate to
+`1000` IO per second to `/dev/sda`:
+
+ $ docker run -ti --device-write-iops /dev/sda:1000 ubuntu
+
+Both flags take limits in the `:` format. Both read and
+write rates must be a positive integer.
+
+## Additional groups
+ --group-add: Add additional groups to run as
+
+By default, the docker container process runs with the supplementary groups looked
+up for the specified user. If one wants to add more to that list of groups, then
+one can use this flag:
+
+ $ docker run --rm --group-add audio --group-add nogroup --group-add 777 busybox id
+ uid=0(root) gid=0(root) groups=10(wheel),29(audio),99(nogroup),777
+
+## Runtime privilege and Linux capabilities
+
+ --cap-add: Add Linux capabilities
+ --cap-drop: Drop Linux capabilities
+ --privileged=false: Give extended privileges to this container
+ --device=[]: Allows you to run devices inside the container without the --privileged flag.
+
+By default, Docker containers are "unprivileged" and cannot, for
+example, run a Docker daemon inside a Docker container. This is because
+by default a container is not allowed to access any devices, but a
+"privileged" container is given access to all devices (see
+the documentation on [cgroups devices](https://www.kernel.org/doc/Documentation/cgroup-v1/devices.txt)).
+
+When the operator executes `docker run --privileged`, Docker will enable
+to access to all devices on the host as well as set some configuration
+in AppArmor or SELinux to allow the container nearly all the same access to the
+host as processes running outside containers on the host. Additional
+information about running with `--privileged` is available on the
+[Docker Blog](http://blog.docker.com/2013/09/docker-can-now-run-within-docker/).
+
+If you want to limit access to a specific device or devices you can use
+the `--device` flag. It allows you to specify one or more devices that
+will be accessible within the container.
+
+ $ docker run --device=/dev/snd:/dev/snd ...
+
+By default, the container will be able to `read`, `write`, and `mknod` these devices.
+This can be overridden using a third `:rwm` set of options to each `--device` flag:
+
+ $ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
+
+ Command (m for help): q
+ $ docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc
+ You will not be able to write the partition table.
+
+ Command (m for help): q
+
+ $ docker run --device=/dev/sda:/dev/xvdc:w --rm -it ubuntu fdisk /dev/xvdc
+ crash....
+
+ $ docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc
+ fdisk: unable to open /dev/xvdc: Operation not permitted
+
+In addition to `--privileged`, the operator can have fine grain control over the
+capabilities using `--cap-add` and `--cap-drop`. By default, Docker has a default
+list of capabilities that are kept. The following table lists the Linux capability
+options which are allowed by default and can be dropped.
+
+| Capability Key | Capability Description |
+| ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| SETPCAP | Modify process capabilities. |
+| MKNOD | Create special files using mknod(2). |
+| AUDIT_WRITE | Write records to kernel auditing log. |
+| CHOWN | Make arbitrary changes to file UIDs and GIDs (see chown(2)). |
+| NET_RAW | Use RAW and PACKET sockets. |
+| DAC_OVERRIDE | Bypass file read, write, and execute permission checks. |
+| FOWNER | Bypass permission checks on operations that normally require the file system UID of the process to match the UID of the file. |
+| FSETID | Don't clear set-user-ID and set-group-ID permission bits when a file is modified. |
+| KILL | Bypass permission checks for sending signals. |
+| SETGID | Make arbitrary manipulations of process GIDs and supplementary GID list. |
+| SETUID | Make arbitrary manipulations of process UIDs. |
+| NET_BIND_SERVICE | Bind a socket to internet domain privileged ports (port numbers less than 1024). |
+| SYS_CHROOT | Use chroot(2), change root directory. |
+| SETFCAP | Set file capabilities. |
+
+The next table shows the capabilities which are not granted by default and may be added.
+
+| Capability Key | Capability Description |
+| ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| SYS_MODULE | Load and unload kernel modules. |
+| SYS_RAWIO | Perform I/O port operations (iopl(2) and ioperm(2)). |
+| SYS_PACCT | Use acct(2), switch process accounting on or off. |
+| SYS_ADMIN | Perform a range of system administration operations. |
+| SYS_NICE | Raise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes. |
+| SYS_RESOURCE | Override resource Limits. |
+| SYS_TIME | Set system clock (settimeofday(2), stime(2), adjtimex(2)); set real-time (hardware) clock. |
+| SYS_TTY_CONFIG | Use vhangup(2); employ various privileged ioctl(2) operations on virtual terminals. |
+| AUDIT_CONTROL | Enable and disable kernel auditing; change auditing filter rules; retrieve auditing status and filtering rules. |
+| MAC_OVERRIDE | Allow MAC configuration or state changes. Implemented for the Smack LSM. |
+| MAC_ADMIN | Override Mandatory Access Control (MAC). Implemented for the Smack Linux Security Module (LSM). |
+| NET_ADMIN | Perform various network-related operations. |
+| SYSLOG | Perform privileged syslog(2) operations. |
+| DAC_READ_SEARCH | Bypass file read permission checks and directory read and execute permission checks. |
+| LINUX_IMMUTABLE | Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags. |
+| NET_BROADCAST | Make socket broadcasts, and listen to multicasts. |
+| IPC_LOCK | Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2)). |
+| IPC_OWNER | Bypass permission checks for operations on System V IPC objects. |
+| SYS_PTRACE | Trace arbitrary processes using ptrace(2). |
+| SYS_BOOT | Use reboot(2) and kexec_load(2), reboot and load a new kernel for later execution. |
+| LEASE | Establish leases on arbitrary files (see fcntl(2)). |
+| WAKE_ALARM | Trigger something that will wake up the system. |
+| BLOCK_SUSPEND | Employ features that can block system suspend. |
+
+Further reference information is available on the [capabilities(7) - Linux man page](http://man7.org/linux/man-pages/man7/capabilities.7.html)
+
+Both flags support the value `ALL`, so if the
+operator wants to have all capabilities but `MKNOD` they could use:
+
+ $ docker run --cap-add=ALL --cap-drop=MKNOD ...
+
+For interacting with the network stack, instead of using `--privileged` they
+should use `--cap-add=NET_ADMIN` to modify the network interfaces.
+
+ $ docker run -it --rm ubuntu:14.04 ip link add dummy0 type dummy
+ RTNETLINK answers: Operation not permitted
+ $ docker run -it --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type dummy
+
+To mount a FUSE based filesystem, you need to combine both `--cap-add` and
+`--device`:
+
+ $ docker run --rm -it --cap-add SYS_ADMIN sshfs sshfs sven@10.10.10.20:/home/sven /mnt
+ fuse: failed to open /dev/fuse: Operation not permitted
+ $ docker run --rm -it --device /dev/fuse sshfs sshfs sven@10.10.10.20:/home/sven /mnt
+ fusermount: mount failed: Operation not permitted
+ $ docker run --rm -it --cap-add SYS_ADMIN --device /dev/fuse sshfs
+ # sshfs sven@10.10.10.20:/home/sven /mnt
+ The authenticity of host '10.10.10.20 (10.10.10.20)' can't be established.
+ ECDSA key fingerprint is 25:34:85:75:25:b0:17:46:05:19:04:93:b5:dd:5f:c6.
+ Are you sure you want to continue connecting (yes/no)? yes
+ sven@10.10.10.20's password:
+ root@30aa0cfaf1b5:/# ls -la /mnt/src/docker
+ total 1516
+ drwxrwxr-x 1 1000 1000 4096 Dec 4 06:08 .
+ drwxrwxr-x 1 1000 1000 4096 Dec 4 11:46 ..
+ -rw-rw-r-- 1 1000 1000 16 Oct 8 00:09 .dockerignore
+ -rwxrwxr-x 1 1000 1000 464 Oct 8 00:09 .drone.yml
+ drwxrwxr-x 1 1000 1000 4096 Dec 4 06:11 .git
+ -rw-rw-r-- 1 1000 1000 461 Dec 4 06:08 .gitignore
+ ....
+
+The default seccomp profile will adjust to the selected capabilities, in order to allow
+use of facilities allowed by the capabilities, so you should not have to adjust this,
+since Docker 1.12. In Docker 1.10 and 1.11 this did not happen and it may be necessary
+to use a custom seccomp profile or use `--security-opt seccomp=unconfined` when adding
+capabilities.
+
+## Logging drivers (--log-driver)
+
+The container can have a different logging driver than the Docker daemon. Use
+the `--log-driver=VALUE` with the `docker run` command to configure the
+container's logging driver. The following options are supported:
+
+| Driver | Description |
+| ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| `none` | Disables any logging for the container. `docker logs` won't be available with this driver. |
+| `json-file` | Default logging driver for Docker. Writes JSON messages to file. No logging options are supported for this driver. |
+| `syslog` | Syslog logging driver for Docker. Writes log messages to syslog. |
+| `journald` | Journald logging driver for Docker. Writes log messages to `journald`. |
+| `gelf` | Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. |
+| `fluentd` | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input). |
+| `awslogs` | Amazon CloudWatch Logs logging driver for Docker. Writes log messages to Amazon CloudWatch Logs |
+| `splunk` | Splunk logging driver for Docker. Writes log messages to `splunk` using Event Http Collector. |
+
+The `docker logs` command is available only for the `json-file` and `journald`
+logging drivers. For detailed information on working with logging drivers, see
+[Configure a logging driver](https://docs.docker.com/engine/admin/logging/overview/).
+
+
+## Overriding Dockerfile image defaults
+
+When a developer builds an image from a [*Dockerfile*](builder.md)
+or when she commits it, the developer can set a number of default parameters
+that take effect when the image starts up as a container.
+
+Four of the Dockerfile commands cannot be overridden at runtime: `FROM`,
+`MAINTAINER`, `RUN`, and `ADD`. Everything else has a corresponding override
+in `docker run`. We'll go through what the developer might have set in each
+Dockerfile instruction and how the operator can override that setting.
+
+ - [CMD (Default Command or Options)](#cmd-default-command-or-options)
+ - [ENTRYPOINT (Default Command to Execute at Runtime)](
+ #entrypoint-default-command-to-execute-at-runtime)
+ - [EXPOSE (Incoming Ports)](#expose-incoming-ports)
+ - [ENV (Environment Variables)](#env-environment-variables)
+ - [HEALTHCHECK](#healthcheck)
+ - [VOLUME (Shared Filesystems)](#volume-shared-filesystems)
+ - [USER](#user)
+ - [WORKDIR](#workdir)
+
+### CMD (default command or options)
+
+Recall the optional `COMMAND` in the Docker
+commandline:
+
+ $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
+
+This command is optional because the person who created the `IMAGE` may
+have already provided a default `COMMAND` using the Dockerfile `CMD`
+instruction. As the operator (the person running a container from the
+image), you can override that `CMD` instruction just by specifying a new
+`COMMAND`.
+
+If the image also specifies an `ENTRYPOINT` then the `CMD` or `COMMAND`
+get appended as arguments to the `ENTRYPOINT`.
+
+### ENTRYPOINT (default command to execute at runtime)
+
+ --entrypoint="": Overwrite the default entrypoint set by the image
+
+The `ENTRYPOINT` of an image is similar to a `COMMAND` because it
+specifies what executable to run when the container starts, but it is
+(purposely) more difficult to override. The `ENTRYPOINT` gives a
+container its default nature or behavior, so that when you set an
+`ENTRYPOINT` you can run the container *as if it were that binary*,
+complete with default options, and you can pass in more options via the
+`COMMAND`. But, sometimes an operator may want to run something else
+inside the container, so you can override the default `ENTRYPOINT` at
+runtime by using a string to specify the new `ENTRYPOINT`. Here is an
+example of how to run a shell in a container that has been set up to
+automatically run something else (like `/usr/bin/redis-server`):
+
+ $ docker run -it --entrypoint /bin/bash example/redis
+
+or two examples of how to pass more parameters to that ENTRYPOINT:
+
+ $ docker run -it --entrypoint /bin/bash example/redis -c ls -l
+ $ docker run -it --entrypoint /usr/bin/redis-cli example/redis --help
+
+You can reset a containers entrypoint by passing an empty string, for example:
+
+ $ docker run -it --entrypoint="" mysql bash
+
+> **Note**: Passing `--entrypoint` will clear out any default command set on the
+> image (i.e. any `CMD` instruction in the Dockerfile used to build it).
+
+### EXPOSE (incoming ports)
+
+The following `run` command options work with container networking:
+
+ --expose=[]: Expose a port or a range of ports inside the container.
+ These are additional to those exposed by the `EXPOSE` instruction
+ -P : Publish all exposed ports to the host interfaces
+ -p=[] : Publish a container᾿s port or a range of ports to the host
+ format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
+ Both hostPort and containerPort can be specified as a
+ range of ports. When specifying ranges for both, the
+ number of container ports in the range must match the
+ number of host ports in the range, for example:
+ -p 1234-1236:1234-1236/tcp
+
+ When specifying a range for hostPort only, the
+ containerPort must not be a range. In this case the
+ container port is published somewhere within the
+ specified hostPort range. (e.g., `-p 1234-1236:1234/tcp`)
+
+ (use 'docker port' to see the actual mapping)
+
+ --link="" : Add link to another container (:alias or )
+
+With the exception of the `EXPOSE` directive, an image developer hasn't
+got much control over networking. The `EXPOSE` instruction defines the
+initial incoming ports that provide services. These ports are available
+to processes inside the container. An operator can use the `--expose`
+option to add to the exposed ports.
+
+To expose a container's internal port, an operator can start the
+container with the `-P` or `-p` flag. The exposed port is accessible on
+the host and the ports are available to any client that can reach the
+host.
+
+The `-P` option publishes all the ports to the host interfaces. Docker
+binds each exposed port to a random port on the host. The range of
+ports are within an *ephemeral port range* defined by
+`/proc/sys/net/ipv4/ip_local_port_range`. Use the `-p` flag to
+explicitly map a single port or range of ports.
+
+The port number inside the container (where the service listens) does
+not need to match the port number exposed on the outside of the
+container (where clients connect). For example, inside the container an
+HTTP service is listening on port 80 (and so the image developer
+specifies `EXPOSE 80` in the Dockerfile). At runtime, the port might be
+bound to 42800 on the host. To find the mapping between the host ports
+and the exposed ports, use `docker port`.
+
+If the operator uses `--link` when starting a new client container in the
+default bridge network, then the client container can access the exposed
+port via a private networking interface.
+If `--link` is used when starting a container in a user-defined network as
+described in [*Docker network overview*](https://docs.docker.com/engine/userguide/networking/),
+it will provide a named alias for the container being linked to.
+
+### ENV (environment variables)
+
+Docker automatically sets some environment variables when creating a Linux
+container. Docker does not set any environment variables when creating a Windows
+container.
+
+The following environment variables are set for Linux containers:
+
+| Variable | Value |
+| -------- | ----- |
+| `HOME` | Set based on the value of `USER` |
+| `HOSTNAME` | The hostname associated with the container |
+| `PATH` | Includes popular directories, such as `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin` |
+| `TERM` | `xterm` if the container is allocated a pseudo-TTY |
+
+
+Additionally, the operator can **set any environment variable** in the
+container by using one or more `-e` flags, even overriding those mentioned
+above, or already defined by the developer with a Dockerfile `ENV`:
+
+```bash
+$ docker run -e "deep=purple" --rm alpine env
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+HOSTNAME=d2219b854598
+deep=purple
+HOME=/root
+```
+
+```PowerShell
+PS C:\> docker run --rm -e "foo=bar" microsoft/nanoserver cmd /s /c set
+ALLUSERSPROFILE=C:\ProgramData
+APPDATA=C:\Users\ContainerAdministrator\AppData\Roaming
+CommonProgramFiles=C:\Program Files\Common Files
+CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
+CommonProgramW6432=C:\Program Files\Common Files
+COMPUTERNAME=C2FAEFCC8253
+ComSpec=C:\Windows\system32\cmd.exe
+foo=bar
+LOCALAPPDATA=C:\Users\ContainerAdministrator\AppData\Local
+NUMBER_OF_PROCESSORS=8
+OS=Windows_NT
+Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps
+PATHEXT=.COM;.EXE;.BAT;.CMD
+PROCESSOR_ARCHITECTURE=AMD64
+PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
+PROCESSOR_LEVEL=6
+PROCESSOR_REVISION=3e04
+ProgramData=C:\ProgramData
+ProgramFiles=C:\Program Files
+ProgramFiles(x86)=C:\Program Files (x86)
+ProgramW6432=C:\Program Files
+PROMPT=$P$G
+PUBLIC=C:\Users\Public
+SystemDrive=C:
+SystemRoot=C:\Windows
+TEMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
+TMP=C:\Users\ContainerAdministrator\AppData\Local\Temp
+USERDOMAIN=User Manager
+USERNAME=ContainerAdministrator
+USERPROFILE=C:\Users\ContainerAdministrator
+windir=C:\Windows
+```
+
+Similarly the operator can set the **HOSTNAME** (Linux) or **COMPUTERNAME** (Windows) with `-h`.
+
+### HEALTHCHECK
+
+```
+ --health-cmd Command to run to check health
+ --health-interval Time between running the check
+ --health-retries Consecutive failures needed to report unhealthy
+ --health-timeout Maximum time to allow one check to run
+ --health-start-period Start period for the container to initialize before starting health-retries countdown
+ --no-healthcheck Disable any container-specified HEALTHCHECK
+```
+
+Example:
+
+ {% raw %}
+ $ docker run --name=test -d \
+ --health-cmd='stat /etc/passwd || exit 1' \
+ --health-interval=2s \
+ busybox sleep 1d
+ $ sleep 2; docker inspect --format='{{.State.Health.Status}}' test
+ healthy
+ $ docker exec test rm /etc/passwd
+ $ sleep 2; docker inspect --format='{{json .State.Health}}' test
+ {
+ "Status": "unhealthy",
+ "FailingStreak": 3,
+ "Log": [
+ {
+ "Start": "2016-05-25T17:22:04.635478668Z",
+ "End": "2016-05-25T17:22:04.7272552Z",
+ "ExitCode": 0,
+ "Output": " File: /etc/passwd\n Size: 334 \tBlocks: 8 IO Block: 4096 regular file\nDevice: 32h/50d\tInode: 12 Links: 1\nAccess: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)\nAccess: 2015-12-05 22:05:32.000000000\nModify: 2015..."
+ },
+ {
+ "Start": "2016-05-25T17:22:06.732900633Z",
+ "End": "2016-05-25T17:22:06.822168935Z",
+ "ExitCode": 0,
+ "Output": " File: /etc/passwd\n Size: 334 \tBlocks: 8 IO Block: 4096 regular file\nDevice: 32h/50d\tInode: 12 Links: 1\nAccess: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)\nAccess: 2015-12-05 22:05:32.000000000\nModify: 2015..."
+ },
+ {
+ "Start": "2016-05-25T17:22:08.823956535Z",
+ "End": "2016-05-25T17:22:08.897359124Z",
+ "ExitCode": 1,
+ "Output": "stat: can't stat '/etc/passwd': No such file or directory\n"
+ },
+ {
+ "Start": "2016-05-25T17:22:10.898802931Z",
+ "End": "2016-05-25T17:22:10.969631866Z",
+ "ExitCode": 1,
+ "Output": "stat: can't stat '/etc/passwd': No such file or directory\n"
+ },
+ {
+ "Start": "2016-05-25T17:22:12.971033523Z",
+ "End": "2016-05-25T17:22:13.082015516Z",
+ "ExitCode": 1,
+ "Output": "stat: can't stat '/etc/passwd': No such file or directory\n"
+ }
+ ]
+ }
+ {% endraw %}
+
+The health status is also displayed in the `docker ps` output.
+
+### TMPFS (mount tmpfs filesystems)
+
+```bash
+--tmpfs=[]: Create a tmpfs mount with: container-dir[:],
+ where the options are identical to the Linux
+ 'mount -t tmpfs -o' command.
+```
+
+The example below mounts an empty tmpfs into the container with the `rw`,
+`noexec`, `nosuid`, and `size=65536k` options.
+
+ $ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image
+
+### VOLUME (shared filesystems)
+
+ -v, --volume=[host-src:]container-dest[:]: Bind mount a volume.
+ The comma-delimited `options` are [rw|ro], [z|Z],
+ [[r]shared|[r]slave|[r]private], and [nocopy].
+ The 'host-src' is an absolute path or a name value.
+
+ If neither 'rw' or 'ro' is specified then the volume is mounted in
+ read-write mode.
+
+ The `nocopy` modes is used to disable automatic copying requested volume
+ path in the container to the volume storage location.
+ For named volumes, `copy` is the default mode. Copy modes are not supported
+ for bind-mounted volumes.
+
+ --volumes-from="": Mount all volumes from the given container(s)
+
+> **Note**:
+> When using systemd to manage the Docker daemon's start and stop, in the systemd
+> unit file there is an option to control mount propagation for the Docker daemon
+> itself, called `MountFlags`. The value of this setting may cause Docker to not
+> see mount propagation changes made on the mount point. For example, if this value
+> is `slave`, you may not be able to use the `shared` or `rshared` propagation on
+> a volume.
+
+The volumes commands are complex enough to have their own documentation
+in section [*Manage data in
+containers*](https://docs.docker.com/engine/tutorials/dockervolumes/). A developer can define
+one or more `VOLUME`'s associated with an image, but only the operator
+can give access from one container to another (or from a container to a
+volume mounted on the host).
+
+The `container-dest` must always be an absolute path such as `/src/docs`.
+The `host-src` can either be an absolute path or a `name` value. If you
+supply an absolute path for the `host-dir`, Docker bind-mounts to the path
+you specify. If you supply a `name`, Docker creates a named volume by that `name`.
+
+A `name` value must start with an alphanumeric character,
+followed by `a-z0-9`, `_` (underscore), `.` (period) or `-` (hyphen).
+An absolute path starts with a `/` (forward slash).
+
+For example, you can specify either `/foo` or `foo` for a `host-src` value.
+If you supply the `/foo` value, Docker creates a bind-mount. If you supply
+the `foo` specification, Docker creates a named volume.
+
+### USER
+
+`root` (id = 0) is the default user within a container. The image developer can
+create additional users. Those users are accessible by name. When passing a numeric
+ID, the user does not have to exist in the container.
+
+The developer can set a default user to run the first process with the
+Dockerfile `USER` instruction. When starting a container, the operator can override
+the `USER` instruction by passing the `-u` option.
+
+ -u="", --user="": Sets the username or UID used and optionally the groupname or GID for the specified command.
+
+ The followings examples are all valid:
+ --user=[ user | user:group | uid | uid:gid | user:gid | uid:group ]
+
+> **Note:** if you pass a numeric uid, it must be in the range of 0-2147483647.
+
+### WORKDIR
+
+The default working directory for running binaries within a container is the
+root directory (`/`), but the developer can set a different default with the
+Dockerfile `WORKDIR` command. The operator can override this with:
+
+ -w="": Working directory inside the container
diff --git a/engine/api/v1.18.md b/engine/api/v1.18.md
new file mode 100644
index 0000000000..d7aab29e02
--- /dev/null
+++ b/engine/api/v1.18.md
@@ -0,0 +1,2158 @@
+---
+title: "Engine API v1.18"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.18/
+- /reference/api/docker_remote_api_v1.18/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST, but for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.18/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`restarting`|`running`|`paused`|`exited`)
+ - `label=key` or `label="key=value"` of a container label
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.18/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Links": ["redis3:redis"],
+ "LxcConf": {"lxc.utsname":"docker"},
+ "Memory": 0,
+ "MemorySwap": 0,
+ "CpuShares": 512,
+ "CpusetCpus": "0,1",
+ "PidMode": "",
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": ""
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **HostConfig**
+ - **Binds** – A list of bind-mounts for this container. Each item is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **LxcConf** - LXC specific configurations. These configurations only
+ work when using the `lxc` execution driver.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ values are: `bridge`, `host`, `none`, and `container:`
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "PortSpecs": null,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": null,
+ "WorkingDir": ""
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecDriver": "native-0.2",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpuShares": 0,
+ "Devices": [],
+ "Dns": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}]
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "Gateway": "",
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "MacAddress": "",
+ "PortMapping": null,
+ "Ports": null
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z"
+ },
+ "Volumes": {},
+ "VolumesRW": {}
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.18/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.18/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "network" : {
+ "rx_dropped" : 0,
+ "rx_bytes" : 648,
+ "rx_errors" : 0,
+ "tx_packets" : 8,
+ "tx_dropped" : 0,
+ "rx_packets" : 8,
+ "tx_errors" : 0,
+ "tx_bytes" : 648
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 16970827,
+ 1839451,
+ 7107380,
+ 10571290
+ ],
+ "usage_in_usermode" : 10000000,
+ "total_usage" : 36488948,
+ "usage_in_kernelmode" : 20000000
+ },
+ "system_cpu_usage" : 20091722000000000,
+ "throttling_data" : {}
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize?h=&w=`
+
+Resize the TTY for container with `id`. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.18/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.18/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.18/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.18/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.18/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.18/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.18/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the Dockerfile. This is
+ ignored if `remote` is specified and points to an individual filename.
+- **t** – 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.
+- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
+ URI points to a single text file, the file's contents are placed into
+ a file called `Dockerfile` and the image is built from that file.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile object
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.18/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+- **repo** – Repository name.
+- **tag** – Tag. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.18/images/ubuntu/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Created": "2013-03-23T22:24:18.818426-07:00",
+ "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
+ "ContainerConfig": {
+ "Hostname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": false,
+ "AttachStderr": false,
+ "Tty": true,
+ "OpenStdin": true,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": ["/bin/bash"],
+ "Dns": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": null,
+ "VolumesFrom": "",
+ "WorkingDir": ""
+ },
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Parent": "27cf784147099545",
+ "Size": 6824592
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.18/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "b750fe79269d",
+ "Created": 1364102658,
+ "CreatedBy": "/bin/bash"
+ },
+ {
+ "Id": "27cf78414709",
+ "Created": 1364068391,
+ "CreatedBy": ""
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.18/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+**Example request**:
+
+ POST /v1.18/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.18/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.18/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.18/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "star_count": 12,
+ "is_official": false,
+ "name": "wma55/u1210sshd",
+ "is_automated": false,
+ "description": ""
+ },
+ {
+ "star_count": 10,
+ "is_official": false,
+ "name": "jdswinbank/sshd",
+ "is_automated": false,
+ "description": ""
+ },
+ {
+ "star_count": 18,
+ "is_official": false,
+ "name": "vgauthier/sshd",
+ "is_automated": false,
+ "description": ""
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /v1.18/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "email": "hannibal@a-team.com",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.18/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Containers": 11,
+ "Debug": 0,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": 1,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": 1,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OperatingSystem": "Boot2Docker",
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "SwapLimit": 0,
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.18/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.5.0",
+ "Os": "linux",
+ "KernelVersion": "3.18.5-tinycore64",
+ "GoVersion": "go1.4.1",
+ "GitCommit": "a8a31ef",
+ "Arch": "amd64",
+ "ApiVersion": "1.18"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.18/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.18/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "PortSpecs": null,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Volumes": {
+ "/tmp": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ create, destroy, die, exec_create, exec_start, export, kill, oom, pause, restart, start, stop, unpause
+
+Docker images report the following events:
+
+ untag, delete
+
+**Example request**:
+
+ GET /v1.18/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
+ {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.18/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.18/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.18/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.18/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "Tty": true
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.18/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.18/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.18/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: plain/text
+
+ {
+ "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
+ "Running" : false,
+ "ExitCode" : 2,
+ "ProcessConfig" : {
+ "privileged" : false,
+ "user" : "",
+ "tty" : false,
+ "entrypoint" : "sh",
+ "arguments" : [
+ "-c",
+ "exit 2"
+ ]
+ },
+ "OpenStdin" : false,
+ "OpenStderr" : false,
+ "OpenStdout" : false,
+ "Container" : {
+ "State" : {
+ "Running" : true,
+ "Paused" : false,
+ "Restarting" : false,
+ "OOMKilled" : false,
+ "Pid" : 3650,
+ "ExitCode" : 0,
+ "Error" : "",
+ "StartedAt" : "2014-11-17T22:26:03.717657531Z",
+ "FinishedAt" : "0001-01-01T00:00:00Z"
+ },
+ "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
+ "Created" : "2014-11-17T22:26:03.626304998Z",
+ "Path" : "date",
+ "Args" : [],
+ "Config" : {
+ "Hostname" : "8f177a186b97",
+ "Domainname" : "",
+ "User" : "",
+ "AttachStdin" : false,
+ "AttachStdout" : false,
+ "AttachStderr" : false,
+ "PortSpecs": null,
+ "ExposedPorts" : null,
+ "Tty" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
+ "Cmd" : [
+ "date"
+ ],
+ "Image" : "ubuntu",
+ "Volumes" : null,
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "NetworkDisabled" : false,
+ "MacAddress" : "",
+ "OnBuild" : null,
+ "SecurityOpt" : null
+ },
+ "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
+ "NetworkSettings" : {
+ "IPAddress" : "172.17.0.2",
+ "IPPrefixLen" : 16,
+ "MacAddress" : "02:42:ac:11:00:02",
+ "Gateway" : "172.17.42.1",
+ "Bridge" : "docker0",
+ "PortMapping" : null,
+ "Ports" : {}
+ },
+ "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
+ "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
+ "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Name" : "/test",
+ "Driver" : "aufs",
+ "ExecDriver" : "native-0.2",
+ "MountLabel" : "",
+ "ProcessLabel" : "",
+ "AppArmorProfile" : "",
+ "RestartCount" : 0,
+ "Volumes" : {},
+ "VolumesRW" : {}
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+This might change in the future.
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.19.md b/engine/api/v1.19.md
new file mode 100644
index 0000000000..c5d6290fc3
--- /dev/null
+++ b/engine/api/v1.19.md
@@ -0,0 +1,2240 @@
+---
+title: "Engine API v1.19"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.19/
+- /reference/api/docker_remote_api_v1.19/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+ - When the client API version is newer than the daemon's, these calls return an HTTP
+ `400 Bad Request` error message.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.19/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`restarting`|`running`|`paused`|`exited`)
+ - `label=key` or `label="key=value"` of a container label
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.19/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Links": ["redis3:redis"],
+ "LxcConf": {"lxc.utsname":"docker"},
+ "Memory": 0,
+ "MemorySwap": 0,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "BlkioWeight": 300,
+ "OomKillDisable": false,
+ "PidMode": "",
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": ""
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **HostConfig**
+ - **Binds** – A list of bind-mounts for this container. Each item is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **LxcConf** - LXC specific configurations. These configurations only
+ work when using the `lxc` execution driver.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ values are: `bridge`, `host`, `none`, and `container:`
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `none`.
+ `syslog` available options are: `address`.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "PortSpecs": null,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": null,
+ "WorkingDir": ""
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecDriver": "native-0.2",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "BlkioWeight": 0,
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "OomKillDisable": false,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}]
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "Gateway": "",
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "MacAddress": "",
+ "PortMapping": null,
+ "Ports": null
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z"
+ },
+ "Volumes": {},
+ "VolumesRW": {}
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.19/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.19/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "network" : {
+ "rx_dropped" : 0,
+ "rx_bytes" : 648,
+ "rx_errors" : 0,
+ "tx_packets" : 8,
+ "tx_dropped" : 0,
+ "rx_packets" : 8,
+ "tx_errors" : 0,
+ "tx_bytes" : 648
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize?h=&w=`
+
+Resize the TTY for container with `id`. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.19/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.19/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.19/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.19/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.19/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275,
+ "Labels": {}
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135,
+ "Labels": {
+ "com.example.version": "v1"
+ }
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.19/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728,
+ "Labels": {}
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.19/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the Dockerfile. This is
+ ignored if `remote` is specified and points to an individual filename.
+- **t** – 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.
+- **remote** – A Git repository URI or HTTP/HTTPS URI build source. If the
+ URI specifies a filename, the file's contents are placed into a file
+ called `Dockerfile`.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+- **cpuperiod** - The length of a CPU period in microseconds.
+- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile object
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.19/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+- **repo** – Repository name.
+- **tag** – Tag. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.19/images/ubuntu/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Created": "2013-03-23T22:24:18.818426-07:00",
+ "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
+ "ContainerConfig": {
+ "Hostname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": false,
+ "AttachStderr": false,
+ "Tty": true,
+ "OpenStdin": true,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": ["/bin/bash"],
+ "Dns": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": null,
+ "VolumesFrom": "",
+ "WorkingDir": ""
+ },
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Parent": "27cf784147099545",
+ "Size": 6824592
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.19/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
+ "Created": 1398108230,
+ "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
+ "Tags": [
+ "ubuntu:lucid",
+ "ubuntu:10.04"
+ ],
+ "Size": 182964289,
+ "Comment": ""
+ },
+ {
+ "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
+ "Created": 1398108222,
+ "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
+ "Tags": null,
+ "Size": 0,
+ "Comment": ""
+ },
+ {
+ "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
+ "Created": 1371157430,
+ "CreatedBy": "",
+ "Tags": [
+ "scratch12:latest",
+ "scratch:latest"
+ ],
+ "Size": 0,
+ "Comment": "Imported from -"
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.19/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+**Example request**:
+
+ POST /v1.19/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.19/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.19/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com). This API
+returns both `is_trusted` and `is_automated` images. Currently, they
+are considered identical. In the future, the `is_trusted` property will
+be deprecated and replaced by the `is_automated` property.
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.19/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "star_count": 12,
+ "is_official": false,
+ "name": "wma55/u1210sshd",
+ "is_trusted": false,
+ "is_automated": false,
+ "description": ""
+ },
+ {
+ "star_count": 10,
+ "is_official": false,
+ "name": "jdswinbank/sshd",
+ "is_trusted": false,
+ "is_automated": false,
+ "description": ""
+ },
+ {
+ "star_count": 18,
+ "is_official": false,
+ "name": "vgauthier/sshd",
+ "is_trusted": false,
+ "is_automated": false,
+ "description": ""
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /v1.19/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "email": "hannibal@a-team.com",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.19/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Containers": 11,
+ "CpuCfsPeriod": true,
+ "CpuCfsQuota": true,
+ "Debug": false,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "ExperimentalBuild": false,
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": true,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": true,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OomKillDisable": true,
+ "OperatingSystem": "Boot2Docker",
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "SwapLimit": false,
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.19/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.5.0",
+ "Os": "linux",
+ "KernelVersion": "3.18.5-tinycore64",
+ "GoVersion": "go1.4.1",
+ "GitCommit": "a8a31ef",
+ "Arch": "amd64",
+ "ApiVersion": "1.19"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.19/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.19/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "PortSpecs": null,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Volumes": {
+ "/tmp": {}
+ },
+ "Labels": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
+
+Docker images report the following events:
+
+ untag, delete
+
+**Example request**:
+
+ GET /v1.19/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
+ {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.19/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.19/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.19/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.19/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "Tty": true,
+ "User": "123:456"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **User** - A string value specifying the user, and optionally, group to run
+ the exec process inside the container. Format is one of: `"user"`,
+ `"user:group"`, `"uid"`, or `"uid:gid"`.
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.19/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.19/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.19/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: plain/text
+
+ {
+ "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
+ "Running" : false,
+ "ExitCode" : 2,
+ "ProcessConfig" : {
+ "privileged" : false,
+ "user" : "",
+ "tty" : false,
+ "entrypoint" : "sh",
+ "arguments" : [
+ "-c",
+ "exit 2"
+ ]
+ },
+ "OpenStdin" : false,
+ "OpenStderr" : false,
+ "OpenStdout" : false,
+ "Container" : {
+ "State" : {
+ "Running" : true,
+ "Paused" : false,
+ "Restarting" : false,
+ "OOMKilled" : false,
+ "Pid" : 3650,
+ "ExitCode" : 0,
+ "Error" : "",
+ "StartedAt" : "2014-11-17T22:26:03.717657531Z",
+ "FinishedAt" : "0001-01-01T00:00:00Z"
+ },
+ "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
+ "Created" : "2014-11-17T22:26:03.626304998Z",
+ "Path" : "date",
+ "Args" : [],
+ "Config" : {
+ "Hostname" : "8f177a186b97",
+ "Domainname" : "",
+ "User" : "",
+ "AttachStdin" : false,
+ "AttachStdout" : false,
+ "AttachStderr" : false,
+ "PortSpecs": null,
+ "ExposedPorts" : null,
+ "Tty" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
+ "Cmd" : [
+ "date"
+ ],
+ "Image" : "ubuntu",
+ "Volumes" : null,
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "NetworkDisabled" : false,
+ "MacAddress" : "",
+ "OnBuild" : null,
+ "SecurityOpt" : null
+ },
+ "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
+ "NetworkSettings" : {
+ "IPAddress" : "172.17.0.2",
+ "IPPrefixLen" : 16,
+ "MacAddress" : "02:42:ac:11:00:02",
+ "Gateway" : "172.17.42.1",
+ "Bridge" : "docker0",
+ "PortMapping" : null,
+ "Ports" : {}
+ },
+ "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
+ "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
+ "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Name" : "/test",
+ "Driver" : "aufs",
+ "ExecDriver" : "native-0.2",
+ "MountLabel" : "",
+ "ProcessLabel" : "",
+ "AppArmorProfile" : "",
+ "RestartCount" : 0,
+ "Volumes" : {},
+ "VolumesRW" : {}
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.20.md b/engine/api/v1.20.md
new file mode 100644
index 0000000000..80868cc20a
--- /dev/null
+++ b/engine/api/v1.20.md
@@ -0,0 +1,2393 @@
+---
+title: "Engine API v1.20"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.20/
+- /reference/api/docker_remote_api_v1.20/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.20/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`created`|`restarting`|`running`|`paused`|`exited`)
+ - `label=key` or `label="key=value"` of a container label
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.20/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Links": ["redis3:redis"],
+ "LxcConf": {"lxc.utsname":"docker"},
+ "Memory": 0,
+ "MemorySwap": 0,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "BlkioWeight": 300,
+ "MemorySwappiness": 60,
+ "OomKillDisable": false,
+ "PidMode": "",
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "GroupAdd": ["newgroup"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": ""
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **HostConfig**
+ - **Binds** – A list of bind-mounts for this container. Each item is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **LxcConf** - LXC specific configurations. These configurations only
+ work when using the `lxc` execution driver.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **GroupAdd** - A list of additional groups that the container process will run as
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ values are: `bridge`, `host`, `none`, and `container:`
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `gelf`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": null,
+ "WorkingDir": ""
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecDriver": "native-0.2",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "BlkioWeight": 0,
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "OomKillDisable": false,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}]
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "Gateway": "",
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "MacAddress": "",
+ "PortMapping": null,
+ "Ports": null
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z"
+ },
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ]
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.20/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.20/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "network" : {
+ "rx_dropped" : 0,
+ "rx_bytes" : 648,
+ "rx_errors" : 0,
+ "tx_packets" : 8,
+ "tx_dropped" : 0,
+ "rx_packets" : 8,
+ "tx_errors" : 0,
+ "tx_bytes" : 648
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize?h=&w=`
+
+Resize the TTY for container with `id`. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.20/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.20/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.20/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.20/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Deprecated** in favor of the `archive` endpoint below.
+
+**Example request**:
+
+ POST /v1.20/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Retrieving information about files and folders in a container
+
+`HEAD /containers/(id or name)/archive`
+
+See the description of the `X-Docker-Container-Path-Stat` header in the
+following section.
+
+#### Get an archive of a filesystem resource in a container
+
+`GET /containers/(id or name)/archive`
+
+Get a tar archive of a resource in the filesystem of container `id`.
+
+**Query parameters**:
+
+- **path** - resource in the container's filesystem to archive. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The resource specified by **path** must exist. To assert that the resource
+ is expected to be a directory, **path** should end in `/` or `/.`
+ (assuming a path separator of `/`). If **path** ends in `/.` then this
+ indicates that only the contents of the **path** directory should be
+ copied. A symlink is always resolved to its target.
+
+ > **Note**: It is not possible to copy certain system files such as resources
+ > under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
+ > container.
+
+**Example request**:
+
+ GET /v1.20/containers/8cce319429b2/archive?path=/root HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+ X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+On success, a response header `X-Docker-Container-Path-Stat` will be set to a
+base64-encoded JSON object containing some filesystem header information about
+the archived resource. The above example value would decode to the following
+JSON object (whitespace added for readability):
+
+```json
+{
+ "name": "root",
+ "size": 4096,
+ "mode": 2147484096,
+ "mtime": "2014-02-27T20:51:23Z",
+ "linkTarget": ""
+}
+```
+
+A `HEAD` request can also be made to this endpoint if only this information is
+desired.
+
+**Status codes**:
+
+- **200** - success, returns archive of copied resource
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** was asserted to be a directory but exists as a
+ file)
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** does not exist)
+- **500** - server error
+
+#### Extract an archive of files or folders to a directory in a container
+
+`PUT /containers/(id or name)/archive`
+
+Upload a tar archive to be extracted to a path in the filesystem of container
+`id`.
+
+**Query parameters**:
+
+- **path** - path to a directory in the container
+ to extract the archive's contents into. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The **path** resource must exist.
+- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
+ if unpacking the given content would cause an existing directory to be
+ replaced with a non-directory and vice versa.
+
+**Example request**:
+
+ PUT /v1.20/containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – the content was extracted successfully
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** should be a directory but exists as a file)
+ - unable to overwrite existing directory with non-directory
+ (if **noOverwriteDirNonDir**)
+ - unable to overwrite existing non-directory with directory
+ (if **noOverwriteDirNonDir**)
+- **403** - client error, permission denied, the volume
+ or container rootfs is marked as read-only.
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** resource does not exist)
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.20/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275,
+ "Labels": {}
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135,
+ "Labels": {
+ "com.example.version": "v1"
+ }
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.20/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728,
+ "Labels": {}
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.20/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the `Dockerfile`. This is
+ ignored if `remote` is specified and points to an external `Dockerfile`.
+- **t** – 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.
+- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
+ URI points to a single text file, the file's contents are placed into
+ a file called `Dockerfile` and the image is built from that file. If
+ the URI points to a tarball, the file is downloaded by the daemon and
+ the contents therein used as the context for the build. If the URI
+ points to a tarball and the `dockerfile` parameter is also specified,
+ there must be a file with the corresponding path inside the tarball.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+- **cpuperiod** - The length of a CPU period in microseconds.
+- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
+ object with the following structure:
+
+ {
+ "docker.example.com": {
+ "username": "janedoe",
+ "password": "hunter2"
+ },
+ "https://index.docker.io/v1/": {
+ "username": "mobydock",
+ "password": "conta1n3rize14"
+ }
+ }
+
+ This object maps the hostname of a registry to an object containing the
+ "username" and "password" for that registry. Multiple registries may
+ be specified as the build may be based on an image requiring
+ authentication to pull from any arbitrary registry. Only the registry
+ domain name (and port if not the default "443") are required. However
+ (for legacy reasons) the "official" Docker, Inc. hosted registry must
+ be specified with both a "https://" prefix and a "/v1/" suffix even
+ though Docker will prefer to use the v2 registry API.
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.20/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+- **repo** – Repository name.
+- **tag** – Tag. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.20/images/ubuntu/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Created": "2013-03-23T22:24:18.818426-07:00",
+ "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
+ "ContainerConfig": {
+ "Hostname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": false,
+ "AttachStderr": false,
+ "Tty": true,
+ "OpenStdin": true,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": ["/bin/bash"],
+ "Dns": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": null,
+ "VolumesFrom": "",
+ "WorkingDir": ""
+ },
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Parent": "27cf784147099545",
+ "Size": 6824592
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.20/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
+ "Created": 1398108230,
+ "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
+ "Tags": [
+ "ubuntu:lucid",
+ "ubuntu:10.04"
+ ],
+ "Size": 182964289,
+ "Comment": ""
+ },
+ {
+ "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
+ "Created": 1398108222,
+ "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
+ "Tags": null,
+ "Size": 0,
+ "Comment": ""
+ },
+ {
+ "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
+ "Created": 1371157430,
+ "CreatedBy": "",
+ "Tags": [
+ "scratch12:latest",
+ "scratch:latest"
+ ],
+ "Size": 0,
+ "Comment": "Imported from -"
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.20/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+**Example request**:
+
+ POST /v1.20/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.20/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.20/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.20/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "wma55/u1210sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "jdswinbank/sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "vgauthier/sshd",
+ "star_count": 0
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /v1.20/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "email": "hannibal@a-team.com",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.20/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Containers": 11,
+ "CpuCfsPeriod": true,
+ "CpuCfsQuota": true,
+ "Debug": false,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "ExperimentalBuild": false,
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": true,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": true,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OomKillDisable": true,
+ "OperatingSystem": "Boot2Docker",
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "SwapLimit": false,
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.20/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.5.0",
+ "Os": "linux",
+ "KernelVersion": "3.18.5-tinycore64",
+ "GoVersion": "go1.4.1",
+ "GitCommit": "a8a31ef",
+ "Arch": "amd64",
+ "ApiVersion": "1.20",
+ "Experimental": false
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.20/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.20/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ],
+ "Labels": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+- **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
+- **changes** – Dockerfile instructions to apply while committing
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
+
+Docker images report the following events:
+
+ delete, import, pull, push, tag, untag
+
+**Example request**:
+
+ GET /v1.20/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
+ {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
+ {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.20/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.20/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.20/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.20/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "Tty": true,
+ "User": "123:456"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **User** - A string value specifying the user, and optionally, group to run
+ the exec process inside the container. Format is one of: `"user"`,
+ `"user:group"`, `"uid"`, or `"uid:gid"`.
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.20/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.20/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.20/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: plain/text
+
+ {
+ "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
+ "Running" : false,
+ "ExitCode" : 2,
+ "ProcessConfig" : {
+ "privileged" : false,
+ "user" : "",
+ "tty" : false,
+ "entrypoint" : "sh",
+ "arguments" : [
+ "-c",
+ "exit 2"
+ ]
+ },
+ "OpenStdin" : false,
+ "OpenStderr" : false,
+ "OpenStdout" : false,
+ "Container" : {
+ "State" : {
+ "Running" : true,
+ "Paused" : false,
+ "Restarting" : false,
+ "OOMKilled" : false,
+ "Pid" : 3650,
+ "ExitCode" : 0,
+ "Error" : "",
+ "StartedAt" : "2014-11-17T22:26:03.717657531Z",
+ "FinishedAt" : "0001-01-01T00:00:00Z"
+ },
+ "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
+ "Created" : "2014-11-17T22:26:03.626304998Z",
+ "Path" : "date",
+ "Args" : [],
+ "Config" : {
+ "Hostname" : "8f177a186b97",
+ "Domainname" : "",
+ "User" : "",
+ "AttachStdin" : false,
+ "AttachStdout" : false,
+ "AttachStderr" : false,
+ "ExposedPorts" : null,
+ "Tty" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
+ "Cmd" : [
+ "date"
+ ],
+ "Image" : "ubuntu",
+ "Volumes" : null,
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "NetworkDisabled" : false,
+ "MacAddress" : "",
+ "OnBuild" : null,
+ "SecurityOpt" : null
+ },
+ "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
+ "NetworkSettings" : {
+ "IPAddress" : "172.17.0.2",
+ "IPPrefixLen" : 16,
+ "MacAddress" : "02:42:ac:11:00:02",
+ "Gateway" : "172.17.42.1",
+ "Bridge" : "docker0",
+ "PortMapping" : null,
+ "Ports" : {}
+ },
+ "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
+ "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
+ "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Name" : "/test",
+ "Driver" : "aufs",
+ "ExecDriver" : "native-0.2",
+ "MountLabel" : "",
+ "ProcessLabel" : "",
+ "AppArmorProfile" : "",
+ "RestartCount" : 0,
+ "Mounts" : []
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.21.md b/engine/api/v1.21.md
new file mode 100644
index 0000000000..f21c722eb1
--- /dev/null
+++ b/engine/api/v1.21.md
@@ -0,0 +1,2971 @@
+---
+title: "Engine API v1.21"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.21/
+- /reference/api/docker_remote_api_v1.21/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+ - When the client API version is newer than the daemon's, these calls return an HTTP
+ `400 Bad Request` error message.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.21/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`created`|`restarting`|`running`|`paused`|`exited`)
+ - `label=key` or `label="key=value"` of a container label
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.21/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "StopSignal": "SIGTERM",
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Links": ["redis3:redis"],
+ "LxcConf": {"lxc.utsname":"docker"},
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "BlkioWeight": 300,
+ "MemorySwappiness": 60,
+ "OomKillDisable": false,
+ "PidMode": "",
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsOptions": [""],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "GroupAdd": ["newgroup"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": "",
+ "VolumeDriver": ""
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
+- **HostConfig**
+ - **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ + `volume-name:container-dest` to bind-mount a volume managed by a
+ volume driver into the container. `container-dest` must be an
+ _absolute_ path.
+ + `volume-name:container-dest:ro` to mount the volume read-only
+ inside the container. `container-dest` must be an _absolute_ path.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **LxcConf** - LXC specific configurations. These configurations only
+ work when using the `lxc` execution driver.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **MemoryReservation** - Memory soft limit in bytes.
+ - **KernelMemory** - Kernel memory limit in bytes.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsOptions** - A list of DNS options
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **GroupAdd** - A list of additional groups that the container process will run as
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart, `"unless-stopped"` to restart always except when
+ user has manually stopped the container or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ standard values are: `bridge`, `host`, `none`, and `container:`. Any other value is taken
+ as a custom network's name to which this container should connect to.
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `gelf`, `awslogs`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+ - **VolumeDriver** - Driver that this container users to mount volumes.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": null,
+ "WorkingDir": "",
+ "StopSignal": "SIGTERM"
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecDriver": "native-0.2",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "BlkioWeight": 0,
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsOptions": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "OomKillDisable": false,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}],
+ "VolumeDriver": ""
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "SandboxID": "",
+ "HairpinMode": false,
+ "LinkLocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": null,
+ "SandboxKey": "",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "",
+ "Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "MacAddress": "",
+ "Networks": {
+ "bridge": {
+ "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:12:00:02"
+ }
+ }
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z",
+ "Status": "running"
+ },
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ]
+ }
+
+**Example request, with size information**:
+
+ GET /v1.21/containers/4fa6e0f0c678/json?size=1 HTTP/1.1
+
+**Example response, with size information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ ....
+ "SizeRw": 0,
+ "SizeRootFs": 972,
+ ....
+ }
+
+**Query parameters**:
+
+- **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.21/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.21/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "networks": {
+ "eth0": {
+ "rx_bytes": 5338,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 36,
+ "tx_bytes": 648,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 8
+ },
+ "eth5": {
+ "rx_bytes": 4641,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 26,
+ "tx_bytes": 690,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 9
+ }
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize`
+
+Resize the TTY for container with `id`. The unit is number of characters. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.21/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.21/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.21/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.21/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Deprecated** in favor of the `archive` endpoint below.
+
+**Example request**:
+
+ POST /v1.21/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Retrieving information about files and folders in a container
+
+`HEAD /containers/(id or name)/archive`
+
+See the description of the `X-Docker-Container-Path-Stat` header in the
+following section.
+
+#### Get an archive of a filesystem resource in a container
+
+`GET /containers/(id or name)/archive`
+
+Get a tar archive of a resource in the filesystem of container `id`.
+
+**Query parameters**:
+
+- **path** - resource in the container's filesystem to archive. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The resource specified by **path** must exist. To assert that the resource
+ is expected to be a directory, **path** should end in `/` or `/.`
+ (assuming a path separator of `/`). If **path** ends in `/.` then this
+ indicates that only the contents of the **path** directory should be
+ copied. A symlink is always resolved to its target.
+
+ > **Note**: It is not possible to copy certain system files such as resources
+ > under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
+ > container.
+
+**Example request**:
+
+ GET /v1.21/containers/8cce319429b2/archive?path=/root HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+ X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+On success, a response header `X-Docker-Container-Path-Stat` will be set to a
+base64-encoded JSON object containing some filesystem header information about
+the archived resource. The above example value would decode to the following
+JSON object (whitespace added for readability):
+
+```json
+{
+ "name": "root",
+ "size": 4096,
+ "mode": 2147484096,
+ "mtime": "2014-02-27T20:51:23Z",
+ "linkTarget": ""
+}
+```
+
+A `HEAD` request can also be made to this endpoint if only this information is
+desired.
+
+**Status codes**:
+
+- **200** - success, returns archive of copied resource
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** was asserted to be a directory but exists as a
+ file)
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** does not exist)
+- **500** - server error
+
+#### Extract an archive of files or folders to a directory in a container
+
+`PUT /containers/(id or name)/archive`
+
+Upload a tar archive to be extracted to a path in the filesystem of container
+`id`.
+
+**Query parameters**:
+
+- **path** - path to a directory in the container
+ to extract the archive's contents into. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The **path** resource must exist.
+- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
+ if unpacking the given content would cause an existing directory to be
+ replaced with a non-directory and vice versa.
+
+**Example request**:
+
+ PUT /v1.21/containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – the content was extracted successfully
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** should be a directory but exists as a file)
+ - unable to overwrite existing directory with non-directory
+ (if **noOverwriteDirNonDir**)
+ - unable to overwrite existing non-directory with directory
+ (if **noOverwriteDirNonDir**)
+- **403** - client error, permission denied, the volume
+ or container rootfs is marked as read-only.
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** resource does not exist)
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.21/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275,
+ "Labels": {}
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135,
+ "Labels": {
+ "com.example.version": "v1"
+ }
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.21/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728,
+ "Labels": {}
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.21/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the `Dockerfile`. This is
+ ignored if `remote` is specified and points to an external `Dockerfile`.
+- **t** – 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 one or more `t` parameters.
+- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
+ URI points to a single text file, the file's contents are placed into
+ a file called `Dockerfile` and the image is built from that file. If
+ the URI points to a tarball, the file is downloaded by the daemon and
+ the contents therein used as the context for the build. If the URI
+ points to a tarball and the `dockerfile` parameter is also specified,
+ there must be a file with the corresponding path inside the tarball.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+- **cpuperiod** - The length of a CPU period in microseconds.
+- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
+- **buildargs** – JSON map of string pairs for build-time variables. Users pass
+ these values at build-time. Docker uses the `buildargs` as the environment
+ context for command(s) run via the Dockerfile's `RUN` instruction or for
+ variable expansion in other Dockerfile instructions. This is not meant for
+ passing secret values. [Read more about the buildargs instruction](../reference/builder.md#arg)
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
+ object with the following structure:
+
+ {
+ "docker.example.com": {
+ "username": "janedoe",
+ "password": "hunter2"
+ },
+ "https://index.docker.io/v1/": {
+ "username": "mobydock",
+ "password": "conta1n3rize14"
+ }
+ }
+
+ This object maps the hostname of a registry to an object containing the
+ "username" and "password" for that registry. Multiple registries may
+ be specified as the build may be based on an image requiring
+ authentication to pull from any arbitrary registry. Only the registry
+ domain name (and port if not the default "443") are required. However
+ (for legacy reasons) the "official" Docker, Inc. hosted registry must
+ be specified with both a "https://" prefix and a "/v1/" suffix even
+ though Docker will prefer to use the v2 registry API.
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.21/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull. The name may include a tag or
+ digest. This parameter may only be used when pulling an image.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+ This parameter may only be used when importing an image.
+- **repo** – Repository name given to an image when it is imported.
+ The repo may include a tag. This parameter may only be used when importing
+ an image.
+- **tag** – Tag or digest. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.21/images/example/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Id" : "85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
+ "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
+ "Comment" : "",
+ "Os" : "linux",
+ "Architecture" : "amd64",
+ "Parent" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "ContainerConfig" : {
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "User" : "",
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "Labels" : {
+ "com.example.license" : "GPL",
+ "com.example.version" : "1.0",
+ "com.example.vendor" : "Acme"
+ },
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts" : null,
+ "Cmd" : [
+ "/bin/sh",
+ "-c",
+ "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
+ ]
+ },
+ "DockerVersion" : "1.9.0-dev",
+ "VirtualSize" : 188359297,
+ "Size" : 0,
+ "Author" : "",
+ "Created" : "2015-09-10T08:30:53.26995814Z",
+ "GraphDriver" : {
+ "Name" : "aufs",
+ "Data" : null
+ },
+ "RepoDigests" : [
+ "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags" : [
+ "example:1.0",
+ "example:latest",
+ "example:stable"
+ ],
+ "Config" : {
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "StdinOnce" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Cmd" : [
+ "/bin/bash"
+ ],
+ "ExposedPorts" : null,
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "Labels" : {
+ "com.example.vendor" : "Acme",
+ "com.example.version" : "1.0",
+ "com.example.license" : "GPL"
+ },
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "WorkingDir" : "",
+ "User" : ""
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.21/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
+ "Created": 1398108230,
+ "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
+ "Tags": [
+ "ubuntu:lucid",
+ "ubuntu:10.04"
+ ],
+ "Size": 182964289,
+ "Comment": ""
+ },
+ {
+ "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
+ "Created": 1398108222,
+ "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
+ "Tags": null,
+ "Size": 0,
+ "Comment": ""
+ },
+ {
+ "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
+ "Created": 1371157430,
+ "CreatedBy": "",
+ "Tags": [
+ "scratch12:latest",
+ "scratch:latest"
+ ],
+ "Size": 0,
+ "Comment": "Imported from -"
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.21/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+**Example request**:
+
+ POST /v1.21/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.21/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.21/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.21/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "wma55/u1210sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "jdswinbank/sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "vgauthier/sshd",
+ "star_count": 0
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /v1.21/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "email": "hannibal@a-team.com",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.21/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "ClusterStore": "etcd://localhost:2379",
+ "Containers": 11,
+ "CpuCfsPeriod": true,
+ "CpuCfsQuota": true,
+ "Debug": false,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "ExperimentalBuild": false,
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": true,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": true,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OomKillDisable": true,
+ "OperatingSystem": "Boot2Docker",
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "ServerVersion": "1.9.0",
+ "SwapLimit": false,
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.21/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.5.0",
+ "Os": "linux",
+ "KernelVersion": "3.18.5-tinycore64",
+ "GoVersion": "go1.4.1",
+ "GitCommit": "a8a31ef",
+ "Arch": "amd64",
+ "ApiVersion": "1.20",
+ "Experimental": false
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.21/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.21/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ],
+ "Labels": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+- **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
+- **changes** – Dockerfile instructions to apply while committing
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
+
+Docker images report the following events:
+
+ delete, import, pull, push, tag, untag
+
+**Example request**:
+
+ GET /v1.21/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status":"pull","id":"busybox:latest","time":1442421700,"timeNano":1442421700598988358}
+ {"status":"create","id":"5745704abe9caa5","from":"busybox","time":1442421716,"timeNano":1442421716853979870}
+ {"status":"attach","id":"5745704abe9caa5","from":"busybox","time":1442421716,"timeNano":1442421716894759198}
+ {"status":"start","id":"5745704abe9caa5","from":"busybox","time":1442421716,"timeNano":1442421716983607193}
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+ - `label=`; -- image and container label to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.21/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.21/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.21/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.21/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "Privileged": true,
+ "Tty": true,
+ "User": "123:456"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Privileged** - Boolean value, runs the exec process with extended privileges.
+- **User** - A string value specifying the user, and optionally, group to run
+ the exec process inside the container. Format is one of: `"user"`,
+ `"user:group"`, `"uid"`, or `"uid:gid"`.
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **409** - container is paused
+- **500** - server error
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.21/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **409** - container is paused
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.21/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.21/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: plain/text
+
+ {
+ "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
+ "Running" : false,
+ "ExitCode" : 2,
+ "ProcessConfig" : {
+ "privileged" : false,
+ "user" : "",
+ "tty" : false,
+ "entrypoint" : "sh",
+ "arguments" : [
+ "-c",
+ "exit 2"
+ ]
+ },
+ "OpenStdin" : false,
+ "OpenStderr" : false,
+ "OpenStdout" : false,
+ "Container" : {
+ "State" : {
+ "Status" : "running",
+ "Running" : true,
+ "Paused" : false,
+ "Restarting" : false,
+ "OOMKilled" : false,
+ "Pid" : 3650,
+ "ExitCode" : 0,
+ "Error" : "",
+ "StartedAt" : "2014-11-17T22:26:03.717657531Z",
+ "FinishedAt" : "0001-01-01T00:00:00Z"
+ },
+ "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
+ "Created" : "2014-11-17T22:26:03.626304998Z",
+ "Path" : "date",
+ "Args" : [],
+ "Config" : {
+ "Hostname" : "8f177a186b97",
+ "Domainname" : "",
+ "User" : "",
+ "AttachStdin" : false,
+ "AttachStdout" : false,
+ "AttachStderr" : false,
+ "ExposedPorts" : null,
+ "Tty" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
+ "Cmd" : [
+ "date"
+ ],
+ "Image" : "ubuntu",
+ "Volumes" : null,
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "NetworkDisabled" : false,
+ "MacAddress" : "",
+ "OnBuild" : null,
+ "SecurityOpt" : null
+ },
+ "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
+ "NetworkSettings" : {
+ "Bridge": "",
+ "SandboxID": "",
+ "HairpinMode": false,
+ "LinkLocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": null,
+ "SandboxKey": "",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "",
+ "Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "MacAddress": "",
+ "Networks": {
+ "bridge": {
+ "EndpointID": "",
+ "Gateway": "",
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": ""
+ }
+ }
+ },
+ "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
+ "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
+ "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Name" : "/test",
+ "Driver" : "aufs",
+ "ExecDriver" : "native-0.2",
+ "MountLabel" : "",
+ "ProcessLabel" : "",
+ "AppArmorProfile" : "",
+ "RestartCount" : 0,
+ "Mounts" : []
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+### 2.4 Volumes
+
+#### List volumes
+
+`GET /volumes`
+
+**Example request**:
+
+ GET /v1.21/volumes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Volumes": [
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+ ]
+ }
+
+**Query parameters**:
+
+- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true`
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a volume
+
+`POST /volumes/create`
+
+Create a volume
+
+**Example request**:
+
+ POST /v1.21/volumes/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Name": "tardis"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+
+**Status codes**:
+
+- **201** - no error
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new volume's name. If not specified, Docker generates a name.
+- **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
+- **DriverOpts** - A mapping of driver options and values. These options are
+ passed directly to the driver and are driver specific.
+
+#### Inspect a volume
+
+`GET /volumes/(name)`
+
+Return low-level information on the volume `name`
+
+**Example request**:
+
+ GET /volumes/tardis
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+
+**Status codes**:
+
+- **200** - no error
+- **404** - no such volume
+- **500** - server error
+
+#### Remove a volume
+
+`DELETE /volumes/(name)`
+
+Instruct the driver to remove the volume (`name`).
+
+**Example request**:
+
+ DELETE /v1.21/volumes/tardis HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** - no error
+- **404** - no such volume or volume driver
+- **409** - volume is in use and cannot be removed
+- **500** - server error
+
+### 2.5 Networks
+
+#### List networks
+
+`GET /networks`
+
+**Example request**:
+
+ GET /v1.21/networks HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+[
+ {
+ "Name": "bridge",
+ "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
+ "Scope": "local",
+ "Driver": "bridge",
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.17.0.0/16"
+ }
+ ]
+ },
+ "Containers": {
+ "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
+ "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
+ "MacAddress": "02:42:ac:11:00:02",
+ "IPv4Address": "172.17.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ }
+ },
+ {
+ "Name": "none",
+ "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
+ "Scope": "local",
+ "Driver": "null",
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ },
+ {
+ "Name": "host",
+ "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
+ "Scope": "local",
+ "Driver": "host",
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ }
+]
+```
+
+**Query parameters**:
+
+- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the networks list. Available filters: `name=[network-names]` , `id=[network-ids]`
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Inspect network
+
+`GET /networks/`
+
+**Example request**:
+
+ GET /v1.21/networks/f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566 HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+{
+ "Name": "bridge",
+ "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
+ "Scope": "local",
+ "Driver": "bridge",
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.17.0.0/16"
+ }
+ ]
+ },
+ "Containers": {
+ "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
+ "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
+ "MacAddress": "02:42:ac:11:00:02",
+ "IPv4Address": "172.17.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ }
+}
+```
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network not found
+
+#### Create a network
+
+`POST /networks/create`
+
+Create a network
+
+**Example request**:
+
+```
+POST /v1.21/networks/create HTTP/1.1
+Content-Type: application/json
+
+{
+ "Name":"isolated_nw",
+ "CheckDuplicate":true,
+ "Driver":"bridge",
+ "IPAM":{
+ "Driver": "default",
+ "Config":[
+ {
+ "Subnet":"172.20.0.0/16",
+ "IPRange":"172.20.10.0/24",
+ "Gateway":"172.20.10.11"
+ }
+ ]
+ }
+}
+```
+
+**Example response**:
+
+```
+HTTP/1.1 201 Created
+Content-Type: application/json
+
+{
+ "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
+ "Warning": ""
+}
+```
+
+**Status codes**:
+
+- **201** - no error
+- **404** - plugin not found
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new network's name. this is a mandatory field
+- **CheckDuplicate** - Requests daemon to check for networks with same name. Defaults to `false`
+- **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
+- **IPAM** - Optional custom IP scheme for the network
+ - **Driver** - Name of the IPAM driver to use. Defaults to `default` driver
+ - **Config** - List of IPAM configuration options, specified as a map:
+ `{"Subnet": , "IPRange": , "Gateway": , "AuxAddress": }`
+- **Options** - Network specific options to be used by the drivers
+
+#### Connect a container to a network
+
+`POST /networks/(id)/connect`
+
+Connect a container to a network
+
+**Example request**:
+
+```
+POST /v1.21/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4"
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container is not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **container** - container-id/name to be connected to the network
+
+#### Disconnect a container from a network
+
+`POST /networks/(id)/disconnect`
+
+Disconnect a container from a network
+
+**Example request**:
+
+```
+POST /v1.21/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4"
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **Container** - container-id/name to be disconnected from a network
+
+#### Remove a network
+
+`DELETE /networks/(id)`
+
+Instruct the driver to remove the network (`id`).
+
+**Example request**:
+
+ DELETE /v1.21/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - no such network
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.22.md b/engine/api/v1.22.md
new file mode 100644
index 0000000000..6b3d6eceb6
--- /dev/null
+++ b/engine/api/v1.22.md
@@ -0,0 +1,3309 @@
+---
+title: "Engine API v1.22"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.22/
+- /reference/api/docker_remote_api_v1.22/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.22/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:02"
+ }
+ }
+ }
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.8",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:08"
+ }
+ }
+ }
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.6",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:06"
+ }
+ }
+ }
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.5",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:05"
+ }
+ }
+ }
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
+ - `label=key` or `label="key=value"` of a container label
+ - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.22/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": null,
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "StopSignal": "SIGTERM",
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Tmpfs": { "/run": "rw,noexec,nosuid,size=65536k" },
+ "Links": ["redis3:redis"],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "BlkioWeight": 300,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "MemorySwappiness": 60,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "PidMode": "",
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsOptions": [""],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "GroupAdd": ["newgroup"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": "",
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "NetworkingConfig": {
+ "EndpointsConfig": {
+ "isolated_nw" : {
+ "IPAMConfig": {
+ "IPv4Address":"172.20.30.33",
+ "IPv6Address":"2001:db8:abcd::3033"
+ },
+ "Links":["container_1", "container_2"],
+ "Aliases":["server_x", "server_y"]
+ }
+ }
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
+- **HostConfig**
+ - **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ + `volume-name:container-dest` to bind-mount a volume managed by a
+ volume driver into the container. `container-dest` must be an
+ _absolute_ path.
+ + `volume-name:container-dest:ro` to mount the volume read-only
+ inside the container. `container-dest` must be an _absolute_ path.
+ - **Tmpfs** – A map of container directories which should be replaced by tmpfs mounts, and their corresponding
+ mount options. A JSON object in the form `{ "/run": "rw,noexec,nosuid,size=65536k" }`.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **MemoryReservation** - Memory soft limit in bytes.
+ - **KernelMemory** - Kernel memory limit in bytes.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of: `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
+ - **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of: `"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of: `"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of: `"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **BlkioDeviceWriteIOps** - Limit write rate (IO per second) to a device in the form of: `"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsOptions** - A list of DNS options
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **GroupAdd** - A list of additional groups that the container process will run as
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart, `"unless-stopped"` to restart always except when
+ user has manually stopped the container or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ standard values are: `bridge`, `host`, `none`, and `container:`. Any other value is taken
+ as a custom network's name to which this container should connect to.
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `gelf`, `awslogs`, `splunk`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+ - **VolumeDriver** - Driver that this container users to mount volumes.
+ - **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "StopSignal": "SIGTERM"
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "BlkioWeight": 0,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsOptions": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}],
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "SandboxID": "",
+ "HairpinMode": false,
+ "LinkLocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": null,
+ "SandboxKey": "",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "",
+ "Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "MacAddress": "",
+ "Networks": {
+ "bridge": {
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:12:00:02"
+ }
+ }
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Dead": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z",
+ "Status": "running"
+ },
+ "Mounts": [
+ {
+ "Name": "fac362...80535",
+ "Source": "/data",
+ "Destination": "/data",
+ "Driver": "local",
+ "Mode": "ro,Z",
+ "RW": false,
+ "Propagation": ""
+ }
+ ]
+ }
+
+**Example request, with size information**:
+
+ GET /v1.22/containers/4fa6e0f0c678/json?size=1 HTTP/1.1
+
+**Example response, with size information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ ....
+ "SizeRw": 0,
+ "SizeRootFs": 972,
+ ....
+ }
+
+**Query parameters**:
+
+- **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.22/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.22/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "networks": {
+ "eth0": {
+ "rx_bytes": 5338,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 36,
+ "tx_bytes": 648,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 8
+ },
+ "eth5": {
+ "rx_bytes": 4641,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 26,
+ "tx_bytes": 690,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 9
+ }
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize`
+
+Resize the TTY for container with `id`. The unit is number of characters. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.22/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Update a container
+
+`POST /containers/(id or name)/update`
+
+Update resource configs of one or more containers.
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/update HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "BlkioWeight": 300,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0",
+ "Memory": 314572800,
+ "MemorySwap": 514288000,
+ "MemoryReservation": 209715200,
+ "KernelMemory": 52428800
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Warnings": []
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **409** - container is paused
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.22/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.22/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.22/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Deprecated** in favor of the `archive` endpoint below.
+
+**Example request**:
+
+ POST /v1.22/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Retrieving information about files and folders in a container
+
+`HEAD /containers/(id or name)/archive`
+
+See the description of the `X-Docker-Container-Path-Stat` header in the
+following section.
+
+#### Get an archive of a filesystem resource in a container
+
+`GET /containers/(id or name)/archive`
+
+Get a tar archive of a resource in the filesystem of container `id`.
+
+**Query parameters**:
+
+- **path** - resource in the container's filesystem to archive. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The resource specified by **path** must exist. To assert that the resource
+ is expected to be a directory, **path** should end in `/` or `/.`
+ (assuming a path separator of `/`). If **path** ends in `/.` then this
+ indicates that only the contents of the **path** directory should be
+ copied. A symlink is always resolved to its target.
+
+ > **Note**: It is not possible to copy certain system files such as resources
+ > under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
+ > container.
+
+**Example request**:
+
+ GET /v1.22/containers/8cce319429b2/archive?path=/root HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+ X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+On success, a response header `X-Docker-Container-Path-Stat` will be set to a
+base64-encoded JSON object containing some filesystem header information about
+the archived resource. The above example value would decode to the following
+JSON object (whitespace added for readability):
+
+```json
+{
+ "name": "root",
+ "size": 4096,
+ "mode": 2147484096,
+ "mtime": "2014-02-27T20:51:23Z",
+ "linkTarget": ""
+}
+```
+
+A `HEAD` request can also be made to this endpoint if only this information is
+desired.
+
+**Status codes**:
+
+- **200** - success, returns archive of copied resource
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** was asserted to be a directory but exists as a
+ file)
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** does not exist)
+- **500** - server error
+
+#### Extract an archive of files or folders to a directory in a container
+
+`PUT /containers/(id or name)/archive`
+
+Upload a tar archive to be extracted to a path in the filesystem of container
+`id`.
+
+**Query parameters**:
+
+- **path** - path to a directory in the container
+ to extract the archive's contents into. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The **path** resource must exist.
+- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
+ if unpacking the given content would cause an existing directory to be
+ replaced with a non-directory and vice versa.
+
+**Example request**:
+
+ PUT /v1.22/containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – the content was extracted successfully
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** should be a directory but exists as a file)
+ - unable to overwrite existing directory with non-directory
+ (if **noOverwriteDirNonDir**)
+ - unable to overwrite existing non-directory with directory
+ (if **noOverwriteDirNonDir**)
+- **403** - client error, permission denied, the volume
+ or container rootfs is marked as read-only.
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** resource does not exist)
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.22/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275,
+ "Labels": {}
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135,
+ "Labels": {
+ "com.example.version": "v1"
+ }
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.22/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728,
+ "Labels": {}
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.22/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the `Dockerfile`. This is
+ ignored if `remote` is specified and points to an external `Dockerfile`.
+- **t** – 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 one or more `t` parameters.
+- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
+ URI points to a single text file, the file's contents are placed into
+ a file called `Dockerfile` and the image is built from that file. If
+ the URI points to a tarball, the file is downloaded by the daemon and
+ the contents therein used as the context for the build. If the URI
+ points to a tarball and the `dockerfile` parameter is also specified,
+ there must be a file with the corresponding path inside the tarball.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+- **cpuperiod** - The length of a CPU period in microseconds.
+- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
+- **buildargs** – JSON map of string pairs for build-time variables. Users pass
+ these values at build-time. Docker uses the `buildargs` as the environment
+ context for command(s) run via the Dockerfile's `RUN` instruction or for
+ variable expansion in other Dockerfile instructions. This is not meant for
+ passing secret values. [Read more about the buildargs instruction](../reference/builder.md#arg)
+- **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
+ object with the following structure:
+
+ {
+ "docker.example.com": {
+ "username": "janedoe",
+ "password": "hunter2"
+ },
+ "https://index.docker.io/v1/": {
+ "username": "mobydock",
+ "password": "conta1n3rize14"
+ }
+ }
+
+ This object maps the hostname of a registry to an object containing the
+ "username" and "password" for that registry. Multiple registries may
+ be specified as the build may be based on an image requiring
+ authentication to pull from any arbitrary registry. Only the registry
+ domain name (and port if not the default "443") are required. However
+ (for legacy reasons) the "official" Docker, Inc. hosted registry must
+ be specified with both a "https://" prefix and a "/v1/" suffix even
+ though Docker will prefer to use the v2 registry API.
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.22/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull. The name may include a tag or
+ digest. This parameter may only be used when pulling an image.
+ The pull is cancelled if the HTTP connection is closed.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+ This parameter may only be used when importing an image.
+- **repo** – Repository name given to an image when it is imported.
+ The repo may include a tag. This parameter may only be used when importing
+ an image.
+- **tag** – Tag or digest. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
+ - Credential based login:
+
+ ```
+ {
+ "username": "jdoe",
+ "password": "secret",
+ "email": "jdoe@acme.com"
+ }
+ ```
+
+ - Token based login:
+
+ ```
+ {
+ "registrytoken": "9cbaf023786cd7..."
+ }
+ ```
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.22/images/example/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Id" : "85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
+ "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
+ "Comment" : "",
+ "Os" : "linux",
+ "Architecture" : "amd64",
+ "Parent" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "ContainerConfig" : {
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "User" : "",
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "Labels" : {
+ "com.example.license" : "GPL",
+ "com.example.version" : "1.0",
+ "com.example.vendor" : "Acme"
+ },
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts" : null,
+ "Cmd" : [
+ "/bin/sh",
+ "-c",
+ "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
+ ]
+ },
+ "DockerVersion" : "1.9.0-dev",
+ "VirtualSize" : 188359297,
+ "Size" : 0,
+ "Author" : "",
+ "Created" : "2015-09-10T08:30:53.26995814Z",
+ "GraphDriver" : {
+ "Name" : "aufs",
+ "Data" : null
+ },
+ "RepoDigests" : [
+ "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags" : [
+ "example:1.0",
+ "example:latest",
+ "example:stable"
+ ],
+ "Config" : {
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "StdinOnce" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Cmd" : [
+ "/bin/bash"
+ ],
+ "ExposedPorts" : null,
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "Labels" : {
+ "com.example.vendor" : "Acme",
+ "com.example.version" : "1.0",
+ "com.example.license" : "GPL"
+ },
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "WorkingDir" : "",
+ "User" : ""
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.22/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
+ "Created": 1398108230,
+ "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
+ "Tags": [
+ "ubuntu:lucid",
+ "ubuntu:10.04"
+ ],
+ "Size": 182964289,
+ "Comment": ""
+ },
+ {
+ "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
+ "Created": 1398108222,
+ "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
+ "Tags": null,
+ "Size": 0,
+ "Comment": ""
+ },
+ {
+ "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
+ "Created": 1371157430,
+ "CreatedBy": "",
+ "Tags": [
+ "scratch12:latest",
+ "scratch:latest"
+ ],
+ "Size": 0,
+ "Comment": "Imported from -"
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.22/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+The push is cancelled if the HTTP connection is closed.
+
+**Example request**:
+
+ POST /v1.22/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
+ - Credential based login:
+
+ ```
+ {
+ "username": "jdoe",
+ "password": "secret",
+ "email": "jdoe@acme.com",
+ }
+ ```
+
+ - Token based login:
+
+ ```
+ {
+ "registrytoken": "9cbaf023786cd7..."
+ }
+ ```
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.22/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.22/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.22/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "wma55/u1210sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "jdswinbank/sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "vgauthier/sshd",
+ "star_count": 0
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /v1.22/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "email": "hannibal@a-team.com",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.22/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Architecture": "x86_64",
+ "ClusterStore": "etcd://localhost:2379",
+ "Containers": 11,
+ "ContainersRunning": 7,
+ "ContainersStopped": 3,
+ "ContainersPaused": 1,
+ "CpuCfsPeriod": true,
+ "CpuCfsQuota": true,
+ "Debug": false,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "ExperimentalBuild": false,
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": true,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": true,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OomKillDisable": true,
+ "OSType": "linux",
+ "OperatingSystem": "Boot2Docker",
+ "Plugins": {
+ "Volume": [
+ "local"
+ ],
+ "Network": [
+ "null",
+ "host",
+ "bridge"
+ ]
+ },
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "ServerVersion": "1.9.0",
+ "SwapLimit": false,
+ "SystemStatus": [["State", "Healthy"]],
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.22/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.10.0",
+ "Os": "linux",
+ "KernelVersion": "3.19.0-23-generic",
+ "GoVersion": "go1.4.2",
+ "GitCommit": "e75da4b",
+ "Arch": "amd64",
+ "ApiVersion": "1.22",
+ "BuildTime": "2015-12-01T07:09:13.444803460+00:00",
+ "Experimental": true
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.22/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.22/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ],
+ "Labels": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+- **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
+- **changes** – Dockerfile instructions to apply while committing
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
+
+Docker images report the following events:
+
+ delete, import, pull, push, tag, untag
+
+Docker volumes report the following events:
+
+ create, mount, unmount, destroy
+
+Docker networks report the following events:
+
+ create, connect, disconnect, destroy
+
+**Example request**:
+
+ GET /v1.22/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Server: Docker/1.10.0 (linux)
+ Date: Fri, 29 Apr 2016 15:18:06 GMT
+ Transfer-Encoding: chunked
+
+ {
+ "status": "pull",
+ "id": "alpine:latest",
+ "Type": "image",
+ "Action": "pull",
+ "Actor": {
+ "ID": "alpine:latest",
+ "Attributes": {
+ "name": "alpine"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101301854122
+ }
+ {
+ "status": "create",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "create",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101381709551
+ }
+ {
+ "status": "attach",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "attach",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101383858412
+ }
+ {
+ "Type": "network",
+ "Action": "connect",
+ "Actor": {
+ "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
+ "Attributes": {
+ "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "name": "bridge",
+ "type": "bridge"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101394865557
+ }
+ {
+ "status": "start",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "start",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101607533796
+ }
+ {
+ "status": "resize",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "resize",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "height": "46",
+ "image": "alpine",
+ "name": "my-container",
+ "width": "204"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101610269268
+ }
+ {
+ "status": "die",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "die",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "exitCode": "0",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105079144137
+ }
+ {
+ "Type": "network",
+ "Action": "disconnect",
+ "Actor": {
+ "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
+ "Attributes": {
+ "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "name": "bridge",
+ "type": "bridge"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105230860245
+ }
+ {
+ "status": "destroy",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "destroy",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105338056026
+ }
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+ - `label=`; -- image and container label to filter
+ - `type=`; -- either `container` or `image` or `volume` or `network`
+ - `volume=`; -- volume to filter
+ - `network=`; -- network to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.22/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.22/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.22/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.22/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "DetachKeys": "ctrl-p,ctrl-q",
+ "Privileged": true,
+ "Tty": true,
+ "User": "123:456"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **DetachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Privileged** - Boolean value, runs the exec process with extended privileges.
+- **User** - A string value specifying the user, and optionally, group to run
+ the exec process inside the container. Format is one of: `"user"`,
+ `"user:group"`, `"uid"`, or `"uid:gid"`.
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **409** - container is paused
+- **500** - server error
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.22/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **409** - container is paused
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.22/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.22/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "CanRemove": false,
+ "ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126",
+ "DetachKeys": "",
+ "ExitCode": 2,
+ "ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b",
+ "OpenStderr": true,
+ "OpenStdin": true,
+ "OpenStdout": true,
+ "ProcessConfig": {
+ "arguments": [
+ "-c",
+ "exit 2"
+ ],
+ "entrypoint": "sh",
+ "privileged": false,
+ "tty": true,
+ "user": "1000"
+ },
+ "Running": false
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+### 2.4 Volumes
+
+#### List volumes
+
+`GET /volumes`
+
+**Example request**:
+
+ GET /v1.22/volumes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Volumes": [
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+ ],
+ "Warnings": []
+ }
+
+**Query parameters**:
+
+- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true`
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a volume
+
+`POST /volumes/create`
+
+Create a volume
+
+**Example request**:
+
+ POST /v1.22/volumes/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Name": "tardis"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+
+**Status codes**:
+
+- **201** - no error
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new volume's name. If not specified, Docker generates a name.
+- **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
+- **DriverOpts** - A mapping of driver options and values. These options are
+ passed directly to the driver and are driver specific.
+
+#### Inspect a volume
+
+`GET /volumes/(name)`
+
+Return low-level information on the volume `name`
+
+**Example request**:
+
+ GET /volumes/tardis
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+
+**Status codes**:
+
+- **200** - no error
+- **404** - no such volume
+- **500** - server error
+
+#### Remove a volume
+
+`DELETE /volumes/(name)`
+
+Instruct the driver to remove the volume (`name`).
+
+**Example request**:
+
+ DELETE /v1.22/volumes/tardis HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** - no error
+- **404** - no such volume or volume driver
+- **409** - volume is in use and cannot be removed
+- **500** - server error
+
+### 2.5 Networks
+
+#### List networks
+
+`GET /networks`
+
+**Example request**:
+
+ GET /v1.22/networks?filters={"type":{"custom":true}} HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+[
+ {
+ "Name": "bridge",
+ "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
+ "Scope": "local",
+ "Driver": "bridge",
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.17.0.0/16"
+ }
+ ]
+ },
+ "Containers": {
+ "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
+ "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
+ "MacAddress": "02:42:ac:11:00:02",
+ "IPv4Address": "172.17.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ }
+ },
+ {
+ "Name": "none",
+ "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
+ "Scope": "local",
+ "Driver": "null",
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ },
+ {
+ "Name": "host",
+ "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
+ "Scope": "local",
+ "Driver": "host",
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ }
+]
+```
+
+**Query parameters**:
+
+- **filters** - JSON encoded network list filter. The filter value is one of:
+ - `id=` Matches all or part of a network id.
+ - `name=` Matches all or part of a network name.
+ - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Inspect network
+
+`GET /networks/`
+
+**Example request**:
+
+ GET /v1.22/networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+{
+ "Name": "net01",
+ "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
+ "Scope": "local",
+ "Driver": "bridge",
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.19.0.0/16",
+ "Gateway": "172.19.0.1/16"
+ }
+ ],
+ "Options": {
+ "foo": "bar"
+ }
+ },
+ "Containers": {
+ "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
+ "Name": "test",
+ "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
+ "MacAddress": "02:42:ac:13:00:02",
+ "IPv4Address": "172.19.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ }
+}
+```
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network not found
+
+#### Create a network
+
+`POST /networks/create`
+
+Create a network
+
+**Example request**:
+
+```
+POST /v1.22/networks/create HTTP/1.1
+Content-Type: application/json
+
+{
+ "Name":"isolated_nw",
+ "CheckDuplicate":true,
+ "Driver":"bridge",
+ "IPAM":{
+ "Driver": "default",
+ "Config":[
+ {
+ "Subnet":"172.20.0.0/16",
+ "IPRange":"172.20.10.0/24",
+ "Gateway":"172.20.10.11"
+ },
+ {
+ "Subnet":"2001:db8:abcd::/64",
+ "Gateway":"2001:db8:abcd::1011"
+ }
+ ],
+ "Options": {
+ "foo": "bar"
+ }
+ },
+ "Internal":true
+}
+```
+
+**Example response**:
+
+```
+HTTP/1.1 201 Created
+Content-Type: application/json
+
+{
+ "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
+ "Warning": ""
+}
+```
+
+**Status codes**:
+
+- **201** - no error
+- **404** - plugin not found
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new network's name. this is a mandatory field
+- **CheckDuplicate** - Requests daemon to check for networks with same name. Defaults to `false`
+- **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
+- **IPAM** - Optional custom IP scheme for the network
+ - **Driver** - Name of the IPAM driver to use. Defaults to `default` driver
+ - **Config** - List of IPAM configuration options, specified as a map:
+ `{"Subnet": , "IPRange": , "Gateway": , "AuxAddress": }`
+ - **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
+- **Options** - Network specific options to be used by the drivers
+
+#### Connect a container to a network
+
+`POST /networks/(id)/connect`
+
+Connect a container to a network
+
+**Example request**:
+
+```
+POST /v1.22/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4",
+ "EndpointConfig": {
+ "IPAMConfig": {
+ "IPv4Address":"172.24.56.89",
+ "IPv6Address":"2001:db8::5689"
+ }
+ }
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container is not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **container** - container-id/name to be connected to the network
+
+#### Disconnect a container from a network
+
+`POST /networks/(id)/disconnect`
+
+Disconnect a container from a network
+
+**Example request**:
+
+```
+POST /v1.22/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4",
+ "Force":false
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **Container** - container-id/name to be disconnected from a network
+- **Force** - Force the container to disconnect from a network
+
+#### Remove a network
+
+`DELETE /networks/(id)`
+
+Instruct the driver to remove the network (`id`).
+
+**Example request**:
+
+ DELETE /v1.22/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - no such network
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.23.md b/engine/api/v1.23.md
new file mode 100644
index 0000000000..aaf42045e8
--- /dev/null
+++ b/engine/api/v1.23.md
@@ -0,0 +1,3426 @@
+---
+title: "Engine API v1.23"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.23/
+- /reference/api/docker_remote_api_v1.23/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+ - When the client API version is newer than the daemon's, these calls return an HTTP
+ `400 Bad Request` error message.
+
+## 2. Endpoints
+
+### 2.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.23/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:02"
+ }
+ }
+ },
+ "Mounts": [
+ {
+ "Name": "fac362...80535",
+ "Source": "/data",
+ "Destination": "/data",
+ "Driver": "local",
+ "Mode": "ro,Z",
+ "RW": false,
+ "Propagation": ""
+ }
+ ]
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.8",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:08"
+ }
+ }
+ },
+ "Mounts": []
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.6",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:06"
+ }
+ }
+ },
+ "Mounts": []
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.5",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:05"
+ }
+ }
+ },
+ "Mounts": []
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
+ - `label=key` or `label="key=value"` of a container label
+ - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
+ - `ancestor`=(`[:]`, `` or ``)
+ - `before`=(`` or ``)
+ - `since`=(`` or ``)
+ - `volume`=(`` or ``)
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.23/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": "",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "StopSignal": "SIGTERM",
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Tmpfs": { "/run": "rw,noexec,nosuid,size=65536k" },
+ "Links": ["redis3:redis"],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "BlkioWeight": 300,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "MemorySwappiness": 60,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "PidMode": "",
+ "PidsLimit": -1,
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsOptions": [""],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "GroupAdd": ["newgroup"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "CgroupParent": "",
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "NetworkingConfig": {
+ "EndpointsConfig": {
+ "isolated_nw" : {
+ "IPAMConfig": {
+ "IPv4Address":"172.20.30.33",
+ "IPv6Address":"2001:db8:abcd::3033"
+ },
+ "Links":["container_1", "container_2"],
+ "Aliases":["server_x", "server_y"]
+ }
+ }
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
+- **HostConfig**
+ - **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ + `volume-name:container-dest` to bind-mount a volume managed by a
+ volume driver into the container. `container-dest` must be an
+ _absolute_ path.
+ + `volume-name:container-dest:ro` to mount the volume read-only
+ inside the container. `container-dest` must be an _absolute_ path.
+ - **Tmpfs** – A map of container directories which should be replaced by tmpfs mounts, and their corresponding
+ mount options. A JSON object in the form `{ "/run": "rw,noexec,nosuid,size=65536k" }`.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **MemoryReservation** - Memory soft limit in bytes.
+ - **KernelMemory** - Kernel memory limit in bytes.
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of: `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
+ - **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of: `"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of: `"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of: `"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **BlkioDeviceWriteIOps** - Limit write rate (IO per second) to a device in the form of: `"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PidsLimit** - Tune a container's pids limit. Set -1 for unlimited.
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsOptions** - A list of DNS options
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **GroupAdd** - A list of additional groups that the container process will run as
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart, `"unless-stopped"` to restart always except when
+ user has manually stopped the container or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **UsernsMode** - Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
+ supported values are: `host`.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ standard values are: `bridge`, `host`, `none`, and `container:`. Any other value is taken
+ as a custom network's name to which this container should connect to.
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+ - **VolumeDriver** - Driver that this container users to mount volumes.
+ - **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "StopSignal": "SIGTERM"
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "BlkioWeight": 0,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsOptions": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}],
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "SandboxID": "",
+ "HairpinMode": false,
+ "LinkLocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": null,
+ "SandboxKey": "",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "",
+ "Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "MacAddress": "",
+ "Networks": {
+ "bridge": {
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:12:00:02"
+ }
+ }
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Dead": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z",
+ "Status": "running"
+ },
+ "Mounts": [
+ {
+ "Name": "fac362...80535",
+ "Source": "/data",
+ "Destination": "/data",
+ "Driver": "local",
+ "Mode": "ro,Z",
+ "RW": false,
+ "Propagation": ""
+ }
+ ]
+ }
+
+**Example request, with size information**:
+
+ GET /v1.23/containers/4fa6e0f0c678/json?size=1 HTTP/1.1
+
+**Example response, with size information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ ....
+ "SizeRw": 0,
+ "SizeRootFs": 972,
+ ....
+ }
+
+**Query parameters**:
+
+- **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.23/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.23/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "pids_stats": {
+ "current": 3
+ },
+ "networks": {
+ "eth0": {
+ "rx_bytes": 5338,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 36,
+ "tx_bytes": 648,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 8
+ },
+ "eth5": {
+ "rx_bytes": 4641,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 26,
+ "tx_bytes": 690,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 9
+ }
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize`
+
+Resize the TTY for container with `id`. The unit is number of characters. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.23/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+> **Note**:
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
+> See [create a container](#create-a-container) for details.
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Update a container
+
+`POST /containers/(id or name)/update`
+
+Update configuration of one or more containers.
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/update HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "BlkioWeight": 300,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0",
+ "Memory": 314572800,
+ "MemorySwap": 514288000,
+ "MemoryReservation": 209715200,
+ "KernelMemory": 52428800,
+ "RestartPolicy": {
+ "MaximumRetryCount": 4,
+ "Name": "on-failure"
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Warnings": []
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **409** - container is paused
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.23/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Wait a container
+
+`POST /containers/(id or name)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /v1.23/containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode": 0}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Remove a container
+
+`DELETE /containers/(id or name)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.23/containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **v** – 1/True/true or 0/False/false, Remove the volumes
+ associated to the container. Default `false`.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
+ Default `false`.
+- **link** - 1/True/true or 0/False/false, Remove the specified
+ link associated to the container. Default `false`.
+
+**Status codes**:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **409** – conflict
+- **500** – server error
+
+#### Copy files or folders from a container
+
+`POST /containers/(id or name)/copy`
+
+Copy files or folders of container `id`
+
+**Deprecated** in favor of the `archive` endpoint below.
+
+**Example request**:
+
+ POST /v1.23/containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource": "test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Retrieving information about files and folders in a container
+
+`HEAD /containers/(id or name)/archive`
+
+See the description of the `X-Docker-Container-Path-Stat` header in the
+following section.
+
+#### Get an archive of a filesystem resource in a container
+
+`GET /containers/(id or name)/archive`
+
+Get a tar archive of a resource in the filesystem of container `id`.
+
+**Query parameters**:
+
+- **path** - resource in the container's filesystem to archive. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The resource specified by **path** must exist. To assert that the resource
+ is expected to be a directory, **path** should end in `/` or `/.`
+ (assuming a path separator of `/`). If **path** ends in `/.` then this
+ indicates that only the contents of the **path** directory should be
+ copied. A symlink is always resolved to its target.
+
+ > **Note**: It is not possible to copy certain system files such as resources
+ > under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
+ > container.
+
+**Example request**:
+
+ GET /v1.23/containers/8cce319429b2/archive?path=/root HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+ X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+On success, a response header `X-Docker-Container-Path-Stat` will be set to a
+base64-encoded JSON object containing some filesystem header information about
+the archived resource. The above example value would decode to the following
+JSON object (whitespace added for readability):
+
+```json
+{
+ "name": "root",
+ "size": 4096,
+ "mode": 2147484096,
+ "mtime": "2014-02-27T20:51:23Z",
+ "linkTarget": ""
+}
+```
+
+A `HEAD` request can also be made to this endpoint if only this information is
+desired.
+
+**Status codes**:
+
+- **200** - success, returns archive of copied resource
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** was asserted to be a directory but exists as a
+ file)
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** does not exist)
+- **500** - server error
+
+#### Extract an archive of files or folders to a directory in a container
+
+`PUT /containers/(id or name)/archive`
+
+Upload a tar archive to be extracted to a path in the filesystem of container
+`id`.
+
+**Query parameters**:
+
+- **path** - path to a directory in the container
+ to extract the archive's contents into. Required.
+
+ If not an absolute path, it is relative to the container's root directory.
+ The **path** resource must exist.
+- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
+ if unpacking the given content would cause an existing directory to be
+ replaced with a non-directory and vice versa.
+
+**Example request**:
+
+ PUT /v1.23/containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
+ Content-Type: application/x-tar
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** – the content was extracted successfully
+- **400** - client error, bad parameter, details in JSON response body, one of:
+ - must specify path parameter (**path** cannot be empty)
+ - not a directory (**path** should be a directory but exists as a file)
+ - unable to overwrite existing directory with non-directory
+ (if **noOverwriteDirNonDir**)
+ - unable to overwrite existing non-directory with directory
+ (if **noOverwriteDirNonDir**)
+- **403** - client error, permission denied, the volume
+ or container rootfs is marked as read-only.
+- **404** - client error, resource not found, one of:
+ – no such container (container `id` does not exist)
+ - no such file or directory (**path** resource does not exist)
+- **500** – server error
+
+### 2.2 Images
+
+#### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /v1.23/images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275,
+ "Labels": {}
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135,
+ "Labels": {
+ "com.example.version": "v1"
+ }
+ }
+ ]
+
+**Example request, with digest information**:
+
+ GET /v1.23/images/json?digests=1 HTTP/1.1
+
+**Example response, with digest information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Created": 1420064636,
+ "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
+ "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
+ "RepoDigests": [
+ "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags": [
+ "localhost:5000/test/busybox:latest",
+ "playdate:latest"
+ ],
+ "Size": 0,
+ "VirtualSize": 2429728,
+ "Labels": {}
+ }
+ ]
+
+The response shows a single image `Id` associated with two repositories
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
+`playdate:latest` to reference the image.
+
+You can also use `RepoDigests` values to reference an image. In this response,
+the array has only one reference and that is to the
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
+digest. You can reference this digest using the value:
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
+
+See the `docker run` and `docker build` commands for examples of digest and tag
+references on the command line.
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
+ - `dangling=true`
+ - `label=key` or `label="key=value"` of an image label
+- **filter** - only return images with the specified name
+
+#### Build image from a Dockerfile
+
+`POST /build`
+
+Build an image from a Dockerfile
+
+**Example request**:
+
+ POST /v1.23/build HTTP/1.1
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream": "Step 1/5..."}
+ {"stream": "..."}
+ {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
+
+The input stream must be a `tar` archive compressed with one of the
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
+
+The archive must include a build instructions file, typically called
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
+used to specify a different build instructions file. To do this, its value must be
+the path to the alternate build instructions file to use.
+
+The archive may include any number of other files,
+which are accessible in the build context (See the [*ADD build
+command*](../reference/builder.md#add)).
+
+The Docker daemon performs a preliminary validation of the `Dockerfile` before
+starting the build, and returns an error if the syntax is incorrect. After that,
+each instruction is run one-by-one until the ID of the new image is output.
+
+The build is canceled if the client drops the connection by quitting
+or being killed.
+
+**Query parameters**:
+
+- **dockerfile** - Path within the build context to the `Dockerfile`. This is
+ ignored if `remote` is specified and points to an external `Dockerfile`.
+- **t** – 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 one or more `t` parameters.
+- **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
+ URI points to a single text file, the file's contents are placed into
+ a file called `Dockerfile` and the image is built from that file. If
+ the URI points to a tarball, the file is downloaded by the daemon and
+ the contents therein used as the context for the build. If the URI
+ points to a tarball and the `dockerfile` parameter is also specified,
+ there must be a file with the corresponding path inside the tarball.
+- **q** – Suppress verbose build output.
+- **nocache** – Do not use the cache when building the image.
+- **pull** - Attempt to pull the image even if an older image exists locally.
+- **rm** - Remove intermediate containers after a successful build (default behavior).
+- **forcerm** - Always remove intermediate containers (includes `rm`).
+- **memory** - Set memory limit for build.
+- **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
+- **cpushares** - CPU shares (relative weight).
+- **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
+- **cpuperiod** - The length of a CPU period in microseconds.
+- **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
+- **buildargs** – JSON map of string pairs for build-time variables. Users pass
+ these values at build-time. Docker uses the `buildargs` as the environment
+ context for command(s) run via the Dockerfile's `RUN` instruction or for
+ variable expansion in other Dockerfile instructions. This is not meant for
+ passing secret values. [Read more about the buildargs instruction](../reference/builder.md#arg)
+- **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
+- **labels** – JSON map of string pairs for labels to set on the image.
+
+**Request Headers**:
+
+- **Content-type** – Set to `"application/tar"`.
+- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
+ object with the following structure:
+
+ {
+ "docker.example.com": {
+ "username": "janedoe",
+ "password": "hunter2"
+ },
+ "https://index.docker.io/v1/": {
+ "username": "mobydock",
+ "password": "conta1n3rize14"
+ }
+ }
+
+ This object maps the hostname of a registry to an object containing the
+ "username" and "password" for that registry. Multiple registries may
+ be specified as the build may be based on an image requiring
+ authentication to pull from any arbitrary registry. Only the registry
+ domain name (and port if not the default "443") are required. However
+ (for legacy reasons) the "official" Docker, Inc. hosted registry must
+ be specified with both a "https://" prefix and a "/v1/" suffix even
+ though Docker will prefer to use the v2 registry API.
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Create an image
+
+`POST /images/create`
+
+Create an image either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /v1.23/images/create?fromImage=busybox&tag=latest HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pulling..."}
+ {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
+ {"error": "Invalid..."}
+ ...
+
+When using this endpoint to pull an image from the registry, the
+`X-Registry-Auth` header can be used to include
+a base64-encoded AuthConfig object.
+
+**Query parameters**:
+
+- **fromImage** – Name of the image to pull. The name may include a tag or
+ digest. This parameter may only be used when pulling an image.
+ The pull is cancelled if the HTTP connection is closed.
+- **fromSrc** – Source to import. The value may be a URL from which the image
+ can be retrieved or `-` to read the image from the request body.
+ This parameter may only be used when importing an image.
+- **repo** – Repository name given to an image when it is imported.
+ The repo may include a tag. This parameter may only be used when importing
+ an image.
+- **tag** – Tag or digest. If empty when pulling an image, this causes all tags
+ for the given image to be pulled.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
+ - Credential based login:
+
+ ```
+ {
+ "username": "jdoe",
+ "password": "secret",
+ "email": "jdoe@acme.com"
+ }
+ ```
+
+ - Token based login:
+
+ ```
+ {
+ "identitytoken": "9cbaf023786cd7..."
+ }
+ ```
+
+**Status codes**:
+
+- **200** – no error
+- **404** - repository does not exist or no read access
+- **500** – server error
+
+
+
+#### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /v1.23/images/example/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Id" : "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
+ "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
+ "Comment" : "",
+ "Os" : "linux",
+ "Architecture" : "amd64",
+ "Parent" : "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "ContainerConfig" : {
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "StdinOnce" : false,
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "User" : "",
+ "WorkingDir" : "",
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "Labels" : {
+ "com.example.license" : "GPL",
+ "com.example.version" : "1.0",
+ "com.example.vendor" : "Acme"
+ },
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts" : null,
+ "Cmd" : [
+ "/bin/sh",
+ "-c",
+ "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
+ ]
+ },
+ "DockerVersion" : "1.9.0-dev",
+ "VirtualSize" : 188359297,
+ "Size" : 0,
+ "Author" : "",
+ "Created" : "2015-09-10T08:30:53.26995814Z",
+ "GraphDriver" : {
+ "Name" : "aufs",
+ "Data" : null
+ },
+ "RepoDigests" : [
+ "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
+ ],
+ "RepoTags" : [
+ "example:1.0",
+ "example:latest",
+ "example:stable"
+ ],
+ "Config" : {
+ "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
+ "NetworkDisabled" : false,
+ "OnBuild" : [],
+ "StdinOnce" : false,
+ "PublishService" : "",
+ "AttachStdin" : false,
+ "OpenStdin" : false,
+ "Domainname" : "",
+ "AttachStdout" : false,
+ "Tty" : false,
+ "Hostname" : "e611e15f9c9d",
+ "Volumes" : null,
+ "Cmd" : [
+ "/bin/bash"
+ ],
+ "ExposedPorts" : null,
+ "Env" : [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "Labels" : {
+ "com.example.vendor" : "Acme",
+ "com.example.version" : "1.0",
+ "com.example.license" : "GPL"
+ },
+ "Entrypoint" : null,
+ "MacAddress" : "",
+ "AttachStderr" : false,
+ "WorkingDir" : "",
+ "User" : ""
+ },
+ "RootFS": {
+ "Type": "layers",
+ "Layers": [
+ "sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6",
+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
+ ]
+ }
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /v1.23/images/ubuntu/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
+ "Created": 1398108230,
+ "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
+ "Tags": [
+ "ubuntu:lucid",
+ "ubuntu:10.04"
+ ],
+ "Size": 182964289,
+ "Comment": ""
+ },
+ {
+ "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
+ "Created": 1398108222,
+ "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
+ "Tags": null,
+ "Size": 0,
+ "Comment": ""
+ },
+ {
+ "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
+ "Created": 1371157430,
+ "CreatedBy": "",
+ "Tags": [
+ "scratch12:latest",
+ "scratch:latest"
+ ],
+ "Size": 0,
+ "Comment": "Imported from -"
+ }
+ ]
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /v1.23/images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status": "Pushing..."}
+ {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
+ {"error": "Invalid..."}
+ ...
+
+If you wish to push an image on to a private registry, that image must already have a tag
+into a repository which references that registry `hostname` and `port`. This repository name should
+then be used in the URL. This duplicates the command line's flow.
+
+The push is cancelled if the HTTP connection is closed.
+
+**Example request**:
+
+ POST /v1.23/images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+**Query parameters**:
+
+- **tag** – The tag to associate with the image on the registry. This is optional.
+
+**Request Headers**:
+
+- **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
+ - Credential based login:
+
+ ```
+ {
+ "username": "jdoe",
+ "password": "secret",
+ "email": "jdoe@acme.com",
+ }
+ ```
+
+ - Identity token based login:
+
+ ```
+ {
+ "identitytoken": "9cbaf023786cd7..."
+ }
+ ```
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+#### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /v1.23/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+
+**Query parameters**:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /v1.23/images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged": "3e2f21a89f"},
+ {"Deleted": "3e2f21a89f"},
+ {"Deleted": "53b4f83ac9"}
+ ]
+
+**Query parameters**:
+
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 1/True/true or 0/False/false, default false
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+#### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /v1.23/images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "wma55/u1210sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "jdswinbank/sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "vgauthier/sshd",
+ "star_count": 0
+ }
+ ...
+ ]
+
+**Query parameters**:
+
+- **term** – term to search
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+### 2.3 Misc
+
+#### Check auth configuration
+
+`POST /auth`
+
+Validate credentials for a registry and get identity token,
+if available, for accessing the registry without password.
+
+**Example request**:
+
+ POST /v1.23/auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username": "hannibal",
+ "password": "xxxx",
+ "serveraddress": "https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+ {
+ "Status": "Login Succeeded",
+ "IdentityToken": "9cbaf023786cd7..."
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+#### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /v1.23/info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Architecture": "x86_64",
+ "ClusterStore": "etcd://localhost:2379",
+ "CgroupDriver": "cgroupfs",
+ "Containers": 11,
+ "ContainersRunning": 7,
+ "ContainersStopped": 3,
+ "ContainersPaused": 1,
+ "CpuCfsPeriod": true,
+ "CpuCfsQuota": true,
+ "Debug": false,
+ "DockerRootDir": "/var/lib/docker",
+ "Driver": "btrfs",
+ "DriverStatus": [[""]],
+ "ExecutionDriver": "native-0.1",
+ "ExperimentalBuild": false,
+ "HttpProxy": "http://test:test@localhost:8080",
+ "HttpsProxy": "https://test:test@localhost:8080",
+ "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
+ "IPv4Forwarding": true,
+ "Images": 16,
+ "IndexServerAddress": "https://index.docker.io/v1/",
+ "InitPath": "/usr/bin/docker",
+ "InitSha1": "",
+ "KernelMemory": true,
+ "KernelVersion": "3.12.0-1-amd64",
+ "Labels": [
+ "storage=ssd"
+ ],
+ "MemTotal": 2099236864,
+ "MemoryLimit": true,
+ "NCPU": 1,
+ "NEventsListener": 0,
+ "NFd": 11,
+ "NGoroutines": 21,
+ "Name": "prod-server-42",
+ "NoProxy": "9.81.1.160",
+ "OomKillDisable": true,
+ "OSType": "linux",
+ "OperatingSystem": "Boot2Docker",
+ "Plugins": {
+ "Volume": [
+ "local"
+ ],
+ "Network": [
+ "null",
+ "host",
+ "bridge"
+ ]
+ },
+ "RegistryConfig": {
+ "IndexConfigs": {
+ "docker.io": {
+ "Mirrors": null,
+ "Name": "docker.io",
+ "Official": true,
+ "Secure": true
+ }
+ },
+ "InsecureRegistryCIDRs": [
+ "127.0.0.0/8"
+ ]
+ },
+ "ServerVersion": "1.9.0",
+ "SwapLimit": false,
+ "SystemStatus": [["State", "Healthy"]],
+ "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /v1.23/version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Version": "1.11.0",
+ "Os": "linux",
+ "KernelVersion": "3.19.0-23-generic",
+ "GoVersion": "go1.4.2",
+ "GitCommit": "e75da4b",
+ "Arch": "amd64",
+ "ApiVersion": "1.23",
+ "BuildTime": "2015-12-01T07:09:13.444803460+00:00",
+ "Experimental": true
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /v1.23/_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /v1.23/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Mounts": [
+ {
+ "Source": "/data",
+ "Destination": "/data",
+ "Mode": "ro,Z",
+ "RW": false
+ }
+ ],
+ "Labels": {
+ "key1": "value1",
+ "key2": "value2"
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "ExposedPorts": {
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {"Id": "596069db4bf5"}
+
+**JSON parameters**:
+
+- **config** - the container's configuration
+
+**Query parameters**:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **comment** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+- **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
+- **changes** – Dockerfile instructions to apply while committing
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, in real time via streaming.
+
+Docker containers report the following events:
+
+ attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
+
+Docker images report the following events:
+
+ delete, import, pull, push, tag, untag
+
+Docker volumes report the following events:
+
+ create, mount, unmount, destroy
+
+Docker networks report the following events:
+
+ create, connect, disconnect, destroy
+
+**Example request**:
+
+ GET /v1.23/events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Server: Docker/1.11.0 (linux)
+ Date: Fri, 29 Apr 2016 15:18:06 GMT
+ Transfer-Encoding: chunked
+
+ {
+ "status": "pull",
+ "id": "alpine:latest",
+ "Type": "image",
+ "Action": "pull",
+ "Actor": {
+ "ID": "alpine:latest",
+ "Attributes": {
+ "name": "alpine"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101301854122
+ }
+ {
+ "status": "create",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "create",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101381709551
+ }
+ {
+ "status": "attach",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "attach",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101383858412
+ }
+ {
+ "Type": "network",
+ "Action": "connect",
+ "Actor": {
+ "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
+ "Attributes": {
+ "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "name": "bridge",
+ "type": "bridge"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101394865557
+ }
+ {
+ "status": "start",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "start",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101607533796
+ }
+ {
+ "status": "resize",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "resize",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "height": "46",
+ "image": "alpine",
+ "name": "my-container",
+ "width": "204"
+ }
+ },
+ "time": 1461943101,
+ "timeNano": 1461943101610269268
+ }
+ {
+ "status": "die",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "die",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "exitCode": "0",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105079144137
+ }
+ {
+ "Type": "network",
+ "Action": "disconnect",
+ "Actor": {
+ "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
+ "Attributes": {
+ "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "name": "bridge",
+ "type": "bridge"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105230860245
+ }
+ {
+ "status": "destroy",
+ "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "from": "alpine",
+ "Type": "container",
+ "Action": "destroy",
+ "Actor": {
+ "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
+ "Attributes": {
+ "com.example.some-label": "some-label-value",
+ "image": "alpine",
+ "name": "my-container"
+ }
+ },
+ "time": 1461943105,
+ "timeNano": 1461943105338056026
+ }
+
+**Query parameters**:
+
+- **since** – Timestamp. Show all events created since timestamp and then stream
+- **until** – Timestamp. Show events created until given timestamp and stop streaming
+- **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
+ - `container=`; -- container to filter
+ - `event=`; -- event to filter
+ - `image=`; -- image to filter
+ - `label=`; -- image and container label to filter
+ - `type=`; -- either `container` or `image` or `volume` or `network`
+ - `volume=`; -- volume to filter
+ - `network=`; -- network to filter
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only that
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.23/images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Get a tarball containing all images
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /v1.23/images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into a Docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /v1.23/images/load
+ Content-Type: application/x-tar
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Transfer-Encoding: chunked
+
+ {"status":"Loading layer","progressDetail":{"current":32768,"total":1292800},"progress":"[= ] 32.77 kB/1.293 MB","id":"8ac8bfaff55a"}
+ {"status":"Loading layer","progressDetail":{"current":65536,"total":1292800},"progress":"[== ] 65.54 kB/1.293 MB","id":"8ac8bfaff55a"}
+ {"status":"Loading layer","progressDetail":{"current":98304,"total":1292800},"progress":"[=== ] 98.3 kB/1.293 MB","id":"8ac8bfaff55a"}
+ {"status":"Loading layer","progressDetail":{"current":131072,"total":1292800},"progress":"[===== ] 131.1 kB/1.293 MB","id":"8ac8bfaff55a"}
+ ...
+ {"stream":"Loaded image: busybox:latest\n"}
+
+**Example response**:
+
+If the "quiet" query parameter is set to `true` / `1` (`?quiet=1`), progress
+details are suppressed, and only a confirmation message is returned once the
+action completes.
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Transfer-Encoding: chunked
+
+ {"stream":"Loaded image: busybox:latest\n"}
+
+**Query parameters**:
+
+- **quiet** – Boolean value, suppress progress details during load. Defaults
+ to `0` / `false` if omitted.
+
+**Status codes**:
+
+- **200** – no error
+- **500** – server error
+
+#### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing these files:
+
+- `VERSION`: currently `1.0` - the file format version
+- `json`: detailed layer information, similar to `docker inspect layer_id`
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, the tarball should also include a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+#### Exec Create
+
+`POST /containers/(id or name)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /v1.23/containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin": true,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Cmd": ["sh"],
+ "DetachKeys": "ctrl-p,ctrl-q",
+ "Privileged": true,
+ "Tty": true,
+ "User": "123:456"
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id": "f90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
+- **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
+- **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
+- **DetachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Privileged** - Boolean value, runs the exec process with extended privileges.
+- **User** - A string value specifying the user, and optionally, group to run
+ the exec process inside the container. Format is one of: `"user"`,
+ `"user:group"`, `"uid"`, or `"uid:gid"`.
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such container
+- **409** - container is paused
+- **500** - server error
+
+#### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
+returns after starting the `exec` command. Otherwise, this API sets up an
+interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /v1.23/exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach": false,
+ "Tty": false
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**JSON parameters**:
+
+- **Detach** - Detach from the `exec` command.
+- **Tty** - Boolean value to allocate a pseudo-TTY.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **409** - container is paused
+
+**Stream details**:
+
+Similar to the stream behavior of `POST /containers/(id or name)/attach` API
+
+#### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters.
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
+
+**Example request**:
+
+ POST /v1.23/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
+ Content-Type: text/plain
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: text/plain
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **201** – no error
+- **404** – no such exec instance
+
+#### Exec Inspect
+
+`GET /exec/(id)/json`
+
+Return low-level information about the `exec` command `id`.
+
+**Example request**:
+
+ GET /v1.23/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "CanRemove": false,
+ "ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126",
+ "DetachKeys": "",
+ "ExitCode": 2,
+ "ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b",
+ "OpenStderr": true,
+ "OpenStdin": true,
+ "OpenStdout": true,
+ "ProcessConfig": {
+ "arguments": [
+ "-c",
+ "exit 2"
+ ],
+ "entrypoint": "sh",
+ "privileged": false,
+ "tty": true,
+ "user": "1000"
+ },
+ "Running": false
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such exec instance
+- **500** - server error
+
+### 2.4 Volumes
+
+#### List volumes
+
+`GET /volumes`
+
+**Example request**:
+
+ GET /v1.23/volumes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Volumes": [
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis"
+ }
+ ],
+ "Warnings": []
+ }
+
+**Query parameters**:
+
+- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true`
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Create a volume
+
+`POST /volumes/create`
+
+Create a volume
+
+**Example request**:
+
+ POST /v1.23/volumes/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Labels": {
+ "com.example.some-label": "some-value",
+ "com.example.some-other-label": "some-other-value"
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis",
+ "Labels": {
+ "com.example.some-label": "some-value",
+ "com.example.some-other-label": "some-other-value"
+ }
+ }
+
+**Status codes**:
+
+- **201** - no error
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new volume's name. If not specified, Docker generates a name.
+- **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
+- **DriverOpts** - A mapping of driver options and values. These options are
+ passed directly to the driver and are driver specific.
+- **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
+
+#### Inspect a volume
+
+`GET /volumes/(name)`
+
+Return low-level information on the volume `name`
+
+**Example request**:
+
+ GET /v1.23/volumes/tardis
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Name": "tardis",
+ "Driver": "local",
+ "Mountpoint": "/var/lib/docker/volumes/tardis/_data",
+ "Labels": {
+ "com.example.some-label": "some-value",
+ "com.example.some-other-label": "some-other-value"
+ }
+ }
+
+**Status codes**:
+
+- **200** - no error
+- **404** - no such volume
+- **500** - server error
+
+#### Remove a volume
+
+`DELETE /volumes/(name)`
+
+Instruct the driver to remove the volume (`name`).
+
+**Example request**:
+
+ DELETE /v1.23/volumes/tardis HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** - no error
+- **404** - no such volume or volume driver
+- **409** - volume is in use and cannot be removed
+- **500** - server error
+
+### 3.5 Networks
+
+#### List networks
+
+`GET /networks`
+
+**Example request**:
+
+ GET /v1.23/networks?filters={"type":{"custom":true}} HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+[
+ {
+ "Name": "bridge",
+ "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
+ "Scope": "local",
+ "Driver": "bridge",
+ "EnableIPv6": false,
+ "Internal": false,
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.17.0.0/16"
+ }
+ ]
+ },
+ "Containers": {
+ "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
+ "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
+ "MacAddress": "02:42:ac:11:00:02",
+ "IPv4Address": "172.17.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ }
+ },
+ {
+ "Name": "none",
+ "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
+ "Scope": "local",
+ "Driver": "null",
+ "EnableIPv6": false,
+ "Internal": false,
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ },
+ {
+ "Name": "host",
+ "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
+ "Scope": "local",
+ "Driver": "host",
+ "EnableIPv6": false,
+ "Internal": false,
+ "IPAM": {
+ "Driver": "default",
+ "Config": []
+ },
+ "Containers": {},
+ "Options": {}
+ }
+]
+```
+
+**Query parameters**:
+
+- **filters** - JSON encoded network list filter. The filter value is one of:
+ - `id=` Matches all or part of a network id.
+ - `name=` Matches all or part of a network name.
+ - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
+
+**Status codes**:
+
+- **200** - no error
+- **500** - server error
+
+#### Inspect network
+
+`GET /networks/`
+
+**Example request**:
+
+ GET /v1.23/networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
+
+**Example response**:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json
+
+{
+ "Name": "net01",
+ "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
+ "Scope": "local",
+ "Driver": "bridge",
+ "EnableIPv6": false,
+ "IPAM": {
+ "Driver": "default",
+ "Config": [
+ {
+ "Subnet": "172.19.0.0/16",
+ "Gateway": "172.19.0.1/16"
+ }
+ ],
+ "Options": {
+ "foo": "bar"
+ }
+ },
+ "Internal": false,
+ "Containers": {
+ "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
+ "Name": "test",
+ "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
+ "MacAddress": "02:42:ac:13:00:02",
+ "IPv4Address": "172.19.0.2/16",
+ "IPv6Address": ""
+ }
+ },
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ },
+ "Labels": {
+ "com.example.some-label": "some-value",
+ "com.example.some-other-label": "some-other-value"
+ }
+}
+```
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network not found
+
+#### Create a network
+
+`POST /networks/create`
+
+Create a network
+
+**Example request**:
+
+```
+POST /v1.23/networks/create HTTP/1.1
+Content-Type: application/json
+
+{
+ "Name":"isolated_nw",
+ "CheckDuplicate":true,
+ "Driver":"bridge",
+ "EnableIPv6": true,
+ "IPAM":{
+ "Driver": "default",
+ "Config":[
+ {
+ "Subnet":"172.20.0.0/16",
+ "IPRange":"172.20.10.0/24",
+ "Gateway":"172.20.10.11"
+ },
+ {
+ "Subnet":"2001:db8:abcd::/64",
+ "Gateway":"2001:db8:abcd::1011"
+ }
+ ],
+ "Options": {
+ "foo": "bar"
+ }
+ },
+ "Internal":true,
+ "Options": {
+ "com.docker.network.bridge.default_bridge": "true",
+ "com.docker.network.bridge.enable_icc": "true",
+ "com.docker.network.bridge.enable_ip_masquerade": "true",
+ "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
+ "com.docker.network.bridge.name": "docker0",
+ "com.docker.network.driver.mtu": "1500"
+ },
+ "Labels": {
+ "com.example.some-label": "some-value",
+ "com.example.some-other-label": "some-other-value"
+ }
+}
+```
+
+**Example response**:
+
+```
+HTTP/1.1 201 Created
+Content-Type: application/json
+
+{
+ "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
+ "Warning": ""
+}
+```
+
+**Status codes**:
+
+- **201** - no error
+- **404** - plugin not found
+- **500** - server error
+
+**JSON parameters**:
+
+- **Name** - The new network's name. this is a mandatory field
+- **CheckDuplicate** - Requests daemon to check for networks with same name. Defaults to `false`
+- **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
+- **Internal** - Restrict external access to the network
+- **IPAM** - Optional custom IP scheme for the network
+ - **Driver** - Name of the IPAM driver to use. Defaults to `default` driver
+ - **Config** - List of IPAM configuration options, specified as a map:
+ `{"Subnet": , "IPRange": , "Gateway": , "AuxAddress": }`
+ - **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
+- **EnableIPv6** - Enable IPv6 on the network
+- **Options** - Network specific options to be used by the drivers
+- **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
+
+#### Connect a container to a network
+
+`POST /networks/(id)/connect`
+
+Connect a container to a network
+
+**Example request**:
+
+```
+POST /v1.23/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4",
+ "EndpointConfig": {
+ "IPAMConfig": {
+ "IPv4Address":"172.24.56.89",
+ "IPv6Address":"2001:db8::5689"
+ }
+ }
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container is not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **container** - container-id/name to be connected to the network
+
+#### Disconnect a container from a network
+
+`POST /networks/(id)/disconnect`
+
+Disconnect a container from a network
+
+**Example request**:
+
+```
+POST /v1.23/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
+Content-Type: application/json
+
+{
+ "Container":"3613f73ba0e4",
+ "Force":false
+}
+```
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+**Status codes**:
+
+- **200** - no error
+- **404** - network or container not found
+- **500** - Internal Server Error
+
+**JSON parameters**:
+
+- **Container** - container-id/name to be disconnected from a network
+- **Force** - Force the container to disconnect from a network
+
+#### Remove a network
+
+`DELETE /networks/(id)`
+
+Instruct the driver to remove the network (`id`).
+
+**Example request**:
+
+ DELETE /v1.23/networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** - no error
+- **404** - no such network
+- **500** - server error
+
+## 3. Going further
+
+### 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - Try to pull it.
+ - Then, retry to create the container.
+
+- Start the container.
+
+- If you are not in detached mode:
+- Attach to the container, using `logs=1` (to have `stdout` and
+ `stderr` from the container's start) and `stream=1`
+
+- If in detached mode or only `stdin` is attached, display the container's id.
+
+### 3.2 Hijacking
+
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
+`stdout`, and `stderr` on the same socket.
+
+To hint potential proxies about connection hijacking, Docker client sends
+connection upgrade headers similarly to websocket.
+
+ Upgrade: tcp
+ Connection: Upgrade
+
+When Docker daemon detects the `Upgrade` header, it switches its status code
+from **200 OK** to **101 UPGRADED** and resends the same headers.
+
+
+### 3.3 CORS Requests
+
+To set cross origin requests to the Engine API please give values to
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
+default or blank means CORS disabled
+
+ $ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
diff --git a/engine/api/v1.24.md b/engine/api/v1.24.md
new file mode 100644
index 0000000000..197bee2685
--- /dev/null
+++ b/engine/api/v1.24.md
@@ -0,0 +1,5321 @@
+---
+title: "Engine API v1.24"
+description: "API Documentation for Docker"
+keywords: "API, Docker, rcli, REST, documentation"
+redirect_from:
+- /engine/reference/api/docker_remote_api_v1.24/
+- /reference/api/docker_remote_api_v1.24/
+---
+
+
+
+## 1. Brief introduction
+
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](../reference/commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
+ - The API tends to be REST. However, for some complex commands, like `attach`
+ or `pull`, the HTTP connection is hijacked to transport `stdout`,
+ `stdin` and `stderr`.
+
+## 2. Errors
+
+The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
+
+ {
+ "message": "page not found"
+ }
+
+The status codes that are returned for each endpoint are specified in the endpoint documentation below.
+
+## 3. Endpoints
+
+### 3.1 Containers
+
+#### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /v1.24/containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Names":["/boring_feynman"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:02"
+ }
+ }
+ },
+ "Mounts": [
+ {
+ "Name": "fac362...80535",
+ "Source": "/data",
+ "Destination": "/data",
+ "Driver": "local",
+ "Mode": "ro,Z",
+ "RW": false,
+ "Propagation": ""
+ }
+ ]
+ },
+ {
+ "Id": "9cd87474be90",
+ "Names":["/coolName"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.8",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:08"
+ }
+ }
+ },
+ "Mounts": []
+ },
+ {
+ "Id": "3176a2479c92",
+ "Names":["/sleepy_dog"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports":[],
+ "Labels": {},
+ "SizeRw":12288,
+ "SizeRootFs":0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.6",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:06"
+ }
+ }
+ },
+ "Mounts": []
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Names":["/running_cat"],
+ "Image": "ubuntu:latest",
+ "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "State": "Exited",
+ "Status": "Exit 0",
+ "Ports": [],
+ "Labels": {},
+ "SizeRw": 12288,
+ "SizeRootFs": 0,
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.5",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:05"
+ }
+ }
+ },
+ "Mounts": []
+ }
+ ]
+
+**Query parameters**:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
+ - `exited=`; -- containers with exit code of `` ;
+ - `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
+ - `label=key` or `label="key=value"` of a container label
+ - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)
+ - `ancestor`=(`[:]`, `` or ``)
+ - `before`=(`` or ``)
+ - `since`=(`` or ``)
+ - `volume`=(`` or ``)
+ - `network`=(`` or ``)
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+#### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /v1.24/containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname": "",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "FOO=bar",
+ "BAZ=quux"
+ ],
+ "Cmd": [
+ "date"
+ ],
+ "Entrypoint": "",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "NetworkDisabled": false,
+ "MacAddress": "12:34:56:78:9a:bc",
+ "ExposedPorts": {
+ "22/tcp": {}
+ },
+ "StopSignal": "SIGTERM",
+ "HostConfig": {
+ "Binds": ["/tmp:/tmp"],
+ "Tmpfs": { "/run": "rw,noexec,nosuid,size=65536k" },
+ "Links": ["redis3:redis"],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "CpuPercent": 80,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0,1",
+ "IOMaximumBandwidth": 0,
+ "IOMaximumIOps": 0,
+ "BlkioWeight": 300,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "MemorySwappiness": 60,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "PidMode": "",
+ "PidsLimit": -1,
+ "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts": false,
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "Dns": ["8.8.8.8"],
+ "DnsOptions": [""],
+ "DnsSearch": [""],
+ "ExtraHosts": null,
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"],
+ "GroupAdd": ["newgroup"],
+ "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
+ "NetworkMode": "bridge",
+ "Devices": [],
+ "Sysctls": { "net.ipv4.ip_forward": "1" },
+ "Ulimits": [{}],
+ "LogConfig": { "Type": "json-file", "Config": {} },
+ "SecurityOpt": [],
+ "StorageOpt": {},
+ "CgroupParent": "",
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "NetworkingConfig": {
+ "EndpointsConfig": {
+ "isolated_nw" : {
+ "IPAMConfig": {
+ "IPv4Address":"172.20.30.33",
+ "IPv6Address":"2001:db8:abcd::3033",
+ "LinkLocalIPs":["169.254.34.68", "fe80::3468"]
+ },
+ "Links":["container_1", "container_2"],
+ "Aliases":["server_x", "server_y"]
+ }
+ }
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806",
+ "Warnings":[]
+ }
+
+**JSON parameters**:
+
+- **Hostname** - A string value containing the hostname to use for the
+ container. This must be a valid RFC 1123 hostname.
+- **Domainname** - A string value containing the domain name to use
+ for the container.
+- **User** - A string value specifying the user inside the container.
+- **AttachStdin** - Boolean value, attaches to `stdin`.
+- **AttachStdout** - Boolean value, attaches to `stdout`.
+- **AttachStderr** - Boolean value, attaches to `stderr`.
+- **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
+- **OpenStdin** - Boolean value, opens `stdin`,
+- **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
+- **Env** - A list of environment variables in the form of `["VAR=value", ...]`
+- **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
+- **Cmd** - Command to run specified as a string or an array of strings.
+- **Entrypoint** - Set the entry point for the container as a string or an array
+ of strings.
+- **Image** - A string specifying the image name to use for the container.
+- **Volumes** - An object mapping mount point paths (strings) inside the
+ container to empty objects.
+- **WorkingDir** - A string specifying the working directory for commands to
+ run in.
+- **NetworkDisabled** - Boolean value, when true disables networking for the
+ container
+- **ExposedPorts** - An object mapping ports to an empty object in the form of:
+ `"ExposedPorts": { "/: {}" }`
+- **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
+- **HostConfig**
+ - **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
+ + `host-src:container-dest` to bind-mount a host path into the
+ container. Both `host-src`, and `container-dest` must be an
+ _absolute_ path.
+ + `host-src:container-dest:ro` to make the bind-mount read-only
+ inside the container. Both `host-src`, and `container-dest` must be
+ an _absolute_ path.
+ + `volume-name:container-dest` to bind-mount a volume managed by a
+ volume driver into the container. `container-dest` must be an
+ _absolute_ path.
+ + `volume-name:container-dest:ro` to mount the volume read-only
+ inside the container. `container-dest` must be an _absolute_ path.
+ - **Tmpfs** – A map of container directories which should be replaced by tmpfs mounts, and their corresponding
+ mount options. A JSON object in the form `{ "/run": "rw,noexec,nosuid,size=65536k" }`.
+ - **Links** - A list of links for the container. Each link entry should be
+ in the form of `container_name:alias`.
+ - **Memory** - Memory limit in bytes.
+ - **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
+ You must use this with `memory` and make the swap value larger than `memory`.
+ - **MemoryReservation** - Memory soft limit in bytes.
+ - **KernelMemory** - Kernel memory limit in bytes.
+ - **CpuPercent** - An integer value containing the usable percentage of the available CPUs. (Windows daemon only)
+ - **CpuShares** - An integer value containing the container's CPU Shares
+ (ie. the relative weight vs other containers).
+ - **CpuPeriod** - The length of a CPU period in microseconds.
+ - **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
+ - **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
+ - **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
+ - **IOMaximumBandwidth** - Maximum IO absolute rate in terms of IOps.
+ - **IOMaximumIOps** - Maximum IO absolute rate in terms of bytes per second.
+ - **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
+ - **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of: `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
+ - **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of: `"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of: `"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
+ - **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of: `"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **BlkioDeviceWriteIOps** - Limit write rate (IO per second) to a device in the form of: `"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
+ `"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
+ - **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
+ - **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
+ - **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
+ - **PidMode** - Set the PID (Process) Namespace mode for the container;
+ `"container:"`: joins another container's PID namespace
+ `"host"`: use the host's PID namespace inside the container
+ - **PidsLimit** - Tune a container's pids limit. Set -1 for unlimited.
+ - **PortBindings** - A map of exposed container ports and the host port they
+ should map to. A JSON object in the form
+ `{ /: [{ "HostPort": "" }] }`
+ Take note that `port` is specified as a string and not an integer value.
+ - **PublishAllPorts** - Allocates a random host port for all of a container's
+ exposed ports. Specified as a boolean value.
+ - **Privileged** - Gives the container full access to the host. Specified as
+ a boolean value.
+ - **ReadonlyRootfs** - Mount the container's root filesystem as read only.
+ Specified as a boolean value.
+ - **Dns** - A list of DNS servers for the container to use.
+ - **DnsOptions** - A list of DNS options
+ - **DnsSearch** - A list of DNS search domains
+ - **ExtraHosts** - A list of hostnames/IP mappings to add to the
+ container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
+ - **VolumesFrom** - A list of volumes to inherit from another container.
+ Specified in the form `[:]`
+ - **CapAdd** - A list of kernel capabilities to add to the container.
+ - **Capdrop** - A list of kernel capabilities to drop from the container.
+ - **GroupAdd** - A list of additional groups that the container process will run as
+ - **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart, `"unless-stopped"` to restart always except when
+ user has manually stopped the container or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+ An ever increasing delay (double the previous delay, starting at 100mS)
+ is added before each restart to prevent flooding the server.
+ - **UsernsMode** - Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
+ supported values are: `host`.
+ - **NetworkMode** - Sets the networking mode for the container. Supported
+ standard values are: `bridge`, `host`, `none`, and `container:`. Any other value is taken
+ as a custom network's name to which this container should connect to.
+ - **Devices** - A list of devices to add to the container specified as a JSON object in the
+ form
+ `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
+ - **Ulimits** - A list of ulimits to set in the container, specified as
+ `{ "Name": , "Soft": , "Hard": }`, for example:
+ `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
+ - **Sysctls** - A list of kernel parameters (sysctls) to set in the container, specified as
+ `{ : }`, for example:
+ `{ "net.ipv4.ip_forward": "1" }`
+ - **SecurityOpt**: A list of string values to customize labels for MLS
+ systems, such as SELinux.
+ - **StorageOpt**: Storage driver options per container. Options can be passed in the form
+ `{"size":"120G"}`
+ - **LogConfig** - Log configuration for the container, specified as a JSON object in the form
+ `{ "Type": "", "Config": {"key1": "val1"}}`.
+ Available types: `json-file`, `syslog`, `journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`.
+ `json-file` logging driver.
+ - **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
+ - **VolumeDriver** - Driver that this container users to mount volumes.
+ - **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
+
+**Query parameters**:
+
+- **name** – Assign the specified name to the container. Must
+ match `/?[a-zA-Z0-9_-]+`.
+
+**Status codes**:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **406** – impossible to attach (container not running)
+- **409** – conflict
+- **500** – server error
+
+#### Inspect a container
+
+`GET /containers/(id or name)/json`
+
+Return low-level information on the container `id`
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "AppArmorProfile": "",
+ "Args": [
+ "-c",
+ "exit 9"
+ ],
+ "Config": {
+ "AttachStderr": true,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "Cmd": [
+ "/bin/sh",
+ "-c",
+ "exit 9"
+ ],
+ "Domainname": "",
+ "Entrypoint": null,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+ ],
+ "ExposedPorts": null,
+ "Hostname": "ba033ac44011",
+ "Image": "ubuntu",
+ "Labels": {
+ "com.example.vendor": "Acme",
+ "com.example.license": "GPL",
+ "com.example.version": "1.0"
+ },
+ "MacAddress": "",
+ "NetworkDisabled": false,
+ "OnBuild": null,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Tty": false,
+ "User": "",
+ "Volumes": {
+ "/volumes/data": {}
+ },
+ "WorkingDir": "",
+ "StopSignal": "SIGTERM"
+ },
+ "Created": "2015-01-06T15:47:31.485331387Z",
+ "Driver": "devicemapper",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": null,
+ "IOMaximumBandwidth": 0,
+ "IOMaximumIOps": 0,
+ "BlkioWeight": 0,
+ "BlkioWeightDevice": [{}],
+ "BlkioDeviceReadBps": [{}],
+ "BlkioDeviceWriteBps": [{}],
+ "BlkioDeviceReadIOps": [{}],
+ "BlkioDeviceWriteIOps": [{}],
+ "CapAdd": null,
+ "CapDrop": null,
+ "ContainerIDFile": "",
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "CpuPercent": 80,
+ "CpuShares": 0,
+ "CpuPeriod": 100000,
+ "Devices": [],
+ "Dns": null,
+ "DnsOptions": null,
+ "DnsSearch": null,
+ "ExtraHosts": null,
+ "IpcMode": "",
+ "Links": null,
+ "LxcConf": [],
+ "Memory": 0,
+ "MemorySwap": 0,
+ "MemoryReservation": 0,
+ "KernelMemory": 0,
+ "OomKillDisable": false,
+ "OomScoreAdj": 500,
+ "NetworkMode": "bridge",
+ "PidMode": "",
+ "PortBindings": {},
+ "Privileged": false,
+ "ReadonlyRootfs": false,
+ "PublishAllPorts": false,
+ "RestartPolicy": {
+ "MaximumRetryCount": 2,
+ "Name": "on-failure"
+ },
+ "LogConfig": {
+ "Config": null,
+ "Type": "json-file"
+ },
+ "SecurityOpt": null,
+ "Sysctls": {
+ "net.ipv4.ip_forward": "1"
+ },
+ "StorageOpt": null,
+ "VolumesFrom": null,
+ "Ulimits": [{}],
+ "VolumeDriver": "",
+ "ShmSize": 67108864
+ },
+ "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
+ "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
+ "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
+ "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
+ "MountLabel": "",
+ "Name": "/boring_euclid",
+ "NetworkSettings": {
+ "Bridge": "",
+ "SandboxID": "",
+ "HairpinMode": false,
+ "LinkLocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": null,
+ "SandboxKey": "",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "",
+ "Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "",
+ "IPPrefixLen": 0,
+ "IPv6Gateway": "",
+ "MacAddress": "",
+ "Networks": {
+ "bridge": {
+ "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
+ "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:12:00:02"
+ }
+ }
+ },
+ "Path": "/bin/sh",
+ "ProcessLabel": "",
+ "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
+ "RestartCount": 1,
+ "State": {
+ "Error": "",
+ "ExitCode": 9,
+ "FinishedAt": "2015-01-06T15:47:32.080254511Z",
+ "OOMKilled": false,
+ "Dead": false,
+ "Paused": false,
+ "Pid": 0,
+ "Restarting": false,
+ "Running": true,
+ "StartedAt": "2015-01-06T15:47:32.072697474Z",
+ "Status": "running"
+ },
+ "Mounts": [
+ {
+ "Name": "fac362...80535",
+ "Source": "/data",
+ "Destination": "/data",
+ "Driver": "local",
+ "Mode": "ro,Z",
+ "RW": false,
+ "Propagation": ""
+ }
+ ]
+ }
+
+**Example request, with size information**:
+
+ GET /v1.24/containers/4fa6e0f0c678/json?size=1 HTTP/1.1
+
+**Example response, with size information**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ ....
+ "SizeRw": 0,
+ "SizeRootFs": 972,
+ ....
+ }
+
+**Query parameters**:
+
+- **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### List processes running inside a container
+
+`GET /containers/(id or name)/top`
+
+List processes running inside the container `id`. On Unix systems this
+is done by running the `ps` command. This endpoint is not
+supported on Windows.
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
+ ],
+ "Processes" : [
+ [
+ "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
+ ],
+ [
+ "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
+ ]
+ ]
+ }
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles" : [
+ "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ ]
+ "Processes" : [
+ [
+ "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
+ ],
+ [
+ "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
+ ]
+ ],
+ }
+
+**Query parameters**:
+
+- **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container logs
+
+`GET /containers/(id or name)/logs`
+
+Get `stdout` and `stderr` logs from the container ``id``
+
+> **Note**:
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **details** - 1/True/true or 0/False/flase, Show extra details provided to logs. Default `false`.
+- **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
+- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
+ will only output log-entries since that timestamp. Default: 0 (unfiltered)
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default `false`.
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **404** – no such container
+- **500** – server error
+
+#### Inspect changes on a container's filesystem
+
+`GET /containers/(id or name)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path": "/dev",
+ "Kind": 0
+ },
+ {
+ "Path": "/dev/kmsg",
+ "Kind": 1
+ },
+ {
+ "Path": "/test",
+ "Kind": 1
+ }
+ ]
+
+Values for `Kind`:
+
+- `0`: Modify
+- `1`: Add
+- `2`: Delete
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Export a container
+
+`GET /containers/(id or name)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /v1.24/containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {% raw %}
+ {{ TAR STREAM }}
+ {% endraw %}
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Get container stats based on resource usage
+
+`GET /containers/(id or name)/stats`
+
+This endpoint returns a live stream of a container's resource usage statistics.
+
+**Example request**:
+
+ GET /v1.24/containers/redis1/stats HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "read" : "2015-01-08T22:57:31.547920715Z",
+ "pids_stats": {
+ "current": 3
+ },
+ "networks": {
+ "eth0": {
+ "rx_bytes": 5338,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 36,
+ "tx_bytes": 648,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 8
+ },
+ "eth5": {
+ "rx_bytes": 4641,
+ "rx_dropped": 0,
+ "rx_errors": 0,
+ "rx_packets": 26,
+ "tx_bytes": 690,
+ "tx_dropped": 0,
+ "tx_errors": 0,
+ "tx_packets": 9
+ }
+ },
+ "memory_stats" : {
+ "stats" : {
+ "total_pgmajfault" : 0,
+ "cache" : 0,
+ "mapped_file" : 0,
+ "total_inactive_file" : 0,
+ "pgpgout" : 414,
+ "rss" : 6537216,
+ "total_mapped_file" : 0,
+ "writeback" : 0,
+ "unevictable" : 0,
+ "pgpgin" : 477,
+ "total_unevictable" : 0,
+ "pgmajfault" : 0,
+ "total_rss" : 6537216,
+ "total_rss_huge" : 6291456,
+ "total_writeback" : 0,
+ "total_inactive_anon" : 0,
+ "rss_huge" : 6291456,
+ "hierarchical_memory_limit" : 67108864,
+ "total_pgfault" : 964,
+ "total_active_file" : 0,
+ "active_anon" : 6537216,
+ "total_active_anon" : 6537216,
+ "total_pgpgout" : 414,
+ "total_cache" : 0,
+ "inactive_anon" : 0,
+ "active_file" : 0,
+ "pgfault" : 964,
+ "inactive_file" : 0,
+ "total_pgpgin" : 477
+ },
+ "max_usage" : 6651904,
+ "usage" : 6537216,
+ "failcnt" : 0,
+ "limit" : 67108864
+ },
+ "blkio_stats" : {},
+ "cpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24472255,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100215355,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 739306590000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ },
+ "precpu_stats" : {
+ "cpu_usage" : {
+ "percpu_usage" : [
+ 8646879,
+ 24350896,
+ 36438778,
+ 30657443
+ ],
+ "usage_in_usermode" : 50000000,
+ "total_usage" : 100093996,
+ "usage_in_kernelmode" : 30000000
+ },
+ "system_cpu_usage" : 9492140000000,
+ "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
+ }
+ }
+
+The precpu_stats is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the “cpu_stats” field.
+
+**Query parameters**:
+
+- **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
+
+**Status codes**:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Resize a container TTY
+
+`POST /containers/(id or name)/resize`
+
+Resize the TTY for container with `id`. The unit is number of characters. You must restart the container for the resize to take effect.
+
+**Example request**:
+
+ POST /v1.24/containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+**Query parameters**:
+
+- **h** – height of `tty` session
+- **w** – width
+
+**Status codes**:
+
+- **200** – no error
+- **404** – No such container
+- **500** – Cannot resize container
+
+#### Start a container
+
+`POST /containers/(id or name)/start`
+
+Start the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/start HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+#### Stop a container
+
+`POST /containers/(id or name)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+#### Restart a container
+
+`POST /containers/(id or name)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **t** – number of seconds to wait before killing the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Kill a container
+
+`POST /containers/(id or name)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **signal** - Signal to send to the container: integer or string like `SIGINT`.
+ When not set, `SIGKILL` is assumed and the call waits for the container to exit.
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Update a container
+
+`POST /containers/(id or name)/update`
+
+Update configuration of one or more containers.
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/update HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "BlkioWeight": 300,
+ "CpuShares": 512,
+ "CpuPeriod": 100000,
+ "CpuQuota": 50000,
+ "CpusetCpus": "0,1",
+ "CpusetMems": "0",
+ "Memory": 314572800,
+ "MemorySwap": 514288000,
+ "MemoryReservation": 209715200,
+ "KernelMemory": 52428800,
+ "RestartPolicy": {
+ "MaximumRetryCount": 4,
+ "Name": "on-failure"
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Warnings": []
+ }
+
+**Status codes**:
+
+- **200** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+#### Rename a container
+
+`POST /containers/(id or name)/rename`
+
+Rename the container `id` to a `new_name`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/rename?name=new_name HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Query parameters**:
+
+- **name** – new name for the container
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **409** - conflict name already assigned
+- **500** – server error
+
+#### Pause a container
+
+`POST /containers/(id or name)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Unpause a container
+
+`POST /containers/(id or name)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+**Status codes**:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+#### Attach to a container
+
+`POST /containers/(id or name)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /v1.24/containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 101 UPGRADED
+ Content-Type: application/vnd.docker.raw-stream
+ Connection: Upgrade
+ Upgrade: tcp
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
+- **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default `false`.
+- **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
+ to `stdin`. Default `false`.
+- **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
+- **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
+ `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
+
+**Status codes**:
+
+- **101** – no error, hints proxy about hijacking
+- **200** – no error, no upgrade header found
+- **400** – bad parameter
+- **404** – no such container
+- **409** - container is paused
+- **500** – server error
+
+**Stream details**:
+
+When using the TTY setting is enabled in
+[`POST /containers/create`
+](#create-a-container),
+the stream is the raw data from the process PTY and client's `stdin`.
+When the TTY is disabled, then the stream is multiplexed to separate
+`stdout` and `stderr`.
+
+The format is a **Header** and a **Payload** (frame).
+
+**HEADER**
+
+The header contains the information which the stream writes (`stdout` or
+`stderr`). It also contains the size of the associated frame encoded in the
+last four bytes (`uint32`).
+
+It is encoded on the first eight bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+`STREAM_TYPE` can be:
+
+- 0: `stdin` (is written on `stdout`)
+- 1: `stdout`
+- 2: `stderr`
+
+`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
+the `uint32` size encoded as big endian.
+
+**PAYLOAD**
+
+The payload is the raw stream.
+
+**IMPLEMENTATION**
+
+The simplest way to implement the Attach protocol is the following:
+
+ 1. Read eight bytes.
+ 2. Choose `stdout` or `stderr` depending on the first byte.
+ 3. Extract the frame size from the last four bytes.
+ 4. Read the extracted size and output it on the correct output.
+ 5. Goto 1.
+
+#### Attach to a container (websocket)
+
+`GET /containers/(id or name)/attach/ws`
+
+Attach to the container `id` via websocket
+
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
+
+**Example request**
+
+ GET /v1.24/containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
+
+**Example response**
+
+ {% raw %}
+ {{ STREAM }}
+ {% endraw %}
+
+**Query parameters**:
+
+- **detachKeys** – Override the key sequence for detaching a
+ container. Format is a single character `[a-Z]` or `ctrl-`
+ where `