From 341739d91676d2b136852313bf3b26373af328bb Mon Sep 17 00:00:00 2001 From: Daniel Mizyrycki Date: Tue, 14 May 2013 03:28:59 -0700 Subject: [PATCH] packaging-debian; issue #251: Update files for prerelease --- packaging/debian/Makefile | 62 +- .../debian/{README.debian => README.Debian} | 21 +- packaging/debian/Vagrantfile | 30 +- packaging/debian/changelog | 20 +- packaging/debian/control | 11 +- packaging/debian/copyright | 229 +--- packaging/debian/docker.initd | 49 - packaging/debian/lxc-docker.1 | 1149 +++++++++++++++++ packaging/debian/lxc-docker.init | 74 ++ packaging/debian/lxc-docker.postinst | 13 - packaging/debian/rules | 6 - 11 files changed, 1312 insertions(+), 352 deletions(-) rename packaging/debian/{README.debian => README.Debian} (50%) delete mode 100644 packaging/debian/docker.initd create mode 100644 packaging/debian/lxc-docker.1 create mode 100755 packaging/debian/lxc-docker.init delete mode 100644 packaging/debian/lxc-docker.postinst diff --git a/packaging/debian/Makefile b/packaging/debian/Makefile index 75ff8f34f5..088b4b75dc 100644 --- a/packaging/debian/Makefile +++ b/packaging/debian/Makefile @@ -1,35 +1,59 @@ +# Debian package Makefile +# +# Dependencies: git debhelper build-essential autotools-dev devscripts golang +# Notes: +# Use 'make debian' to create the debian package +# To create a specific version, use 'VERSION_TAG=v0.2.0 make debian' +# GPG_KEY environment variable needs to contain a GPG private key for package +# to be signed and uploaded to debian. +# If GPG_KEY is not defined, make debian will create docker package and exit +# with status code 2 + PKG_NAME=lxc-docker -DOCKER_VERSION=$(shell head -1 changelog | awk 'match($$0, /\(.+\)/) {print substr($$0, RSTART+1, RLENGTH-4)}') +ROOT_PATH=$(shell git rev-parse --show-toplevel) GITHUB_PATH=github.com/dotcloud/docker -SOURCE_PKG=$(PKG_NAME)_$(DOCKER_VERSION).orig.tar.gz -BUILD_SRC=${CURDIR}/../../build_src +BUILD_SRC=build_src +VERSION_TAG?=v$(shell sed -E 's/.+\((.+)-.+\).+/\1/;q' changelog) +VERSION=$(shell echo ${VERSION_TAG} | cut -c2-) +DOCKER_VERSION=${PKG_NAME}_${VERSION} all: - # Compile docker. Used by debian dpkg-buildpackage. + # Compile docker. Used by debian dpkg-buildpackage. cd src/${GITHUB_PATH}/docker; GOPATH=${CURDIR} go build install: - # Used by debian dpkg-buildpackage + # Used by debian dpkg-buildpackage mkdir -p $(DESTDIR)/usr/bin - mkdir -p $(DESTDIR)/etc/init.d - install -m 0755 src/${GITHUB_PATH}/docker/docker $(DESTDIR)/usr/bin - install -o root -m 0755 debian/docker.initd $(DESTDIR)/etc/init.d/docker + mkdir -p $(DESTDIR)/usr/share/man/man1 + mkdir -p $(DESTDIR)/usr/share/doc/lxc-docker + install -m 0755 src/${GITHUB_PATH}/docker/docker $(DESTDIR)/usr/bin/lxc-docker + cp debian/lxc-docker.1 $(DESTDIR)/usr/share/man/man1 + cp debian/CHANGELOG.md $(DESTDIR)/usr/share/doc/lxc-docker/changelog debian: - # This Makefile will compile the github master branch of dotcloud/docker - # Retrieve docker project and its go structure from internet - rm -rf ${BUILD_SRC} - GOPATH=${BUILD_SRC} go get ${GITHUB_PATH} + # Prepare docker source from revision ${VERSION_TAG} + rm -rf ${BUILD_SRC} ${PKG_NAME}_[0-9]* + git clone file://$(ROOT_PATH) ${BUILD_SRC}/src/${GITHUB_PATH} --branch ${VERSION_TAG} --depth 1 + GOPATH=${CURDIR}/${BUILD_SRC} go get -d ${GITHUB_PATH} # Add debianization mkdir ${BUILD_SRC}/debian cp Makefile ${BUILD_SRC} - cp -r * ${BUILD_SRC}/debian - cp ../../README.md ${BUILD_SRC} + cp -r `ls | grep -v ${BUILD_SRC}` ${BUILD_SRC}/debian + cp ${ROOT_PATH}/README.md ${BUILD_SRC} + cp ${ROOT_PATH}/CHANGELOG.md ${BUILD_SRC}/debian # Cleanup - for d in `find ${BUILD_SRC} -name '.git*'`; do rm -rf $$d; done - rm -rf ${BUILD_SRC}/../${SOURCE_PKG} - rm -rf ${BUILD_SRC}/pkg + rm -rf `find . -name '.git*'` + rm -f ${DOCKER_VERSION}* # Create docker debian files - cd ${BUILD_SRC}; tar czf ../${SOURCE_PKG} . - cd ${BUILD_SRC}; dpkg-buildpackage + cd ${BUILD_SRC}; tar czf ../${DOCKER_VERSION}.orig.tar.gz . + cd ${BUILD_SRC}; dpkg-buildpackage -us -uc rm -rf ${BUILD_SRC} + # Sign package and upload it to PPA if GPG_KEY environment variable + # holds a private GPG KEY + if /usr/bin/test "$${GPG_KEY}" == ""; then exit 2; fi + mkdir ${BUILD_SRC} + # Import gpg signing key + echo "$${GPG_KEY}" | gpg --allow-secret-key-import --import + # Sign the package + cd ${BUILD_SRC}; dpkg-source -x ${CURDIR}/${DOCKER_VERSION}-1.dsc + cd ${BUILD_SRC}/${PKG_NAME}-${VERSION}; debuild -S -sa diff --git a/packaging/debian/README.debian b/packaging/debian/README.Debian similarity index 50% rename from packaging/debian/README.debian rename to packaging/debian/README.Debian index 83dc42268b..cb09477961 100644 --- a/packaging/debian/README.debian +++ b/packaging/debian/README.Debian @@ -3,29 +3,26 @@ Docker on Debian Docker has been built and tested on Wheezy. All docker functionality works out of the box, except for memory limitation as the stock debian kernel -does not support it yet. +disables it by default. To enable docker memory limitation, the kernel needs +to be loaded with boot parameters: cgroup_enable=memory swapaccount=1 Building docker package ~~~~~~~~~~~~~~~~~~~~~~~ -Building Dependencies: debhelper, autotools-dev and golang - - Assuming you have a wheezy system up and running -# Download a fresh copy of the docker project -git clone https://github.com/dotcloud/docker.git -cd docker - # Get building dependencies -sudo apt-get update ; sudo apt-get install -y debhelper autotools-dev golang +sudo apt-get update +sudo apt-get install -y debhelper build-essential autotools-dev golang -# Make the debian package, with no memory limitation support -(cd packaging/debian; make debian NO_MEMORY_LIMIT=1) +# Make the debian package +git clone https://github.com/dotcloud/docker.git +cd docker/packaging/debian +make debian Install docker package ~~~~~~~~~~~~~~~~~~~~~~ -sudo dpkg -i lxc-docker_0.1.4-1_amd64.deb; sudo apt-get install -f -y +sudo dpkg -i lxc-docker_*-1_amd64.deb; sudo apt-get install -f -y diff --git a/packaging/debian/Vagrantfile b/packaging/debian/Vagrantfile index 2da2900605..5913882f9f 100644 --- a/packaging/debian/Vagrantfile +++ b/packaging/debian/Vagrantfile @@ -1,22 +1,18 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : +VM_IP = "192.168.33.31" +PKG_DEP = "git debhelper build-essential autotools-dev devscripts golang" -$BUILDBOT_IP = '192.168.33.31' +Vagrant::Config.run do |config| + config.vm.box = 'debian-7.0.rc1.64' + config.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box' + config.vm.share_folder 'v-data', '/data/docker', "#{File.dirname(__FILE__)}/../.." + config.vm.network :hostonly,VM_IP -def v10(config) - config.vm.box = 'debian' - config.vm.share_folder 'v-data', '/data/docker', File.dirname(__FILE__) + '/../..' - config.vm.network :hostonly, $BUILDBOT_IP + # Add kernel cgroup memory limitation boot parameters + grub_cmd="sed -i 's#DEFAULT=\"quiet\"#DEFAULT=\"cgroup_enable=memory swapaccount=1 quiet\"#' /etc/default/grub" + config.vm.provision :shell, :inline => "#{grub_cmd};update-grub" # Install debian packaging dependencies and create debian packages - config.vm.provision :shell, :inline => 'apt-get -qq update; apt-get install -y debhelper autotools-dev golang' - config.vm.provision :shell, :inline => 'cd /data/docker/packaging/debian; make debian' -end - -Vagrant::VERSION < '1.1.0' and Vagrant::Config.run do |config| - v10(config) -end - -Vagrant::VERSION >= '1.1.0' and Vagrant.configure('1') do |config| - v10(config) + pkg_cmd = "apt-get -qq update; DEBIAN_FRONTEND=noninteractive apt-get install -qq -y #{PKG_DEP}; " \ + "export GPG_KEY='#{ENV['GPG_KEY']}'; cd /data/docker/packaging/debian; make debian" + config.vm.provision :shell, :inline => pkg_cmd end diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 761a879e8a..c7a34d4869 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,14 +1,16 @@ -lxc-docker (0.1.4-1) unstable; urgency=low +lxc-docker (0.3.2-1) UNRELEASED; urgency=low + - Runtime: Store the actual archive on commit + - Registry: Improve the checksum process + - Registry: Use the size to have a good progress bar while pushing + - Registry: Use the actual archive if it exists in order to speed up the push + - Registry: Fix error 400 on push - Improvements [+], Updates [*], Bug fixes [-]: - * Changed default bridge interface do 'docker0' - - Fix a race condition when running the port allocator - - -- Daniel Mizyrycki Wed, 10 Apr 2013 18:06:21 -0700 + -- Daniel Mizyrycki Sun, 12 May 2013 00:00:00 -0700 -lxc-docker (0.1.0-1) unstable; urgency=low +lxc-docker (0.2.0-1) UNRELEASED; urgency=low + + - Pre-release (Closes: #706060) - * Initial release + -- Daniel Mizyrycki Fri, 26 Apr 2013 23:41:29 -0700 - -- Daniel Mizyrycki Mon, 29 Mar 2013 18:09:55 -0700 diff --git a/packaging/debian/control b/packaging/debian/control index a09e9aee56..35a2a28cd1 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -2,15 +2,16 @@ Source: lxc-docker Section: admin Priority: optional Maintainer: Daniel Mizyrycki -Build-Depends: debhelper (>= 9),autotools-dev,golang -Standards-Version: 3.9.3 +Build-Depends: debhelper (>=9), autotools-dev, golang +Standards-Version: 3.9.4 +Vcs-Git: git://git.debian.org/git/collab-maint/lxc-docker.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/lxc-docker.git;a=summary Homepage: http://github.com/dotcloud/docker Package: lxc-docker Architecture: linux-any -Depends: ${misc:Depends},${shlibs:Depends},lxc,bsdtar -Conflicts: docker -Description: lxc-docker is a Linux container runtime +Depends: ${shlibs:Depends}, ${misc:Depends}, lxc, bsdtar +Description: Linux container runtime Docker complements LXC with a high-level API which operates at the process level. It runs unix processes with strong guarantees of isolation and repeatability across servers. diff --git a/packaging/debian/copyright b/packaging/debian/copyright index 668c8635e4..8bb40030af 100644 --- a/packaging/debian/copyright +++ b/packaging/debian/copyright @@ -1,237 +1,22 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: docker -Upstream-Contact: DotCloud Inc +Upstream-Contact: dotCloud Inc Source: http://github.com/dotcloud/docker Files: * -Copyright: 2012, DotCloud Inc +Copyright: 2012, dotCloud Inc License: Apache-2.0 - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2012 DotCloud 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. - - -Files: src/github.com/kr/pty/* -Copyright: Copyright (c) 2011 Keith Rarick -License: Expat - Copyright (c) 2011 Keith Rarick - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the - Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall - be included in all copies or substantial portions of the - Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY - KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + . + On Debian systems, the complete text of the Apache version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/packaging/debian/docker.initd b/packaging/debian/docker.initd deleted file mode 100644 index 2b6a3c0979..0000000000 --- a/packaging/debian/docker.initd +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -### BEGIN INIT INFO -# Provides: docker -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: docker -# Description: docker daemon -### END INIT INFO - -DOCKER=/usr/bin/docker -PIDFILE=/var/run/docker.pid - -# Check docker is present -[ -x $DOCKER ] || log_success_msg "Docker not present" - -# Get lsb functions -. /lib/lsb/init-functions - - -case "$1" in - start) - log_begin_msg "Starting docker..." - start-stop-daemon --start --background --exec "$DOCKER" -- -d - log_end_msg $? - ;; - stop) - log_begin_msg "Stopping docker..." - docker_pid=`pgrep -f "$DOCKER -d"` - [ -n "$docker_pid" ] && kill $docker_pid - log_end_msg $? - ;; - status) - docker_pid=`pgrep -f "$DOCKER -d"` - if [ -z "$docker_pid" ] ; then - echo "docker not running" - else - echo "docker running (pid $docker_pid)" - fi - ;; - *) - echo "Usage: /etc/init.d/docker {start|stop|status}" - exit 1 - ;; -esac - -exit 0 diff --git a/packaging/debian/lxc-docker.1 b/packaging/debian/lxc-docker.1 new file mode 100644 index 0000000000..8f98785285 --- /dev/null +++ b/packaging/debian/lxc-docker.1 @@ -0,0 +1,1149 @@ +.TH "DOCKER" "1" "May 07, 2013" "0.1" "Docker" +.SH NAME +docker \- Docker Documentation +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.sp +This documentation has the following resources: +.SH CONCEPTS +.sp +Contents: +.SS Standard Containers +.SS What is a Standard Container? +.sp +Docker defines a unit of software delivery called a Standard Container. The goal of a Standard Container is to encapsulate a software component and all its dependencies in +a format that is self\-describing and portable, so that any compliant runtime can run it without extra dependency, regardless of the underlying machine and the contents of the container. +.sp +The spec for Standard Containers is currently work in progress, but it is very straightforward. It mostly defines 1) an image format, 2) a set of standard operations, and 3) an execution environment. +.sp +A great analogy for this is the shipping container. Just like Standard Containers are a fundamental unit of software delivery, shipping containers (\fI\%http://bricks.argz.com/ins/7823-1/12\fP) are a fundamental unit of physical delivery. +.SS Standard operations +.sp +Just like shipping containers, Standard Containers define a set of STANDARD OPERATIONS. Shipping containers can be lifted, stacked, locked, loaded, unloaded and labelled. Similarly, standard containers can be started, stopped, copied, snapshotted, downloaded, uploaded and tagged. +.SS Content\-agnostic +.sp +Just like shipping containers, Standard Containers are CONTENT\-AGNOSTIC: all standard operations have the same effect regardless of the contents. A shipping container will be stacked in exactly the same way whether it contains Vietnamese powder coffee or spare Maserati parts. Similarly, Standard Containers are started or uploaded in the same way whether they contain a postgres database, a php application with its dependencies and application server, or Java build artifacts. +.SS Infrastructure\-agnostic +.sp +Both types of containers are INFRASTRUCTURE\-AGNOSTIC: they can be transported to thousands of facilities around the world, and manipulated by a wide variety of equipment. A shipping container can be packed in a factory in Ukraine, transported by truck to the nearest routing center, stacked onto a train, loaded into a German boat by an Australian\-built crane, stored in a warehouse at a US facility, etc. Similarly, a standard container can be bundled on my laptop, uploaded to S3, downloaded, run and snapshotted by a build server at Equinix in Virginia, uploaded to 10 staging servers in a home\-made Openstack cluster, then sent to 30 production instances across 3 EC2 regions. +.SS Designed for automation +.sp +Because they offer the same standard operations regardless of content and infrastructure, Standard Containers, just like their physical counterpart, are extremely well\-suited for automation. In fact, you could say automation is their secret weapon. +.sp +Many things that once required time\-consuming and error\-prone human effort can now be programmed. Before shipping containers, a bag of powder coffee was hauled, dragged, dropped, rolled and stacked by 10 different people in 10 different locations by the time it reached its destination. 1 out of 50 disappeared. 1 out of 20 was damaged. The process was slow, inefficient and cost a fortune \- and was entirely different depending on the facility and the type of goods. +.sp +Similarly, before Standard Containers, by the time a software component ran in production, it had been individually built, configured, bundled, documented, patched, vendored, templated, tweaked and instrumented by 10 different people on 10 different computers. Builds failed, libraries conflicted, mirrors crashed, post\-it notes were lost, logs were misplaced, cluster updates were half\-broken. The process was slow, inefficient and cost a fortune \- and was entirely different depending on the language and infrastructure provider. +.SS Industrial\-grade delivery +.sp +There are 17 million shipping containers in existence, packed with every physical good imaginable. Every single one of them can be loaded on the same boats, by the same cranes, in the same facilities, and sent anywhere in the World with incredible efficiency. It is embarrassing to think that a 30 ton shipment of coffee can safely travel half\-way across the World in \fIless time\fP than it takes a software team to deliver its code from one datacenter to another sitting 10 miles away. +.sp +With Standard Containers we can put an end to that embarrassment, by making INDUSTRIAL\-GRADE DELIVERY of software a reality. +.SS Standard Container Specification +.sp +(TODO) +.SS Image format +.SS Standard operations +.INDENT 0.0 +.IP \(bu 2 +Copy +.IP \(bu 2 +Run +.IP \(bu 2 +Stop +.IP \(bu 2 +Wait +.IP \(bu 2 +Commit +.IP \(bu 2 +Attach standard streams +.IP \(bu 2 +List filesystem changes +.IP \(bu 2 +.UNINDENT +.SS Execution environment +.SS Root filesystem +.SS Environment variables +.SS Process arguments +.SS Networking +.SS Process namespacing +.SS Resource limits +.SS Process monitoring +.SS Logging +.SS Signals +.SS Pseudo\-terminal allocation +.SS Security +.SH INSTALLATION +.sp +Contents: +.SS Ubuntu Linux +.INDENT 0.0 +.INDENT 3.5 +\fBPlease note this project is currently under heavy development. It should not be used in production.\fP +.UNINDENT +.UNINDENT +.sp +Installing on Ubuntu 12.04 and 12.10 +.sp +Right now, the officially supported distributions are: +.sp +Ubuntu 12.04 (precise LTS) +Ubuntu 12.10 (quantal) +Docker probably works on other distributions featuring a recent kernel, the AUFS patch, and up\-to\-date lxc. However this has not been tested. +.SS Install dependencies: +.sp +.nf +.ft C +sudo apt\-get install lxc wget bsdtar curl +sudo apt\-get install linux\-image\-extra\-\(gauname \-r\(ga +.ft P +.fi +.sp +The linux\-image\-extra package is needed on standard Ubuntu EC2 AMIs in order to install the aufs kernel module. +.sp +Install the latest docker binary: +.sp +.nf +.ft C +wget http://get.docker.io/builds/$(uname \-s)/$(uname \-m)/docker\-master.tgz +tar \-xf docker\-master.tgz +.ft P +.fi +.sp +Run your first container! +.sp +.nf +.ft C +cd docker\-master +.ft P +.fi +.sp +.nf +.ft C +sudo ./docker run \-i \-t base /bin/bash +.ft P +.fi +.sp +Consider adding docker to your PATH for simplicity. +.sp +Continue with the \fIhello_world\fP example. +.SS Mac OS X and other linux +.INDENT 0.0 +.INDENT 3.5 +Please note this is a community contributed installation path. The only \(aqofficial\(aq installation is using the \fIubuntu_linux\fP installation path. This version +may be out of date because it depends on some binaries to be updated and published +.UNINDENT +.UNINDENT +.SS Requirements +.sp +We currently rely on some Ubuntu\-linux specific packages, this will change in the future, but for now we provide a +streamlined path to install Virtualbox with a Ubuntu 12.10 image using Vagrant. +.INDENT 0.0 +.IP 1. 3 +Install virtualbox from \fI\%https://www.virtualbox.org/\fP (or use your package manager) +.IP 2. 3 +Install vagrant from \fI\%http://www.vagrantup.com/\fP (or use your package manager) +.IP 3. 3 +Install git if you had not installed it before, check if it is installed by running +\fBgit\fP in a terminal window +.UNINDENT +.sp +We recommend having at least about 2Gb of free disk space and 2Gb RAM (or more). +.SS Installation +.INDENT 0.0 +.IP 1. 3 +Fetch the docker sources +.UNINDENT +.sp +.nf +.ft C +git clone https://github.com/dotcloud/docker.git +.ft P +.fi +.INDENT 0.0 +.IP 2. 3 +Run vagrant from the sources directory +.UNINDENT +.sp +.nf +.ft C +vagrant up +.ft P +.fi +.sp +Vagrant will: +.INDENT 0.0 +.IP \(bu 2 +Download the Quantal64 base ubuntu virtual machine image from get.docker.io/ +.IP \(bu 2 +Boot this image in virtualbox +.UNINDENT +.sp +Then it will use Puppet to perform an initial setup in this machine: +.INDENT 0.0 +.IP \(bu 2 +Download & untar the most recent docker binary tarball to vagrant homedir. +.IP \(bu 2 +Debootstrap to /var/lib/docker/images/ubuntu. +.IP \(bu 2 +Install & run dockerd as service. +.IP \(bu 2 +Put docker in /usr/local/bin. +.IP \(bu 2 +Put latest Go toolchain in /usr/local/go. +.UNINDENT +.sp +You now have a Ubuntu Virtual Machine running with docker pre\-installed. +.sp +To access the VM and use Docker, Run \fBvagrant ssh\fP from the same directory as where you ran +\fBvagrant up\fP. Vagrant will make sure to connect you to the correct VM. +.sp +.nf +.ft C +vagrant ssh +.ft P +.fi +.sp +Now you are in the VM, run docker +.sp +.nf +.ft C +docker +.ft P +.fi +.sp +Continue with the \fIhello_world\fP example. +.SS Windows +.INDENT 0.0 +.INDENT 3.5 +Please note this is a community contributed installation path. The only \(aqofficial\(aq installation is using the \fIubuntu_linux\fP installation path. This version +may be out of date because it depends on some binaries to be updated and published +.UNINDENT +.UNINDENT +.SS Requirements +.INDENT 0.0 +.IP 1. 3 +Install virtualbox from \fI\%https://www.virtualbox.org\fP \- or follow this \fI\%tutorial\fP +.UNINDENT +.INDENT 0.0 +.IP 2. 3 +Install vagrant from \fI\%http://www.vagrantup.com\fP \- or follow this \fI\%tutorial\fP +.UNINDENT +.INDENT 0.0 +.IP 3. 3 +Install git with ssh from \fI\%http://git-scm.com/downloads\fP \- or follow this \fI\%tutorial\fP +.UNINDENT +.sp +We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more). +.SS Opening a command prompt +.sp +First open a cmd prompt. Press Windows key and then press “R” key. This will open the RUN dialog box for you. Type “cmd” and press Enter. Or you can click on Start, type “cmd” in the “Search programs and files” field, and click on cmd.exe. +[image: Git install] +[image] +.sp +This should open a cmd prompt window. +[image: run docker] +[image] +.sp +Alternatively, you can also use a Cygwin terminal, or Git Bash (or any other command line program you are usually using). The next steps would be the same. +.SS Launch an Ubuntu virtual server +.sp +Let’s download and run an Ubuntu image with docker binaries already installed. +.sp +.nf +.ft C +git clone https://github.com/dotcloud/docker.git +cd docker +vagrant up +.ft P +.fi +[image: run docker] +[image] +.sp +Congratulations! You are running an Ubuntu server with docker installed on it. You do not see it though, because it is running in the background. +.SS Log onto your Ubuntu server +.sp +Let’s log into your Ubuntu server now. To do so you have two choices: +.INDENT 0.0 +.IP \(bu 2 +Use Vagrant on Windows command prompt OR +.IP \(bu 2 +Use SSH +.UNINDENT +.SS Using Vagrant on Windows Command Prompt +.sp +Run the following command +.sp +.nf +.ft C +vagrant ssh +.ft P +.fi +.sp +You may see an error message starting with “\fIssh\fP executable not found”. In this case it means that you do not have SSH in your PATH. If you do not have SSH in your PATH you can set it up with the “set” command. For instance, if your ssh.exe is in the folder named “C:Program Files (x86)Gitbin”, then you can run the following command: +.sp +.nf +.ft C +set PATH=%PATH%;C:\eProgram Files (x86)\eGit\ebin +.ft P +.fi +[image: run docker] +[image] +.SS Using SSH +.sp +First step is to get the IP and port of your Ubuntu server. Simply run: +.sp +.nf +.ft C +vagrant ssh\-config +.ft P +.fi +.sp +You should see an output with HostName and Port information. In this example, HostName is 127.0.0.1 and port is 2222. And the User is “vagrant”. The password is not shown, but it is also “vagrant”. +[image: run docker] +[image] +.sp +You can now use this information for connecting via SSH to your server. To do so you can: +.INDENT 0.0 +.IP \(bu 2 +Use putty.exe OR +.IP \(bu 2 +Use SSH from a terminal +.UNINDENT +.SS Use putty.exe +.sp +You can download putty.exe from this page \fI\%http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html\fP +Launch putty.exe and simply enter the information you got from last step. +[image: run docker] +[image] +.sp +Open, and enter user = vagrant and password = vagrant. +[image: run docker] +[image] +.SS SSH from a terminal +.sp +You can also run this command on your favorite terminal (windows prompt, cygwin, git\-bash, …). Make sure to adapt the IP and port from what you got from the vagrant ssh\-config command. +.sp +.nf +.ft C +ssh vagrant@127.0.0.1 –p 2222 +.ft P +.fi +.sp +Enter user = vagrant and password = vagrant. +[image: run docker] +[image] +.sp +Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine ! +.SS Running Docker +.sp +First you have to be root in order to run docker. Simply run the following command: +.sp +.nf +.ft C +sudo su +.ft P +.fi +.sp +You are now ready for the docker’s “hello world” example. Run +.sp +.nf +.ft C +docker run \-a busybox echo hello world +.ft P +.fi +[image: run docker] +[image] +.sp +All done! +.sp +Now you can continue with the \fIhello_world\fP example. +.SS Amazon EC2 +.INDENT 0.0 +.INDENT 3.5 +Please note this is a community contributed installation path. The only \(aqofficial\(aq installation is using the \fIubuntu_linux\fP installation path. This version +may be out of date because it depends on some binaries to be updated and published +.UNINDENT +.UNINDENT +.SS Installation +.sp +Docker can now be installed on Amazon EC2 with a single vagrant command. Vagrant 1.1 or higher is required. +.INDENT 0.0 +.IP 1. 3 +Install vagrant from \fI\%http://www.vagrantup.com/\fP (or use your package manager) +.IP 2. 3 +Install the vagrant aws plugin +.sp +.nf +.ft C +vagrant plugin install vagrant\-aws +.ft P +.fi +.IP 3. 3 +Get the docker sources, this will give you the latest Vagrantfile and puppet manifests. +.sp +.nf +.ft C +git clone https://github.com/dotcloud/docker.git +.ft P +.fi +.IP 4. 3 +Check your AWS environment. +.sp +Create a keypair specifically for EC2, give it a name and save it to your disk. \fII usually store these in my ~/.ssh/ folder\fP. +.sp +Check that your default security group has an inbound rule to accept SSH (port 22) connections. +.IP 5. 3 +Inform Vagrant of your settings +.sp +Vagrant will read your access credentials from your environment, so we need to set them there first. Make sure +you have everything on amazon aws setup so you can (manually) deploy a new image to EC2. +.sp +.nf +.ft C +export AWS_ACCESS_KEY_ID=xxx +export AWS_SECRET_ACCESS_KEY=xxx +export AWS_KEYPAIR_NAME=xxx +export AWS_SSH_PRIVKEY=xxx +.ft P +.fi +.sp +The environment variables are: +.INDENT 3.0 +.IP \(bu 2 +\fBAWS_ACCESS_KEY_ID\fP \- The API key used to make requests to AWS +.IP \(bu 2 +\fBAWS_SECRET_ACCESS_KEY\fP \- The secret key to make AWS API requests +.IP \(bu 2 +\fBAWS_KEYPAIR_NAME\fP \- The name of the keypair used for this EC2 instance +.IP \(bu 2 +\fBAWS_SSH_PRIVKEY\fP \- The path to the private key for the named keypair, for example \fB~/.ssh/docker.pem\fP +.UNINDENT +.sp +You can check if they are set correctly by doing something like +.sp +.nf +.ft C +echo $AWS_ACCESS_KEY_ID +.ft P +.fi +.IP 6. 3 +Do the magic! +.sp +.nf +.ft C +vagrant up \-\-provider=aws +.ft P +.fi +.sp +If it stalls indefinitely on \fB[default] Waiting for SSH to become available...\fP, Double check your default security +zone on AWS includes rights to SSH (port 22) to your container. +.sp +If you have an advanced AWS setup, you might want to have a look at the \fI\%https://github.com/mitchellh/vagrant-aws\fP +.IP 7. 3 +Connect to your machine +.sp +.nf +.ft C +vagrant ssh +.ft P +.fi +.IP 8. 3 +Your first command +.sp +Now you are in the VM, run docker +.sp +.nf +.ft C +docker +.ft P +.fi +.UNINDENT +.sp +Continue with the \fIhello_world\fP example. +.SH EXAMPLES +.sp +Contents: +.SS Hello World +.sp +This is the most basic example available for using docker +.sp +This example assumes you have Docker installed. +.sp +Download the base container +.sp +.nf +.ft C +# Download a base image +docker pull base +.ft P +.fi +.sp +The \fIbase\fP image is a minimal \fIubuntu\fP based container, alternatively you can select \fIbusybox\fP, a bare +minimal linux system. The images are retrieved from the docker repository. +.sp +.nf +.ft C +#run a simple echo command, that will echo hello world back to the console over standard out. +docker run base /bin/echo hello world +.ft P +.fi +.sp +\fBExplanation:\fP +.INDENT 0.0 +.IP \(bu 2 +\fB"docker run"\fP run a command in a new container +.IP \(bu 2 +\fB"base"\fP is the image we want to run the command inside of. +.IP \(bu 2 +\fB"/bin/echo"\fP is the command we want to run in the container +.IP \(bu 2 +\fB"hello world"\fP is the input for the echo command +.UNINDENT +.sp +\fBVideo:\fP +.sp +See the example in action +.sp +Continue to the \fIhello_world_daemon\fP example. +.SS Hello World Daemon +.sp +The most boring daemon ever written. +.sp +This example assumes you have Docker installed and with the base image already imported \fBdocker pull base\fP. +We will use the base image to run a simple hello world daemon that will just print hello world to standard +out every second. It will continue to do this until we stop it. +.sp +\fBSteps:\fP +.sp +.nf +.ft C +$ CONTAINER_ID=$(docker run \-d base /bin/sh \-c "while true; do echo hello world; sleep 1; done") +.ft P +.fi +.sp +We are going to run a simple hello world daemon in a new container made from the busybox daemon. +.INDENT 0.0 +.IP \(bu 2 +\fB"docker run \-d "\fP run a command in a new container. We pass "\-d" so it runs as a daemon. +.IP \(bu 2 +\fB"base"\fP is the image we want to run the command inside of. +.IP \(bu 2 +\fB"/bin/sh \-c"\fP is the command we want to run in the container +.IP \(bu 2 +\fB"while true; do echo hello world; sleep 1; done"\fP is the mini script we want to run, that will just print hello world once a second until we stop it. +.IP \(bu 2 +\fB$CONTAINER_ID\fP the output of the run command will return a container id, we can use in future commands to see what is going on with this process. +.UNINDENT +.sp +.nf +.ft C +$ docker logs $CONTAINER_ID +.ft P +.fi +.sp +Check the logs make sure it is working correctly. +.INDENT 0.0 +.IP \(bu 2 +\fB"docker logs\fP" This will return the logs for a container +.IP \(bu 2 +\fB$CONTAINER_ID\fP The Id of the container we want the logs for. +.UNINDENT +.sp +.nf +.ft C +docker attach $CONTAINER_ID +.ft P +.fi +.sp +Attach to the container to see the results in realtime. +.INDENT 0.0 +.IP \(bu 2 +\fB"docker attach\fP" This will allow us to attach to a background process to see what is going on. +.IP \(bu 2 +\fB$CONTAINER_ID\fP The Id of the container we want to attach too. +.UNINDENT +.sp +.nf +.ft C +docker ps +.ft P +.fi +.sp +Check the process list to make sure it is running. +.INDENT 0.0 +.IP \(bu 2 +\fB"docker ps"\fP this shows all running process managed by docker +.UNINDENT +.sp +.nf +.ft C +$ docker stop $CONTAINER_ID +.ft P +.fi +.sp +Stop the container, since we don\(aqt need it anymore. +.INDENT 0.0 +.IP \(bu 2 +\fB"docker stop"\fP This stops a container +.IP \(bu 2 +\fB$CONTAINER_ID\fP The Id of the container we want to stop. +.UNINDENT +.sp +.nf +.ft C +docker ps +.ft P +.fi +.sp +Make sure it is really stopped. +.sp +\fBVideo:\fP +.sp +See the example in action +.sp +Continue to the \fIpython_web_app\fP example. +.SS Notes: +.INDENT 0.0 +.IP \(bu 2 +\fBDocker daemon\fP The docker daemon is started by \fBsudo docker \-d\fP, Vagrant may have started +the Docker daemon for you, but you will need to restart it this way if it was terminated. Otherwise +it may give you \fBCouldn\(aqt create Tag store: open /var/lib/docker/repositories: permission denied\fP +.UNINDENT +.SS Building a python web app +.sp +The goal of this example is to show you how you can author your own docker images using a parent image, making changes to it, and then saving the results as a new image. We will do that by making a simple hello flask web application image. +.sp +\fBSteps:\fP +.sp +.nf +.ft C +$ docker import shykes/pybuilder +.ft P +.fi +.sp +We are importing the "shykes/pybuilder" docker image +.sp +.nf +.ft C +$ URL=http://github.com/shykes/helloflask/archive/master.tar.gz +.ft P +.fi +.sp +We set a URL variable that points to a tarball of a simple helloflask web app +.sp +.nf +.ft C +$ BUILD_JOB=$(docker run \-t shykes/pybuilder:1d9aab3737242c65 /usr/local/bin/buildapp $URL) +.ft P +.fi +.sp +Inside of the "shykes/pybuilder" image there is a command called buildapp, we are running that command and passing the $URL variable from step 2 to it, and running the whole thing inside of a new container. BUILD_JOB will be set with the new container_id. "1d9aab3737242c65" came from the output of step 1 when importing image. also available from \(aqdocker images\(aq. +.sp +.nf +.ft C +$ docker attach $BUILD_JOB +[...] +.ft P +.fi +.sp +We attach to the new container to see what is going on. Ctrl\-C to disconnect +.sp +.nf +.ft C +$ BUILD_IMG=$(docker commit $BUILD_JOB _/builds/github.com/hykes/helloflask/master) +.ft P +.fi +.sp +Save the changed we just made in the container to a new image called "_/builds/github.com/hykes/helloflask/master" and save the image id in the BUILD_IMG variable name. +.sp +.nf +.ft C +$ WEB_WORKER=$(docker run \-p 5000 $BUILD_IMG /usr/local/bin/runapp) +.ft P +.fi +.sp +Use the new image we just created and create a new container with network port 5000, and return the container id and store in the WEB_WORKER variable. +.sp +.nf +.ft C +$ docker logs $WEB_WORKER + * Running on http://0.0.0.0:5000/ +.ft P +.fi +.sp +view the logs for the new container using the WEB_WORKER variable, and if everything worked as planned you should see the line "Running on \fI\%http://0.0.0.0:5000/\fP" in the log output. +.sp +\fBVideo:\fP +.sp +See the example in action +.sp +Continue to the \fI\%base commands\fP +.SH CONTRIBUTING +.SS Contributing to Docker +.sp +Want to hack on Docker? Awesome! There are instructions to get you +started on the website: \fI\%http://docker.io/gettingstarted.html\fP +.sp +They are probably not perfect, please let us know if anything feels +wrong or incomplete. +.SS Contribution guidelines +.SS Pull requests are always welcome +.sp +We are always thrilled to receive pull requests, and do our best to +process them as fast as possible. Not sure if that typo is worth a pull +request? Do it! We will appreciate it. +.sp +If your pull request is not accepted on the first try, don\(aqt be +discouraged! If there\(aqs a problem with the implementation, hopefully you +received feedback on what to improve. +.sp +We\(aqre trying very hard to keep Docker lean and focused. We don\(aqt want it +to do everything for everybody. This means that we might decide against +incorporating a new feature. However, there might be a way to implement +that feature \fIon top of\fP docker. +.SS Discuss your design on the mailing list +.sp +We recommend discussing your plans \fI\%on the mailing +list\fP +before starting to code \- especially for more ambitious contributions. +This gives other contributors a chance to point you in the right +direction, give feedback on your design, and maybe point out if someone +else is working on the same thing. +.SS Create issues... +.sp +Any significant improvement should be documented as \fI\%a github +issue\fP before anybody +starts working on it. +.SS ...but check for existing issues first! +.sp +Please take a moment to check that an issue doesn\(aqt already exist +documenting your bug report or improvement proposal. If it does, it +never hurts to add a quick "+1" or "I have this problem too". This will +help prioritize the most common problems and requests. +.SS Write tests +.sp +Golang has a great testing suite built in: use it! Take a look at +existing tests for inspiration. +.SS Setting up a dev environment +.sp +Instructions that have been verified to work on Ubuntu 12.10, +.sp +Then run the docker daemon, +.sp +Run the \fBgo install\fP command (above) to recompile docker. +.SH COMMANDS +.sp +Contents: +.SS Base commands +.SS Running an interactive shell +.sp +.nf +.ft C +# Download a base image +docker import base + +# Run an interactive shell in the base image, +# allocate a tty, attach stdin and stdout +docker run \-a \-i \-t base /bin/bash +.ft P +.fi +.SS Starting a long\-running worker process +.sp +.nf +.ft C +# Run docker in daemon mode +(docker \-d || echo "Docker daemon already running") & + +# Start a very useful long\-running process +JOB=$(docker run base /bin/sh \-c "while true; do echo Hello world!; sleep 1; done") + +# Collect the output of the job so far +docker logs $JOB + +# Kill the job +docker kill $JOB +.ft P +.fi +.SS Listing all running containers +.sp +.nf +.ft C +docker ps +.ft P +.fi +.SS Expose a service on a TCP port +.sp +.nf +.ft C +# Expose port 4444 of this container, and tell netcat to listen on it +JOB=$(docker run \-p 4444 base /bin/nc \-l \-p 4444) + +# Which public port is NATed to my container? +PORT=$(docker port $JOB 4444) + +# Connect to the public port via the host\(aqs public address +echo hello world | nc $(hostname) $PORT + +# Verify that the network connection worked +echo "Daemon received: $(docker logs $JOB)" +.ft P +.fi +.sp +Continue to the complete \fI\%Command Line Interface\fP +.SS Command Line Interface +.SS Docker Usage +.sp +.nf +.ft C +$ docker + Usage: docker COMMAND [arg...] + + A self\-sufficient runtime for linux containers. + + Commands: + attach Attach to a running container + commit Create a new image from a container\(aqs changes + diff Inspect changes on a container\(aqs filesystem + export Stream the contents of a container as a tar archive + history Show the history of an image + images List images + import Create a new filesystem image from the contents of a tarball + info Display system\-wide information + inspect Return low\-level information on a container + kill Kill a running container + login Register or Login to the docker registry server + logs Fetch the logs of a container + port Lookup the public\-facing port which is NAT\-ed to PRIVATE_PORT + ps List containers + pull Pull an image or a repository to the docker registry server + push Push an image or a repository to the docker registry server + restart Restart a running container + rm Remove a container + rmi Remove an image + run Run a command in a new container + start Start a stopped container + stop Stop a running container + tag Tag an image into a repository + version Show the docker version information + wait Block until a container stops, then print its exit code +.ft P +.fi +.SS attach +.sp +.nf +.ft C +Usage: docker attach [OPTIONS] + +Attach to a running container + + \-e=true: Attach to stderr + \-i=false: Attach to stdin + \-o=true: Attach to stdout +.ft P +.fi +.SS commit +.sp +.nf +.ft C +Usage: docker commit [OPTIONS] CONTAINER [DEST] + +Create a new image from a container\(aqs changes + +\-m="": Commit message +.ft P +.fi +.SS diff +.sp +.nf +.ft C +Usage: docker diff CONTAINER [OPTIONS] + +Inspect changes on a container\(aqs filesystem +.ft P +.fi +.SS export +.sp +.nf +.ft C +Usage: docker export CONTAINER + +Export the contents of a filesystem as a tar archive +.ft P +.fi +.SS history +.sp +.nf +.ft C +Usage: docker history [OPTIONS] IMAGE + +Show the history of an image +.ft P +.fi +.SS images +.sp +.nf +.ft C +Usage: docker images [OPTIONS] [NAME] + +List images + + \-a=false: show all images + \-q=false: only show numeric IDs +.ft P +.fi +.SS import +.sp +Usage: docker import [OPTIONS] URL|\- [REPOSITORY [TAG]] +.sp +Create a new filesystem image from the contents of a tarball +.SS info +.sp +.nf +.ft C +Usage: docker info + +Display system\-wide information. +.ft P +.fi +.SS inspect +.sp +.nf +.ft C +Usage: docker inspect [OPTIONS] CONTAINER + +Return low\-level information on a container +.ft P +.fi +.SS kill +.sp +.nf +.ft C +Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...] + +Kill a running container +.ft P +.fi +.SS login +.sp +.nf +.ft C +Usage: docker login + +Register or Login to the docker registry server +.ft P +.fi +.SS logs +.sp +.nf +.ft C +Usage: docker logs [OPTIONS] CONTAINER + +Fetch the logs of a container +.ft P +.fi +.SS port +.sp +.nf +.ft C +Usage: docker port [OPTIONS] CONTAINER PRIVATE_PORT + +Lookup the public\-facing port which is NAT\-ed to PRIVATE_PORT +.ft P +.fi +.SS ps +.sp +.nf +.ft C +Usage: docker ps [OPTIONS] + +List containers + + \-a=false: Show all containers. Only running containers are shown by default. + \-notrunc=false: Don\(aqt truncate output + \-q=false: Only display numeric IDs +.ft P +.fi +.SS pull +.sp +.nf +.ft C +Usage: docker pull NAME + +Pull an image or a repository from the registry +.ft P +.fi +.SS push +.sp +.nf +.ft C +Usage: docker push NAME + +Push an image or a repository to the registry +.ft P +.fi +.SS restart +.sp +.nf +.ft C +Usage: docker restart [OPTIONS] NAME + +Restart a running container +.ft P +.fi +.SS rm +.sp +.nf +.ft C +Usage: docker rm [OPTIONS] CONTAINER + +Remove a container +.ft P +.fi +.SS rmi +.sp +.nf +.ft C +Usage: docker rmi [OPTIONS] IMAGE + +Remove an image + + \-a=false: Use IMAGE as a path and remove ALL images in this path + \-r=false: Use IMAGE as a regular expression instead of an exact name +.ft P +.fi +.SS run +.sp +.nf +.ft C +Usage: docker run [OPTIONS] IMAGE COMMAND [ARG...] + +Run a command in a new container + + \-a=false: Attach stdin and stdout + \-c="": Comment + \-i=false: Keep stdin open even if not attached + \-m=0: Memory limit (in bytes) + \-p=[]: Map a network port to the container + \-t=false: Allocate a pseudo\-tty + \-u="": Username or UID +.ft P +.fi +.SS start +.sp +.nf +.ft C +Usage: docker start [OPTIONS] NAME + +Start a stopped container +.ft P +.fi +.SS stop +.sp +.nf +.ft C +Usage: docker stop [OPTIONS] NAME + +Stop a running container +.ft P +.fi +.SS tag +.sp +.nf +.ft C +Usage: docker tag [OPTIONS] IMAGE REPOSITORY [TAG] + +Tag an image into a repository + + \-f=false: Force +.ft P +.fi +.SS version +.sp +.nf +.ft C +Usage: docker version + +Show the docker version information +.ft P +.fi +.SS wait +.sp +.nf +.ft C +Usage: docker wait [OPTIONS] NAME + +Block until a container stops, then print its exit code. +.ft P +.fi +.SH FAQ +.SS Most frequently asked questions. +.sp +\fB1. How much does Docker cost?\fP +.sp +Docker is 100% free, it is open source, so you can use it without paying. +.sp +\fB2. What open source license are you using?\fP +.sp +We are using the Apache License Version 2.0, see it here: \fI\%https://github.com/dotcloud/docker/blob/master/LICENSE\fP +.sp +\fB3. Does Docker run on Mac OS X or Windows?\fP +.sp +Not at this time, Docker currently only runs on Linux, but you can use VirtualBox to run Docker in a virtual machine on your box, and get the best of both worlds. Check out the \fI\%MacOSX\fP and \fI\%Windows\fP intallation guides. +.sp +\fB4. How do containers compare to virtual machines?\fP +.sp +They are complementary. VMs are best used to allocate chunks of hardware resources. Containers operate at the process level, which makes them very lightweight and perfect as a unit of software delivery. +.sp +\fB5. Can I help by adding some questions and answers?\fP +.sp +Definitely! You can fork \fI\%the repo\fP and edit the documentation sources. +.sp +\fB42. Where can I find more answers?\fP +.sp +You can find more answers on: +.INDENT 0.0 +.IP \(bu 2 +\fI\%IRC: docker on freenode\fP +.IP \(bu 2 +\fI\%Github\fP +.IP \(bu 2 +\fI\%Ask questions on Stackoverflow\fP +.IP \(bu 2 +\fI\%Join the conversation on Twitter\fP +.UNINDENT +.sp +Looking for something else to read? Checkout the \fIhello_world\fP example. +.SH AUTHOR +Team Docker +.SH COPYRIGHT +2013, Team Docker +.\" Generated by docutils manpage writer. +.\" +. diff --git a/packaging/debian/lxc-docker.init b/packaging/debian/lxc-docker.init new file mode 100755 index 0000000000..b85acfe082 --- /dev/null +++ b/packaging/debian/lxc-docker.init @@ -0,0 +1,74 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: lxc-docker +# Required-Start: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Linux container runtime +# Description: Linux container runtime +### END INIT INFO + +DOCKER=/usr/bin/lxc-docker + +# Check lxc-docker is present +[ -x $DOCKER ] || (log_failure_msg "lxc-docker not present"; exit 1) + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin + +# Get lsb functions +. /lib/lsb/init-functions + +check_root_id () +{ + if [ "$(id -u)" != "0" ]; then + log_failure_msg "LXC Docker must be run as root"; exit 1 + fi +} + +case "$1" in + start) + check_root_id || exit 1 + log_begin_msg "Starting LXC Docker" + mount | grep cgroup >/dev/null || mount -t cgroup none /sys/fs/cgroup + start-stop-daemon --start --background --exec "$DOCKER" -- -d + log_end_msg $? + ;; + + stop) + check_root_id || exit 1 + log_begin_msg "Stopping LXC Docker" + docker_pid=`pgrep -f "$DOCKER -d"` + [ -n "$docker_pid" ] && kill $docker_pid + log_end_msg $? + ;; + + restart) + check_root_id || exit 1 + docker_pid=`pgrep -f "$DOCKER -d"` + [ -n "$docker_pid" ] && /etc/init.d/lxc-docker stop + /etc/init.d/lxc-docker start + ;; + + force-reload) + check_root_id || exit 1 + /etc/init.d/lxc-docker restart + ;; + + status) + docker_pid=`pgrep -f "$DOCKER -d"` + if [ -z "$docker_pid" ] ; then + echo "lxc-docker not running" + else + echo "lxc-docker running (pid $docker_pid)" + fi + ;; + + *) + echo "Usage: /etc/init.d/lxc-docker {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/packaging/debian/lxc-docker.postinst b/packaging/debian/lxc-docker.postinst deleted file mode 100644 index 91e251dc8d..0000000000 --- a/packaging/debian/lxc-docker.postinst +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Ensure cgroup is mounted -if [ -z "`/bin/egrep -e '^cgroup' /etc/fstab`" ]; then - /bin/echo 'cgroup /sys/fs/cgroup cgroup defaults 0 0' >>/etc/fstab -fi -if [ -z "`/bin/mount | /bin/egrep -e '^cgroup'`" ]; then - /bin/mount /sys/fs/cgroup -fi - -# Start docker -/usr/sbin/update-rc.d docker defaults -/etc/init.d/docker start diff --git a/packaging/debian/rules b/packaging/debian/rules index 25f16f9c61..b81f131b62 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -1,12 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. -# Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: