Compare commits

...

714 Commits

Author SHA1 Message Date
Guillaume J. Charmes
38b8373434 Implement the COPY operator within the builder 2013-04-24 14:28:51 -07:00
Guillaume J. Charmes
03b5f8a585 Make sure the destination directory exists when using docker insert 2013-04-24 13:51:28 -07:00
Guillaume J. Charmes
bc260f0225 Add insert command in order to insert external files within an image 2013-04-24 13:37:00 -07:00
Guillaume J. Charmes
45dcd1125b Add a Builder.Commit method 2013-04-24 13:35:57 -07:00
Guillaume J. Charmes
d2e063d9e1 make builder.Run public it now runs only given arguments without sh -c 2013-04-24 12:31:20 -07:00
Guillaume J. Charmes
567a484b66 Clear the containers/images upon failure 2013-04-24 12:02:00 -07:00
Guillaume J. Charmes
5d4b886ad6 Add build command 2013-04-24 11:03:01 -07:00
Solomon Hykes
90668a8a99 Bumped version to 0.2.0 2013-04-23 23:15:09 -07:00
Solomon Hykes
c7fd84b8a0 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-23 23:05:38 -07:00
Solomon Hykes
874a40ed3a - Dev: dockerbuilder requires a fake initctl because 'apt-get install devscripts' insists on installing a stupid daemon I never asked for in the first place. 2013-04-23 23:04:54 -07:00
Solomon Hykes
370fafacbf Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-23 22:57:50 -07:00
Solomon Hykes
a0478f726d dockerbuilder: upload most recent Ubuntu package (note version FOO might not yet be packaged at tag vFOO) 2013-04-23 22:57:34 -07:00
Solomon Hykes
e5bc5a2e31 Merge pull request #427 from dhrp/docs
- Packaging: Fixed Vagrantfile
* Documentation: Updated install instructions
2013-04-23 19:49:28 -07:00
Solomon Hykes
25fc3a7e76 Merge pull request #470 from dotcloud/packaging-ubuntu
* Packaging: Add 0.1.8 to Ubuntu packaging changelog
* Packaging: Update the Ubuntu maintainer manual
2013-04-23 19:46:56 -07:00
Solomon Hykes
b3ab0b561e Makefile improvements
+ Convenience rules: srcrelease, deps
	- Separate dependency vendoring from building the binary
	  (re-download dependencies with 'make deps')
2013-04-23 19:41:38 -07:00
Solomon Hykes
8b8c8bf7cb Fix 'make release RELEASE_VERSION=master' 2013-04-23 18:50:53 -07:00
Solomon Hykes
a8651a23b2 make release: build a binary release of the most recent version tag 2013-04-23 18:32:59 -07:00
Daniel Mizyrycki
f744cfd5a7 packaging-ubuntu: update maintainer documentation for changelog file 2013-04-23 13:51:03 -07:00
Solomon Hykes
e03b241fb1 dockerbuilder: build with 'make; cp -R ./bin' 2013-04-23 12:07:54 -07:00
Thatcher Peskens
1ddca1948b Fixed remaining issues and conflicts created by last merge. 2013-04-23 12:04:53 -07:00
Solomon Hykes
2485bb2cd2 dockerbuilder: use a pristine GOPATH, with the fresh checkout registered at the right path (for internal submodules) 2013-04-23 11:45:47 -07:00
Solomon Hykes
7577f48dc4 dockerbuilder: build in current directory instead /go and /tmp 2013-04-23 10:53:02 -07:00
Solomon Hykes
0512cf9c83 dockerbuilder: /usr/local/bin is already set by docker 2013-04-23 10:49:58 -07:00
Solomon Hykes
73da7a12e7 Increased timeout in TCP port allocation test to pass on slower machines 2013-04-23 10:12:46 -07:00
Solomon Hykes
50f5723f1d Merge pull request #465 from shamrin/patch-2
- Documentation: fixed typo in "Building blocks"
2013-04-23 09:02:19 -07:00
Alexey Shamrin
cbc4eccd50 fixed typo in buildingblocks.rst 2013-04-23 12:52:55 +04:00
Solomon Hykes
cff26b3a6c Merge pull request #464 from tianon/patch-1
- Runtime: adapt cgroup capability detection to work on Gentoo
2013-04-23 00:36:10 -07:00
Solomon Hykes
329c3e0ffd Merge pull request #462 from dotcloud/initial_changelog
+ Add initial Changelog
2013-04-23 00:32:25 -07:00
Solomon Hykes
4f6cc5c733 Completed Changelog for all past versions 2013-04-23 00:30:18 -07:00
Tianon Gravi
e413340723 Update FindCgroupMountpoint to be more forgiving
On Gentoo, the memory cgroup is mounted at /sys/fs/cgroup/memory, but the mount line looks like the following:
memory on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)

(note that the first word on the line is "memory", not "cgroup", but the other essentials are there, namely the type of cgroup and the memory mount option)
2013-04-23 01:09:29 -06:00
Solomon Hykes
95e066d24f - Runtime: ghost containers can be killed. 2013-04-22 22:30:33 -07:00
Solomon Hykes
82b8f7a565 hack/dockerbuilder: a standard build environment for building and uploading official binary builds of docker... inside docker 2013-04-22 22:29:12 -07:00
Solomon Hykes
97badbd29e Bumped version to 0.1.8 2013-04-22 22:04:57 -07:00
Thatcher Peskens
5a5e417d46 Merge remote-tracking branch 'dotcloud/master' into dhrp/docs
Conflicts:
	docker/docker.go
	docs/sources/installation/archlinux.rst
	docs/sources/installation/index.rst
	docs/sources/installation/ubuntulinux.rst
	runtime.go
	utils.go
2013-04-22 18:44:50 -07:00
Thatcher Peskens
4031a01af1 Merged changes 2013-04-22 18:38:42 -07:00
Guillaume J. Charmes
0b0d958b88 Merge pull request #463 from dotcloud/improve_pid_file_feature
Check that the pid in pidfile exists before preventing docker to start
2013-04-22 18:24:03 -07:00
Guillaume J. Charmes
03e4704ae5 Merge pull request #442 from dotcloud/fix_deleted_file_diff
Use aufs to handle parents whiteouts instead of doing it manually
2013-04-22 18:23:46 -07:00
Guillaume J. Charmes
7a8ac76299 Merge pull request #456 from dotcloud/453-generic_kernel_detection-fix
453 generic kernel detection fix
2013-04-22 18:20:17 -07:00
Guillaume J. Charmes
c05c91ca3b Make kernel detection work without suffix 2013-04-22 18:15:33 -07:00
Guillaume J. Charmes
b76d63cb0c Forbid attach to ghost 2013-04-22 17:53:32 -07:00
Guillaume J. Charmes
f926ed182f Allow to kill/stop ghosts 2013-04-22 17:53:32 -07:00
Guillaume J. Charmes
d440782e17 Allow to kill container after docker server restarts 2013-04-22 17:52:38 -07:00
Guillaume J. Charmes
82848d4158 Allow to wait on container even after docker server restarts using lxc-info 2013-04-22 17:52:38 -07:00
Guillaume J. Charmes
97535e5a64 Add unit test for file deletion 2013-04-22 17:51:09 -07:00
Guillaume J. Charmes
f079fbe3fa Check that the pid in pidfile exists before preventing docker to start 2013-04-22 15:57:31 -07:00
Guillaume J. Charmes
90d144b612 Merge pull request #457 from shamrin/patch-1
README.md: `docker port` instead of just `port`
2013-04-22 15:40:03 -07:00
Guillaume J. Charmes
d3db94696d Merge pull request #461 from neomantra/master
Fix typo (ghot -> ghost)
2013-04-22 15:39:34 -07:00
Evan Wies
ffe16e3224 Fix typo (ghot -> ghost) 2013-04-22 18:37:06 -04:00
Guillaume J. Charmes
0b60829df7 Add initial changelog 2013-04-22 15:26:06 -07:00
Thatcher Peskens
690e118670 Updated gettingstarted with quicker install. 2013-04-22 13:36:00 -07:00
Alexey Shamrin
038e1d174b README.md: docker port instead of just port 2013-04-23 00:27:23 +04:00
Thatcher Peskens
6c8dcd5cbb Updated Vagrantfile and documentation to reflect new installation path using Ubuntu's PPA, also switched everything to use Ubuntu 12.04 by default. 2013-04-22 13:10:32 -07:00
Guillaume J. Charmes
16aeb77d51 Move the kernel detection to arch specific files 2013-04-22 12:08:59 -07:00
Guillaume J. Charmes
4ac3b803b9 Make the kernel version detection more generic 2013-04-22 11:39:56 -07:00
Guillaume J. Charmes
3514e47edc Do not prevent docker from running when kernel detection fails 2013-04-22 11:26:34 -07:00
Guillaume J. Charmes
acb546cd1b Fix race within TestRunDisconnectTty 2013-04-22 11:16:32 -07:00
Guillaume J. Charmes
2ced94b414 Merge pull request #454 from tianon/master
Update utils.go to not enforce extra constraints on the kernel "flavor" (such as being integral or even comparable one to another)
2013-04-22 08:02:42 -07:00
Guillaume J. Charmes
71b5806614 Do not stop execution if cgroup mountpoint is not found 2013-04-22 00:44:57 -04:00
Tianon Gravi
1f65c6bf4c Update utils.go to not enforce extra constraints on the kernel "flavor" (such as being integral or even comparable one to another)
This is especially to fix the current docker on kernels such as gentoo-sources, where the "flavor" is the string "gentoo", and that obviously fails to be converted to an integer.
2013-04-21 19:19:38 -06:00
Solomon Hykes
965e8a02d2 'docker push' shows an additional progress bar while it buffers the archive to disk. Fixes #451. 2013-04-21 15:29:26 -07:00
Solomon Hykes
baacae8345 'docker push' buffers filesystem archives on disk instead of memory. 2013-04-21 14:23:55 -07:00
Solomon Hykes
52cedb8a05 Better title in ubuntu install doc 2013-04-20 18:26:15 -07:00
Solomon Hykes
15c7e72e2a Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-20 18:19:04 -07:00
Solomon Hykes
76b40ad6c9 Merge remote-tracking branch 'origin/check_kernel_capabilities' 2013-04-20 17:40:25 -07:00
Solomon Hykes
6909f3911f Merge pull request #422 from shawnsi/arch-docs
Arch docs
2013-04-20 17:35:43 -07:00
Solomon Hykes
3b6c540fe8 Bumped version to 0.1.7 2013-04-20 17:35:00 -07:00
Solomon Hykes
d49a273071 Moved 'under the hood' below install instructions and examples in README 2013-04-20 17:33:02 -07:00
Solomon Hykes
1201c418cd Fix Ubuntu install doc 2013-04-20 17:31:49 -07:00
Solomon Hykes
4a9c3a92e1 Formatting fix in ubuntu install doc 2013-04-20 17:30:33 -07:00
Solomon Hykes
28831a412f Link to public images list in the README 2013-04-20 17:29:41 -07:00
Solomon Hykes
70cf467fdf Removed duplicate ubuntu binary install instructions from README 2013-04-20 17:29:12 -07:00
Solomon Hykes
c40f01319f Cleaned up install instructions in the README
* Addded quick install on ubuntu as the 1st install option
	* Grouped other binary installs under "binary installs"
	* Removed duplicate binary ubuntu installs (linked to the docs)
	* Improved "build from source" instructions
2013-04-20 17:26:50 -07:00
Thatcher Peskens
0731d1a582 Updated ubuntu install 2013-04-19 20:59:43 -07:00
Thatcher Peskens
8ecde8f9a5 Updated documentation and fixed Vagrantfile 2013-04-19 20:57:50 -07:00
Solomon Hykes
911925b54a Add a test for allocating tcp ports and reaching them on localhost 2013-04-19 20:46:07 -07:00
Solomon Hykes
7f1a32b9ff Shutdown loopback-to-loopback proxy when unmapping a port 2013-04-19 20:44:25 -07:00
Solomon Hykes
930e9a7e43 Emulate DNAT in userland for loopback-to-loopback connections. This makes container ports available from localhost. 2013-04-19 19:35:44 -07:00
Solomon Hykes
61259ab4b4 Exclude loopback-to-loopback connections from DNAT rules, to allow userland proxying 2013-04-19 19:32:32 -07:00
Solomon Hykes
931ca464a7 'docker ps' shows port mappings 2013-04-19 19:29:13 -07:00
Guillaume J. Charmes
cc5a044a8c update TestRunDisconnectTty to reflect the correct behavior of CmdRun 2013-04-19 17:51:41 -07:00
Guillaume J. Charmes
0eb425426f Merge pull request #444 from lopter/master
Fixe the race condition between docker run and docker logs from #428
2013-04-19 18:09:58 -07:00
Guillaume J. Charmes
3bfb70db24 Wait for the container terminate at the end of CmdRun
Fixes the race condition between docker run and docker logs from #428.
2013-04-19 18:06:13 -07:00
Guillaume J. Charmes
e49af5b6de Use aufs to handle parents whitouts instead of doing it manually 2013-04-19 16:33:25 -07:00
Solomon Hykes
d8416539b3 contrib/vagrant-docker: a placeholder to centralize collaboration on an official docker provider for vagrant 2013-04-19 15:55:34 -07:00
Solomon Hykes
a76c3a9c95 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-19 12:55:32 -07:00
Solomon Hykes
e81ddb2dc7 Fixed 'hack' rule in Makefile 2013-04-19 12:55:17 -07:00
Solomon Hykes
4d728821e3 Merge remote-tracking branch 'origin/buildbot' 2013-04-19 12:47:22 -07:00
Guillaume J. Charmes
e92c4b1f39 Merge pull request #415 from dotcloud/261-choose_grace_period-feature
added -t in docker stop and restart to choose grace period
2013-04-19 12:42:34 -07:00
Solomon Hykes
152a9f77b4 Fix ubuntu packaging to build from a clean checkout of the correct git tag 2013-04-19 12:39:40 -07:00
Solomon Hykes
bfb84b564c Merge remote-tracking branch 'origin/30-packaging-ubuntu' 2013-04-19 11:31:53 -07:00
Solomon Hykes
e8a67f632e Cleanup examples on README 2013-04-18 22:37:45 -07:00
Solomon Hykes
3d2fd8a650 Small wording fix in README 2013-04-18 22:24:52 -07:00
Solomon Hykes
79a78d37e7 Add examples to the README 2013-04-18 22:24:29 -07:00
Solomon Hykes
3ae5c45d9a Fix examples in README to no longer rely on standalone mode 2013-04-18 22:22:00 -07:00
Guillaume J. Charmes
f3e89fae28 Use mount to determine the cgroup mountpoint 2013-04-18 21:57:58 -07:00
Guillaume J. Charmes
c42a4179fc Add unit tests for CompareKernelVersion 2013-04-18 21:34:34 -07:00
Guillaume J. Charmes
2d32ac8cff Improve the docker version output 2013-04-18 21:08:33 -07:00
Guillaume J. Charmes
f68d107a13 Remove the NO_MEMORY_LIMIT constant 2013-04-18 21:08:20 -07:00
Guillaume J. Charmes
640efc2ed2 Add capabilities check to allow docker to run on kernel that does not have all options 2013-04-18 20:55:41 -07:00
Guillaume J. Charmes
003622c8b6 Check kernel version and display warning if too low 2013-04-18 20:47:24 -07:00
Thatcher Peskens
6de5ca1e64 Added redirect from old location of documentation (/documentation), these was the location when we were on github. 2013-04-18 16:00:18 -07:00
Solomon Hykes
deb55e416e contrib/docker-build: don't remove the base image if the first build step fails 2013-04-18 14:46:17 -07:00
Shawn Siefkas
7eda9c64b8 Updating the arch linux installation docs
New AUR package name
Adding systemd service unit info
2013-04-18 09:20:23 -05:00
Shawn Siefkas
84c13a3dcf Adding archlinux packaging documentation 2013-04-18 09:17:31 -05:00
Victor Vieux
90602ab62a fixed test 2013-04-18 16:03:50 +02:00
Daniel Mizyrycki
8e6ba343bf packaging-ubuntu, issue #30: Ensure docker package installs and passes tests on official vagrant Ubuntu 12.04 box 2013-04-17 21:10:53 -07:00
Daniel Mizyrycki
523cd8e29c packaging-ubuntu, issue #30: streamline building and uploading to PPA 2013-04-17 20:56:34 -07:00
Daniel Mizyrycki
fd39af7f85 packaging-ubuntu: move original files in place for update 2013-04-17 20:56:34 -07:00
Solomon Hykes
ee82870ff7 Bumped version to 0.1.6 to mark image format change (author field) 2013-04-17 20:18:35 -07:00
Solomon Hykes
227a8142a3 Record the author of an image with 'docker commit -author' 2013-04-17 20:13:11 -07:00
Solomon Hykes
4ef2d5c1e6 Added 'author' field to the image format 2013-04-17 19:58:17 -07:00
Solomon Hykes
e34e44e8e6 Bumped version to 0.1.5 2013-04-17 17:12:08 -07:00
Solomon Hykes
13d9e26edd Fix the behavior of Graph.Register so that it can be interrupted without side effect 2013-04-17 16:35:22 -07:00
Solomon Hykes
0a3131554c Merge pull request #406 from shawnsi/405-arch-docs
Issue #405: Documentation for Arch Linux Install
2013-04-17 15:45:26 -07:00
Solomon Hykes
521ce07859 Merge pull request #409 from lynaghk/master
Docker init created by contrib setup script should set proper UTF8 LANG
2013-04-17 15:23:12 -07:00
Solomon Hykes
f02950965e Merge remote-tracking branch 'origin/183-no_such_device-fix' 2013-04-17 11:54:57 -07:00
Solomon Hykes
16f6daa5be Merge remote-tracking branch 'origin/416-lxc_0_9_compatibliity-fix' 2013-04-17 11:35:12 -07:00
Solomon Hykes
ca6cd5b557 Keep a cache of the unit-tests image. So I can code in conferences with crappy wifi. 2013-04-17 11:32:13 -07:00
Victor Vieux
1615bb08c7 added -t in docker stop and restart to choose grace period 2013-04-17 11:56:30 +02:00
Guillaume J. Charmes
c4cd224d90 improve the crashTest script 2013-04-16 15:20:04 -07:00
Guillaume J. Charmes
7b0e96f1f4 Manually pass the env to docker-init instead of relying on lxc to pass it 2013-04-16 14:32:50 -07:00
Solomon Hykes
fc72a809c1 Remove unneeded dependencies from README 2013-04-16 12:10:16 -07:00
Solomon Hykes
2a47df0202 Disabled standalone mode (fixes #364) 2013-04-15 11:44:11 -07:00
Kevin J. Lynagh
468fb90117 install.sh script's dockerd.conf should set docker daemon environment's LANG to en_US.UTF-8. See #355. 2013-04-15 08:49:48 -07:00
Victor Vieux
ac49a797b4 try to load aufs module, disply error on failure 2013-04-15 12:05:46 +02:00
Guillaume J. Charmes
1ec6c223c9 Add a script to help reproduce #407 2013-04-14 15:13:32 -07:00
Solomon Hykes
db08705e3c Merge remote-tracking branch 'origin/packaging' 2013-04-13 21:40:53 -07:00
Solomon Hykes
fdf3308260 Merge remote-tracking branch 'origin/396-disabling_memory_limit-feature' 2013-04-13 21:25:53 -07:00
Guillaume J. Charmes
c2c72bcfd7 Add \r to error message in run raw mode 2013-04-13 15:03:24 -07:00
Solomon Hykes
cdf90bb04b Merge remote-tracking branch 'origin/96-dns_issue-fix' 2013-04-12 17:50:59 -07:00
Shawn Siefkas
45809e9a05 Issue #405: Documentation for Arch Linux Install 2013-04-12 13:25:33 -05:00
Guillaume J. Charmes
1967c8342a Allow to disable memory limit at compilation time 2013-04-12 10:48:20 -07:00
Guillaume J. Charmes
7673afc843 Allow use to set his own dns via -dns 2013-04-12 10:43:13 -07:00
Solomon Hykes
b1fbebb4a3 Fixed wording of ghost-related messages 2013-04-12 10:39:08 -07:00
Solomon Hykes
3527291b47 Merge remote-tracking branch 'origin/ghost_handling-fix' 2013-04-12 10:33:36 -07:00
Solomon Hykes
57d31c9777 Merge remote-tracking branch 'origin/kill_behaviour_fix' 2013-04-12 10:20:26 -07:00
Guillaume J. Charmes
a2f5a56143 Merge pull request #403 from titanous/update-authors
Update AUTHORS
2013-04-12 07:56:19 -07:00
Jonathan Rudenberg
343ed6b53f Update AUTHORS 2013-04-12 10:44:50 -04:00
Guillaume J. Charmes
22893429ed Go fmt 2013-04-12 07:37:24 -07:00
Guillaume J. Charmes
c1703c2b68 Merge branch 'create_pidfile' of https://github.com/flavio/docker into flavio-create_pidfile 2013-04-12 07:28:36 -07:00
Guillaume J. Charmes
a8c15477d9 Merge pull request #381 from dotcloud/371-add-l-ps
Add options to docker ps
2013-04-12 07:16:00 -07:00
Guillaume J. Charmes
9d03b2bb62 Merge pull request #395 from dotcloud/commands_usage-fix
fixes some usages (multiple parameters mostly)
2013-04-12 07:03:36 -07:00
Victor Vieux
8987bd5832 removed not needed [OPTIONS] and remove poor messages like 'Not enough arguments' 2013-04-12 12:26:31 +02:00
Daniel Mizyrycki
f226842aa1 Packaging, Debian: Add maintainer documentation 2013-04-11 20:17:41 -07:00
Daniel Mizyrycki
b14164879b Packaging: Add README documentation 2013-04-11 17:39:47 -07:00
Guillaume J. Charmes
bb22cd492e Add unit test for hanging kill + fix other tests behaviour 2013-04-11 16:21:19 -07:00
Solomon Hykes
27be5aec74 Merge pull request #386 from lopter/master
Use ip to setup the gateway in sysinit.go
2013-04-11 15:02:20 -07:00
Solomon Hykes
048f9f4974 Added docker-build (formerly github.com/shykes/changer) as a contrib script 2013-04-11 14:44:39 -07:00
Flavio Castelli
fb0b375be7 docker daemon: create file containing PID
Ensure the docker daemon creates a file containing its PID under
/var/run/docker.pid.

The daemon takes care of removing the pid file when it receives either
SIGTERM, SIGINT or SIGKILL.

The daemon also refuses to start when the pidfile is found. An
explanation message is shown to the user when this happens.

This change is required to make docker easier to manage by tools like
checkproc which rely on this information.
2013-04-11 21:41:08 +02:00
Solomon Hykes
79d934bfb0 Simplify the output of 'docker images' by removing the PARENT column 2013-04-11 12:11:41 -07:00
Solomon Hykes
54dfedc516 Merge remote-tracking branch 'origin/148-remove_repositories-feature' 2013-04-11 11:36:28 -07:00
Solomon Hykes
0eb7157b6f Merge remote-tracking branch 'origin/crlf_on_raw_mode' 2013-04-11 11:31:17 -07:00
Solomon Hykes
2de953490d Contrib post-commit hook for checking gofmt 2013-04-11 11:30:35 -07:00
Victor Vieux
3ba44d2d5f fixes some usages 2013-04-11 18:46:47 +02:00
Guillaume J. Charmes
313d13ea01 Detect and mark ghost container. 2013-04-11 09:26:17 -07:00
Guillaume J. Charmes
e68c04b722 force kill now use lxc-kill. Fixes #383 2013-04-11 09:04:04 -07:00
Guillaume J. Charmes
c902c43766 Merge pull request #392 from dotcloud/rm_usage-fix
Display usage when no parameter in docker rm
2013-04-11 07:56:46 -07:00
Victor Vieux
c105049f7e display usage when no parameter 2013-04-11 16:27:01 +02:00
Victor Vieux
17136d58f2 snake_case to camelCase 2013-04-11 13:09:40 +02:00
Daniel Mizyrycki
8ea1e9126f packaging; issue #251: Add debian packaging 2013-04-10 21:00:39 -07:00
Guillaume J. Charmes
6dc4c74b5a Use crlf in registry function to avoid issue with autlogin in push and autopull in run 2013-04-10 19:13:15 -07:00
Guillaume J. Charmes
9d1fd2317d use crlf in login in order to avoir issue due to real raw mode 2013-04-10 19:08:46 -07:00
Guillaume J. Charmes
1f9f5eed5d Put the resolv.conf path in a variable instead of being hardcoded within lxc 2013-04-10 18:23:34 -07:00
Louis Opter
5e1a975b48 Use ip to setup the gateway in sysinit.go
ip from iproute2 replaces the legacy route tool which is often not
installed by default on recent Linux distributions.

The same patch has been done in network.go and is re-used here.
2013-04-10 17:40:28 -07:00
Guillaume J. Charmes
97f48e59fc Allow rmi to remove image from its name 2013-04-10 17:23:42 -07:00
Solomon Hykes
e41fd24542 Added temporary spec for data volumes as requested on #111 2013-04-10 13:57:26 -07:00
Victor Vieux
8bd192fb16 changed last to n 2013-04-10 21:09:21 +02:00
Daniel Mizyrycki
d2c1850fb5 testing: Make postcommit more generic 2013-04-10 11:32:48 -07:00
Victor Vieux
8c3331dc97 add -l to docker ps 2013-04-10 19:30:57 +02:00
Solomon Hykes
f507188ddc Merge pull request #372 from srid/goroutine-scope
serve goroutine must refer to the local conn
2013-04-09 21:06:31 -07:00
Solomon Hykes
76b7b2adf7 Merge remote-tracking branch 'origin/wait_non_existing_container-fix' 2013-04-09 21:05:15 -07:00
Solomon Hykes
cb68662b9b Merge pull request #377 from jbarbier/buildbot
Fix the Makefile, rule=hack to make it work on Windows
2013-04-09 20:53:29 -07:00
Julien Barbier
b7cda3288e Fix the Makefile, rule=hack to make it work on Windows 2013-04-09 19:07:50 -07:00
Solomon Hykes
a1f54cad6c Merge pull request #367 from johncosta/333-redis-documentation
Add documentation for running a redis process with docker
2013-04-09 18:16:39 -07:00
Guillaume J. Charmes
9f83b9df22 Make sure all containers (even previously stopped) get a correct wait lock 2013-04-09 17:40:02 -07:00
John Costa
4ab241c930 incorporate feedback for improving the PR 2013-04-09 18:04:01 -04:00
Sridhar Ratnakumar
f731835e45 serve goroutine must refer to the local conn 2013-04-09 15:00:05 -07:00
Daniel Mizyrycki
bbaa975ec8 testing: Add buildbot VM 2013-04-09 14:37:37 -07:00
John Costa
418ef43fbb Merge github.com:dotcloud/docker into 333-redis-documentation 2013-04-09 16:07:40 -04:00
Solomon Hykes
40ebe78bb1 Bumped version to 0.1.4 2013-04-09 13:00:50 -07:00
Solomon Hykes
1b7115a337 Merge remote-tracking branch 'origin/disable_signals-create_escape_sequence' 2013-04-09 12:56:32 -07:00
Guillaume J. Charmes
2e6a5bc7ee Update README with escape sequence 2013-04-09 12:55:26 -07:00
Guillaume J. Charmes
72cef46e5e Fix merge issue 2013-04-09 12:55:26 -07:00
Guillaume J. Charmes
626bfd87a7 Use integers instead of non-printable chars in the escape sequence detection 2013-04-09 12:55:26 -07:00
Guillaume J. Charmes
8f41f1fa60 Remove unused optimization that could lead in loosing the escape sequence 2013-04-09 12:55:26 -07:00
Guillaume J. Charmes
faa8843650 Look for the escape sequence only in tty mode 2013-04-09 12:55:17 -07:00
Guillaume J. Charmes
0d9e54367f Fix deadlock on stop failure 2013-04-09 12:06:01 -07:00
Guillaume J. Charmes
1f70b1e15d Implement an escape sequence in order to be able to detach from a container 2013-04-09 11:06:17 -07:00
Guillaume J. Charmes
3f63b87807 Disable signal catching and enable real posix raw mode 2013-04-09 11:06:17 -07:00
Solomon Hykes
9c3d2b6a4e Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-09 11:02:43 -07:00
Solomon Hykes
1716fccbcc Merge remote-tracking branch 'origin/change_run_detach_behavious_tty_mode' 2013-04-09 10:39:13 -07:00
Solomon Hykes
9043e4c757 Merge pull request #363 from dhrp/docs
Added code and color for 'note' and updated the examples note.
2013-04-09 10:36:44 -07:00
Solomon Hykes
2e9a73c5d8 Merge remote-tracking branch 'origin/fix_flush_behaviour' 2013-04-09 10:31:56 -07:00
Guillaume J. Charmes
1eaaa6b744 Flush stdout on import to avoid deadklock when waiting for stdin (import -). Fixed #365 2013-04-09 10:02:57 -07:00
Guillaume J. Charmes
cb54e9c659 Flush whether or not there we set the rawmode to avoid the client to lock 2013-04-09 09:59:30 -07:00
Guillaume J. Charmes
7c2b085d1a Add inconditionnal lock in Start/Stop/Kill to avoid races 2013-04-09 09:09:54 -07:00
Guillaume J. Charmes
d063d52cce Update the unit test to reflect the new CmdRun behaviour in tty mode 2013-04-09 08:18:36 -07:00
Guillaume J. Charmes
64c1b6d9cd Change the behaviour of CmdRun in tty mode: dont kill the process uppon detach 2013-04-09 08:18:16 -07:00
John Costa
8f15c423e6 add documentation for running a redis process with docker 2013-04-09 11:04:14 -04:00
Guillaume J. Charmes
329f4449dc Remove the mutexes and use chan instead in order to handle the wait lock 2013-04-09 07:57:59 -07:00
Solomon Hykes
0767916ade Merge pull request #346 from srid/patch-2
make the service example work
2013-04-08 22:12:34 -07:00
Solomon Hykes
10923c7890 Merge remote-tracking branch 'origin/pty_fix-1' 2013-04-08 21:12:22 -07:00
Thatcher Peskens
2832ea0cfe Added code and color for 'note' and updated the hello world note. 2013-04-08 20:10:47 -07:00
Solomon Hykes
a7299a3f26 Merge remote-tracking branch 'origin/unit_test_improvment-2' 2013-04-08 18:29:12 -07:00
Solomon Hykes
1601366cb6 Make it more clear when Docker fails to allocate a free IP range for its bridge 2013-04-08 18:16:58 -07:00
Louis Opter
e9a68801ba Update the tests according to the "optional raw mode" changes 2013-04-08 16:07:12 -07:00
Guillaume J. Charmes
f73401fb9a Add missing file 2013-04-08 16:07:12 -07:00
Guillaume J. Charmes
dcf4572a69 Set the raw mode only for tty enabled containers 2013-04-08 16:07:12 -07:00
Guillaume J. Charmes
d530d581f7 Make commands.go more idiomatic. Use DockerConn only when needed, keep io.Writer when not 2013-04-08 15:58:09 -07:00
Guillaume J. Charmes
bdf05d8368 Reenable CmdRunAttachStdin and CmdRunHostname now using the DockConn interface 2013-04-08 15:58:09 -07:00
Guillaume J. Charmes
b71b226cc1 Improve error management (avoid unwanted output in tests) 2013-04-08 15:58:09 -07:00
Guillaume J. Charmes
80f6b4587b Edit the tests for them to use the new command API. Disable TestRunHostname and TestAttachStdin. 2013-04-08 15:58:09 -07:00
Guillaume J. Charmes
e6e9c1cd62 Use io.WriteCloser instead of *os.File in DockerLocalConn so we can use it with standard writers and pipes 2013-04-08 15:58:09 -07:00
Guillaume J. Charmes
246eed52de Move DockerLocalConn and terminal functions form package "main" to "rcli" in order to be able to use DockerLocalConn in commands_test.go 2013-04-08 15:58:09 -07:00
Louis Opter
b306a60738 Simplification in the goroutine that restore the terminal state on SIGINT 2013-04-08 15:58:09 -07:00
Louis Opter
7d0ab3858e Only set the terminal in raw mode for commands which need it
The raw mode is actually only needed when you attach to a container.
Having it enabled all the time can be a pain, e.g: if docker crashes
your terminal will end up in a broken state.

Since we are currently missing a real API for the docker daemon to
negotiate this kind of options, this changeset actually enable the raw
mode on the login (because it outputs a password), run and attach
commands.

This "optional raw mode" is implemented by passing a more complicated
interface than io.Writer as the stdout argument of each command. This
interface (DockerConn) exposes a method which allows the command to set
the terminal in raw mode or not.

Finally, the code added by this changeset will be deprecated by a real
API for the docker daemon.
2013-04-08 15:58:09 -07:00
Louis Opter
4e5001b46a Remove the unused http transport from rcli 2013-04-08 15:58:09 -07:00
Solomon Hykes
b8f9803459 Merge pull request #347 from kencochrane/303_docs_fix
improved the example docs to help #303
2013-04-08 11:50:07 -07:00
Solomon Hykes
0c018d3697 Merge pull request #356 from flavio/improve_python_web_app_example
Extend the documentation covering the web app example
2013-04-08 11:49:17 -07:00
Flavio Castelli
72fdb41069 Extend the documentation covering the web app example
Make it clear how to access the web app running inside of the container
from the host.
2013-04-08 17:39:30 +02:00
Ken Cochrane
6eb8a74ff9 added headers to examples linking back to running the examples page 2013-04-07 10:23:00 -04:00
Ken Cochrane
81ebf4fcf6 made a new running the examples page, and added a link to the top of each example to the page to show people how to run them. 2013-04-07 10:21:08 -04:00
Sridhar Ratnakumar
9875a9b1f1 sync with README 2013-04-07 00:43:57 -07:00
Sridhar Ratnakumar
27feba4594 make the service example work
issue #98 requires connecting to localhost (which `hostname` may resolve to) will not work.
2013-04-07 00:41:24 -07:00
Guillaume J. Charmes
c83393a541 Move the DockerConn flush to its own function 2013-04-05 20:08:31 -07:00
Guillaume J. Charmes
7e1e7d14fa Make sure to flush buffer when setting raw mode 2013-04-05 19:48:49 -07:00
Guillaume J. Charmes
99b5bec069 Fix run disconnect behavious in tty mode + add unit test to enforce it 2013-04-05 19:02:35 -07:00
Guillaume J. Charmes
7d8895545e Cleanup pty variable names 2013-04-05 17:40:55 -07:00
Guillaume J. Charmes
33a5fe3bd4 Make sure the process start in his own session and grabs the terminal 2013-04-05 17:40:55 -07:00
Guillaume J. Charmes
847a8f45a4 Merge the 3 ptys in 1 2013-04-05 17:40:55 -07:00
Solomon Hykes
8cf30395a1 Changed default bridge interface do 'docker0' 2013-04-05 14:16:19 -07:00
Solomon Hykes
22adb52c0a The flag to use a pre-existing bridge interface is '-b'. Added explanation 2013-04-05 14:16:04 -07:00
Solomon Hykes
793c1ad990 Merge remote-tracking branch 'origin/219-default-bridge-2' 2013-04-05 14:02:16 -07:00
Solomon Hykes
febaeebfb8 Add tests of tcp port allocator 2013-04-05 13:03:24 -07:00
Solomon Hykes
d32f184696 Fix a race condition when running the port allocator 2013-04-05 13:03:04 -07:00
Guillaume J. Charmes
20085794f0 Increase the timeout in TestStart() to make sure the container has the time to die within the function 2013-04-05 02:01:38 -07:00
Solomon Hykes
a4fc52305a Bumping version to 0.1.3 2013-04-04 23:05:03 -07:00
Solomon Hykes
2aad4a3478 Choose which TCP frontend port to allocate with '-p :PORT' 2013-04-04 22:58:01 -07:00
Solomon Hykes
a5fb1d6c01 Refactored PortAllocator to allow for same-frontend constraint 2013-04-04 22:56:12 -07:00
Guillaume J. Charmes
b76b329ef0 Prevent destroy() to stop twice container in TestRestore() 2013-04-04 20:40:42 -07:00
Guillaume J. Charmes
bae6f95830 Increase the timeout of TestRestore() to avoid unwanted timeout error 2013-04-04 20:32:44 -07:00
Guillaume J. Charmes
cda9cf1539 Avoid unwanted warnings from destroy() in TestStart() 2013-04-04 20:30:24 -07:00
Solomon Hykes
f344212b93 Renamed PortAllocator.populate() to run() 2013-04-04 19:49:32 -07:00
Solomon Hykes
0424998f38 Print a less confusing error message when lxcbr0 doesn't exist 2013-04-04 19:14:10 -07:00
Solomon Hykes
8bfbdd7afa Add versioning to docker image format. IMPORTANT: the format versioning is pegged to docker's versioning, so changes to the format MUST trigger an increment in version number. 2013-04-04 18:38:43 -07:00
Solomon Hykes
3de51b7bfe Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-04 17:00:59 -07:00
Solomon Hykes
a58cd8c616 Merge pull request #322 from sa2ajj/port-map-nitpick
change option description to reflect the semantics
2013-04-04 16:39:54 -07:00
Solomon Hykes
586a79cca0 Merge remote-tracking branch 'dominikh/minor-code-touchups' 2013-04-04 16:20:37 -07:00
Solomon Hykes
349edf1bea Merge pull request #331 from lynaghk/master
Fix broken link on documentation website between examples.
2013-04-04 16:18:27 -07:00
Solomon Hykes
677908910c Merge pull request #320 from sa2ajj/cli-docs
move each command description into a separate document
2013-04-04 16:17:53 -07:00
Solomon Hykes
6b5fe8c2ec Merge remote-tracking branch 'origin/257-container_real_running_state-fix' 2013-04-04 15:34:18 -07:00
Solomon Hykes
26088a72b3 Merge remote-tracking branch 'dominikh/improve-attachopts' 2013-04-04 15:18:41 -07:00
Solomon Hykes
ebc837957f Continue cleaning up iptables rules from previous version, to avoid crashing after an upgrade 2013-04-04 15:16:42 -07:00
Solomon Hykes
c4d3da5871 Merge remote-tracking branch 'unclejack/137-fix-nat' 2013-04-04 15:06:20 -07:00
unclejack
32f5811476 stop looping remote:port from host to containers 2013-04-04 23:07:10 +03:00
Solomon Hykes
a7f191d51d Merge remote-tracking branch 'origin/328-i_o_error_uncloced_connection-fix' 2013-04-04 11:03:39 -07:00
Guillaume J. Charmes
1b370f9d8d Move the default bridge name to a constant 2013-04-04 05:33:28 -07:00
Kevin J. Lynagh
92186d7cf7 Fix broken link in doc site.
Broken link was from python_web_app to nonexistent "base commands page"; updated to point to next item in examples menu, running_ssh_service screencast.
2013-04-03 22:23:17 -07:00
Solomon Hykes
5d3c0767da Simplified Graph.Delete() - no more garbage collecting, just atomic deregister then os.RemoveAll 2013-04-03 22:14:28 -07:00
Guillaume J. Charmes
aa4bf4284b If bridge does not exists, try to create it 2013-04-03 16:17:03 -07:00
Guillaume J. Charmes
d9a9bfc9c7 Make LXC aware of custom bridge 2013-04-03 16:15:44 -07:00
Guillaume J. Charmes
90a6e310fe Add an helper function to check if two network overlaps. Also add unit tests for this function 2013-04-03 16:15:43 -07:00
Guillaume J. Charmes
f39af7e05d Put the bridge interface name in the command line 2013-04-03 16:15:43 -07:00
Solomon Hykes
dce5a06aba Bumped version to 0.1.2 2013-04-03 15:35:32 -07:00
unclejack
3b65be9127 Fix NAT problem with ports looping back to containers 2013-04-04 01:32:46 +03:00
shin-
ad0183e419 Check WaitTimeout return in test, replaced lock initialization in runtime.Register() with call to initLock() 2013-04-03 10:48:02 -07:00
Dominik Honnef
4f36039e7b clean up AttachOpts type
Primarily, there is no reason to have a pointer to a map. Furthermore,
make() can be used on AttachOpts directly.
2013-04-03 16:06:35 +02:00
Mikhail Sobolev
b74d1c9247 change option description to reflect the semantics
At least, for me, 'map' means that there are two values and one is "mapped" to
another.

In this case, just one value is provided (container's port), the other value is
automatically obtained (host's port) and the actual mapping can be seen using
``docker port`` command.
2013-04-03 16:37:56 +03:00
Mikhail Sobolev
cf8b8c1969 move each command description into a separate document 2013-04-03 15:55:18 +03:00
shin-
d1767bbf67 Moved resetLock() to the Load() method ; changed resetLock() to initLock() and changed behavior to not modify the lock if it was already set (not nil) 2013-04-03 05:39:39 -07:00
shin-
7b74b9cab5 Integrated @creack's feedback on TestRestore 2013-04-03 05:37:45 -07:00
Dominik Honnef
14d3880daf remove superfluous panic 2013-04-03 11:19:48 +02:00
Dominik Honnef
22f1cc955d replace unreachable returns with panics
Not only is this a more common idiom, it'll make finding bugs easier,
and it'll make porting to Go 1.1 easier.

Go 1.1 will not require the final return or panic because it has a
notion of terminating statements.
2013-04-03 11:18:23 +02:00
Dominik Honnef
cab31fd512 use wg.Done() isntead of wg.Add(-1) 2013-04-03 11:11:34 +02:00
Dominik Honnef
1fc55c2bb9 kill the right containers in runtime_test 2013-04-03 11:11:06 +02:00
Dominik Honnef
5ecd940a59 remove dead code in CmdPush 2013-04-03 11:08:32 +02:00
Dominik Honnef
3b8c2417fb use fmt.Fprintf instead of fmt.Fprint
fmt.Fprint does not allow format strings
2013-04-03 11:04:33 +02:00
Solomon Hykes
15c3096e89 Merged attachStdin 2013-04-02 20:46:32 -07:00
Solomon Hykes
22d1622926 Merge remote-tracking branch 'robryk/writebroadcaster-stuff' 2013-04-02 20:35:13 -07:00
Solomon Hykes
35c68944c7 Merged shawnsi/git-version 2013-04-02 20:26:22 -07:00
Solomon Hykes
b1fa26bb76 TestRunHostname checks that 'docker run -h' correctly sets a custom hostname 2013-04-02 19:00:05 -07:00
Solomon Hykes
d6fb2a0836 Merge remote-tracking branch 'sa2ajj/hostname-parameter' 2013-04-02 18:41:14 -07:00
Solomon Hykes
65aa3dda85 Merged dhrp/docs 2013-04-02 18:39:39 -07:00
Solomon Hykes
a05af3ebf3 Fix a bug which caused 'docker push' to fail with 411-lenght-required in Go 1.0 2013-04-02 18:37:29 -07:00
Solomon Hykes
0e1781af26 Merge remote-tracking branch 'unclejack/194-high-image-compression' 2013-04-02 18:10:07 -07:00
Solomon Hykes
14d9f51bbe Merge branch 'master' into attach-stdin 2013-04-02 18:07:45 -07:00
Solomon Hykes
c04af2a330 docker run [-a [stdin|stdout|stderr] [...]]: choose which streams to attach to when running a command. Fixes #234. 2013-04-02 18:07:16 -07:00
Solomon Hykes
c77063afcd Add test for attaching only stdin at run with 'docker run -i -a=stdin' 2013-04-02 18:05:19 -07:00
Guillaume J. Charmes
a19a9e3ca8 Discarding errors in CmdRun 2013-04-02 12:21:35 -07:00
Guillaume J. Charmes
ad2bbe23be Close the broadcaster once they are not needed anymore 2013-04-02 12:19:01 -07:00
Guillaume J. Charmes
6882c78ce4 Add a stdincloser to container.Attach in order to close the client connection when needed 2013-04-02 12:18:20 -07:00
Solomon Hykes
2db358146f 'docker run' in attached mode no longer waits for the process to exit. Take this into account in the tests. 2013-04-02 11:07:49 -07:00
Solomon Hykes
1cc1cb099e When simulating disconnects in the tests, make sure that the command returns - but don't check for a specific return value 2013-04-02 11:06:42 -07:00
Solomon Hykes
aea2675f7b Activate Config.StdinOnce at argument parsing 2013-04-02 11:02:19 -07:00
Solomon Hykes
8f9e454241 [unit tests] Cleanly kill all containers before nuking a temporary runtime 2013-04-02 11:00:14 -07:00
Solomon Hykes
7666307931 Use an environment variable to activate debug mode, instead of a package-specific flag 2013-04-02 10:58:16 -07:00
shin-
791ca6fde4 Better crash simulation in TestRestore ; force state lock creation when loading a container from disk 2013-04-02 10:06:49 -07:00
Guillaume J. Charmes
43484e8b50 Add a TestRunExit, make sure cmdRun returns after process dies 2013-04-02 09:22:30 -07:00
Shawn Siefkas
5471f5b2ee Implementing dirty git checkout indicator 2013-04-02 09:58:19 -05:00
shin-
02c211a0dc variable names 2013-04-02 07:13:42 -07:00
shin-
c780ff5ae7 More thorough test case, use container.Stop() instead of lxc-kill,
use setStopped() during the restore step
2013-04-02 07:01:43 -07:00
shin-
8edf0ca7f3 Merge branch 'master' into 257-container_real_running_state-fix 2013-04-02 06:37:50 -07:00
Joffrey F
927308cfd9 Merge pull request #317 from dotcloud/307-loginfix
Fix for #307
2013-04-02 03:01:23 -07:00
shin-
8fed600077 Fix for #307 2013-04-02 03:00:21 -07:00
Robert Obryk
a83d87abd4 Renamed writeBroadcaster.Close() to CloseWriters(). 2013-04-02 10:45:17 +02:00
Solomon Hykes
c808940c04 Refactored CmdRun and CmdAttach to use Container.Attach 2013-04-01 23:52:20 -07:00
Thatcher Peskens
81874ad442 Fixed a lot of language and small things. 2013-04-01 19:11:09 -07:00
Solomon Hykes
3478d6f706 Merge pull request #288 from titanous/expand-contributing
Expand the contributing guidelines
2013-04-01 18:45:18 -07:00
Solomon Hykes
13b6309138 Merge pull request #312 from sa2ajj/devenv-doc-fix
fix code block formatting
2013-04-01 18:40:29 -07:00
Mikhail Sobolev
90db9e7517 fix code block formatting 2013-04-02 04:35:54 +03:00
Thatcher Peskens
f15889461d Merge remote-tracking branch 'dotcloud/master' into dhrp/docs 2013-04-01 18:11:46 -07:00
Guillaume J. Charmes
dea4194f8b Merge pull request #286 from titanous/285-close-bodies
Close HTTP response bodies
2013-04-01 17:59:22 -07:00
Solomon Hykes
e331f1ee0e Merge pull request #305 from fsouza/master
Makefile: simplify "fmt" target
2013-04-01 16:28:29 -07:00
unclejack
0ddc6867fb use xz compression when pushing images to the registry
This makes the xz compression the default.
2013-04-02 02:19:34 +03:00
unclejack
3c5d2e4661 add support for xz compression
This adds xz as a compression option.
xz is alread supported by bsdtar without the external xz program.
2013-04-02 02:16:28 +03:00
Solomon Hykes
ff5cb8e864 Images can be removed by short-hand ID. Solves #306. 2013-04-01 16:04:44 -07:00
Solomon Hykes
7ad2e022fb Add test to reproduce issue #306 2013-04-01 16:02:02 -07:00
Mikhail Sobolev
f65fc1e766 add host name parameter to "run" command
fixes #243
2013-04-02 01:26:17 +03:00
Mikhail Sobolev
dcc9dfb27d make complex options to stand out 2013-04-02 01:26:17 +03:00
Francisco Souza
650dff73bd makefile: simplify "fmt" target, and include -s flag 2013-04-01 18:50:25 -03:00
Solomon Hykes
6d00145076 Merge pull request #304 from paulhammond/mkimage-busybox-fixes
Fix mkimage-busybox
2013-04-01 14:38:00 -07:00
Paul Hammond
cc2558bf10 Fix mkimage-busybox 2013-04-01 14:34:12 -07:00
Shawn Siefkas
e566b89a5f Shortening the git commit used in the version command 2013-04-01 16:31:33 -05:00
Solomon Hykes
47c4c2abd4 Merge remote-tracking branch 'origin/progress_bar_push_pull' 2013-04-01 13:49:07 -07:00
Solomon Hykes
fa5bb5acf1 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-04-01 13:44:19 -07:00
Solomon Hykes
50500cfcb6 Merge pull request #300 from cespare/make-fmt
Add a 'fmt' target to the Makefile.
2013-04-01 13:41:53 -07:00
Guillaume J. Charmes
9e81ab65cb Merge pull request #301 from dotcloud/container_test_improvment-1
Avoid destroy() timeout by closing stdin in TestStart()
2013-04-01 13:36:02 -07:00
Guillaume J. Charmes
ff26493fd5 Merge pull request #298 from cespare/cleanup-1
Some style, text, and comment cleanup.
2013-04-01 13:26:40 -07:00
Caleb Spare
9b13d21fc9 Add a 'fmt' target to the Makefile.
A convenience for gofmting all the code, including subpackages.
2013-04-01 13:05:00 -07:00
Caleb Spare
887f509d1d Don't use an interface{} where a string will do. 2013-04-01 12:56:59 -07:00
Caleb Spare
13d2b08638 A few spelling/grammar corrections. 2013-04-01 12:56:50 -07:00
Caleb Spare
c298a91f95 Use a *println or *print function instead of *printf where appropriate. 2013-04-01 12:17:00 -07:00
Shawn Siefkas
37a78902db Adding git commit to the version output
The Makefile must be used in order to inject the git commit
via -ldflags.
2013-04-01 13:52:45 -05:00
Caleb Spare
15b3088157 Don't convert []byte to string unnecessarily. 2013-04-01 11:15:40 -07:00
Caleb Spare
7830cf9166 Don't use a strings.Reader where a bytes.Reader will do.
There are several places where a []byte is converted to a string
and then fed into strings.NewReader().
2013-04-01 11:15:10 -07:00
Jonathan Rudenberg
321d94b17e Expand the contributing guidelines 2013-04-01 12:35:04 -04:00
Jonathan Rudenberg
6b59cc8a10 Close HTTP response bodies
Fixes #285.
2013-04-01 09:51:56 -04:00
Guillaume J. Charmes
91b1f9eee9 Avoid destroy() timeout by closing stdin in TestStart() 2013-03-31 22:42:10 -07:00
Solomon Hykes
c9a13147fe Merge pull request #238 from johncosta/42-contribution-guidelines
Contribution guidelines
2013-03-31 22:14:18 -07:00
Solomon Hykes
1632566ecb Show shorthand image IDs for convenience. Shorthand IDs (or any non-conflicting prefix) can be used to lookup images 2013-03-31 22:11:55 -07:00
Solomon Hykes
a52a28b609 Temporarily disable a broken test (waiting for @creack to fix it), and silence a warning which pollutes unit tests but is complicated to fix 2013-03-31 22:05:14 -07:00
Solomon Hykes
54443c092c gofmt 2013-03-31 22:04:59 -07:00
Guillaume J. Charmes
ad1e8a9b0f Add unit test for CmdAttach 2013-03-31 21:48:18 -07:00
Solomon Hykes
29b7ecb017 Merge pull request #272 from dominikh/improve/lazy-ip-allocator
Make IP allocator lazy
2013-03-31 21:04:35 -07:00
Dominik Honnef
6f9a67a7c7 Make IP allocator lazy
Instead of allocating all possible IPs in advance, generate them as
needed.

A loop will cycle through all possible IPs in sequential order,
allocating them as needed and marking them as in use. Once the loop
exhausts all IPs, it will wrap back to the beginning. IPs that are
already in use will be skipped. When an IP is released, it will be
cleared and be available for allocation again.

Two decisions went into this design:

1) Minimize memory footprint by only allocating IPs that are actually
in use

2) Minimize reuse of released IP addresses to avoid sending traffic to
the wrong containers

As a side effect, the functions for IP/Mask<->int conversion have been
rewritten to never be able to fail in order to reduce the amount of
error returns.

Fixes gh-231
2013-04-01 06:02:44 +02:00
Guillaume J. Charmes
cfeed391d7 Change the commands unit tests in order to reflect the proper behaviour of CmdRun 2013-03-31 20:52:35 -07:00
Guillaume J. Charmes
8c36e6920a Working in progress: add unit tests for the running state check 2013-03-31 20:14:54 -07:00
Guillaume J. Charmes
3dcaf20d6b Check if the containers are really running when starting docker 2013-03-31 17:40:39 -07:00
Guillaume J. Charmes
d949e2804a Add a check to avoid double start (resulting in dockerd to panic) and unit test for it 2013-03-31 14:15:10 -07:00
Guillaume J. Charmes
1fc9405537 Add progress bar on docker push 2013-03-31 13:53:47 -07:00
Guillaume J. Charmes
b64dfdd8cd Add a progress bar to docker pull 2013-03-31 13:04:41 -07:00
Solomon Hykes
a6779bcae2 Revert regression introduced in 81eac415ad, which caused 'docker run -i' to never close stdin 2013-03-31 02:44:56 -07:00
Solomon Hykes
8293a0d533 Bumped version to 0.1.1 2013-03-31 02:18:04 -07:00
Solomon Hykes
0b9a3c86a2 Show shorthand container IDs for convenience. Shorthand IDs (or any non-conflicting prefix) can be used to lookup containers 2013-03-31 02:02:01 -07:00
Solomon Hykes
5a2a044e24 Merge remote-tracking branch 'origin/125-reattach_attached_run_command-fix' 2013-03-31 00:20:31 -07:00
Guillaume J. Charmes
99f9b69716 Add debug infos in CmdInfo to know the amount of fds and goroutines in use 2013-03-30 10:33:10 -07:00
Guillaume J. Charmes
b336d928fe Make sure to close all pipes when detaching client (#228) 2013-03-30 09:47:09 -07:00
Guillaume J. Charmes
4760749402 Close the containers stdin when the process dies 2013-03-30 09:08:53 -07:00
Guillaume J. Charmes
7efde5eb83 Fix a scope issue preventing the close of slave stdin pty (#228) 2013-03-30 09:07:54 -07:00
Guillaume J. Charmes
5252ab697c Store the master ptys in order to close them when the process dies (#228) 2013-03-30 09:05:53 -07:00
Guillaume J. Charmes
41555f67e0 Merge pull request #269 from cespare/gofmt-1
Gofmt.
2013-03-30 12:46:47 -07:00
Robert Obryk
75ba07cb3a Swapped a map for a list in writeBroadcaster. 2013-03-30 16:04:19 +01:00
Robert Obryk
0bdfcfaa33 Make writeBroadcaster safe for concurrent use. 2013-03-30 16:02:22 +01:00
Guillaume J. Charmes
8cceafc834 Add unit test for the #125 scenario. Reattach after client disconnect on stdin allocated container 2013-03-30 06:55:47 -07:00
Caleb Spare
2d4c5ddbdd Gofmt. 2013-03-29 23:58:30 -07:00
Solomon Hykes
d1ed28cb94 Merge remote-tracking branch 'robryk/cmdstream-deadlock' 2013-03-29 23:43:02 -07:00
Solomon Hykes
7dbb1eacc1 Merge remote-tracking branch 'origin/improve_container_tests' 2013-03-29 23:41:09 -07:00
Thatcher Peskens
e9d17b1f91 Redundant message in basics. 2013-03-29 17:38:31 -07:00
Thatcher Peskens
6437648176 Added a lot of basic instructions on various topics 2013-03-29 17:30:10 -07:00
Daniel Mizyrycki
e99541e637 packaging; issue #30: Original files to make the Ubuntu PPA on launch date 2013-03-29 14:57:31 -07:00
Robert Obryk
68278b66c5 Added a timeout to TestCmdStreamLargeStderr. 2013-03-29 22:36:36 +01:00
Solomon Hykes
f483b214bb Merge remote-tracking branch 'robryk/bufreader-race' 2013-03-29 13:50:33 -07:00
Solomon Hykes
f5b458b1dc Merge pull request #250 from metachord/master
Remove unnecessary path parts
2013-03-29 13:42:23 -07:00
Solomon Hykes
f7b4f0c193 FIXME: implement a timeout in TestCmdStreamLArgStderr to avoid blocking the whole test suite when it fails 2013-03-29 13:37:52 -07:00
Solomon Hykes
6ede6bc8f2 Comment CmdStream a little bit to facilitate future fixes and contributions 2013-03-29 13:26:02 -07:00
Solomon Hykes
fdae64d8d7 Merge remote-tracking branch 'robryk/cmdstream-deadlock' 2013-03-29 13:20:17 -07:00
Solomon Hykes
f85e6548c7 Comment to explain CmdStream 2013-03-29 13:18:59 -07:00
Solomon Hykes
c937e237ad Merged Ctrl-C interception by @creack 2013-03-29 13:12:04 -07:00
Guillaume J. Charmes
0ebdca5e61 Add unit test for multiple attach / restart 2013-03-29 10:56:49 -07:00
Guillaume J. Charmes
81eac415ad Do not close the stdin of the process when the client deattaches himslef 2013-03-29 09:42:42 -07:00
Guillaume J. Charmes
0b2eee8b33 Fix #108, reattach now works properly 2013-03-29 09:31:47 -07:00
Solomon Hykes
d0d5d5ff09 Merge pull request #265 from dotcloud/formating_debug_harmonize
Formating debug harmonize
2013-03-29 21:30:43 -07:00
Solomon Hykes
57dfca052b Merge pull request #266 from dotcloud/do_not_log_stopped_container
Do not log non-running containers
2013-03-29 21:29:19 -07:00
Solomon Hykes
99b36c2c32 Add comments in graph.go 2013-03-29 21:13:59 -07:00
Solomon Hykes
b013d93786 Merge remote-tracking branch 'origin/264-remove_cmdAttach_option' 2013-03-29 20:30:43 -07:00
Solomon Hykes
b1fa21aa0e Merge remote-tracking branch 'lopter/master' 2013-03-29 20:17:33 -07:00
Louis Opter
9740102990 Fix output in the login command
It was broken because the terminal is in raw mode.

This changeset adds code in the login commmand to do a little bit of
interpretation on the user input (something usually done by the terminal
emulator itself).
2013-03-29 11:39:41 -07:00
Guillaume J. Charmes
0f7a4534c1 Do not log non-running containers 2013-03-29 08:46:06 -07:00
Guillaume J. Charmes
7a565a0479 Remove unused variable from container struct 2013-03-29 08:41:48 -07:00
Guillaume J. Charmes
69c2250ec2 Add some error checking in container monitor 2013-03-29 08:29:59 -07:00
Guillaume J. Charmes
d17f78c373 Harmonize the error management. Use fmt.Errorf instead of errors.New 2013-03-29 08:19:42 -07:00
Guillaume J. Charmes
ccac5b1382 Add debug infos 2013-03-29 08:18:43 -07:00
Guillaume J. Charmes
9442d6b349 Remove the options of CmdAttach 2013-03-29 07:49:26 -07:00
Guillaume J. Charmes
232dbb1864 Improve the containers unit tests (add error checking) 2013-03-29 07:44:58 -07:00
Robert Obryk
58befe3081 Fix a deadlock in CmdStream.
As per FIXME, CmdStream could have deadlocked if a command printed
enough on stderr. This commit fixes that, but still keeps all of
the stderr output in memory.
2013-03-29 12:55:48 +01:00
John Costa
bd3c6793a1 remove dulicated text and correct contributing link 2013-03-29 07:06:58 -04:00
Robert Obryk
d52451bcf8 Fix a race condition in bufReader.
The race condition cen be detected by running existing bufReader tests
with Go's race detector.
2013-03-29 11:00:50 +01:00
Maxim Treskin
6d72758f12 Remove unnecessary part of paths to lxc executables 2013-03-29 12:07:25 +07:00
Solomon Hykes
1d6929c8bc Fixed leftover from docs merge. Thanks @cespare for spotting! 2013-03-28 19:18:03 -07:00
Solomon Hykes
48a208baf1 Merging dhrp/docs 2013-03-28 19:12:58 -07:00
Thatcher Peskens
61cf09b2e7 Fixed some links in gettingstarted 2013-03-28 19:03:06 -07:00
Solomon Hykes
b51fe837a4 Merge pull request #241 from titanous/cleanup-deps
Remove unneeded sqlite deps from puppet and debian control
2013-03-28 18:45:44 -07:00
Solomon Hykes
4e11e42546 Merge pull request #244 from dotcloud/docs-julien
Docs: Changed the url of the LEGO img to point to the one with copyright
2013-03-28 18:45:20 -07:00
Solomon Hykes
ba33d67a1a Test that iptables() looks for iptables in the PATH 2013-03-28 18:44:47 -07:00
Solomon Hykes
70853785b6 Merge remote-tracking branch 'shawnsi/iptables-wrapper' 2013-03-28 18:40:02 -07:00
Solomon Hykes
12a65dc4a8 Merge remote-tracking branch 'titanous/camelize' 2013-03-28 18:23:59 -07:00
Solomon Hykes
b67fe1ecb9 Merge pull request #246 from titanous/update-authors
Update AUTHORS and add .mailmap
2013-03-28 18:19:05 -07:00
Jonathan Rudenberg
6bcc55f7d0 Update AUTHORS and add .mailmap 2013-03-28 20:53:54 -04:00
Jonathan Rudenberg
a6da7f138c Camelize some snake_case variable names 2013-03-28 20:12:23 -04:00
Julien Barbier
d66de319bd Docs: Changed the url of the LEGO img to point to the one with copyright 2013-03-28 17:09:36 -07:00
John Costa
760736b3f3 add contributing guidlines md file 2013-03-28 20:04:21 -04:00
Solomon Hykes
0636c11f0b Merge remote-tracking branch 'origin/165-push_permission_check-fix' 2013-03-28 15:45:00 -07:00
Jonathan Rudenberg
5dc1e66366 Remove unneeded sqlite deps from puppet and debian control 2013-03-28 18:38:53 -04:00
John Costa
a5054184a1 move documentation changes to reStructuredText docs under website. https://github.com/dotcloud/docker/issues/42 2013-03-28 16:32:31 -04:00
Thatcher Peskens
09910785c8 Merge remote-tracking branch 'dotcloud/master' into dhrp/docs
Conflicts:
	docs/sources/examples/python_web_app.rst
2013-03-28 12:48:32 -07:00
Shawn Siefkas
523803d633 Handling iptables() errors more usefully during portmapper setup 2013-03-28 14:44:54 -05:00
Thatcher Peskens
4bd21e0d7f Merge remote-tracking branch 'dotcloud/master' into dhrp/docs 2013-03-28 12:36:14 -07:00
Shawn Siefkas
c66d2b6a53 Return error when iptables is not found 2013-03-28 14:30:56 -05:00
Thatcher Peskens
da69df5f42 Added the lego illustration to the docs.docker.io 'homepage' 2013-03-28 12:27:37 -07:00
Thatcher Peskens
32b58159cd Changed the lego illustration on /README.md to the version which contains the copyright in the image itself. 2013-03-28 12:18:22 -07:00
Shawn Siefkas
dfc3904f77 Looking for iptables in PATH 2013-03-28 14:02:50 -05:00
Solomon Hykes
4825d3a537 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-03-28 11:54:33 -07:00
Ken Cochrane
5c639118d3 fixed some of the syntax in example
The example was broken, I updated it to work with latest version of code.
2013-03-28 15:51:10 -03:00
Thatcher Peskens
9bc7e71f16 Removed $'s from examples to make them easier to copy paste 2013-03-28 11:50:00 -07:00
Solomon Hykes
19316955dd Merge remote-tracking branch 'origin/174-remove_image_twice-fix' 2013-03-28 11:48:41 -07:00
Thatcher Peskens
172f746e4d Fixed links on gettingstarted to point to the right places in docs 2013-03-28 11:44:33 -07:00
Solomon Hykes
47e5d2f5e1 Merge remote-tracking branch 'origin/docs' 2013-03-28 11:12:00 -07:00
Thatcher Peskens
70594bdd16 Merge remote-tracking branch 'dotcloud/master' into local/dotcloud/docs 2013-03-28 10:58:01 -07:00
Ken Cochrane
09e69e45a6 Merge pull request #225 from dhrp/readthedocs
#225 Update the docs to work with http://docs.docker.io
2013-03-28 06:58:21 -07:00
Ken Cochrane
9528b8685f Merge pull request #229 from mynamewastaken/master
Fixed typo in description
2013-03-28 06:55:40 -07:00
mynamewastaken
b3cbe87b62 Update README.md
Fixed typo
2013-03-28 02:55:28 -05:00
Guillaume J. Charmes
6a236184af Change hardcoded "0" onto os.Stdin.Fd() 2013-03-27 23:56:36 -07:00
Guillaume J. Charmes
108acc0511 #214 Better signal handling 2013-03-27 23:54:53 -07:00
Charles Hooper
e37ce11cfa Merge pull request #227 from chooper/issue226_vagrant
Remove /usr/local/bin/docker from Vagrant VirtualMachine image during provisioning
2013-03-27 22:56:37 -07:00
Charles Hooper
fa89076673 Remove /usr/local/bin/docker 2013-03-28 05:28:11 +00:00
Charles Hooper
5aba56e0e0 Merge remote-tracking branch 'upstream/master' 2013-03-28 02:08:04 +00:00
Charles Hooper
daa7e4a203 Merge pull request #184 from titanous/simplify-vagrant
vagrant: Simplify provisioning to build from repo
2013-03-27 19:07:20 -07:00
Jonathan Rudenberg
a3ab89df2b vagrant: Simplify provisioning to build from repo
This sets up an idiomatic Go workspace in /opt/go with the source
shared from the host directory in
/opt/go/src/github.com/dotcloud/docker and docker installed into
/opt/go
2013-03-27 21:55:25 -04:00
Thatcher Peskens
90fb5dc962 Made all paths "pretty url's" including gettingstarted. 2013-03-27 17:01:50 -07:00
Thatcher Peskens
3b71336edc Made changes to incorporate extermal docs.docker.io. Also took out /documentation/ dir so sources are easier accessible and the folder is not redundant on docs.docker.io/documentation/ 2013-03-27 16:43:13 -07:00
Guillaume J. Charmes
baea0a98f8 Add unit test for #174 Delete image already deleted then repulled 2013-03-27 12:09:58 -07:00
Solomon Hykes
d8dc6d4583 Merged branch sa2ajj/top-level-makefile 2013-03-27 11:50:01 -07:00
Charles Hooper
95d87f1ac0 Merge remote-tracking branch 'upstream/master' 2013-03-27 14:50:42 +00:00
Charles Hooper
7e9975d00a Merge pull request #205 from crazysim/docker-local-shared
Use the directory where the Vagrantfile is located for SyncFolders instead of a hard-coded "~/docker"
2013-03-27 07:34:58 -07:00
Ken Cochrane
212a044a55 changed docker import to docker pull
changed docker import to docker pull, still need to make sure that the image is in the registry.
2013-03-27 10:44:20 -03:00
Ken Cochrane
165a7f3670 change docker import to docker pull
change docker import to docker pull in the basecommands doc
2013-03-27 10:43:05 -03:00
Ken Cochrane
0d75c68e5e Merge pull request #209 from gottagetmac/patch-1
Fixed typo in command description for pull
2013-03-27 06:06:15 -07:00
Daniel Robinson
ff04ce3ddf Fixed typo in command description for pull 2013-03-27 10:02:11 -03:00
Nelson Chen
43213dfc4a use the directory where the vagrantfile is located for mounting 2013-03-26 23:14:50 -07:00
Solomon Hykes
4a086dfc08 Fixed broken examples in docs 2013-03-26 20:28:46 -07:00
Charles Hooper
6b54a439b2 Merge pull request #204 from dhrp/master
Added amazon install path to documentation.
2013-03-26 20:23:21 -07:00
Charles Hooper
00b81936aa Merge pull request #192 from chooper/vagrant11-providers
Fix AWS provisioning with Vagrant
2013-03-26 20:18:09 -07:00
Solomon Hykes
b2e16f941d Merge pull request #199 from dotcloud/smalldocs
Small update to docs
2013-03-26 20:12:03 -07:00
Solomon Hykes
72563925a1 Merge pull request #200 from dhrp/update-examples
Update examples
2013-03-26 20:11:07 -07:00
Solomon Hykes
f951f7876b Merge pull request #203 from hblanks/remove-run-dash-a
docs - remove references to run -a
2013-03-26 20:08:25 -07:00
Hunter Blanks
7e4ac6c689 docs - remove references to run -a 2013-03-26 19:31:50 -07:00
Charles Hooper
9e5a25c100 Merge remote-tracking branch 'upstream/master' 2013-03-27 02:19:52 +00:00
Charles Hooper
8461196a79 Stop using custom AMI and use standard Ubuntu AMI 2013-03-27 01:41:47 +00:00
Charles Hooper
5bec4b8f04 Fix Rackspace cloud user, remove dupe /home/vagrant definition 2013-03-27 01:41:06 +00:00
Thatcher Peskens
502f772839 not debian, but ubuntu is in base image 2013-03-26 18:28:46 -07:00
Thatcher Peskens
8cfaf658cc Updated hello world examples 2013-03-26 18:21:52 -07:00
Charles Hooper
2b7284db4f Remove duplicate user definition 2013-03-27 01:20:45 +00:00
Charles Hooper
2b090320be Merge remote-tracking branch 'upstream/master' into vagrant11-providers
Conflicts:
	puppet/modules/docker/manifests/init.pp
2013-03-27 01:09:22 +00:00
root
378dacdf1c added copyright for LEGO picture 2013-03-26 17:25:35 -07:00
Thatcher Peskens
8513c179f3 Added files REQUIRED to have succesfull gh-pages deploy (i.c.w. sphinx) 2013-03-26 17:25:26 -07:00
Solomon Hykes
a710475726 Merge pull request #135 from amesserl/raxcloud-support
Added support to use docker with Rackspace Cloud Servers
2013-03-26 16:55:01 -07:00
Solomon Hykes
a8ae0aafe3 Add unit test for container id format 2013-03-26 16:54:13 -07:00
Jonathan Rudenberg
9518503ebe Remove extraneous rand.Seed 2013-03-26 19:29:53 -04:00
Jonathan Rudenberg
141b5fc7d7 Simplify id generation
Instead of using a SHA-256 of a random number, hex encode 32 bytes
of random data from crypto/rand (sourced from /dev/urandom).
2013-03-26 19:29:44 -04:00
Thatcher Peskens
709849e717 Added Amazon AWS tutorial (can be activated after @sub_'s pull request is accepted. 2013-03-26 16:29:21 -07:00
Solomon Hykes
2ee3db6cd2 Merge pull request #193 from vivekagr/master
Fixed a misspelled command in the docs.
2013-03-26 15:39:48 -07:00
Solomon Hykes
84d1929973 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-03-26 15:36:07 -07:00
Charles Hooper
195208593d Merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	README.md
2013-03-26 22:30:49 +00:00
Solomon Hykes
846a9e8963 When doing a reverse-lookup of an image's tag, if the image has multiple tags, the first tag in alphabetical order will be used 2013-03-26 15:30:16 -07:00
Vivek Agarwal
5cec37de53 Fixed a misspelled command in the docs.
`vagrant up` command was misspelled as `vagant up`.
2013-03-27 03:54:26 +05:30
Thatcher Peskens
261003ceb0 Merge remote-tracking branch 'dotcloud/docs' 2013-03-26 14:52:00 -07:00
Guillaume J. Charmes
e260e80814 Merge pull request #190 from dotcloud/189-broken_env_tty_mode-fix
#189 Fix the env in TTY mode
2013-03-26 14:44:30 -07:00
Ken Cochrane
2d71e2a44c Merge pull request #186 from pbogdan/fix-docs-document-title
Improve document <title>'s for the docs.
2013-03-26 14:36:43 -07:00
Thatcher Peskens
84df72222d Typo in macosx tutorial 2013-03-26 14:31:45 -07:00
Piotr Bogdan
08f1e3af48 Improve document <title>'s for the docs. 2013-03-26 21:25:42 +00:00
Charles Hooper
afdf29e57f Fix issue where Vagrant AWS deploys outside of my dev account would fail 2013-03-26 21:21:54 +00:00
Daniel Mizyrycki
262be79041 Merge pull request #181 from dhrp/master
These are the necessary changes to tell github to not use jekyill and listen to http://docker.io
2013-03-26 13:20:51 -07:00
Solomon Hykes
8da1810975 Merge remote-tracking branch 'origin/175-auto_download_run-feature' 2013-03-26 13:20:32 -07:00
Solomon Hykes
9df7023497 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-03-26 13:15:21 -07:00
Solomon Hykes
54fa59c8ec Set the container's hostname to the truncated ID 2013-03-26 13:14:44 -07:00
Solomon Hykes
2664139da4 Example of sharing an image in the README 2013-03-26 13:07:06 -07:00
Solomon Hykes
6bf4a10ed4 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-03-26 12:57:42 -07:00
Solomon Hykes
7f79fabaee Added missing 'docker pull' to first example 2013-03-26 12:52:11 -07:00
Solomon Hykes
3813fa8a16 Rephrased answer to Q4 in the FAQ 2013-03-26 12:34:23 -07:00
Daniel Mizyrycki
75a116bdaa Add more links and a question to the faq 2013-03-26 12:14:58 -07:00
Thatcher Peskens
f87aa7e336 Added files REQUIRED to have succesfull gh-pages deploy (i.c.w. sphinx) 2013-03-26 12:00:46 -07:00
Solomon Hykes
1904003511 Emphasized 'not for production' warning 2013-03-26 11:58:42 -07:00
Solomon Hykes
84cca8afc8 Changed project description in home page 2013-03-26 11:46:51 -07:00
Solomon Hykes
1a96ce552f Merge remote-tracking branch 'dhrp/master' 2013-03-26 11:34:21 -07:00
Solomon Hykes
7db1890c99 New 'make github-deploy' rule to deploy the docs to github-pages 2013-03-26 11:27:36 -07:00
Charles Hooper
5cebc226cc Use new AMI that won't cause issues with cloud-init apply_creds 2013-03-26 17:40:56 +00:00
Thatcher Peskens
1c5162c5a9 Added two user quotes. Cleanup of images. 2013-03-26 10:03:10 -07:00
Solomon Hykes
53641e8b8d Merged documentation 2013-03-26 09:49:10 -07:00
Solomon Hykes
038fb523f1 Merge pull request #168 from johncosta/42-contribution-guidlines
incorporate feedback from https://github.com/dotcloud/docker/issues/42
2013-03-26 09:42:14 -07:00
Solomon Hykes
b70858ccae Merge pull request #169 from sa2ajj/no-executable-sources
remove executable bit from lxc_template.go
2013-03-26 09:41:37 -07:00
Thatcher Peskens
f7d69601c5 Added line "docker is not ready for production" to tutorials 2013-03-26 08:50:34 -07:00
shin-
2333be46aa Re-enabled help for run command and added client-side error messages when arguments are missing 2013-03-26 08:31:26 -07:00
Mikhail Sobolev
f961ec55e7 print the location of the built binary 2013-03-26 17:19:58 +02:00
Mikhail Sobolev
21f55419b7 allow for verbose output from go tools 2013-03-26 17:19:58 +02:00
Mikhail Sobolev
a26c58e27e slightly re-phrase the build from source in README 2013-03-26 17:19:58 +02:00
Mikhail Sobolev
5a0010abe9 do not print executed commands 2013-03-26 17:19:58 +02:00
Mikhail Sobolev
a57b37ed0e use .gopath/ instead of build/ 2013-03-26 17:19:57 +02:00
Mikhail Sobolev
6b4bc971fd add a test target 2013-03-26 17:19:57 +02:00
Mikhail Sobolev
7009d6c6dd introduce top-level Makefile to build the docker binary 2013-03-26 17:19:54 +02:00
Mikhail Sobolev
b2b6d519c5 remove executable bit from lxc_template.go 2013-03-26 16:36:49 +02:00
shin-
3cce89d8ed Fixed issue with misplaced cursor after output 2013-03-26 07:10:31 -07:00
Guillaume J. Charmes
cca59081de #189 Fix the env in TTY mode 2013-03-26 07:01:59 -07:00
John Costa
e53f45f621 incorporate feedback from https://github.com/dotcloud/docker/issues/42 2013-03-26 09:17:44 -04:00
Guillaume J. Charmes
004a5310d9 Try to fetch missing base only on "not found" error 2013-03-26 05:28:17 -07:00
Guillaume J. Charmes
6ccd473127 Improve the pre-push repository lookup for permisisons 2013-03-26 04:12:08 -07:00
Guillaume J. Charmes
161526d99d Add a lookup before pushing repository to check permissions 2013-03-26 04:12:08 -07:00
Guillaume J. Charmes
069918e1fd #174 Check if the image is already in the garbage before moving it. If it does, remove (really) the older one. 2013-03-26 03:33:47 -07:00
Guillaume J. Charmes
91d78a10c3 #175 Add autodownload on run command 2013-03-26 03:05:10 -07:00
Thatcher Peskens
6f80674d66 Fixed a little problem in the style 2013-03-25 21:16:33 -07:00
Thatcher Peskens
3150a789c1 Fixed a little problem in the style 2013-03-25 21:07:56 -07:00
Thatcher Peskens
f37a693825 Improved README 2013-03-25 20:48:04 -07:00
Guillaume J. Charmes
7e540a083f Merge pull request #164 from kencochrane/users
Fixed help commands that were printing double.
2013-03-25 20:18:30 -07:00
Solomon Hykes
522b8bf2c1 Merge branch 'origin/18-termcap_issues-fix' 2013-03-25 20:09:58 -07:00
Thatcher Peskens
243eea36ca Merge remote-tracking branch 'origin/master' 2013-03-25 19:53:14 -07:00
Thatcher Peskens
69b09ccfc8 Merge of docker-website into the docker documentation. 2013-03-25 19:52:52 -07:00
Guillaume J. Charmes
41a2954e4e MakeRaw on given fd instead of 0 2013-03-25 19:31:20 -07:00
Guillaume J. Charmes
c85db1003b Force xterm as TERM in tty mode 2013-03-25 19:20:18 -07:00
Solomon Hykes
7943a02cb6 Improved error checking of 'docker pull' by printing body of HTTP error 2013-03-25 18:50:02 -07:00
Solomon Hykes
f70bc2c98c Cleaned up error checking of 'docker pull', to be symmetrical to 'docker push' 2013-03-25 18:48:57 -07:00
dhrp
022a1f9957 Updated README.md to prepare for docs merge 2013-03-25 18:46:13 -07:00
Guillaume J. Charmes
211ed0a766 Merge branch '18-termcap_issues-fix' of github.com:dotcloud/docker into 18-termcap_issues-fix 2013-03-25 18:45:07 -07:00
Guillaume J. Charmes
50bee2f811 Fix termcaps on the linux client 2013-03-25 18:44:05 -07:00
Guillaume J. Charmes
922a8648fc Fix termcaps on the linux client 2013-03-25 18:43:25 -07:00
Ken Cochrane
c9d93cd333 fixed issue with rmi help showing help twice 2013-03-25 21:35:31 -04:00
Ken Cochrane
a9a439183d fixed an issue with the help history command, printed twice 2013-03-25 21:33:56 -04:00
Solomon Hykes
e4a69b1044 Cleaned up error checking of 'docker push' 2013-03-25 17:20:55 -07:00
Solomon Hykes
b31211cbe9 Cleaned up UI of 'docker push' 2013-03-25 17:20:26 -07:00
Solomon Hykes
d01b5894c4 Unit tests fetch their base image with 'docker pull docker-ut' 2013-03-25 17:18:56 -07:00
Guillaume J. Charmes
504663a6ee Skip missing images instead of failing the push 2013-03-25 15:29:42 -07:00
Solomon Hykes
bd63ae72e6 Merge branch 'master' of ssh://github.com/dotcloud/docker 2013-03-25 14:25:17 -07:00
Charles Hooper
4c19c9341c Merge remote-tracking branch 'upstream/master' 2013-03-25 19:41:24 +00:00
Sam Alba
222c04a7e7 Merge pull request #154 from dotcloud/153-commitnorepo
Clearer information when listing images
2013-03-25 12:04:57 -07:00
Charles Hooper
fcdfd696ec Merge remote-tracking branch 'upstream/master' 2013-03-25 18:24:45 +00:00
shin-
c8ca50b483 Fixed issue #158 (docker crashes when docker run is called with not enough arguments) 2013-03-25 07:17:11 -07:00
Guillaume J. Charmes
a61e68275a Merge branch 'master' of github.com:dotcloud/docker 2013-03-25 01:29:09 -07:00
Guillaume J. Charmes
6576b19a28 Improve the debug function 2013-03-25 01:29:01 -07:00
Guillaume J. Charmes
ceb66fd035 Merge pull request #152 from srid/patch-1
`docker import` doesn't download an image
2013-03-24 16:58:35 -07:00
Guillaume J. Charmes
22598ee572 Merge pull request #155 from sa2ajj/debian-control-fix
fix run-time dependency
2013-03-24 16:54:01 -07:00
Guillaume J. Charmes
52969416bc Merge pull request #147 from dotcloud/146_autologin-feature
#146 Auto login on push
2013-03-24 16:52:50 -07:00
Mikhail Sobolev
c61172f9c2 fix run-time dependency 2013-03-25 01:36:59 +02:00
shin-
0786d9ec22 Show <none> instead of an empty string in docker images listing for images with no repository or tag 2013-03-24 15:01:41 -07:00
shin-
938bf4c901 Reverted previous change 2013-03-24 14:53:00 -07:00
shin-
87d4e16568 Quick fix to avoid creating empty-string repositories when committing 2013-03-24 14:38:10 -07:00
Sridhar Ratnakumar
55c8908756 docker import doesn't download an image
```
$ docker import base
Downloading from http://base
Error: Get http://base: lookup base: no such host
```
only `docker pull` does:

```
$ docker pull base
Pulling base...
Pulling repo: https://registry.docker.io/v1/users/base
Pull completed
```
2013-03-24 14:13:08 -07:00
Guillaume J. Charmes
51455b1ee0 Merge pull request #138 from srid/handle-port-mapper-error
handle errors during the creation of port mapper
2013-03-24 10:27:03 -07:00
Ken Cochrane
906626b8f8 Merge pull request #143 from dotcloud/141-142_update_help-fix
141 142 update help fix
2013-03-24 07:07:24 -07:00
Charles Hooper
94b9ca988d Fix missing group "Vagrant" error 2013-03-24 10:49:16 +00:00
Charles Hooper
bea7894166 Merge remote-tracking branch 'amesserl/raxcloud-support'
Conflicts:
	Vagrantfile
2013-03-24 10:16:50 +00:00
Solomon Hykes
b32436cd2e Prevent container.Kill() from crashing if container.cmd is nil 2013-03-23 19:51:35 -07:00
Solomon Hykes
190e2fa50f Generate full-size SHA256 IDs for images and containers 2013-03-23 19:33:00 -07:00
Solomon Hykes
0d46ddf7b4 'docker commit -m': optional commit message 2013-03-23 19:16:42 -07:00
Solomon Hykes
f7eaaa3adb Clean up 'container' environment variable injected by lxc-start 2013-03-23 19:11:00 -07:00
Solomon Hykes
57e2126a02 Bumped version to 0.1.0 2013-03-23 17:48:18 -07:00
Solomon Hykes
5130d3d6ec Merge branch 'graph' 2013-03-23 17:47:33 -07:00
Solomon Hykes
587debf92e Merge branch 'graph' of http://github.com/dotcloud/docker into graph 2013-03-23 17:04:37 -07:00
Solomon Hykes
d301c7b98c 'docker images' doesn't show all anonymous images by default - only anonymous heads 2013-03-23 17:03:30 -07:00
Solomon Hykes
f43fbda2a4 No more dependency on sqlite 2013-03-23 16:17:01 -07:00
Guillaume J. Charmes
e09383bccf Remove json alteration 2013-03-23 14:54:18 -07:00
Solomon Hykes
301a8afff5 Properly cleanup iptables rules inserted in OUTPUT (introduced in 3c6b8bb888) 2013-03-22 22:31:20 -07:00
Sridhar Ratnakumar
371225520f handle errors during the creation of port mapper
example:

  2013/03/22 21:42:55 Unable to setup port networking: Failed to create DOCKER chain

  (which was possibly introduced by commit 3c6b8bb88)
2013-03-22 21:44:01 -07:00
Guillaume J. Charmes
eb95e49150 #146 Auto login on push 2013-03-22 19:04:12 -07:00
Guillaume J. Charmes
96010e3ca1 Allow anonymous pulls 2013-03-22 18:46:47 -07:00
Guillaume J. Charmes
e55b8b2fd9 Merge pull request #145 from dotcloud/144-login_daemon_mode-fix
Login now works with daemon mode
2013-03-23 20:30:19 -07:00
Guillaume J. Charmes
ffe5370e35 Login now works with daemon mode 2013-03-22 18:37:53 -07:00
Guillaume J. Charmes
df19863b23 #142 Change the help for push and pull in order for it to be more clear 2013-03-22 18:17:49 -07:00
Guillaume J. Charmes
cb3c4af404 #141 Update and order the help 2013-03-22 18:15:44 -07:00
Guillaume J. Charmes
bd2a55cd26 Merge branch 'no_root_repo_push' 2013-03-22 17:58:34 -07:00
Guillaume J. Charmes
b370acd679 Forbid users to push "root" repositories 2013-03-22 17:58:00 -07:00
Guillaume J. Charmes
5c04d3488a Implement the "library" repository endpoint on the registry 2013-03-22 17:43:11 -07:00
Solomon Hykes
690cae0ef4 Merge pull request #133 from shawnsi/master
Vagrant Provision Touch Up
2013-03-22 15:11:52 -07:00
Solomon Hykes
936bd87a52 Merge pull request #124 from donspaulding/master
Fix typos in the README
2013-03-22 15:10:13 -07:00
Guillaume J. Charmes
dc2d930520 Remove the json alterations when decoding 2013-03-22 14:27:10 -07:00
Guillaume J. Charmes
966cddf26b Add some verbosity to the push/pull 2013-03-22 13:21:44 -07:00
Guillaume J. Charmes
6e35f28352 Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 13:10:31 -07:00
Solomon Hykes
0146c80c40 An image embeds the configuration of its parent container ('ContainerConfig') 2013-03-23 14:48:16 -07:00
Solomon Hykes
b809dc4271 Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-23 14:18:41 -07:00
Solomon Hykes
f37c432bd5 Fixed 'docker inspect' to exit silently when an image doesn't exist 2013-03-23 14:18:35 -07:00
Solomon Hykes
d9471bee3d Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-23 12:39:36 -07:00
Solomon Hykes
6ce64e8458 Moved image name into config. runtime.Create() now receives a single Config parameter 2013-03-23 12:39:09 -07:00
Solomon Hykes
031f91df1a runtime.Create receives an image name + Config. The Config includes all required runtime information: command, environment, ports etc. 2013-03-23 12:16:58 -07:00
Guillaume J. Charmes
89763bc8af Remove the lookup before pushing 2013-03-22 13:10:17 -07:00
Guillaume J. Charmes
6e507b9460 Add a Debugf() helper and a -D (debug) flag to docker 2013-03-22 11:44:12 -07:00
Guillaume J. Charmes
c57727fd65 Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 11:18:33 -07:00
Guillaume J. Charmes
a2e5333a93 Make sure the remote repository exists prior to push 2013-03-22 10:42:13 -07:00
Guillaume J. Charmes
5e6355d182 Fix the lookup method 2013-03-22 10:22:22 -07:00
Joffrey F
e4886a9e33 Merge pull request #134 from shawnsi/98-natfix
Fixing Issue #98: Adding DOCKER to output chain during iptables setup
2013-03-22 09:35:07 -07:00
Antony Messerli
95ad9e4573 Adding support for the Rackspace Open Cloud 2013-03-22 11:30:54 -05:00
Shawn Siefkas
3c6b8bb888 Fixing Issue #98: Adding DOCKER to output chain during iptables setup 2013-03-22 11:28:15 -05:00
Shawn Siefkas
cff01ec5ec Redirecting docker daemon stdout/stderr to /var/log/dockerd 2013-03-22 10:30:47 -05:00
creack
0c4b639083 Update makefile gotest 2013-03-22 08:04:53 -07:00
creack
d1c8eabc63 Fix/Improve push/pull registry 2013-03-22 07:56:44 -07:00
creack
c000a5ed75 Remove the possibility to choose the remote name on push 2013-03-22 07:10:52 -07:00
Shawn Siefkas
9542876d2f Waiting to start docker until the fresh binaries have been copied in 2013-03-22 08:48:50 -05:00
creack
899613f788 Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 06:39:08 -07:00
Solomon Hykes
829eeb07f8 'docker run' with no argument no longer hardcodes a default image and command 2013-03-22 20:55:17 -07:00
Solomon Hykes
841c7ac0f9 Deprecated 'docker run -a'. Containers are run in the foreground by default. '-d' enables detached mode 2013-03-22 20:46:14 -07:00
Solomon Hykes
34fbaa5f6d 'docker run -e': set environment variables in a container 2013-03-22 20:36:34 -07:00
Solomon Hykes
9b5f0fac81 Fix 'docker import' to accept urls without explicit http:// scheme 2013-03-22 19:47:32 -07:00
creack
1ed78ee160 Improve (drastically) the push 2013-03-22 06:38:54 -07:00
creack
e726bdcce2 Fix the rootPath for auth 2013-03-22 05:52:13 -07:00
creack
ab3a57d01b Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 04:44:46 -07:00
Solomon Hykes
bc51d961cd Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-22 19:22:24 -07:00
Solomon Hykes
12049f956a 'docker {history,ps,images}': show human-friendly image names when applicable 2013-03-22 19:22:06 -07:00
Solomon Hykes
7952e6befe Merge branch 'master' into graph 2013-03-22 18:30:46 -07:00
Solomon Hykes
72e16f6d96 Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-22 18:27:32 -07:00
Solomon Hykes
bf7602bc09 'docker tag': assign a repository+tag to an image 2013-03-22 18:27:18 -07:00
Solomon Hykes
520af226c0 Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-22 17:52:27 -07:00
Solomon Hykes
542c66997f 'docker inspect' can lookup image by repository and tag 2013-03-22 17:52:19 -07:00
Solomon Hykes
f8ebeaae10 Removed debug command 'docker mount' 2013-03-22 17:44:12 -07:00
Solomon Hykes
56752158af Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-22 17:40:32 -07:00
Solomon Hykes
09b27f9e8d Fancier output for 'docker history' 2013-03-22 17:22:32 -07:00
creack
77549ad4f6 Improve the error management with the registry communication 2013-03-22 04:44:07 -07:00
creack
fc0eac37e4 Put back the "official" repo 2013-03-22 04:37:18 -07:00
creack
db8f2a1a9d Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 04:35:19 -07:00
creack
08cb430281 Move the debian makefile to avoid confusions 2013-03-22 04:34:46 -07:00
shin-
9fa3d891c6 Merge branch 'master' of github.com:dotcloud/docker 2013-03-22 04:25:37 -07:00
shin-
b00ff47963 Fixing newlines in attached mode 2013-03-22 04:24:03 -07:00
creack
e02f7912bc Enforce login for push/pull 2013-03-22 03:43:57 -07:00
creack
e4f9a0dca0 Update the help with push/pull 2013-03-22 03:24:37 -07:00
creack
3870ebee6d Add content type to Push 2013-03-22 03:22:36 -07:00
creack
062ebff098 Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 03:10:30 -07:00
creack
0eed4b4386 Add some verbosity to the push/pull features 2013-03-22 03:10:09 -07:00
creack
4307b7dd8e Add authentification to all registry call 2013-03-22 02:57:28 -07:00
creack
c72ff318d3 Integrate Auth in runtime and make the config file relative to runtime root 2013-03-22 02:19:39 -07:00
creack
5e561a9d52 Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-22 01:27:16 -07:00
Solomon Hykes
640026ec59 Looking up a tag by repository name will default to REPOSITORY:latest. The empty tag '' is no longer allowed. 2013-03-22 16:07:13 -07:00
creack
11c4294846 Handle push/pull of repositories 2013-03-22 01:25:27 -07:00
Solomon Hykes
1850e8d49c Merge pull request #128 from cespare/markdown-fixes2
Fix numbering in README markdown.
2013-03-21 22:46:22 -07:00
Solomon Hykes
afb4a36ffa Merge pull request #130 from dotcloud/113_vagrant-compat
113 vagrant compat
2013-03-21 22:44:38 -07:00
Daniel Mizyrycki
45df6f7801 vagrant; issue #113: normalize whitespaces 2013-03-21 22:26:18 -07:00
Daniel Mizyrycki
6295a02275 vagrant; issue #113: Make Vagrantfile backward compatible with versions < 1.1 2013-03-21 22:16:52 -07:00
dhrp
13e597a5ad create README.md at this place for preview. 2013-03-21 21:47:14 -07:00
Caleb Spare
d515e2b06c Fix numbering in README markdown. 2013-03-21 21:46:00 -07:00
Solomon Hykes
41c664cacf Merge pull request #126 from cespare/markdown-fixes
Markdown fixes in the readme.
2013-03-21 18:24:46 -07:00
Caleb Spare
7566006d0d Markdown fixes in the readme. 2013-03-21 18:20:54 -07:00
creack
d8fa52b7b5 Comply the tests with golang TIP 2013-03-21 10:31:02 -07:00
creack
f246cc9cdd Apply the new WalkHistory prototype to merge 2013-03-21 10:12:05 -07:00
creack
da266e6c7b Factorize the pull/push commands and create a registry.go 2013-03-21 10:10:14 -07:00
Solomon Hykes
f50dcbe404 Image.ParentCommand and Image.ParentConatiner should be stored 2013-03-21 22:45:22 -07:00
Solomon Hykes
cdd62522b6 Merge branch 'graph' of ssh://github.com/dotcloud/docker into graph 2013-03-21 22:21:00 -07:00
Solomon Hykes
1ad69ad415 'docker history': show the history of an image 2013-03-21 21:42:18 -07:00
Solomon Hykes
05ae69a6eb 'docker commit' records parent container id and command, in addition to parent image 2013-03-21 21:13:27 -07:00
Solomon Hykes
8396798eba 'docker commit' can optionally tag the new image into a repository 2013-03-21 20:07:37 -07:00
Solomon Hykes
49a78929c6 Repositories and tags can't have ':' in their name (to allow parsing the REPO:TAG notation) 2013-03-21 20:06:20 -07:00
Solomon Hykes
379d449c44 'docker run' can reference an image by REPOSITORY:TAG 2013-03-21 19:01:55 -07:00
Solomon Hykes
d0c776528b Fix a bug which caused repository metadata to be cleared at startup 2013-03-21 19:00:43 -07:00
Solomon Hykes
4af8b711c0 Fixed output quirks in 'docker images' 2013-03-21 18:59:12 -07:00
Solomon Hykes
ef711962d5 Folded graph/ back into main package 2013-03-21 17:47:23 -07:00
Solomon Hykes
44faa07b6c First integration of runtime with repositories & tags 2013-03-21 17:35:49 -07:00
Solomon Hykes
680f40c37e graph.RepoStore: first draft of a Repository/Tag on top of the graph 2013-03-21 12:18:47 -07:00
shin-
3aefed2dc2 When lxcbr0 has several associated IPs, default to first one found 2013-03-21 09:19:22 -07:00
Don Spaulding
8ff60ddef4 Typos in the README 2013-03-21 08:39:52 -05:00
creack
eef9659c95 merge graph in graph 2013-03-21 06:35:57 -07:00
creack
42cf74d56b POC: push/pull are (kinda) working 2013-03-21 06:33:29 -07:00
creack
04ba4348de Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-21 04:32:04 -07:00
creack
864a8d9aca Merge branch 'graph' of github.com:dotcloud/docker into graph 2013-03-21 03:54:24 -07:00
creack
edcfd687ef POC of push/pull for images, pull works, push do push but without the layer 2013-03-21 03:53:27 -07:00
creack
3e8d1dfb69 Enforce model for the json image format 2013-03-21 03:52:58 -07:00
Solomon Hykes
b6b5e5cec1 Merged master 2013-03-21 02:13:21 -07:00
Solomon Hykes
f783759928 Docker currently doesn't support 32-bit hosts. Let's make that clear by failing right away with an informative message 2013-03-21 02:04:10 -07:00
Solomon Hykes
c37d7aad36 Merge branch 'master' into graph 2013-03-21 01:43:32 -07:00
Solomon Hykes
d65983f386 No need for a Container.networkManager field: it can be accessed via Container.runtime 2013-03-21 01:43:03 -07:00
Solomon Hykes
1ed13f65fe Merge branch 'master' into graph 2013-03-21 01:38:44 -07:00
Solomon Hykes
377cebe36f Renamed docker*.go to runtime*.go 2013-03-21 01:24:54 -07:00
Solomon Hykes
2f781f2128 Removed 'sparse export' mode, it is deprecated by the new diff-based transfer protocol 2013-03-21 01:24:12 -07:00
Solomon Hykes
e627a0da1e Renamed 'docker tar' to 'docker export' for symmetry with 'docker import' 2013-03-21 01:23:00 -07:00
Solomon Hykes
623e91e2e3 Moved Go() to the main package... And got rid of the useless docker/future package 2013-03-21 01:13:55 -07:00
Solomon Hykes
deb603aaf4 Removed unused utility future.Pv() 2013-03-21 01:10:44 -07:00
Solomon Hykes
0208b6accd moved GenerateId() to the graph package 2013-03-21 01:07:07 -07:00
Solomon Hykes
d7c5d060c4 Moved Download() and progressReader{} to the main package 2013-03-21 00:54:54 -07:00
Solomon Hykes
299d0b2720 Moved HumanDuration() to the main package 2013-03-21 00:52:43 -07:00
Solomon Hykes
b8547f31e4 Renamed Docker{} to Runtime{} for clarity 2013-03-21 00:41:15 -07:00
Solomon Hykes
7c57a4cfc0 Simplified the core container API, ported it to the new graph. Some features are missing eg. image 'paths' and tags 2013-03-21 00:25:00 -07:00
Solomon Hykes
84e8c4aa1d Fixed a bug in graph.Graph.Get() 2013-03-21 00:21:32 -07:00
Solomon Hykes
89a140fb75 Removed redundant mount_test.go (graph_test.go already tests the mount ability) 2013-03-21 00:21:03 -07:00
Guillaume J. Charmes
3e9877a30f Merge pull request #122 from srid/patch-1
remove ! from command line
2013-03-20 23:26:50 -07:00
Sridhar Ratnakumar
3bb176d8ae remove ! from command line
bash does not like it

```
$ JOB=$(docker run base /bin/sh -c "while true; do echo Hello world!; sleep 1; done")
bash: !: event not found
$
```
2013-03-20 22:53:42 -07:00
Solomon Hykes
34023558f5 Pruned more semi-useless commands: 'docker cat', 'docker cp', 'docker ls', 'docker write'. Removed outdated commands from help message 2013-03-20 22:48:52 -07:00
Solomon Hykes
9d82bab041 Removed anal warning from 'go vet' 2013-03-20 22:42:50 -07:00
Solomon Hykes
3eff62394b Removed dependency on the fake package in graph unit tests 2013-03-20 22:42:08 -07:00
Solomon Hykes
4d9c324495 Removed extra import 2013-03-20 22:41:31 -07:00
Solomon Hykes
75c866d6a3 Unmount() and Mounted(): utility functions to unmount a mountpoint and check if it's mounted, respectively 2013-03-20 22:41:03 -07:00
Solomon Hykes
6f6eaca861 Removed mount code from container. It belongs in graph 2013-03-20 22:16:02 -07:00
Solomon Hykes
ea258c4492 docker/fs is deprecated by docker/graph 2013-03-20 22:15:09 -07:00
Solomon Hykes
240333277a Removed Image.Unmount(). It belongs in container code 2013-03-20 22:13:57 -07:00
Solomon Hykes
9e8278134d Image.Mount(): create rw and rootfs directory if they don't exist 2013-03-20 22:13:28 -07:00
Solomon Hykes
c8db980add Image.Changes(): list all changes between an image and a rw directory 2013-03-20 22:12:38 -07:00
Guillaume J. Charmes
3f63e3426e Merge pull request #121 from ezbercih/patch-1
Fix issue #120, initialize TCPAddr w/ field names
2013-03-20 20:25:16 -07:00
Solomon Hykes
31296cc3f7 Removed deprecated or useless commands (cp, layers, reset, mirror, debug, web) 2013-03-20 20:21:59 -07:00
Solomon Hykes
33d2905cde Merge pull request #115 from termie/readme_update
update the dependencies for the dev environment
2013-03-20 15:20:18 -07:00
termie
2048354c8b update the dev requirements in readme
a little pedantic, perhaps, but on a fresh precise image from vagrant I
still needed these two packages to run the commands following it
2013-03-20 20:17:46 +00:00
Solomon Hykes
98542d4497 Merge branch 'master' into graph 2013-03-20 09:41:37 -07:00
shin-
6d580247c2 Removed 'fake' package. 2013-03-20 07:49:38 -07:00
creack
ab99e9252d Complete pull request #121, init TCPAddr with named field 2013-03-20 06:02:25 -07:00
ezbercih
fac32cda5a Fix issue #120, initialize TCPAddr w/ field names
Current Go tip (+74e65f07a0c8) and likely Go 1.1 does not build docker since net.TCPAddr struct has an additional field now for IPv6:

type TCPAddr struct {
    IP   IP
    Port int
    Zone string // IPv6 scoped addressing zone
}

Initializing the struct with named fields resolves this problem.
2013-03-21 00:11:16 -03:00
Solomon Hykes
a3174fd874 Merge pull request #114 from jpetazzo/whiteboard20130319
Images & repositories, what they mean, and the protocol to push/pull them
2013-03-20 00:18:43 -07:00
Solomon Hykes
ddf4c79977 Merge pull request #112 from srid/devenv
instructions to compile docker
2013-03-20 00:08:54 -07:00
Jérôme Petazzoni
acd51ecea8 add pseudo-spec of images, repositories, push, and pull operations 2013-03-19 20:35:14 -07:00
Sridhar Ratnakumar
4389574aff instructions to compile docker 2013-03-19 20:17:32 -07:00
Solomon Hykes
ff2ae90764 Merge pull request #110 from synack/master
Add linux-image-extra instructions to README
2013-03-19 18:46:28 -07:00
Jeremy Grosser
2508b5cef9 Update README.md 2013-03-19 18:45:11 -07:00
Solomon Hykes
3c1db4ca43 Ported test for image deletion 2013-03-18 17:57:18 -07:00
Solomon Hykes
33f6a0aaf5 docker/graph: a store for filesystem images and the graph of their relationships 2013-03-18 00:15:35 -07:00
jpetazzo
71c997dc83 Add contrib/ directory, README, and script to create a basic busybox image 2013-03-14 03:13:00 +00:00
215 changed files with 23455 additions and 4142 deletions

11
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.vagrant
.vagrant*
bin
docker/docker
.*.swp
a.out
@@ -6,3 +7,11 @@ a.out
build_src
command-line-arguments.test
.flymake*
docker.test
auth/auth.test
.idea
.DS_Store
docs/_build
docs/_static
docs/_templates
.gopath/

19
.mailmap Normal file
View File

@@ -0,0 +1,19 @@
# Generate AUTHORS: git log --all --format='%aN <%aE>' | sort -uf | grep -v vagrant-ubuntu-12
<charles.hooper@dotcloud.com> <chooper@plumata.com>
<daniel.mizyrycki@dotcloud.com> <daniel@dotcloud.com>
<daniel.mizyrycki@dotcloud.com> <mzdaniel@glidelink.net>
Guillaume J. Charmes <guillaume.charmes@dotcloud.com> creack <charmes.guillaume@gmail.com>
<guillaume.charmes@dotcloud.com> <guillaume@dotcloud.com>
<kencochrane@gmail.com> <KenCochrane@gmail.com>
<sridharr@activestate.com> <github@srid.name>
Thatcher Peskens <thatcher@dotcloud.com> dhrp <thatcher@dotcloud.com>
Thatcher Peskens <thatcher@dotcloud.com> dhrp <thatcher@gmx.net>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com> jpetazzo <jerome.petazzoni@dotcloud.com>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com> <jp@enix.org>
Joffrey F <joffrey@dotcloud.com>
<joffrey@dotcloud.com> <f.joffrey@gmail.com>
Tim Terhorst <mynamewastaken+git@gmail.com>
Andy Smith <github@anarkystic.com>
<kalessin@kalessin.fr> <louis@dotcloud.com>
<victor.vieux@dotcloud.com> <victor@dotcloud.com>
<dominik@honnef.co> <dominikh@fork-bomb.org>

58
AUTHORS
View File

@@ -1,13 +1,45 @@
Solomon Hykes
Sam Alba
Jérôme Petazzoni
Andrea Luzzardi
Joffrey Fuhrer
Louis Opter
Niall O'Higgins
Brian McCallister
Jeff Lindsay
Ken Cochrane
Charles Hooper
Guillaume Charmes
Daniel Mizyrycki
Andrea Luzzardi <aluzzardi@gmail.com>
Andy Rothfusz <github@metaliveblog.com>
Andy Smith <github@anarkystic.com>
Antony Messerli <amesserl@rackspace.com>
Brian McCallister <brianm@skife.org>
Caleb Spare <cespare@gmail.com>
Charles Hooper <charles.hooper@dotcloud.com>
Daniel Mizyrycki <daniel.mizyrycki@dotcloud.com>
Daniel Robinson <gottagetmac@gmail.com>
Dominik Honnef <dominik@honnef.co>
Don Spaulding <donspauldingii@gmail.com>
ezbercih <cem.ezberci@gmail.com>
Flavio Castelli <fcastelli@suse.com>
Francisco Souza <f@souza.cc>
Frederick F. Kautz IV <fkautz@alumni.cmu.edu>
Guillaume J. Charmes <guillaume.charmes@dotcloud.com>
Hunter Blanks <hunter@twilio.com>
Jeff Lindsay <progrium@gmail.com>
Jeremy Grosser <jeremy@synack.me>
Joffrey F <joffrey@dotcloud.com>
John Costa <john.costa@gmail.com>
Jonathan Rudenberg <jonathan@titanous.com>
Julien Barbier <write0@gmail.com>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com>
Ken Cochrane <kencochrane@gmail.com>
Kevin J. Lynagh <kevin@keminglabs.com>
Louis Opter <kalessin@kalessin.fr>
Maxim Treskin <zerthurd@gmail.com>
Mikhail Sobolev <mss@mawhrin.net>
Nelson Chen <crazysim@gmail.com>
Niall O'Higgins <niallo@unworkable.org>
Paul Hammond <paul@paulhammond.org>
Piotr Bogdan <ppbogdan@gmail.com>
Robert Obryk <robryk@gmail.com>
Sam Alba <sam.alba@gmail.com>
Shawn Siefkas <shawn.siefkas@meredith.com>
Silas Sewell <silas@sewell.org>
Solomon Hykes <solomon@dotcloud.com>
Sridhar Ratnakumar <sridharr@activestate.com>
Thatcher Peskens <thatcher@dotcloud.com>
Tim Terhorst <mynamewastaken+git@gmail.com>
Troy Howard <thoward37@gmail.com>
unclejack <unclejacksons@gmail.com>
Victor Vieux <victor.vieux@dotcloud.com>
Vivek Agarwal <me@vivek.im>

86
CHANGELOG.md Normal file
View File

@@ -0,0 +1,86 @@
# Changelog
## 0.2.0 (2012-04-23)
- Runtime: ghost containers can be killed and waited for
* Documentation: update install intructions
- Packaging: fix Vagrantfile
- Development: automate releasing binaries and ubuntu packages
+ Add a changelog
- Various bugfixes
## 0.1.8 (2013-04-22)
- Dynamically detect cgroup capabilities
- Issue stability warning on kernels <3.8
- 'docker push' buffers on disk instead of memory
- Fix 'docker diff' for removed files
- Fix 'docker stop' for ghost containers
- Fix handling of pidfile
- Various bugfixes and stability improvements
## 0.1.7 (2013-04-18)
- Container ports are available on localhost
- 'docker ps' shows allocated TCP ports
- Contributors can run 'make hack' to start a continuous integration VM
- Streamline ubuntu packaging & uploading
- Various bugfixes and stability improvements
## 0.1.6 (2013-04-17)
- Record the author an image with 'docker commit -author'
## 0.1.5 (2013-04-17)
- Disable standalone mode
- Use a custom DNS resolver with 'docker -d -dns'
- Detect ghost containers
- Improve diagnosis of missing system capabilities
- Allow disabling memory limits at compile time
- Add debian packaging
- Documentation: installing on Arch Linux
- Documentation: running Redis on docker
- Fixed lxc 0.9 compatibility
- Automatically load aufs module
- Various bugfixes and stability improvements
## 0.1.4 (2013-04-09)
- Full support for TTY emulation
- Detach from a TTY session with the escape sequence `C-p C-q`
- Various bugfixes and stability improvements
- Minor UI improvements
- Automatically create our own bridge interface 'docker0'
## 0.1.3 (2013-04-04)
- Choose TCP frontend port with '-p :PORT'
- Layer format is versioned
- Major reliability improvements to the process manager
- Various bugfixes and stability improvements
## 0.1.2 (2013-04-03)
- Set container hostname with 'docker run -h'
- Selective attach at run with 'docker run -a [stdin[,stdout[,stderr]]]'
- Various bugfixes and stability improvements
- UI polish
- Progress bar on push/pull
- Use XZ compression by default
- Make IP allocator lazy
## 0.1.1 (2013-03-31)
- Display shorthand IDs for convenience
- Stabilize process management
- Layers can include a commit message
- Simplified 'docker attach'
- Fixed support for re-attaching
- Various bugfixes and stability improvements
- Auto-download at run
- Auto-login on push
- Beefed up documentation
## 0.1.0 (2013-03-23)
- First release
- Implement registry in order to push/pull images
- TCP port allocation
- Fix termcaps on Linux
- Add documentation
- Add Vagrant support with Vagrantfile
- Add unit tests
- Add repository/tags to ease image management
- Improve the layer implementation

93
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,93 @@
# Contributing to Docker
Want to hack on Docker? Awesome! There are instructions to get you
started on the website: http://docker.io/gettingstarted.html
They are probably not perfect, please let us know if anything feels
wrong or incomplete.
## Contribution guidelines
### Pull requests are always welcome
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.
If your pull request is not accepted on the first try, don't be
discouraged! If there's a problem with the implementation, hopefully you
received feedback on what to improve.
We're trying very hard to keep Docker lean and focused. We don't 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 *on top of* docker.
### Discuss your design on the mailing list
We recommend discussing your plans [on the mailing
list](https://groups.google.com/forum/?fromgroups#!forum/docker-club)
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.
### Create issues...
Any significant improvement should be documented as [a github
issue](https://github.com/dotcloud/docker/issues) before anybody
starts working on it.
### ...but check for existing issues first!
Please take a moment to check that an issue doesn't 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.
### Conventions
Fork the repo and make changes on your fork in a feature branch:
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
issue
- If it's a feature branch, create an enhancement issue to announce your
intentions, and name it XXX-something where XXX is the number of the issue.
Submit unit tests for your changes. Go has a great test framework built in; use
it! Take a look at existing tests for inspiration. Run the full test suite on
your branch before submitting a pull request.
Make sure you include relevant updates or additions to documentation when
creating or modifying features.
Write clean code. Universally formatted code promotes ease of writing, reading,
and maintenance. Always run `go fmt` before committing your changes. Most
editors have plugins that do this automatically, and there's also a git
pre-commit hook:
```
curl -o .git/hooks/pre-commit https://raw.github.com/edsrzf/gofmt-git-hook/master/fmt-check && chmod +x .git/hooks/pre-commit
```
Pull requests descriptions should be as clear as possible and include a
reference to all the issues that they address.
Code review comments may be added to your pull request. Discuss, then make the
suggested modifications and push additional commits to your feature branch. Be
sure to post a comment after pushing. The new commits will show up in the pull
request automatically, but the reviewers will not be notified unless you
comment.
Before the pull request is merged, make sure that you squash your commits into
logical units of work using `git rebase -i` and `git push -f`. After every
commit the test suite should be passing. Include documentation changes in the
same commit so that a revert would remove all traces of the feature or fix.
Commits that fix or close an issue should include a reference like `Closes #XXX`
or `Fixes #XXX`, which will automatically close the issue when merged.
Add your name to the AUTHORS file, but make sure the list is sorted and your
name and email address match your git configuration. The AUTHORS file is
regenerated occasionally from the git commit history, so a mismatch may result
in your changes being overwritten.

131
Makefile
View File

@@ -1,83 +1,78 @@
PKG_NAME=dotcloud-docker
PKG_ARCH=amd64
PKG_VERSION=1
ROOT_PATH:=$(PWD)
BUILD_PATH=build # Do not change, decided by dpkg-buildpackage
BUILD_SRC=build_src
GITHUB_PATH=src/github.com/dotcloud/docker
INSDIR=usr/bin
SOURCE_PACKAGE=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
DEB_PACKAGE=$(PKG_NAME)_$(PKG_VERSION)_$(PKG_ARCH).deb
EXTRA_GO_PKG=fs auth
DOCKER_PACKAGE := github.com/dotcloud/docker
RELEASE_VERSION := $(shell git tag | grep -E "v[0-9\.]+$$" | sort -nr | head -n 1)
SRCRELEASE := docker-$(RELEASE_VERSION)
BINRELEASE := docker-$(RELEASE_VERSION).tgz
TMPDIR=$(shell mktemp -d -t XXXXXX)
GIT_ROOT := $(shell git rev-parse --show-toplevel)
BUILD_DIR := $(CURDIR)/.gopath
GOPATH ?= $(BUILD_DIR)
export GOPATH
# Build a debian source package
all: clean build_in_deb
GO_OPTIONS ?=
ifeq ($(VERBOSE), 1)
GO_OPTIONS += -v
endif
build_in_deb:
echo "GOPATH = " $(ROOT_PATH)
mkdir bin
cd $(GITHUB_PATH)/docker; GOPATH=$(ROOT_PATH) go build -o $(ROOT_PATH)/bin/docker
GIT_COMMIT = $(shell git rev-parse --short HEAD)
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES")
# DESTDIR provided by Debian packaging
install:
# Call this from a go environment (as packaged for deb source package)
mkdir -p $(DESTDIR)/$(INSDIR)
mkdir -p $(DESTDIR)/etc/init
install -m 0755 bin/docker $(DESTDIR)/$(INSDIR)
install -o root -m 0755 etc/docker.upstart $(DESTDIR)/etc/init/docker.conf
BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS)"
$(BUILD_SRC): clean
# Copy ourselves into $BUILD_SRC to comply with unusual golang constraints
tar --exclude=*.tar.gz --exclude=checkout.tgz -f checkout.tgz -cz *
mkdir -p $(BUILD_SRC)/$(GITHUB_PATH)
tar -f checkout.tgz -C $(BUILD_SRC)/$(GITHUB_PATH) -xz
cd $(BUILD_SRC)/$(GITHUB_PATH)/docker; GOPATH=$(ROOT_PATH)/$(BUILD_SRC) go get -d
for d in `find $(BUILD_SRC) -name '.git*'`; do rm -rf $$d; done
# Populate source build with debian stuff
cp -R -L ./deb/* $(BUILD_SRC)
SRC_DIR := $(GOPATH)/src
$(SOURCE_PACKAGE): $(BUILD_SRC)
rm -f $(SOURCE_PACKAGE)
# Create the debian source package
tar -f $(SOURCE_PACKAGE) -C ${ROOT_PATH}/${BUILD_SRC} -cz .
DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
DOCKER_MAIN := $(DOCKER_DIR)/docker
# Build deb package fetching go dependencies and cleaning up git repositories
deb: $(DEB_PACKAGE)
DOCKER_BIN_RELATIVE := bin/docker
DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE)
$(DEB_PACKAGE): $(SOURCE_PACKAGE)
# dpkg-buildpackage looks for source package tarball in ../
cd $(BUILD_SRC); dpkg-buildpackage
rm -rf $(BUILD_PATH) debian/$(PKG_NAME)* debian/files
.PHONY: all clean test hack release srcrelease $(BINRELEASE) $(SRCRELEASE) $(DOCKER_BIN) $(DOCKER_DIR)
debsrc: $(SOURCE_PACKAGE)
all: $(DOCKER_BIN)
# Build local sources
#$(PKG_NAME): build_local
$(DOCKER_BIN): $(DOCKER_DIR)
@mkdir -p $(dir $@)
@(cd $(DOCKER_MAIN); go build $(GO_OPTIONS) $(BUILD_OPTIONS) -o $@)
@echo $(DOCKER_BIN_RELATIVE) is created.
build_local:
-@mkdir -p bin
cd docker && go build -o ../bin/docker
$(DOCKER_DIR):
@mkdir -p $(dir $@)
@rm -f $@
@ln -sf $(CURDIR)/ $@
@(cd $(DOCKER_MAIN); go get $(GO_OPTIONS))
gotest:
@echo "\033[36m[Testing]\033[00m docker..."
@sudo -E GOPATH=$(ROOT_PATH)/$(BUILD_SRC) go test -v && \
echo -n "\033[32m[OK]\033[00m" || \
echo -n "\033[31m[FAIL]\033[00m"; \
echo " docker"
@echo "Testing extra repos {$(EXTRA_GO_PKG)}"
@for package in $(EXTRA_GO_PKG); do \
echo "\033[36m[Testing]\033[00m docker/$$package..." && \
cd $$package ; \
sudo -E GOPATH=$(ROOT_PATH)/$(BUILD_SRC) go test -v && \
echo -n "\033[32m[OK]\033[00m" || \
echo -n "\033[31m[FAIL]\033[00m" ; \
echo " docker/$$package" ; \
cd .. ;\
done
@sudo rm -rf /tmp/docker-*
whichrelease:
echo $(RELEASE_VERSION)
release: $(BINRELEASE)
srcrelease: $(SRCRELEASE)
deps: $(DOCKER_DIR)
# A clean checkout of $RELEASE_VERSION, with vendored dependencies
$(SRCRELEASE):
rm -fr $(SRCRELEASE)
git clone $(GIT_ROOT) $(SRCRELEASE)
cd $(SRCRELEASE); git checkout -q $(RELEASE_VERSION)
# A binary release ready to be uploaded to a mirror
$(BINRELEASE): $(SRCRELEASE)
rm -f $(BINRELEASE)
cd $(SRCRELEASE); make; cp -R bin docker-$(RELEASE_VERSION); tar -f ../$(BINRELEASE) -zv -c docker-$(RELEASE_VERSION)
clean:
rm -rf $(BUILD_PATH) debian/$(PKG_NAME)* debian/files $(BUILD_SRC) checkout.tgz bin
@rm -rf $(dir $(DOCKER_BIN))
ifeq ($(GOPATH), $(BUILD_DIR))
@rm -rf $(BUILD_DIR)
else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
@rm -f $(DOCKER_DIR)
endif
test: all
@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS))
fmt:
@gofmt -s -l -w .
hack:
cd $(CURDIR)/buildbot && vagrant up

334
README.md
View File

@@ -1,17 +1,17 @@
Docker: the Linux container runtime
===================================
Docker complements LXC with a high-level API with operates at the process level. It runs unix processes with strong guarantees of isolation and repeatability across servers.
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.
Is is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
<img src="http://bricks.argz.com/bricksfiles/lego/07000/7823/012.jpg"/>
![Docker L](docs/sources/static_files/lego_docker.jpg "Docker")
* *Heterogeneous payloads*: any combination of binaries, libraries, configuration files, scripts, virtualenvs, jars, gems, tarballs, you name it. No more juggling between domain-specific tools. Docker can deploy and run them all.
* *Any server*: docker can run on any x64 machine with a modern linux kernel - whether it's a laptop, a bare metal server or a VM. This makes it perfect for multi-cloud deployments.
* *Isolation*: docker isolates processes from each other and from the underlying host, using lightweight containers.
* *Isolation*: docker isolates processes from each other and from the underlying host, using lightweight containers.
* *Repeatability*: because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.
@@ -25,15 +25,146 @@ Notable features
* Network isolation: each process container runs in its own network namespace, with a virtual interface and IP address of its own.
* Copy-on-write: root filesystems are created using copy-on-write, which makes deployment extremeley fast, memory-cheap and disk-cheap.
* Copy-on-write: root filesystems are created using copy-on-write, which makes deployment extremely fast, memory-cheap and disk-cheap.
* Logging: the standard streams (stdout/stderr/stdin) of each process container is collected and logged for real-time or batch retrieval.
* Logging: the standard streams (stdout/stderr/stdin) of each process container are collected and logged for real-time or batch retrieval.
* Change management: changes to a container's filesystem can be committed into a new image and re-used to create more containers. No templating or manual configuration required.
* Interactive shell: docker can allocate a pseudo-tty and attach to the standard input of any container, for example to run a throwaway interactive shell.
Install instructions
==================
Quick install on Ubuntu 12.04 and 12.10
---------------------------------------
```bash
curl get.docker.io | sh -x
```
Binary installs
----------------
Docker supports the following binary installation methods.
Note that some methods are community contributions and not yet officially supported.
* [Ubuntu 12.04 and 12.10 (officially supported)](http://docs.docker.io/en/latest/installation/ubuntulinux/)
* [Arch Linux](http://docs.docker.io/en/latest/installation/archlinux/)
* [MacOS X (with Vagrant)](http://docs.docker.io/en/latest/installation/macos/)
* [Windows (with Vagrant)](http://docs.docker.io/en/latest/installation/windows/)
* [Amazon EC2 (with Vagrant)](http://docs.docker.io/en/latest/installation/amazon/)
Installing from source
----------------------
1. Make sure you have a [Go language](http://golang.org/doc/install) compiler and [git](http://git-scm.com) installed.
2. Checkout the source code
```bash
git clone http://github.com/dotcloud/docker
```
3. Build the docker binary
```bash
cd docker
make VERBOSE=1
sudo cp ./bin/docker /usr/local/bin/docker
```
Usage examples
==============
First run the docker daemon
---------------------------
All the examples assume your machine is running the docker daemon. To run the docker daemon in the background, simply type:
```bash
# On a production system you want this running in an init script
sudo docker -d &
```
Now you can run docker in client mode: all commands will be forwarded to the docker daemon, so the client can run from any account.
```bash
# Now you can run docker commands from any account.
docker help
```
Throwaway shell in a base ubuntu image
--------------------------------------
```bash
docker pull ubuntu:12.10
# Run an interactive shell, allocate a tty, attach stdin and stdout
# To detach the tty without exiting the shell, use the escape sequence Ctrl-p + Ctrl-q
docker run -i -t ubuntu:12.10 /bin/bash
```
Starting a long-running worker process
--------------------------------------
```bash
# Start a very useful long-running process
JOB=$(docker run -d ubuntu /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
```
Running an irc bouncer
----------------------
```bash
BOUNCER_ID=$(docker run -d -p 6667 -u irc shykes/znc $USER $PASSWORD)
echo "Configure your irc client to connect to port $(docker port $BOUNCER_ID 6667) of this machine"
```
Running Redis
-------------
```bash
REDIS_ID=$(docker run -d -p 6379 shykes/redis redis-server)
echo "Configure your redis client to connect to port $(docker port $REDIS_ID 6379) of this machine"
```
Share your own image!
---------------------
```bash
CONTAINER=$(docker run -d ubuntu:12.10 apt-get install -y curl)
docker commit -m "Installed curl" $CONTAINER $USER/betterbase
docker push $USER/betterbase
```
A list of publicly available images is [available here](https://github.com/dotcloud/docker/wiki/Public-docker-images).
Expose a service on a TCP port
------------------------------
```bash
# Expose port 4444 of this container, and tell netcat to listen on it
JOB=$(docker run -d -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's public address
# Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work.
IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }')
echo hello world | nc $IP $PORT
# Verify that the network connection worked
echo "Daemon received: $(docker logs $JOB)"
```
Under the hood
--------------
@@ -50,189 +181,60 @@ Under the hood, Docker is built on the following components:
* [lxc](http://lxc.sourceforge.net/), a set of convenience scripts to simplify the creation of linux containers.
Install instructions
==================
Installing on Ubuntu 12.04 and 12.10
------------------------------------
1. Install dependencies:
```bash
sudo apt-get install lxc wget bsdtar curl
```
2. Install the latest docker binary:
```bash
wget http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz
tar -xf docker-master.tgz
```
3. Run your first container!
```bash
cd docker-master
sudo ./docker run -a -i -t base /bin/bash
```
Consider adding docker to your `PATH` for simplicity.
Installing on other Linux distributions
---------------------------------------
Right now, the officially supported distributions are:
* 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.
Installing with Vagrant
-----------------------
Currently, Docker can be installed with Vagrant both on your localhost
with VirtualBox as well as on Amazon EC2. Vagrant 1.1 is required for
EC2, but deploying is as simple as:
```bash
$ export AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \
AWS_KEYPAIR_NAME=xxx \
AWS_SSH_PRIVKEY=xxx
$ vagrant plugin install vagrant-aws
$ vagrant up --provider=aws
```
The environment variables are:
* `AWS_ACCESS_KEY_ID` - The API key used to make requests to AWS
* `AWS_SECRET_ACCESS_KEY` - The secret key to make AWS API requests
* `AWS_KEYPAIR_NAME` - The name of the keypair used for this EC2 instance
* `AWS_SSH_PRIVKEY` - The path to the private key for the named keypair
For VirtualBox, you can simply ignore setting any of the environment
variables and omit the ``provider`` flag. VirtualBox is still supported with
Vagrant <= 1.1:
```bash
$ vagrant up
```
Usage examples
==============
Running an interactive shell
----------------------------
```bash
# 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
```
Starting a long-running worker process
--------------------------------------
```bash
# 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
```
Listing all running containers
------------------------------
```bash
docker ps
```
Expose a service on a TCP port
------------------------------
```bash
# 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's public address
echo hello world | nc $(hostname) $PORT
# Verify that the network connection worked
echo "Daemon received: $(docker logs $JOB)"
```
Contributing to Docker
======================
Want to hack on Docker? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete.
Want to hack on Docker? Awesome! There are instructions to get you started on the website: http://docs.docker.io/en/latest/contributing/contributing/
Contribution guidelines
-----------------------
### Pull requests are always welcome
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.
If your pull request is not accepted on the first try, don't be discouraged! If there's a problen with the implementation, hopefully you received feedback on what to improve.
We're trying very hard to keep Docker lean and focused. We don't 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 *on top of* docker.
### Discuss your design on the mailing list
We recommend discussing your plans [on the mailing list](https://groups.google.com/forum/?fromgroups#!forum/docker-club) 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.
### Create issues...
Any significant improvement should be documented as a github issue before anybody start working on it.
### ...but check for existing issues first!
Please take a moment to check that an issue doesn't 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.
They are probably not perfect, please let us know if anything feels wrong or incomplete.
### Write tests
Note
----
Golang has a great testing suite built in: use it! Take a look at existing tests for inspiration.
We also keep the documentation in this repository. The website documentation is generated using sphinx using these sources.
Please find it under docs/sources/ and read more about it https://github.com/dotcloud/docker/master/docs/README.md
Please feel free to fix / update the documentation and send us pull requests. More tutorials are also welcome.
Setting up a dev environment
----------------------------
Coming soon!
Instructions that have been verified to work on Ubuntu 12.10,
```bash
sudo apt-get -y install lxc wget bsdtar curl golang git
export GOPATH=~/go/
export PATH=$GOPATH/bin:$PATH
mkdir -p $GOPATH/src/github.com/dotcloud
cd $GOPATH/src/github.com/dotcloud
git clone git@github.com:dotcloud/docker.git
cd docker
go get -v github.com/dotcloud/docker/...
go install -v github.com/dotcloud/docker/...
```
Then run the docker daemon,
```bash
sudo $GOPATH/bin/docker -d
```
Run the `go install` command (above) to recompile docker.
What is a Standard Container?
=============================
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.
a format that is self-describing and portable, so that any compliant runtime can run it without extra dependencies, regardless of the underlying machine and the contents of the container.
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.
The spec for Standard Containers is currently a 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.
A great analogy for this is the shipping container. Just like Standard Containers are a fundamental unit of software delivery, shipping containers (http://bricks.argz.com/ins/7823-1/12) are a fundamental unit of physical delivery.

71
SPECS/data-volumes.md Normal file
View File

@@ -0,0 +1,71 @@
## Spec for data volumes
Spec owner: Solomon Hykes <solomon@dotcloud.com>
Data volumes (issue #111) are a much-requested feature which trigger much discussion and debate. Below is the current authoritative spec for implementing data volumes.
This spec will be deprecated once the feature is fully implemented.
Discussion, requests, trolls, demands, offerings, threats and other forms of supplications concerning this spec should be addressed to Solomon here: https://github.com/dotcloud/docker/issues/111
### 1. Creating data volumes
At container creation, parts of a container's filesystem can be mounted as separate data volumes. Volumes are defined with the -v flag.
For example:
```bash
$ docker run -v /var/lib/postgres -v /var/log postgres /usr/bin/postgres
```
In this example, a new container is created from the 'postgres' image. At the same time, docker creates 2 new data volumes: one will be mapped to the container at /var/lib/postgres, the other at /var/log.
2 important notes:
1) Volumes don't have top-level names. At no point does the user provide a name, or is a name given to him. Volumes are identified by the path at which they are mounted inside their container.
2) The user doesn't choose the source of the volume. Docker only mounts volumes it created itself, in the same way that it only runs containers that it created itself. That is by design.
### 2. Sharing data volumes
Instead of creating its own volumes, a container can share another container's volumes. For example:
```bash
$ docker run --volumes-from $OTHER_CONTAINER_ID postgres /usr/local/bin/postgres-backup
```
In this example, a new container is created from the 'postgres' example. At the same time, docker will *re-use* the 2 data volumes created in the previous example. One volume will be mounted on the /var/lib/postgres of *both* containers, and the other will be mounted on the /var/log of both containers.
### 3. Under the hood
Docker stores volumes in /var/lib/docker/volumes. Each volume receives a globally unique ID at creation, and is stored at /var/lib/docker/volumes/ID.
At creation, volumes are attached to a single container - the source of truth for this mapping will be the container's configuration.
Mounting a volume consists of calling "mount --bind" from the volume's directory to the appropriate sub-directory of the container mountpoint. This may be done by Docker itself, or farmed out to lxc (which supports mount-binding) if possible.
### 4. Backups, transfers and other volume operations
Volumes sometimes need to be backed up, transfered between hosts, synchronized, etc. These operations typically are application-specific or site-specific, eg. rsync vs. S3 upload vs. replication vs...
Rather than attempting to implement all these scenarios directly, Docker will allow for custom implementations using an extension mechanism.
### 5. Custom volume handlers
Docker allows for arbitrary code to be executed against a container's volumes, to implement any custom action: backup, transfer, synchronization across hosts, etc.
Here's an example:
```bash
$ DB=$(docker run -d -v /var/lib/postgres -v /var/log postgres /usr/bin/postgres)
$ BACKUP_JOB=$(docker run -d --volumes-from $DB shykes/backuper /usr/local/bin/backup-postgres --s3creds=$S3CREDS)
$ docker wait $BACKUP_JOB
```
Congratulations, you just implemented a custom volume handler, using Docker's built-in ability to 1) execute arbitrary code and 2) share volumes between containers.

179
Vagrantfile vendored
View File

@@ -1,119 +1,82 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("1") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
def v10(config)
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "quantal64_3.5.0-25"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
# config.vm.network :hostonly, "192.168.33.10"
# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.
# config.vm.network :bridged
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
config.vm.share_folder "v-data", "~/docker", "~/docker"
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file quantal64.pp in the manifests_path directory.
#
# An example Puppet manifest to provision the message of the day:
#
# # group { "puppet":
# # ensure => "present",
# # }
# #
# # File { owner => 0, group => 0, mode => 0644 }
# #
# # file { '/etc/motd':
# # content => "Welcome to your Vagrant-built virtual machine!
# # Managed by Puppet.\n"
# # }
#
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "quantal64.pp"
puppet.module_path = "puppet/modules"
end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision :chef_solo do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { :mysql_password => "foo" }
# end
# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision :chef_client do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# IF you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
# Install ubuntu packaging dependencies and create ubuntu packages
config.vm.provision :shell, :inline => "echo 'deb http://ppa.launchpad.net/dotcloud/lxc-docker/ubuntu precise main' >>/etc/apt/sources.list"
config.vm.provision :shell, :inline => 'export DEBIAN_FRONTEND=noninteractive; apt-get -qq update; apt-get install -qq -y --force-yes lxc-docker'
end
Vagrant.configure("2") do |config|
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)
end
Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
config.vm.provider :aws do |aws|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
aws.region = "us-east-1"
aws.ami = "ami-1c1e8075"
aws.ssh_username = "vagrant"
aws.instance_type = "t1.micro"
aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
aws.region = "us-east-1"
aws.ami = "ami-d0f89fb9"
aws.ssh_username = "ubuntu"
aws.instance_type = "t1.micro"
end
config.vm.provider :rackspace do |rs|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box"
config.ssh.private_key_path = ENV["RS_PRIVATE_KEY"]
rs.username = ENV["RS_USERNAME"]
rs.api_key = ENV["RS_API_KEY"]
rs.public_key_path = ENV["RS_PUBLIC_KEY"]
rs.flavor = /512MB/
rs.image = /Ubuntu/
end
config.vm.provider :virtualbox do |vb|
config.vm.box = "quantal64_3.5.0-25"
config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"
end
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
end
end
Vagrant::VERSION >= "1.2.0" and Vagrant.configure("2") do |config|
config.vm.provider :aws do |aws, override|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
override.ssh.private_key_path = ENV["AWS_SSH_PRIVKEY"]
override.ssh.username = "ubuntu"
aws.region = "us-east-1"
aws.ami = "ami-d0f89fb9"
aws.instance_type = "t1.micro"
end
config.vm.provider :rackspace do |rs|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box"
config.ssh.private_key_path = ENV["RS_PRIVATE_KEY"]
rs.username = ENV["RS_USERNAME"]
rs.api_key = ENV["RS_API_KEY"]
rs.public_key_path = ENV["RS_PUBLIC_KEY"]
rs.flavor = /512MB/
rs.image = /Ubuntu/
end
config.vm.provider :virtualbox do |vb|
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
end
end

View File

@@ -1,18 +1,22 @@
package fs
package docker
import (
"errors"
"io"
"io/ioutil"
"os"
"os/exec"
)
type Archive io.Reader
type Compression uint32
const (
Uncompressed Compression = iota
Bzip2
Gzip
Xz
)
func (compression *Compression) Flag() string {
@@ -21,6 +25,8 @@ func (compression *Compression) Flag() string {
return "j"
case Gzip:
return "z"
case Xz:
return "J"
}
return ""
}
@@ -40,6 +46,9 @@ func Untar(archive io.Reader, path string) error {
return nil
}
// CmdStream executes a command, and returns its stdout as a stream.
// If the command fails to run or doesn't complete successfully, an error
// will be returned, including anything written on stderr.
func CmdStream(cmd *exec.Cmd) (io.Reader, error) {
stdout, err := cmd.StdoutPipe()
if err != nil {
@@ -50,24 +59,66 @@ func CmdStream(cmd *exec.Cmd) (io.Reader, error) {
return nil, err
}
pipeR, pipeW := io.Pipe()
errChan := make(chan []byte)
// Collect stderr, we will use it in case of an error
go func() {
errText, e := ioutil.ReadAll(stderr)
if e != nil {
errText = []byte("(...couldn't fetch stderr: " + e.Error() + ")")
}
errChan <- errText
}()
// Copy stdout to the returned pipe
go func() {
_, err := io.Copy(pipeW, stdout)
if err != nil {
pipeW.CloseWithError(err)
}
errText, e := ioutil.ReadAll(stderr)
if e != nil {
errText = []byte("(...couldn't fetch stderr: " + e.Error() + ")")
}
errText := <-errChan
if err := cmd.Wait(); err != nil {
// FIXME: can this block if stderr outputs more than the size of StderrPipe()'s buffer?
pipeW.CloseWithError(errors.New(err.Error() + ": " + string(errText)))
} else {
pipeW.Close()
}
}()
// Run the command and return the pipe
if err := cmd.Start(); err != nil {
return nil, err
}
return pipeR, nil
}
// NewTempArchive reads the content of src into a temporary file, and returns the contents
// of that file as an archive. The archive can only be read once - as soon as reading completes,
// the file will be deleted.
func NewTempArchive(src Archive, dir string) (*TempArchive, error) {
f, err := ioutil.TempFile(dir, "")
if err != nil {
return nil, err
}
if _, err := io.Copy(f, src); err != nil {
return nil, err
}
if _, err := f.Seek(0, 0); err != nil {
return nil, err
}
st, err := f.Stat()
if err != nil {
return nil, err
}
size := st.Size()
return &TempArchive{f, size}, nil
}
type TempArchive struct {
*os.File
Size int64 // Pre-computed from Stat().Size() as a convenience
}
func (archive *TempArchive) Read(data []byte) (int, error) {
n, err := archive.File.Read(data)
if err != nil {
os.Remove(archive.File.Name())
}
return n, err
}

View File

@@ -1,12 +1,35 @@
package fs
package docker
import (
"io"
"io/ioutil"
"os"
"os/exec"
"testing"
"time"
)
func TestCmdStreamLargeStderr(t *testing.T) {
cmd := exec.Command("/bin/sh", "-c", "dd if=/dev/zero bs=1k count=1000 of=/dev/stderr; echo hello")
out, err := CmdStream(cmd)
if err != nil {
t.Fatalf("Failed to start command: " + err.Error())
}
errCh := make(chan error)
go func() {
_, err := io.Copy(ioutil.Discard, out)
errCh <- err
}()
select {
case err := <-errCh:
if err != nil {
t.Fatalf("Command should not have failed (err=%s...)", err.Error()[:100])
}
case <-time.After(5 * time.Second):
t.Fatalf("Command did not complete in 5 seconds; probable deadlock")
}
}
func TestCmdStreamBad(t *testing.T) {
badCmd := exec.Command("/bin/sh", "-c", "echo hello; echo >&2 error couldn\\'t reverse the phase pulser; exit 1")
out, err := CmdStream(badCmd)

View File

@@ -8,11 +8,12 @@ import (
"io/ioutil"
"net/http"
"os"
"path"
"strings"
)
// Where we store the config file
const CONFIGFILE = "/var/lib/docker/.dockercfg"
const CONFIGFILE = ".dockercfg"
// the registry server we want to login against
const REGISTRY_SERVER = "https://registry.docker.io"
@@ -21,10 +22,20 @@ type AuthConfig struct {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
rootPath string `json:-`
}
func NewAuthConfig(username, password, email, rootPath string) *AuthConfig {
return &AuthConfig{
Username: username,
Password: password,
Email: email,
rootPath: rootPath,
}
}
// create a base64 encoded auth string to store in config
func EncodeAuth(authConfig AuthConfig) string {
func EncodeAuth(authConfig *AuthConfig) string {
authStr := authConfig.Username + ":" + authConfig.Password
msg := []byte(authStr)
encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg)))
@@ -33,50 +44,54 @@ func EncodeAuth(authConfig AuthConfig) string {
}
// decode the auth string
func DecodeAuth(authStr string) (AuthConfig, error) {
func DecodeAuth(authStr string) (*AuthConfig, error) {
decLen := base64.StdEncoding.DecodedLen(len(authStr))
decoded := make([]byte, decLen)
authByte := []byte(authStr)
n, err := base64.StdEncoding.Decode(decoded, authByte)
if err != nil {
return AuthConfig{}, err
return nil, err
}
if n > decLen {
return AuthConfig{}, errors.New("something went wrong decoding auth config")
return nil, fmt.Errorf("Something went wrong decoding auth config")
}
arr := strings.Split(string(decoded), ":")
if len(arr) != 2 {
return nil, fmt.Errorf("Invalid auth configuration file")
}
password := strings.Trim(arr[1], "\x00")
return AuthConfig{Username: arr[0], Password: password}, nil
return &AuthConfig{Username: arr[0], Password: password}, nil
}
// load up the auth config information and return values
func LoadConfig() (AuthConfig, error) {
if _, err := os.Stat(CONFIGFILE); err == nil {
b, err := ioutil.ReadFile(CONFIGFILE)
if err != nil {
return AuthConfig{}, err
}
arr := strings.Split(string(b), "\n")
orig_auth := strings.Split(arr[0], " = ")
orig_email := strings.Split(arr[1], " = ")
authConfig, err := DecodeAuth(orig_auth[1])
if err != nil {
return AuthConfig{}, err
}
authConfig.Email = orig_email[1]
return authConfig, nil
} else {
return AuthConfig{}, nil
// FIXME: use the internal golang config parser
func LoadConfig(rootPath string) (*AuthConfig, error) {
confFile := path.Join(rootPath, CONFIGFILE)
if _, err := os.Stat(confFile); err != nil {
return &AuthConfig{}, fmt.Errorf("The Auth config file is missing")
}
return AuthConfig{}, nil
b, err := ioutil.ReadFile(confFile)
if err != nil {
return nil, err
}
arr := strings.Split(string(b), "\n")
origAuth := strings.Split(arr[0], " = ")
origEmail := strings.Split(arr[1], " = ")
authConfig, err := DecodeAuth(origAuth[1])
if err != nil {
return nil, err
}
authConfig.Email = origEmail[1]
authConfig.rootPath = rootPath
return authConfig, nil
}
// save the auth config
func saveConfig(authStr string, email string) error {
func saveConfig(rootPath, authStr string, email string) error {
lines := "auth = " + authStr + "\n" + "email = " + email + "\n"
b := []byte(lines)
err := ioutil.WriteFile(CONFIGFILE, b, 0600)
err := ioutil.WriteFile(path.Join(rootPath, CONFIGFILE), b, 0600)
if err != nil {
return err
}
@@ -84,7 +99,7 @@ func saveConfig(authStr string, email string) error {
}
// try to register/login to the registry server
func Login(authConfig AuthConfig) (string, error) {
func Login(authConfig *AuthConfig) (string, error) {
storeConfig := false
reqStatusCode := 0
var status string
@@ -96,6 +111,7 @@ func Login(authConfig AuthConfig) (string, error) {
return "", errors.New(errMsg)
}
// using `bytes.NewReader(jsonBody)` here causes the server to respond with a 411 status.
b := strings.NewReader(string(jsonBody))
req1, err := http.Post(REGISTRY_SERVER+"/v1/users", "application/json; charset=utf-8", b)
if err != nil {
@@ -115,6 +131,7 @@ func Login(authConfig AuthConfig) (string, error) {
status = "Account Created\n"
storeConfig = true
} else if reqStatusCode == 400 {
// FIXME: This should be 'exists', not 'exist'. Need to change on the server first.
if string(reqBody) == "Username or email already exist" {
client := &http.Client{}
req, err := http.NewRequest("GET", REGISTRY_SERVER+"/v1/users", nil)
@@ -136,16 +153,16 @@ func Login(authConfig AuthConfig) (string, error) {
return "", errors.New(status)
}
} else {
status = fmt.Sprintf("Registration: %s", string(reqBody))
status = fmt.Sprintf("Registration: %s", reqBody)
return "", errors.New(status)
}
} else {
status = fmt.Sprintf("[%s] : %s", reqStatusCode, string(reqBody))
status = fmt.Sprintf("[%s] : %s", reqStatusCode, reqBody)
return "", errors.New(status)
}
if storeConfig {
authStr := EncodeAuth(authConfig)
saveConfig(authStr, authConfig.Email)
saveConfig(authConfig.rootPath, authStr, authConfig.Email)
}
return status, nil
}

View File

@@ -5,7 +5,7 @@ import (
)
func TestEncodeAuth(t *testing.T) {
newAuthConfig := AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
authStr := EncodeAuth(newAuthConfig)
decAuthConfig, err := DecodeAuth(authStr)
if err != nil {

20
buildbot/README.rst Normal file
View File

@@ -0,0 +1,20 @@
Buildbot
========
Buildbot is a continuous integration system designed to automate the
build/test cycle. By automatically rebuilding and testing the tree each time
something has changed, build problems are pinpointed quickly, before other
developers are inconvenienced by the failure.
When running 'make hack' at the docker root directory, it spawns a virtual
machine in the background running a buildbot instance and adds a git
post-commit hook that automatically run docker tests for you.
You can check your buildbot instance at http://192.168.33.21:8010/waterfall
Buildbot dependencies
---------------------
vagrant, virtualbox packages and python package requests

28
buildbot/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,28 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
$BUILDBOT_IP = '192.168.33.21'
def v10(config)
config.vm.box = "quantal64_3.5.0-25"
config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"
config.vm.share_folder 'v-data', '/data/docker', File.dirname(__FILE__) + '/..'
config.vm.network :hostonly, $BUILDBOT_IP
# Ensure puppet is installed on the instance
config.vm.provision :shell, :inline => 'apt-get -qq update; apt-get install -y puppet'
config.vm.provision :puppet do |puppet|
puppet.manifests_path = '.'
puppet.manifest_file = 'buildbot.pp'
puppet.options = ['--templatedir','.']
end
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)
end

View File

@@ -0,0 +1,43 @@
#!/bin/bash
# Auto setup of buildbot configuration. Package installation is being done
# on buildbot.pp
# Dependencies: buildbot, buildbot-slave, supervisor
SLAVE_NAME='buildworker'
SLAVE_SOCKET='localhost:9989'
BUILDBOT_PWD='pass-docker'
USER='vagrant'
ROOT_PATH='/data/buildbot'
DOCKER_PATH='/data/docker'
BUILDBOT_CFG="$DOCKER_PATH/buildbot/buildbot-cfg"
IP=$(grep BUILDBOT_IP /data/docker/buildbot/Vagrantfile | awk -F "'" '{ print $2; }')
function run { su $USER -c "$1"; }
export PATH=/bin:sbin:/usr/bin:/usr/sbin:/usr/local/bin
# Exit if buildbot has already been installed
[ -d "$ROOT_PATH" ] && exit 0
# Setup buildbot
run "mkdir -p ${ROOT_PATH}"
cd ${ROOT_PATH}
run "buildbot create-master master"
run "cp $BUILDBOT_CFG/master.cfg master"
run "sed -i 's/localhost/$IP/' master/master.cfg"
run "buildslave create-slave slave $SLAVE_SOCKET $SLAVE_NAME $BUILDBOT_PWD"
# Allow buildbot subprocesses (docker tests) to properly run in containers,
# in particular with docker -u
run "sed -i 's/^umask = None/umask = 000/' ${ROOT_PATH}/slave/buildbot.tac"
# Setup supervisor
cp $BUILDBOT_CFG/buildbot.conf /etc/supervisor/conf.d/buildbot.conf
sed -i "s/^chmod=0700.*0700./chmod=0770\nchown=root:$USER/" /etc/supervisor/supervisord.conf
kill -HUP `pgrep -f "/usr/bin/python /usr/bin/supervisord"`
# Add git hook
cp $BUILDBOT_CFG/post-commit $DOCKER_PATH/.git/hooks
sed -i "s/localhost/$IP/" $DOCKER_PATH/.git/hooks/post-commit

View File

@@ -0,0 +1,18 @@
[program:buildmaster]
command=su vagrant -c "buildbot start master"
directory=/data/buildbot
chown= root:root
redirect_stderr=true
stdout_logfile=/var/log/supervisor/buildbot-master.log
stderr_logfile=/var/log/supervisor/buildbot-master.log
[program:buildworker]
command=buildslave start slave
directory=/data/buildbot
chown= root:root
redirect_stderr=true
stdout_logfile=/var/log/supervisor/buildbot-slave.log
stderr_logfile=/var/log/supervisor/buildbot-slave.log
[group:buildbot]
programs=buildmaster,buildworker

View File

@@ -0,0 +1,46 @@
import os
from buildbot.buildslave import BuildSlave
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.config import BuilderConfig
from buildbot.process.factory import BuildFactory
from buildbot.steps.shell import ShellCommand
from buildbot.status import html
from buildbot.status.web import authz, auth
PORT_WEB = 8010 # Buildbot webserver port
PORT_MASTER = 9989 # Port where buildbot master listen buildworkers
TEST_USER = 'buildbot' # Credential to authenticate build triggers
TEST_PWD = 'docker' # Credential to authenticate build triggers
BUILDER_NAME = 'docker'
BUILDPASSWORD = 'pass-docker' # Credential to authenticate buildworkers
DOCKER_PATH = '/data/docker'
c = BuildmasterConfig = {}
c['title'] = "Docker"
c['titleURL'] = "waterfall"
c['buildbotURL'] = "http://localhost:{0}/".format(PORT_WEB)
c['db'] = {'db_url':"sqlite:///state.sqlite"}
c['slaves'] = [BuildSlave('buildworker', BUILDPASSWORD)]
c['slavePortnum'] = PORT_MASTER
c['schedulers'] = [ForceScheduler(name='trigger',builderNames=[BUILDER_NAME])]
# Docker test command
test_cmd = """(
cd {0}/..; rm -rf docker-tmp; git clone docker docker-tmp;
cd docker-tmp; make test; exit_status=$?;
cd ..; rm -rf docker-tmp; exit $exit_status)""".format(DOCKER_PATH)
# Builder
factory = BuildFactory()
factory.addStep(ShellCommand(description='Docker',logEnviron=False,
usePTY=True,command=test_cmd))
c['builders'] = [BuilderConfig(name=BUILDER_NAME,slavenames=['buildworker'],
factory=factory)]
# Status
authz_cfg=authz.Authz(auth=auth.BasicAuth([(TEST_USER,TEST_PWD)]),
forceBuild='auth')
c['status'] = [html.WebStatus(http_port=PORT_WEB, authz=authz_cfg)]

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
'''Trigger buildbot docker test build
post-commit git hook designed to automatically trigger buildbot on
the provided vagrant docker VM.'''
import requests
USERNAME = 'buildbot'
PASSWORD = 'docker'
BASE_URL = 'http://localhost:8010'
path = lambda s: BASE_URL + '/' + s
try:
session = requests.session()
session.post(path('login'),data={'username':USERNAME,'passwd':PASSWORD})
session.post(path('builders/docker/force'),
data={'forcescheduler':'trigger','reason':'Test commit'})
except:
pass

32
buildbot/buildbot.pp Normal file
View File

@@ -0,0 +1,32 @@
node default {
$USER = 'vagrant'
$ROOT_PATH = '/data/buildbot'
$DOCKER_PATH = '/data/docker'
exec {'apt_update': command => '/usr/bin/apt-get update' }
Package { require => Exec['apt_update'] }
group {'puppet': ensure => 'present'}
# Install dependencies
Package { ensure => 'installed' }
package { ['python-dev','python-pip','supervisor','lxc','bsdtar','git','golang']: }
file{[ '/data' ]:
owner => $USER, group => $USER, ensure => 'directory' }
file {'/var/tmp/requirements.txt':
content => template('requirements.txt') }
exec {'requirements':
require => [ Package['python-dev'], Package['python-pip'],
File['/var/tmp/requirements.txt'] ],
cwd => '/var/tmp',
command => "/bin/sh -c '(/usr/bin/pip install -r requirements.txt;
rm /var/tmp/requirements.txt)'" }
exec {'buildbot-cfg-sh':
require => [ Package['supervisor'], Exec['requirements']],
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
cwd => '/data',
command => "$DOCKER_PATH/buildbot/buildbot-cfg/buildbot-cfg.sh" }
}

View File

@@ -0,0 +1,6 @@
sqlalchemy<=0.7.9
sqlalchemy-migrate>=0.7.2
buildbot==0.8.7p1
buildbot_slave==0.8.7p1
nose==1.2.1
requests==1.1.0

169
builder.go Normal file
View File

@@ -0,0 +1,169 @@
package docker
import (
"bufio"
"fmt"
"io"
"strings"
)
type Builder struct {
runtime *Runtime
}
func NewBuilder(runtime *Runtime) *Builder {
return &Builder{
runtime: runtime,
}
}
func (builder *Builder) Run(image *Image, cmd ...string) (*Container, error) {
// FIXME: pass a NopWriter instead of nil
config, err := ParseRun(append([]string{"-d", image.Id}, cmd...), nil, builder.runtime.capabilities)
if config.Image == "" {
return nil, fmt.Errorf("Image not specified")
}
if len(config.Cmd) == 0 {
return nil, fmt.Errorf("Command not specified")
}
if config.Tty {
return nil, fmt.Errorf("The tty mode is not supported within the builder")
}
// Create new container
container, err := builder.runtime.Create(config)
if err != nil {
return nil, err
}
if err := container.Start(); err != nil {
return nil, err
}
return container, nil
}
func (builder *Builder) Commit(container *Container, repository, tag, comment, author string) (*Image, error) {
return builder.runtime.Commit(container.Id, repository, tag, comment, author)
}
func (builder *Builder) clearTmp(containers, images map[string]struct{}) {
for c := range containers {
tmp := builder.runtime.Get(c)
builder.runtime.Destroy(tmp)
Debugf("Removing container %s", c)
}
for i := range images {
builder.runtime.graph.Delete(i)
Debugf("Removing image %s", i)
}
}
func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) error {
var (
image, base *Image
tmpContainers map[string]struct{} = make(map[string]struct{})
tmpImages map[string]struct{} = make(map[string]struct{})
)
defer builder.clearTmp(tmpContainers, tmpImages)
file := bufio.NewReader(dockerfile)
for {
line, err := file.ReadString('\n')
if err != nil {
if err == io.EOF {
break
}
return err
}
line = strings.TrimSpace(line)
// Skip comments and empty line
if len(line) == 0 || line[0] == '#' {
continue
}
tmp := strings.SplitN(line, " ", 2)
if len(tmp) != 2 {
return fmt.Errorf("Invalid Dockerfile format")
}
switch tmp[0] {
case "from":
fmt.Fprintf(stdout, "FROM %s\n", tmp[1])
image, err = builder.runtime.repositories.LookupImage(tmp[1])
if err != nil {
return err
}
break
case "run":
fmt.Fprintf(stdout, "RUN %s\n", tmp[1])
if image == nil {
return fmt.Errorf("Please provide a source image with `from` prior to run")
}
// Create the container and start it
c, err := builder.Run(image, "/bin/sh", "-c", tmp[1])
if err != nil {
return err
}
tmpContainers[c.Id] = struct{}{}
// Wait for it to finish
if result := c.Wait(); result != 0 {
return fmt.Errorf("!!! '%s' return non-zero exit code '%d'. Aborting.", tmp[1], result)
}
// Commit the container
base, err = builder.Commit(c, "", "", "", "")
if err != nil {
return err
}
tmpImages[base.Id] = struct{}{}
fmt.Fprintf(stdout, "===> %s\n", base.ShortId())
break
case "copy":
if image == nil {
return fmt.Errorf("Please provide a source image with `from` prior to copy")
}
tmp2 := strings.SplitN(tmp[1], " ", 2)
if len(tmp) != 2 {
return fmt.Errorf("Invalid COPY format")
}
fmt.Fprintf(stdout, "COPY %s to %s in %s\n", tmp2[0], tmp2[1], base.ShortId())
file, err := Download(tmp2[0], stdout)
if err != nil {
return err
}
defer file.Body.Close()
c, err := builder.Run(base, "echo", "insert", tmp2[0], tmp2[1])
if err != nil {
return err
}
if err := c.Inject(file.Body, tmp2[1]); err != nil {
return err
}
base, err = builder.Commit(c, "", "", "", "")
if err != nil {
return err
}
fmt.Fprintf(stdout, "===> %s\n", base.ShortId())
break
default:
fmt.Fprintf(stdout, "Skipping unknown op %s\n", tmp[0])
}
}
if base != nil {
// The build is successful, keep the temporary containers and images
for i := range tmpImages {
delete(tmpImages, i)
}
for i := range tmpContainers {
delete(tmpContainers, i)
}
fmt.Fprintf(stdout, "Build finished. image id: %s\n", base.ShortId())
} else {
fmt.Fprintf(stdout, "An error occured during the build\n")
}
return nil
}

View File

@@ -1,4 +1,4 @@
package fs
package docker
import (
"fmt"
@@ -33,24 +33,15 @@ func (change *Change) String() string {
return fmt.Sprintf("%s %s", kind, change.Path)
}
func (store *Store) Changes(mp *Mountpoint) ([]Change, error) {
func Changes(layers []string, rw string) ([]Change, error) {
var changes []Change
image, err := store.Get(mp.Image)
if err != nil {
return nil, err
}
layers, err := image.layers()
if err != nil {
return nil, err
}
err = filepath.Walk(mp.Rw, func(path string, f os.FileInfo, err error) error {
err := filepath.Walk(rw, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
// Rebase path
path, err = filepath.Rel(mp.Rw, path)
path, err = filepath.Rel(rw, path)
if err != nil {
return err
}
@@ -113,15 +104,3 @@ func (store *Store) Changes(mp *Mountpoint) ([]Change, error) {
}
return changes, nil
}
// Reset removes all changes to the filesystem, reverting it to its initial state.
func (mp *Mountpoint) Reset() error {
if err := os.RemoveAll(mp.Rw); err != nil {
return err
}
// We removed the RW directory itself along with its content: let's re-create an empty one.
if err := mp.createFolders(); err != nil {
return err
}
return nil
}

File diff suppressed because it is too large Load Diff

397
commands_test.go Normal file
View File

@@ -0,0 +1,397 @@
package docker
import (
"bufio"
"fmt"
"github.com/dotcloud/docker/rcli"
"io"
"io/ioutil"
"strings"
"testing"
"time"
)
func closeWrap(args ...io.Closer) error {
e := false
ret := fmt.Errorf("Error closing elements")
for _, c := range args {
if err := c.Close(); err != nil {
e = true
ret = fmt.Errorf("%s\n%s", ret, err)
}
}
if e {
return ret
}
return nil
}
func setTimeout(t *testing.T, msg string, d time.Duration, f func()) {
c := make(chan bool)
// Make sure we are not too long
go func() {
time.Sleep(d)
c <- true
}()
go func() {
f()
c <- false
}()
if <-c {
t.Fatal(msg)
}
}
func assertPipe(input, output string, r io.Reader, w io.Writer, count int) error {
for i := 0; i < count; i++ {
if _, err := w.Write([]byte(input)); err != nil {
return err
}
o, err := bufio.NewReader(r).ReadString('\n')
if err != nil {
return err
}
if strings.Trim(o, " \r\n") != output {
return fmt.Errorf("Unexpected output. Expected [%s], received [%s]", output, o)
}
}
return nil
}
func cmdWait(srv *Server, container *Container) error {
stdout, stdoutPipe := io.Pipe()
go func() {
srv.CmdWait(nil, stdoutPipe, container.Id)
}()
if _, err := bufio.NewReader(stdout).ReadString('\n'); err != nil {
return err
}
// Cleanup pipes
return closeWrap(stdout, stdoutPipe)
}
// TestRunHostname checks that 'docker run -h' correctly sets a custom hostname
func TestRunHostname(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
stdin, _ := io.Pipe()
stdout, stdoutPipe := io.Pipe()
c := make(chan struct{})
go func() {
if err := srv.CmdRun(stdin, rcli.NewDockerLocalConn(stdoutPipe), "-h", "foobar", GetTestImage(runtime).Id, "hostname"); err != nil {
t.Fatal(err)
}
close(c)
}()
cmdOutput, err := bufio.NewReader(stdout).ReadString('\n')
if err != nil {
t.Fatal(err)
}
if cmdOutput != "foobar\n" {
t.Fatalf("'hostname' should display '%s', not '%s'", "foobar\n", cmdOutput)
}
setTimeout(t, "CmdRun timed out", 2*time.Second, func() {
<-c
cmdWait(srv, srv.runtime.List()[0])
})
}
func TestRunExit(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()
c1 := make(chan struct{})
go func() {
srv.CmdRun(stdin, rcli.NewDockerLocalConn(stdoutPipe), "-i", GetTestImage(runtime).Id, "/bin/cat")
close(c1)
}()
setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
t.Fatal(err)
}
})
container := runtime.List()[0]
// Closing /bin/cat stdin, expect it to exit
p, err := container.StdinPipe()
if err != nil {
t.Fatal(err)
}
if err := p.Close(); err != nil {
t.Fatal(err)
}
// as the process exited, CmdRun must finish and unblock. Wait for it
setTimeout(t, "Waiting for CmdRun timed out", 2*time.Second, func() {
<-c1
cmdWait(srv, container)
})
// Make sure that the client has been disconnected
setTimeout(t, "The client should have been disconnected once the remote process exited.", 2*time.Second, func() {
// Expecting pipe i/o error, just check that read does not block
stdin.Read([]byte{})
})
// Cleanup pipes
if err := closeWrap(stdin, stdinPipe, stdout, stdoutPipe); err != nil {
t.Fatal(err)
}
}
// Expected behaviour: the process dies when the client disconnects
func TestRunDisconnect(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()
c1 := make(chan struct{})
go func() {
// We're simulating a disconnect so the return value doesn't matter. What matters is the
// fact that CmdRun returns.
srv.CmdRun(stdin, rcli.NewDockerLocalConn(stdoutPipe), "-i", GetTestImage(runtime).Id, "/bin/cat")
close(c1)
}()
setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
t.Fatal(err)
}
})
// Close pipes (simulate disconnect)
if err := closeWrap(stdin, stdinPipe, stdout, stdoutPipe); err != nil {
t.Fatal(err)
}
// as the pipes are close, we expect the process to die,
// therefore CmdRun to unblock. Wait for CmdRun
setTimeout(t, "Waiting for CmdRun timed out", 2*time.Second, func() {
<-c1
})
// Client disconnect after run -i should cause stdin to be closed, which should
// cause /bin/cat to exit.
setTimeout(t, "Waiting for /bin/cat to exit timed out", 2*time.Second, func() {
container := runtime.List()[0]
container.Wait()
if container.State.Running {
t.Fatalf("/bin/cat is still running after closing stdin")
}
})
}
// Expected behaviour: the process dies when the client disconnects
func TestRunDisconnectTty(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()
c1 := make(chan struct{})
go func() {
// We're simulating a disconnect so the return value doesn't matter. What matters is the
// fact that CmdRun returns.
srv.CmdRun(stdin, rcli.NewDockerLocalConn(stdoutPipe), "-i", "-t", GetTestImage(runtime).Id, "/bin/cat")
close(c1)
}()
setTimeout(t, "Waiting for the container to be started timed out", 2*time.Second, func() {
for {
// Client disconnect after run -i should keep stdin out in TTY mode
l := runtime.List()
if len(l) == 1 && l[0].State.Running {
break
}
time.Sleep(10 * time.Millisecond)
}
})
// Client disconnect after run -i should keep stdin out in TTY mode
container := runtime.List()[0]
setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
t.Fatal(err)
}
})
// Close pipes (simulate disconnect)
if err := closeWrap(stdin, stdinPipe, stdout, stdoutPipe); err != nil {
t.Fatal(err)
}
// In tty mode, we expect the process to stay alive even after client's stdin closes.
// Do not wait for run to finish
// Give some time to monitor to do his thing
container.WaitTimeout(500 * time.Millisecond)
if !container.State.Running {
t.Fatalf("/bin/cat should still be running after closing stdin (tty mode)")
}
}
// TestAttachStdin checks attaching to stdin without stdout and stderr.
// 'docker run -i -a stdin' should sends the client's stdin to the command,
// then detach from it and print the container id.
func TestRunAttachStdin(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()
ch := make(chan struct{})
go func() {
srv.CmdRun(stdin, rcli.NewDockerLocalConn(stdoutPipe), "-i", "-a", "stdin", GetTestImage(runtime).Id, "sh", "-c", "echo hello; cat")
close(ch)
}()
// Send input to the command, close stdin
setTimeout(t, "Write timed out", 2*time.Second, func() {
if _, err := stdinPipe.Write([]byte("hi there\n")); err != nil {
t.Fatal(err)
}
if err := stdinPipe.Close(); err != nil {
t.Fatal(err)
}
})
container := runtime.List()[0]
// Check output
cmdOutput, err := bufio.NewReader(stdout).ReadString('\n')
if err != nil {
t.Fatal(err)
}
if cmdOutput != container.ShortId()+"\n" {
t.Fatalf("Wrong output: should be '%s', not '%s'\n", container.ShortId()+"\n", cmdOutput)
}
// wait for CmdRun to return
setTimeout(t, "Waiting for CmdRun timed out", 2*time.Second, func() {
<-ch
})
setTimeout(t, "Waiting for command to exit timed out", 2*time.Second, func() {
container.Wait()
})
// Check logs
if cmdLogs, err := container.ReadLog("stdout"); err != nil {
t.Fatal(err)
} else {
if output, err := ioutil.ReadAll(cmdLogs); err != nil {
t.Fatal(err)
} else {
expectedLog := "hello\nhi there\n"
if string(output) != expectedLog {
t.Fatalf("Unexpected logs: should be '%s', not '%s'\n", expectedLog, output)
}
}
}
}
// Expected behaviour, the process stays alive when the client disconnects
func TestAttachDisconnect(t *testing.T) {
runtime, err := newTestRuntime()
if err != nil {
t.Fatal(err)
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
container, err := runtime.Create(
&Config{
Image: GetTestImage(runtime).Id,
Memory: 33554432,
Cmd: []string{"/bin/cat"},
OpenStdin: true,
},
)
if err != nil {
t.Fatal(err)
}
defer runtime.Destroy(container)
// Start the process
if err := container.Start(); err != nil {
t.Fatal(err)
}
stdin, stdinPipe := io.Pipe()
stdout, stdoutPipe := io.Pipe()
// Attach to it
c1 := make(chan struct{})
go func() {
// We're simulating a disconnect so the return value doesn't matter. What matters is the
// fact that CmdAttach returns.
srv.CmdAttach(stdin, rcli.NewDockerLocalConn(stdoutPipe), container.Id)
close(c1)
}()
setTimeout(t, "First read/write assertion timed out", 2*time.Second, func() {
if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
t.Fatal(err)
}
})
// Close pipes (client disconnects)
if err := closeWrap(stdin, stdinPipe, stdout, stdoutPipe); err != nil {
t.Fatal(err)
}
// Wait for attach to finish, the client disconnected, therefore, Attach finished his job
setTimeout(t, "Waiting for CmdAttach timed out", 2*time.Second, func() {
<-c1
})
// We closed stdin, expect /bin/cat to still be running
// Wait a little bit to make sure container.monitor() did his thing
err = container.WaitTimeout(500 * time.Millisecond)
if err == nil || !container.State.Running {
t.Fatalf("/bin/cat is not running after closing stdin")
}
// Try to avoid the timeoout in destroy. Best effort, don't check error
cStdin, _ := container.StdinPipe()
cStdin.Close()
}

View File

@@ -2,8 +2,8 @@ package docker
import (
"encoding/json"
"errors"
"github.com/dotcloud/docker/fs"
"fmt"
"github.com/dotcloud/docker/rcli"
"github.com/kr/pty"
"io"
"io/ioutil"
@@ -11,162 +11,178 @@ import (
"os"
"os/exec"
"path"
"sort"
"strconv"
"strings"
"syscall"
"time"
)
var sysInitPath string
func init() {
sysInitPath = SelfPath()
}
type Container struct {
Id string
Root string
root string
Id string
Created time.Time
Path string
Args []string
Config *Config
Mountpoint *fs.Mountpoint
State *State
Image string
Config *Config
State State
Image string
network *NetworkInterface
networkManager *NetworkManager
NetworkSettings *NetworkSettings
SysInitPath string
lxcConfigPath string
cmd *exec.Cmd
stdout *writeBroadcaster
stderr *writeBroadcaster
stdin io.ReadCloser
stdinPipe io.WriteCloser
SysInitPath string
ResolvConfPath string
stdoutLog *os.File
stderrLog *os.File
cmd *exec.Cmd
stdout *writeBroadcaster
stderr *writeBroadcaster
stdin io.ReadCloser
stdinPipe io.WriteCloser
ptyMaster io.Closer
runtime *Runtime
waitLock chan struct{}
}
type Config struct {
Hostname string
User string
Memory int64 // Memory limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1' to disable swap
Ports []int
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
OpenStdin bool // Open stdin
Hostname string
User string
Memory int64 // Memory limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1' to disable swap
AttachStdin bool
AttachStdout bool
AttachStderr bool
PortSpecs []string
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
OpenStdin bool // Open stdin
StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
Env []string
Cmd []string
Dns []string
Image string // Name of the image as it was passed by the operator (eg. could be symbolic)
}
func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Config, error) {
cmd := rcli.Subcmd(stdout, "run", "[OPTIONS] IMAGE COMMAND [ARG...]", "Run a command in a new container")
if len(args) > 0 && args[0] != "--help" {
cmd.SetOutput(ioutil.Discard)
}
flHostname := cmd.String("h", "", "Container host name")
flUser := cmd.String("u", "", "Username or UID")
flDetach := cmd.Bool("d", false, "Detached mode: leave the container running in the background")
flAttach := NewAttachOpts()
cmd.Var(flAttach, "a", "Attach to stdin, stdout or stderr.")
flStdin := cmd.Bool("i", false, "Keep stdin open even if not attached")
flTty := cmd.Bool("t", false, "Allocate a pseudo-tty")
flMemory := cmd.Int64("m", 0, "Memory limit (in bytes)")
if *flMemory > 0 && !capabilities.MemoryLimit {
fmt.Fprintf(stdout, "WARNING: Your kernel does not support memory limit capabilities. Limitation discarded.\n")
*flMemory = 0
}
var flPorts ListOpts
cmd.Var(&flPorts, "p", "Expose a container's port to the host (use 'docker port' to see the actual mapping)")
var flEnv ListOpts
cmd.Var(&flEnv, "e", "Set environment variables")
var flDns ListOpts
cmd.Var(&flDns, "dns", "Set custom dns servers")
if err := cmd.Parse(args); err != nil {
return nil, err
}
if *flDetach && len(flAttach) > 0 {
return nil, fmt.Errorf("Conflicting options: -a and -d")
}
// If neither -d or -a are set, attach to everything by default
if len(flAttach) == 0 && !*flDetach {
if !*flDetach {
flAttach.Set("stdout")
flAttach.Set("stderr")
if *flStdin {
flAttach.Set("stdin")
}
}
}
parsedArgs := cmd.Args()
runCmd := []string{}
image := ""
if len(parsedArgs) >= 1 {
image = cmd.Arg(0)
}
if len(parsedArgs) > 1 {
runCmd = parsedArgs[1:]
}
config := &Config{
Hostname: *flHostname,
PortSpecs: flPorts,
User: *flUser,
Tty: *flTty,
OpenStdin: *flStdin,
Memory: *flMemory,
AttachStdin: flAttach.Get("stdin"),
AttachStdout: flAttach.Get("stdout"),
AttachStderr: flAttach.Get("stderr"),
Env: flEnv,
Cmd: runCmd,
Dns: flDns,
Image: image,
}
if *flMemory > 0 && !capabilities.SwapLimit {
fmt.Fprintf(stdout, "WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.\n")
config.MemorySwap = -1
}
// When allocating stdin in attached mode, close stdin at client disconnect
if config.OpenStdin && config.AttachStdin {
config.StdinOnce = true
}
return config, nil
}
type NetworkSettings struct {
IpAddress string
IpPrefixLen int
Gateway string
Bridge string
PortMapping map[string]string
}
func createContainer(id string, root string, command string, args []string, image *fs.Image, config *Config, netManager *NetworkManager) (*Container, error) {
mountpoint, err := image.Mountpoint(path.Join(root, "rootfs"), path.Join(root, "rw"))
if err != nil {
return nil, err
// String returns a human-readable description of the port mapping defined in the settings
func (settings *NetworkSettings) PortMappingHuman() string {
var mapping []string
for private, public := range settings.PortMapping {
mapping = append(mapping, fmt.Sprintf("%s->%s", public, private))
}
container := &Container{
Id: id,
Root: root,
Created: time.Now(),
Path: command,
Args: args,
Config: config,
Image: image.Id,
Mountpoint: mountpoint,
State: newState(),
networkManager: netManager,
NetworkSettings: &NetworkSettings{},
SysInitPath: sysInitPath,
lxcConfigPath: path.Join(root, "config.lxc"),
stdout: newWriteBroadcaster(),
stderr: newWriteBroadcaster(),
}
if err := os.Mkdir(root, 0700); err != nil {
return nil, err
}
// Setup logging of stdout and stderr to disk
if stdoutLog, err := os.OpenFile(path.Join(container.Root, id+"-stdout.log"), os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600); err != nil {
return nil, err
} else {
container.stdoutLog = stdoutLog
}
if stderrLog, err := os.OpenFile(path.Join(container.Root, id+"-stderr.log"), os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600); err != nil {
return nil, err
} else {
container.stderrLog = stderrLog
}
if container.Config.OpenStdin {
container.stdin, container.stdinPipe = io.Pipe()
} else {
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
}
container.stdout.AddWriter(NopWriteCloser(container.stdoutLog))
container.stderr.AddWriter(NopWriteCloser(container.stderrLog))
if err := container.save(); err != nil {
return nil, err
}
return container, nil
sort.Strings(mapping)
return strings.Join(mapping, ", ")
}
func loadContainer(store *fs.Store, containerPath string, netManager *NetworkManager) (*Container, error) {
data, err := ioutil.ReadFile(path.Join(containerPath, "config.json"))
// Inject the io.Reader at the given path. Note: do not close the reader
func (container *Container) Inject(file io.Reader, pth string) error {
// Make sure the directory exists
if err := os.MkdirAll(path.Join(container.rwPath(), path.Dir(pth)), 0755); err != nil {
return err
}
// FIXME: Handle permissions/already existing dest
dest, err := os.Create(path.Join(container.rwPath(), pth))
if err != nil {
return nil, err
return err
}
mountpoint, err := store.FetchMountpoint(
path.Join(containerPath, "rootfs"),
path.Join(containerPath, "rw"),
)
if err != nil {
return nil, err
} else if mountpoint == nil {
return nil, errors.New("Couldn't load container: unregistered mountpoint.")
if _, err := io.Copy(dest, file); err != nil {
return err
}
container := &Container{
stdout: newWriteBroadcaster(),
stderr: newWriteBroadcaster(),
lxcConfigPath: path.Join(containerPath, "config.lxc"),
networkManager: netManager,
NetworkSettings: &NetworkSettings{},
Mountpoint: mountpoint,
}
// Load container settings
if err := json.Unmarshal(data, container); err != nil {
return nil, err
}
// Setup logging of stdout and stderr to disk
if stdoutLog, err := os.OpenFile(path.Join(container.Root, container.Id+"-stdout.log"), os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600); err != nil {
return nil, err
} else {
container.stdoutLog = stdoutLog
}
if stderrLog, err := os.OpenFile(path.Join(container.Root, container.Id+"-stderr.log"), os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600); err != nil {
return nil, err
} else {
container.stderrLog = stderrLog
}
container.stdout.AddWriter(NopWriteCloser(container.stdoutLog))
container.stderr.AddWriter(NopWriteCloser(container.stderrLog))
if container.Config.OpenStdin {
container.stdin, container.stdinPipe = io.Pipe()
} else {
container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
}
container.State = newState()
return container, nil
return nil
}
func (container *Container) Cmd() *exec.Cmd {
@@ -177,64 +193,32 @@ func (container *Container) When() time.Time {
return container.Created
}
func (container *Container) loadUserData() (map[string]string, error) {
jsonData, err := ioutil.ReadFile(path.Join(container.Root, "userdata.json"))
if err != nil {
if os.IsNotExist(err) {
return make(map[string]string), nil
}
return nil, err
}
data := make(map[string]string)
if err := json.Unmarshal(jsonData, &data); err != nil {
return nil, err
}
return data, nil
}
func (container *Container) saveUserData(data map[string]string) error {
jsonData, err := json.Marshal(data)
func (container *Container) FromDisk() error {
data, err := ioutil.ReadFile(container.jsonPath())
if err != nil {
return err
}
return ioutil.WriteFile(path.Join(container.Root, "userdata.json"), jsonData, 0700)
}
func (container *Container) SetUserData(key, value string) error {
data, err := container.loadUserData()
if err != nil {
// Load container settings
if err := json.Unmarshal(data, container); err != nil {
return err
}
data[key] = value
return container.saveUserData(data)
return nil
}
func (container *Container) GetUserData(key string) string {
data, err := container.loadUserData()
if err != nil {
return ""
}
if value, exists := data[key]; exists {
return value
}
return ""
}
func (container *Container) save() (err error) {
func (container *Container) ToDisk() (err error) {
data, err := json.Marshal(container)
if err != nil {
return
}
return ioutil.WriteFile(path.Join(container.Root, "config.json"), data, 0666)
return ioutil.WriteFile(container.jsonPath(), data, 0666)
}
func (container *Container) generateLXCConfig() error {
fo, err := os.Create(container.lxcConfigPath)
fo, err := os.Create(container.lxcConfigPath())
if err != nil {
return err
}
defer fo.Close()
if err := LxcTemplateCompiled.Execute(fo, container); err != nil {
return err
}
@@ -242,53 +226,37 @@ func (container *Container) generateLXCConfig() error {
}
func (container *Container) startPty() error {
stdout_master, stdout_slave, err := pty.Open()
ptyMaster, ptySlave, err := pty.Open()
if err != nil {
return err
}
container.cmd.Stdout = stdout_slave
stderr_master, stderr_slave, err := pty.Open()
if err != nil {
return err
}
container.cmd.Stderr = stderr_slave
container.ptyMaster = ptyMaster
container.cmd.Stdout = ptySlave
container.cmd.Stderr = ptySlave
// Copy the PTYs to our broadcasters
go func() {
defer container.stdout.Close()
io.Copy(container.stdout, stdout_master)
}()
go func() {
defer container.stderr.Close()
io.Copy(container.stderr, stderr_master)
defer container.stdout.CloseWriters()
Debugf("[startPty] Begin of stdout pipe")
io.Copy(container.stdout, ptyMaster)
Debugf("[startPty] End of stdout pipe")
}()
// stdin
var stdin_slave io.ReadCloser
if container.Config.OpenStdin {
stdin_master, stdin_slave, err := pty.Open()
if err != nil {
return err
}
container.cmd.Stdin = stdin_slave
// FIXME: The following appears to be broken.
// "cannot set terminal process group (-1): Inappropriate ioctl for device"
// container.cmd.SysProcAttr = &syscall.SysProcAttr{Setctty: true, Setsid: true}
container.cmd.Stdin = ptySlave
container.cmd.SysProcAttr = &syscall.SysProcAttr{Setctty: true, Setsid: true}
go func() {
defer container.stdin.Close()
io.Copy(stdin_master, container.stdin)
Debugf("[startPty] Begin of stdin pipe")
io.Copy(ptyMaster, container.stdin)
Debugf("[startPty] End of stdin pipe")
}()
}
if err := container.cmd.Start(); err != nil {
return err
}
stdout_slave.Close()
stderr_slave.Close()
if stdin_slave != nil {
stdin_slave.Close()
}
ptySlave.Close()
return nil
}
@@ -302,25 +270,154 @@ func (container *Container) start() error {
}
go func() {
defer stdin.Close()
Debugf("Begin of stdin pipe [start]")
io.Copy(stdin, container.stdin)
Debugf("End of stdin pipe [start]")
}()
}
return container.cmd.Start()
}
func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error {
var cStdout, cStderr io.ReadCloser
var nJobs int
errors := make(chan error, 3)
if stdin != nil && container.Config.OpenStdin {
nJobs += 1
if cStdin, err := container.StdinPipe(); err != nil {
errors <- err
} else {
go func() {
Debugf("[start] attach stdin\n")
defer Debugf("[end] attach stdin\n")
// No matter what, when stdin is closed (io.Copy unblock), close stdout and stderr
if cStdout != nil {
defer cStdout.Close()
}
if cStderr != nil {
defer cStderr.Close()
}
if container.Config.StdinOnce && !container.Config.Tty {
defer cStdin.Close()
}
if container.Config.Tty {
_, err = CopyEscapable(cStdin, stdin)
} else {
_, err = io.Copy(cStdin, stdin)
}
if err != nil {
Debugf("[error] attach stdin: %s\n", err)
}
// Discard error, expecting pipe error
errors <- nil
}()
}
}
if stdout != nil {
nJobs += 1
if p, err := container.StdoutPipe(); err != nil {
errors <- err
} else {
cStdout = p
go func() {
Debugf("[start] attach stdout\n")
defer Debugf("[end] attach stdout\n")
// If we are in StdinOnce mode, then close stdin
if container.Config.StdinOnce {
if stdin != nil {
defer stdin.Close()
}
if stdinCloser != nil {
defer stdinCloser.Close()
}
}
_, err := io.Copy(stdout, cStdout)
if err != nil {
Debugf("[error] attach stdout: %s\n", err)
}
errors <- err
}()
}
}
if stderr != nil {
nJobs += 1
if p, err := container.StderrPipe(); err != nil {
errors <- err
} else {
cStderr = p
go func() {
Debugf("[start] attach stderr\n")
defer Debugf("[end] attach stderr\n")
// If we are in StdinOnce mode, then close stdin
if container.Config.StdinOnce {
if stdin != nil {
defer stdin.Close()
}
if stdinCloser != nil {
defer stdinCloser.Close()
}
}
_, err := io.Copy(stderr, cStderr)
if err != nil {
Debugf("[error] attach stderr: %s\n", err)
}
errors <- err
}()
}
}
return Go(func() error {
if cStdout != nil {
defer cStdout.Close()
}
if cStderr != nil {
defer cStderr.Close()
}
// FIXME: how do clean up the stdin goroutine without the unwanted side effect
// of closing the passed stdin? Add an intermediary io.Pipe?
for i := 0; i < nJobs; i += 1 {
Debugf("Waiting for job %d/%d\n", i+1, nJobs)
if err := <-errors; err != nil {
Debugf("Job %d returned error %s. Aborting all jobs\n", i+1, err)
return err
}
Debugf("Job %d completed successfully\n", i+1)
}
Debugf("All jobs completed successfully\n")
return nil
})
}
func (container *Container) Start() error {
if err := container.Mountpoint.EnsureMounted(); err != nil {
container.State.lock()
defer container.State.unlock()
if container.State.Running {
return fmt.Errorf("The container %s is already running.", container.Id)
}
if err := container.EnsureMounted(); err != nil {
return err
}
if err := container.allocateNetwork(); err != nil {
return err
}
// Make sure the config is compatible with the current kernel
if container.Config.Memory > 0 && !container.runtime.capabilities.MemoryLimit {
log.Printf("WARNING: Your kernel does not support memory limit capabilities. Limitation discarded.\n")
container.Config.Memory = 0
}
if container.Config.Memory > 0 && !container.runtime.capabilities.SwapLimit {
log.Printf("WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.\n")
container.Config.MemorySwap = -1
}
if err := container.generateLXCConfig(); err != nil {
return err
}
params := []string{
"-n", container.Id,
"-f", container.lxcConfigPath,
"-f", container.lxcConfigPath(),
"--",
"/sbin/init",
}
@@ -333,11 +430,33 @@ func (container *Container) Start() error {
params = append(params, "-u", container.Config.User)
}
if container.Config.Tty {
params = append(params, "-e", "TERM=xterm")
}
// Setup environment
params = append(params,
"-e", "HOME=/",
"-e", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
)
for _, elem := range container.Config.Env {
params = append(params, "-e", elem)
}
// Program
params = append(params, "--", container.Path)
params = append(params, container.Args...)
container.cmd = exec.Command("/usr/bin/lxc-start", params...)
container.cmd = exec.Command("lxc-start", params...)
// Setup logging of stdout and stderr to disk
if err := container.runtime.LogToDisk(container.stdout, container.logPath("stdout")); err != nil {
return err
}
if err := container.runtime.LogToDisk(container.stderr, container.logPath("stderr")); err != nil {
return err
}
var err error
if container.Config.Tty {
@@ -348,8 +467,13 @@ func (container *Container) Start() error {
if err != nil {
return err
}
// FIXME: save state on disk *first*, then converge
// this way disk state is used as a journal, eg. we can restore after crash etc.
container.State.setRunning(container.cmd.Process.Pid)
container.save()
// Init the lock
container.waitLock = make(chan struct{})
container.ToDisk()
go container.monitor()
return nil
}
@@ -389,68 +513,98 @@ func (container *Container) StdoutPipe() (io.ReadCloser, error) {
return newBufReader(reader), nil
}
func (container *Container) StdoutLog() io.Reader {
r, err := os.Open(container.stdoutLog.Name())
if err != nil {
return nil
}
return r
}
func (container *Container) StderrPipe() (io.ReadCloser, error) {
reader, writer := io.Pipe()
container.stderr.AddWriter(writer)
return newBufReader(reader), nil
}
func (container *Container) StderrLog() io.Reader {
r, err := os.Open(container.stderrLog.Name())
if err != nil {
return nil
}
return r
}
func (container *Container) allocateNetwork() error {
iface, err := container.networkManager.Allocate()
iface, err := container.runtime.networkManager.Allocate()
if err != nil {
return err
}
container.NetworkSettings.PortMapping = make(map[string]string)
for _, port := range container.Config.Ports {
if extPort, err := iface.AllocatePort(port); err != nil {
for _, spec := range container.Config.PortSpecs {
if nat, err := iface.AllocatePort(spec); err != nil {
iface.Release()
return err
} else {
container.NetworkSettings.PortMapping[strconv.Itoa(port)] = strconv.Itoa(extPort)
container.NetworkSettings.PortMapping[strconv.Itoa(nat.Backend)] = strconv.Itoa(nat.Frontend)
}
}
container.network = iface
container.NetworkSettings.Bridge = container.runtime.networkManager.bridgeIface
container.NetworkSettings.IpAddress = iface.IPNet.IP.String()
container.NetworkSettings.IpPrefixLen, _ = iface.IPNet.Mask.Size()
container.NetworkSettings.Gateway = iface.Gateway.String()
return nil
}
func (container *Container) releaseNetwork() error {
err := container.network.Release()
func (container *Container) releaseNetwork() {
container.network.Release()
container.network = nil
container.NetworkSettings = &NetworkSettings{}
return err
}
// FIXME: replace this with a control socket within docker-init
func (container *Container) waitLxc() error {
for {
if output, err := exec.Command("lxc-info", "-n", container.Id).CombinedOutput(); err != nil {
return err
} else {
if !strings.Contains(string(output), "RUNNING") {
return nil
}
}
time.Sleep(500 * time.Millisecond)
}
return nil
}
func (container *Container) monitor() {
// Wait for the program to exit
container.cmd.Wait()
exitCode := container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
Debugf("Waiting for process")
// If the command does not exists, try to wait via lxc
if container.cmd == nil {
if err := container.waitLxc(); err != nil {
Debugf("%s: Process: %s", container.Id, err)
}
} else {
if err := container.cmd.Wait(); err != nil {
// Discard the error as any signals or non 0 returns will generate an error
Debugf("%s: Process: %s", container.Id, err)
}
}
Debugf("Process finished")
var exitCode int = -1
if container.cmd != nil {
exitCode = container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
}
// Cleanup
if err := container.releaseNetwork(); err != nil {
log.Printf("%v: Failed to release network: %v", container.Id, err)
container.releaseNetwork()
if container.Config.OpenStdin {
if err := container.stdin.Close(); err != nil {
Debugf("%s: Error close stdin: %s", container.Id, err)
}
}
container.stdout.Close()
container.stderr.Close()
if err := container.Mountpoint.Umount(); err != nil {
if err := container.stdout.CloseWriters(); err != nil {
Debugf("%s: Error close stdout: %s", container.Id, err)
}
if err := container.stderr.CloseWriters(); err != nil {
Debugf("%s: Error close stderr: %s", container.Id, err)
}
if container.ptyMaster != nil {
if err := container.ptyMaster.Close(); err != nil {
Debugf("%s: Error closing Pty master: %s", container.Id, err)
}
}
if err := container.Unmount(); err != nil {
log.Printf("%v: Failed to umount filesystem: %v", container.Id, err)
}
@@ -461,51 +615,85 @@ func (container *Container) monitor() {
// Report status back
container.State.setStopped(exitCode)
container.save()
// Release the lock
close(container.waitLock)
if err := container.ToDisk(); err != nil {
// FIXME: there is a race condition here which causes this to fail during the unit tests.
// If another goroutine was waiting for Wait() to return before removing the container's root
// from the filesystem... At this point it may already have done so.
// This is because State.setStopped() has already been called, and has caused Wait()
// to return.
// FIXME: why are we serializing running state to disk in the first place?
//log.Printf("%s: Failed to dump configuration to the disk: %s", container.Id, err)
}
}
func (container *Container) kill() error {
if err := container.cmd.Process.Kill(); err != nil {
return err
if !container.State.Running {
return nil
}
// Sending SIGKILL to the process via lxc
output, err := exec.Command("lxc-kill", "-n", container.Id, "9").CombinedOutput()
if err != nil {
log.Printf("error killing container %s (%s, %s)", container.Id, output, err)
}
// 2. Wait for the process to die, in last resort, try to kill the process directly
if err := container.WaitTimeout(10 * time.Second); err != nil {
if container.cmd == nil {
return fmt.Errorf("lxc-kill failed, impossible to kill the container %s", container.Id)
}
log.Printf("Container %s failed to exit within 10 seconds of lxc SIGKILL - trying direct SIGKILL", container.Id)
if err := container.cmd.Process.Kill(); err != nil {
return err
}
}
// Wait for the container to be actually stopped
container.Wait()
return nil
}
func (container *Container) Kill() error {
container.State.lock()
defer container.State.unlock()
if !container.State.Running {
return nil
}
return container.kill()
}
func (container *Container) Stop() error {
func (container *Container) Stop(seconds int) error {
container.State.lock()
defer container.State.unlock()
if !container.State.Running {
return nil
}
// 1. Send a SIGTERM
if output, err := exec.Command("/usr/bin/lxc-kill", "-n", container.Id, "15").CombinedOutput(); err != nil {
log.Printf(string(output))
log.Printf("Failed to send SIGTERM to the process, force killing")
if err := container.Kill(); err != nil {
if output, err := exec.Command("lxc-kill", "-n", container.Id, "15").CombinedOutput(); err != nil {
log.Print(string(output))
log.Print("Failed to send SIGTERM to the process, force killing")
if err := container.kill(); err != nil {
return err
}
}
// 2. Wait for the process to exit on its own
if err := container.WaitTimeout(10 * time.Second); err != nil {
log.Printf("Container %v failed to exit within 10 seconds of SIGTERM - using the force", container.Id)
if err := container.Kill(); err != nil {
if err := container.WaitTimeout(time.Duration(seconds) * time.Second); err != nil {
log.Printf("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.Id, seconds)
if err := container.kill(); err != nil {
return err
}
}
return nil
}
func (container *Container) Restart() error {
if err := container.Stop(); err != nil {
func (container *Container) Restart(seconds int) error {
if err := container.Stop(seconds); err != nil {
return err
}
if err := container.Start(); err != nil {
@@ -516,13 +704,21 @@ func (container *Container) Restart() error {
// Wait blocks until the container stops running, then returns its exit code.
func (container *Container) Wait() int {
for container.State.Running {
container.State.wait()
}
<-container.waitLock
return container.State.ExitCode
}
func (container *Container) ExportRw() (Archive, error) {
return Tar(container.rwPath(), Uncompressed)
}
func (container *Container) Export() (Archive, error) {
if err := container.EnsureMounted(); err != nil {
return nil, err
}
return Tar(container.RootfsPath(), Uncompressed)
}
func (container *Container) WaitTimeout(timeout time.Duration) error {
done := make(chan bool)
go func() {
@@ -532,9 +728,89 @@ func (container *Container) WaitTimeout(timeout time.Duration) error {
select {
case <-time.After(timeout):
return errors.New("Timed Out")
return fmt.Errorf("Timed Out")
case <-done:
return nil
}
panic("unreachable")
}
func (container *Container) EnsureMounted() error {
if mounted, err := container.Mounted(); err != nil {
return err
} else if mounted {
return nil
}
return container.Mount()
}
func (container *Container) Mount() error {
image, err := container.GetImage()
if err != nil {
return err
}
return image.Mount(container.RootfsPath(), container.rwPath())
}
func (container *Container) Changes() ([]Change, error) {
image, err := container.GetImage()
if err != nil {
return nil, err
}
return image.Changes(container.rwPath())
}
func (container *Container) GetImage() (*Image, error) {
if container.runtime == nil {
return nil, fmt.Errorf("Can't get image of unregistered container")
}
return container.runtime.graph.Get(container.Image)
}
func (container *Container) Mounted() (bool, error) {
return Mounted(container.RootfsPath())
}
func (container *Container) Unmount() error {
return Unmount(container.RootfsPath())
}
// ShortId returns a shorthand version of the container's id for convenience.
// A collision with other container shorthands is very unlikely, but possible.
// In case of a collision a lookup with Runtime.Get() will fail, and the caller
// will need to use a langer prefix, or the full-length container Id.
func (container *Container) ShortId() string {
return TruncateId(container.Id)
}
func (container *Container) logPath(name string) string {
return path.Join(container.root, fmt.Sprintf("%s-%s.log", container.Id, name))
}
func (container *Container) ReadLog(name string) (io.Reader, error) {
return os.Open(container.logPath(name))
}
func (container *Container) jsonPath() string {
return path.Join(container.root, "config.json")
}
func (container *Container) lxcConfigPath() string {
return path.Join(container.root, "config.lxc")
}
// This method must be exported to be used from the lxc template
func (container *Container) RootfsPath() string {
return path.Join(container.root, "rootfs")
}
func (container *Container) rwPath() string {
return path.Join(container.root, "rw")
}
func validateId(id string) error {
if id == "" {
return fmt.Errorf("Invalid empty id")
}
return nil
}

File diff suppressed because it is too large Load Diff

96
contrib/crashTest.go Normal file
View File

@@ -0,0 +1,96 @@
package main
import (
"io"
"log"
"os"
"os/exec"
"time"
)
const DOCKER_PATH = "/home/creack/dotcloud/docker/docker/docker"
func runDaemon() (*exec.Cmd, error) {
os.Remove("/var/run/docker.pid")
cmd := exec.Command(DOCKER_PATH, "-d")
outPipe, err := cmd.StdoutPipe()
if err != nil {
return nil, err
}
errPipe, err := cmd.StderrPipe()
if err != nil {
return nil, err
}
if err := cmd.Start(); err != nil {
return nil, err
}
go func() {
io.Copy(os.Stdout, outPipe)
}()
go func() {
io.Copy(os.Stderr, errPipe)
}()
return cmd, nil
}
func crashTest() error {
if err := exec.Command("/bin/bash", "-c", "while true; do true; done").Start(); err != nil {
return err
}
for {
daemon, err := runDaemon()
if err != nil {
return err
}
// time.Sleep(5000 * time.Millisecond)
var stop bool
go func() error {
stop = false
for i := 0; i < 100 && !stop; i++ {
func() error {
cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world")
log.Printf("%d", i)
outPipe, err := cmd.StdoutPipe()
if err != nil {
return err
}
inPipe, err := cmd.StdinPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
go func() {
io.Copy(os.Stdout, outPipe)
}()
// Expecting error, do not check
inPipe.Write([]byte("hello world!!!!!\n"))
go inPipe.Write([]byte("hello world!!!!!\n"))
go inPipe.Write([]byte("hello world!!!!!\n"))
inPipe.Close()
if err := cmd.Wait(); err != nil {
return err
}
outPipe.Close()
return nil
}()
}
return nil
}()
time.Sleep(20 * time.Second)
stop = true
if err := daemon.Process.Kill(); err != nil {
return err
}
}
return nil
}
func main() {
if err := crashTest(); err != nil {
log.Println(err)
}
}

View File

@@ -0,0 +1,68 @@
# docker-build: build your software with docker
## Description
docker-build is a script to build docker images from source. It will be deprecated once the 'build' feature is incorporated into docker itself (See https://github.com/dotcloud/docker/issues/278)
Author: Solomon Hykes <solomon@dotcloud.com>
## Install
docker-builder requires:
1) A reasonably recent Python setup (tested on 2.7.2).
2) A running docker daemon at version 0.1.4 or more recent (http://www.docker.io/gettingstarted)
## Usage
First create a valid Changefile, which defines a sequence of changes to apply to a base image.
$ cat Changefile
# Start build from a know base image
from base:ubuntu-12.10
# Update ubuntu sources
run echo 'deb http://archive.ubuntu.com/ubuntu quantal main universe multiverse' > /etc/apt/sources.list
run apt-get update
# Install system packages
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q git
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang
# Insert files from the host (./myscript must be present in the current directory)
copy myscript /usr/local/bin/myscript
Run docker-build, and pass the contents of your Changefile as standard input.
$ IMG=$(./docker-build < Changefile)
This will take a while: for each line of the changefile, docker-build will:
1. Create a new container to execute the given command or insert the given file
2. Wait for the container to complete execution
3. Commit the resulting changes as a new image
4. Use the resulting image as the input of the next step
If all the steps succeed, the result will be an image containing the combined results of each build step.
You can trace back those build steps by inspecting the image's history:
$ docker history $IMG
ID CREATED CREATED BY
1e9e2045de86 A few seconds ago /bin/sh -c cat > /usr/local/bin/myscript; chmod +x /usr/local/bin/git
77db140aa62a A few seconds ago /bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang
77db140aa62a A few seconds ago /bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl
77db140aa62a A few seconds ago /bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -q git
83e85d155451 A few seconds ago /bin/sh -c apt-get update
bfd53b36d9d3 A few seconds ago /bin/sh -c echo 'deb http://archive.ubuntu.com/ubuntu quantal main universe multiverse' > /etc/apt/sources.list
base 2 weeks ago /bin/bash
27cf78414709 2 weeks ago
Note that your build started from 'base', as instructed by your Changefile. But that base image itself seems to have been built in 2 steps - hence the extra step in the history.
You can use this build technique to create any image you want: a database, a web application, or anything else that can be build by a sequence of unix commands - in other words, anything else.

104
contrib/docker-build/docker-build Executable file
View File

@@ -0,0 +1,104 @@
#!/usr/bin/env python
# docker-build is a script to build docker images from source.
# It will be deprecated once the 'build' feature is incorporated into docker itself.
# (See https://github.com/dotcloud/docker/issues/278)
#
# Author: Solomon Hykes <solomon@dotcloud.com>
# First create a valid Changefile, which defines a sequence of changes to apply to a base image.
#
# $ cat Changefile
# # Start build from a know base image
# from base:ubuntu-12.10
# # Update ubuntu sources
# run echo 'deb http://archive.ubuntu.com/ubuntu quantal main universe multiverse' > /etc/apt/sources.list
# run apt-get update
# # Install system packages
# run DEBIAN_FRONTEND=noninteractive apt-get install -y -q git
# run DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl
# run DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang
# # Insert files from the host (./myscript must be present in the current directory)
# copy myscript /usr/local/bin/myscript
#
#
# Run docker-build, and pass the contents of your Changefile as standard input.
#
# $ IMG=$(./docker-build < Changefile)
#
# This will take a while: for each line of the changefile, docker-build will:
#
# 1. Create a new container to execute the given command or insert the given file
# 2. Wait for the container to complete execution
# 3. Commit the resulting changes as a new image
# 4. Use the resulting image as the input of the next step
import sys
import subprocess
import json
import hashlib
def docker(args, stdin=None):
print "# docker " + " ".join(args)
p = subprocess.Popen(["docker"] + list(args), stdin=stdin, stdout=subprocess.PIPE)
return p.stdout
def image_exists(img):
return docker(["inspect", img]).read().strip() != ""
def run_and_commit(img_in, cmd, stdin=None):
run_id = docker(["run"] + (["-i", "-a", "stdin"] if stdin else ["-d"]) + [img_in, "/bin/sh", "-c", cmd], stdin=stdin).read().rstrip()
print "---> Waiting for " + run_id
result=int(docker(["wait", run_id]).read().rstrip())
if result != 0:
print "!!! '{}' return non-zero exit code '{}'. Aborting.".format(cmd, result)
sys.exit(1)
return docker(["commit", run_id]).read().rstrip()
def insert(base, src, dst):
print "COPY {} to {} in {}".format(src, dst, base)
if dst == "":
raise Exception("Missing destination path")
stdin = file(src)
stdin.seek(0)
return run_and_commit(base, "cat > {0}; chmod +x {0}".format(dst), stdin=stdin)
def main():
base=""
steps = []
try:
for line in sys.stdin.readlines():
line = line.strip()
# Skip comments and empty lines
if line == "" or line[0] == "#":
continue
op, param = line.split(" ", 1)
if op == "from":
print "FROM " + param
base = param
steps.append(base)
elif op == "run":
print "RUN " + param
result = run_and_commit(base, param)
steps.append(result)
base = result
print "===> " + base
elif op == "copy":
src, dst = param.split(" ", 1)
result = insert(base, src, dst)
steps.append(result)
base = result
print "===> " + base
else:
print "Skipping uknown op " + op
except:
docker(["rmi"] + steps[1:])
raise
print base
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,11 @@
# Start build from a know base image
from base:ubuntu-12.10
# Update ubuntu sources
run echo 'deb http://archive.ubuntu.com/ubuntu quantal main universe multiverse' > /etc/apt/sources.list
run apt-get update
# Install system packages
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q git
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl
run DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang
# Insert files from the host (./myscript must be present in the current directory)
copy myscript /usr/local/bin/myscript

View File

@@ -45,7 +45,7 @@ then
echo "Upstart script already exists."
else
echo "Creating /etc/init/dockerd.conf..."
echo "exec /usr/local/bin/docker -d" > /etc/init/dockerd.conf
echo "exec env LANG=\"en_US.UTF-8\" /usr/local/bin/docker -d" > /etc/init/dockerd.conf
fi
echo "Starting dockerd..."

View File

@@ -35,6 +35,5 @@ do
cp -a /dev/$X dev
done
tar -cf- . | docker put busybox
docker run -i -a -u root busybox /bin/echo Success.
tar -cf- . | docker import - busybox
docker run -i -u root busybox /bin/echo Success.

View File

@@ -0,0 +1,3 @@
# Vagrant-docker
This is a placeholder for the official vagrant-docker, a plugin for Vagrant (http://vagrantup.com) which exposes Docker as a provider.

View File

@@ -1 +0,0 @@
../Makefile

View File

@@ -1 +0,0 @@
../README.md

View File

@@ -1,5 +0,0 @@
dotcloud-docker (1) precise; urgency=low
* Initial release
-- dotCloud <ops@dotcloud.com> Mon, 14 Mar 2013 04:43:21 -0700

View File

@@ -1,20 +0,0 @@
Source: dotcloud-docker
Section: misc
Priority: extra
Homepage: https://github.com/dotcloud/docker
Maintainer: Daniel Mizyrycki <daniel@dotcloud.com>
Build-Depends: debhelper (>= 8.0.0), pkg-config, git, golang, libsqlite3-dev
Vcs-Git: https://github.com/dotcloud/docker.git
Standards-Version: 3.9.2
Package: dotcloud-docker
Architecture: amd64
Provides: dotcloud-docker
Depends: lxc, wget, bsdtar, curl, sqlite3
Conflicts: docker
Description: A process manager with superpowers
It encapsulates heterogeneous payloads in Standard Containers, and runs
them on any server with strong guarantees of isolation and repeatability.
Is is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment
systems, private PaaS, service-oriented architectures, etc.

View File

@@ -1,209 +0,0 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: dotcloud-docker
Source: https://github.com/dotcloud/docker
Files: *
Copyright: 2012 DotCloud Inc (opensource@dotcloud.com)
License: Apache License Version 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 (opensource@dotcloud.com)
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.

View File

@@ -1,10 +0,0 @@
description "Run docker"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
respawn
script
test -f /etc/default/locale && . /etc/default/locale || true
LANG=$LANG LC_ALL=$LANG /usr/bin/docker -d
end script

161
docker.go
View File

@@ -1,161 +0,0 @@
package docker
import (
"container/list"
"fmt"
"github.com/dotcloud/docker/fs"
"io/ioutil"
"log"
"os"
"path"
"sort"
)
type Docker struct {
root string
repository string
containers *list.List
networkManager *NetworkManager
Store *fs.Store
}
func (docker *Docker) List() []*Container {
containers := new(History)
for e := docker.containers.Front(); e != nil; e = e.Next() {
containers.Add(e.Value.(*Container))
}
return *containers
}
func (docker *Docker) getContainerElement(id string) *list.Element {
for e := docker.containers.Front(); e != nil; e = e.Next() {
container := e.Value.(*Container)
if container.Id == id {
return e
}
}
return nil
}
func (docker *Docker) Get(id string) *Container {
e := docker.getContainerElement(id)
if e == nil {
return nil
}
return e.Value.(*Container)
}
func (docker *Docker) Exists(id string) bool {
return docker.Get(id) != nil
}
func (docker *Docker) Create(id string, command string, args []string, image *fs.Image, config *Config) (*Container, error) {
if docker.Exists(id) {
return nil, fmt.Errorf("Container %v already exists", id)
}
root := path.Join(docker.repository, id)
container, err := createContainer(id, root, command, args, image, config, docker.networkManager)
if err != nil {
return nil, err
}
docker.containers.PushBack(container)
return container, nil
}
func (docker *Docker) Destroy(container *Container) error {
element := docker.getContainerElement(container.Id)
if element == nil {
return fmt.Errorf("Container %v not found - maybe it was already destroyed?", container.Id)
}
if err := container.Stop(); err != nil {
return err
}
if container.Mountpoint.Mounted() {
if err := container.Mountpoint.Umount(); err != nil {
return fmt.Errorf("Unable to umount container %v: %v", container.Id, err)
}
}
if err := container.Mountpoint.Deregister(); err != nil {
return fmt.Errorf("Unable to deregiser -- ? mountpoint %v: %v", container.Mountpoint.Root, err)
}
if err := os.RemoveAll(container.Root); err != nil {
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.Id, err)
}
docker.containers.Remove(element)
return nil
}
func (docker *Docker) restore() error {
dir, err := ioutil.ReadDir(docker.repository)
if err != nil {
return err
}
for _, v := range dir {
container, err := loadContainer(docker.Store, path.Join(docker.repository, v.Name()), docker.networkManager)
if err != nil {
log.Printf("Failed to load container %v: %v", v.Name(), err)
continue
}
docker.containers.PushBack(container)
}
return nil
}
func New() (*Docker, error) {
return NewFromDirectory("/var/lib/docker")
}
func NewFromDirectory(root string) (*Docker, error) {
docker_repo := path.Join(root, "containers")
if err := os.MkdirAll(docker_repo, 0700); err != nil && !os.IsExist(err) {
return nil, err
}
store, err := fs.New(path.Join(root, "images"))
if err != nil {
return nil, err
}
netManager, err := newNetworkManager(networkBridgeIface)
if err != nil {
return nil, err
}
docker := &Docker{
root: root,
repository: docker_repo,
containers: list.New(),
Store: store,
networkManager: netManager,
}
if err := docker.restore(); err != nil {
return nil, err
}
return docker, nil
}
type History []*Container
func (history *History) Len() int {
return len(*history)
}
func (history *History) Less(i, j int) bool {
containers := *history
return containers[j].When().Before(containers[i].When())
}
func (history *History) Swap(i, j int) {
containers := *history
tmp := containers[i]
containers[i] = containers[j]
containers[j] = tmp
}
func (history *History) Add(container *Container) {
*history = append(*history, container)
sort.Sort(history)
}

View File

@@ -2,13 +2,21 @@ package main
import (
"flag"
"fmt"
"github.com/dotcloud/docker"
"github.com/dotcloud/docker/future"
"github.com/dotcloud/docker/rcli"
"github.com/dotcloud/docker/term"
"io"
"io/ioutil"
"log"
"os"
"os/signal"
"strconv"
"syscall"
)
var (
GIT_COMMIT string
)
func main() {
@@ -17,14 +25,27 @@ func main() {
docker.SysInit()
return
}
fl_daemon := flag.Bool("d", false, "Daemon mode")
// FIXME: Switch d and D ? (to be more sshd like)
flDaemon := flag.Bool("d", false, "Daemon mode")
flDebug := flag.Bool("D", false, "Debug mode")
bridgeName := flag.String("b", "", "Attach containers to a pre-existing network bridge")
pidfile := flag.String("p", "/var/run/docker.pid", "File containing process PID")
flag.Parse()
if *fl_daemon {
if *bridgeName != "" {
docker.NetworkBridgeIface = *bridgeName
} else {
docker.NetworkBridgeIface = docker.DefaultNetworkBridge
}
if *flDebug {
os.Setenv("DEBUG", "1")
}
docker.GIT_COMMIT = GIT_COMMIT
if *flDaemon {
if flag.NArg() != 0 {
flag.Usage()
return
}
if err := daemon(); err != nil {
if err := daemon(*pidfile); err != nil {
log.Fatal(err)
}
} else {
@@ -34,7 +55,48 @@ func main() {
}
}
func daemon() error {
func createPidFile(pidfile string) error {
if pidString, err := ioutil.ReadFile(pidfile); err == nil {
pid, err := strconv.Atoi(string(pidString))
if err == nil {
if _, err := os.Stat(fmt.Sprintf("/proc/%d/", pid)); err == nil {
return fmt.Errorf("pid file found, ensure docker is not running or delete %s", pidfile)
}
}
}
file, err := os.Create(pidfile)
if err != nil {
return err
}
defer file.Close()
_, err = fmt.Fprintf(file, "%d", os.Getpid())
return err
}
func removePidFile(pidfile string) {
if err := os.Remove(pidfile); err != nil {
log.Printf("Error removing %s: %s", pidfile, err)
}
}
func daemon(pidfile string) error {
if err := createPidFile(pidfile); err != nil {
log.Fatal(err)
}
defer removePidFile(pidfile)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))
go func() {
sig := <-c
log.Printf("Received signal '%v', exiting\n", sig)
removePidFile(pidfile)
os.Exit(0)
}()
service, err := docker.NewServer()
if err != nil {
return err
@@ -43,50 +105,42 @@ func daemon() error {
}
func runCommand(args []string) error {
var oldState *term.State
var err error
if term.IsTerminal(0) && os.Getenv("NORAW") == "" {
oldState, err = term.MakeRaw(0)
if err != nil {
return err
}
defer term.Restore(0, oldState)
}
// FIXME: we want to use unix sockets here, but net.UnixConn doesn't expose
// CloseWrite(), which we need to cleanly signal that stdin is closed without
// closing the connection.
// See http://code.google.com/p/go/issues/detail?id=3345
if conn, err := rcli.Call("tcp", "127.0.0.1:4242", args...); err == nil {
receive_stdout := future.Go(func() error {
options := conn.GetOptions()
if options.RawTerminal &&
term.IsTerminal(int(os.Stdin.Fd())) &&
os.Getenv("NORAW") == "" {
if oldState, err := rcli.SetRawTerminal(); err != nil {
return err
} else {
defer rcli.RestoreTerminal(oldState)
}
}
receiveStdout := docker.Go(func() error {
_, err := io.Copy(os.Stdout, conn)
return err
})
send_stdin := future.Go(func() error {
sendStdin := docker.Go(func() error {
_, err := io.Copy(conn, os.Stdin)
if err := conn.CloseWrite(); err != nil {
log.Printf("Couldn't send EOF: " + err.Error())
}
return err
})
if err := <-receive_stdout; err != nil {
if err := <-receiveStdout; err != nil {
return err
}
if !term.IsTerminal(0) {
if err := <-send_stdin; err != nil {
if !term.IsTerminal(int(os.Stdin.Fd())) {
if err := <-sendStdin; err != nil {
return err
}
}
} else {
service, err := docker.NewServer()
if err != nil {
return err
}
if err := rcli.LocalCall(service, os.Stdin, os.Stdout, args...); err != nil {
return err
}
}
if oldState != nil {
term.Restore(0, oldState)
return fmt.Errorf("Can't connect to docker daemon. Is 'docker -d' running on this host?")
}
return nil
}

View File

@@ -1,319 +0,0 @@
package docker
import (
"github.com/dotcloud/docker/fs"
"io"
"io/ioutil"
"os"
"os/exec"
"os/user"
"testing"
)
const testLayerPath string = "/var/lib/docker/docker-ut.tar"
const unitTestImageName string = "busybox"
var unitTestStoreBase string
var srv *Server
func nuke(docker *Docker) error {
return os.RemoveAll(docker.root)
}
func CopyDirectory(source, dest string) error {
if _, err := exec.Command("cp", "-ra", source, dest).Output(); err != nil {
return err
}
return nil
}
func layerArchive(tarfile string) (io.Reader, error) {
// FIXME: need to close f somewhere
f, err := os.Open(tarfile)
if err != nil {
return nil, err
}
return f, nil
}
func init() {
// Hack to run sys init during unit testing
if SelfPath() == "/sbin/init" {
SysInit()
return
}
if usr, err := user.Current(); err != nil {
panic(err)
} else if usr.Uid != "0" {
panic("docker tests needs to be run as root")
}
// Create a temp directory
root, err := ioutil.TempDir("", "docker-test")
if err != nil {
panic(err)
}
unitTestStoreBase = root
// Make it our Store root
docker, err := NewFromDirectory(root)
if err != nil {
panic(err)
}
// Create the "Server"
srv := &Server{
images: docker.Store,
containers: docker,
}
// Retrieve the Image
if err := srv.CmdImport(os.Stdin, os.Stdout, unitTestImageName); err != nil {
panic(err)
}
}
func newTestDocker() (*Docker, error) {
root, err := ioutil.TempDir("", "docker-test")
if err != nil {
return nil, err
}
if err := os.Remove(root); err != nil {
return nil, err
}
if err := CopyDirectory(unitTestStoreBase, root); err != nil {
panic(err)
return nil, err
}
docker, err := NewFromDirectory(root)
if err != nil {
return nil, err
}
return docker, nil
}
func GetTestImage(docker *Docker) *fs.Image {
imgs, err := docker.Store.Images()
if err != nil {
panic(err)
} else if len(imgs) < 1 {
panic("GASP")
}
return imgs[0]
}
func TestCreate(t *testing.T) {
docker, err := newTestDocker()
if err != nil {
t.Fatal(err)
}
defer nuke(docker)
// Make sure we start we 0 containers
if len(docker.List()) != 0 {
t.Errorf("Expected 0 containers, %v found", len(docker.List()))
}
container, err := docker.Create(
"test_create",
"ls",
[]string{"-al"},
GetTestImage(docker),
&Config{},
)
if err != nil {
t.Fatal(err)
}
defer func() {
if err := docker.Destroy(container); err != nil {
t.Error(err)
}
}()
// Make sure we can find the newly created container with List()
if len(docker.List()) != 1 {
t.Errorf("Expected 1 container, %v found", len(docker.List()))
}
// Make sure the container List() returns is the right one
if docker.List()[0].Id != "test_create" {
t.Errorf("Unexpected container %v returned by List", docker.List()[0])
}
// Make sure we can get the container with Get()
if docker.Get("test_create") == nil {
t.Errorf("Unable to get newly created container")
}
// Make sure it is the right container
if docker.Get("test_create") != container {
t.Errorf("Get() returned the wrong container")
}
// Make sure Exists returns it as existing
if !docker.Exists("test_create") {
t.Errorf("Exists() returned false for a newly created container")
}
}
func TestDestroy(t *testing.T) {
docker, err := newTestDocker()
if err != nil {
t.Fatal(err)
}
defer nuke(docker)
container, err := docker.Create(
"test_destroy",
"ls",
[]string{"-al"},
GetTestImage(docker),
&Config{},
)
if err != nil {
t.Fatal(err)
}
// Destroy
if err := docker.Destroy(container); err != nil {
t.Error(err)
}
// Make sure docker.Exists() behaves correctly
if docker.Exists("test_destroy") {
t.Errorf("Exists() returned true")
}
// Make sure docker.List() doesn't list the destroyed container
if len(docker.List()) != 0 {
t.Errorf("Expected 0 container, %v found", len(docker.List()))
}
// Make sure docker.Get() refuses to return the unexisting container
if docker.Get("test_destroy") != nil {
t.Errorf("Unable to get newly created container")
}
// Make sure the container root directory does not exist anymore
_, err = os.Stat(container.Root)
if err == nil || !os.IsNotExist(err) {
t.Errorf("Container root directory still exists after destroy")
}
// Test double destroy
if err := docker.Destroy(container); err == nil {
// It should have failed
t.Errorf("Double destroy did not fail")
}
}
func TestGet(t *testing.T) {
docker, err := newTestDocker()
if err != nil {
t.Fatal(err)
}
defer nuke(docker)
container1, err := docker.Create(
"test1",
"ls",
[]string{"-al"},
GetTestImage(docker),
&Config{},
)
if err != nil {
t.Fatal(err)
}
defer docker.Destroy(container1)
container2, err := docker.Create(
"test2",
"ls",
[]string{"-al"},
GetTestImage(docker),
&Config{},
)
if err != nil {
t.Fatal(err)
}
defer docker.Destroy(container2)
container3, err := docker.Create(
"test3",
"ls",
[]string{"-al"},
GetTestImage(docker),
&Config{},
)
if err != nil {
t.Fatal(err)
}
defer docker.Destroy(container3)
if docker.Get("test1") != container1 {
t.Errorf("Get(test1) returned %v while expecting %v", docker.Get("test1"), container1)
}
if docker.Get("test2") != container2 {
t.Errorf("Get(test2) returned %v while expecting %v", docker.Get("test2"), container2)
}
if docker.Get("test3") != container3 {
t.Errorf("Get(test3) returned %v while expecting %v", docker.Get("test3"), container3)
}
}
func TestRestore(t *testing.T) {
root, err := ioutil.TempDir("", "docker-test")
if err != nil {
t.Fatal(err)
}
if err := os.Remove(root); err != nil {
t.Fatal(err)
}
if err := CopyDirectory(unitTestStoreBase, root); err != nil {
t.Fatal(err)
}
docker1, err := NewFromDirectory(root)
if err != nil {
t.Fatal(err)
}
// Create a container with one instance of docker
container1, err := docker1.Create(
"restore_test",
"ls",
[]string{"-al"},
GetTestImage(docker1),
&Config{},
)
if err != nil {
t.Fatal(err)
}
defer docker1.Destroy(container1)
if len(docker1.List()) != 1 {
t.Errorf("Expected 1 container, %v found", len(docker1.List()))
}
if err := container1.Run(); err != nil {
t.Fatal(err)
}
// Here are are simulating a docker restart - that is, reloading all containers
// from scratch
docker2, err := NewFromDirectory(root)
if err != nil {
t.Fatal(err)
}
defer nuke(docker2)
if len(docker2.List()) != 1 {
t.Errorf("Expected 1 container, %v found", len(docker2.List()))
}
container2 := docker2.Get("restore_test")
if container2 == nil {
t.Fatal("Unable to Get container")
}
if err := container2.Run(); err != nil {
t.Fatal(err)
}
}

185
docs/Makefile Normal file
View File

@@ -0,0 +1,185 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sources
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
# @echo " html to make standalone HTML files"
# @echo " dirhtml to make HTML files named index.html in directories"
# @echo " singlehtml to make a single large HTML file"
# @echo " pickle to make pickle files"
# @echo " json to make JSON files"
# @echo " htmlhelp to make HTML files and a HTML help project"
# @echo " qthelp to make HTML files and a qthelp project"
# @echo " devhelp to make HTML files and a Devhelp project"
# @echo " epub to make an epub"
# @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
# @echo " latexpdf to make LaTeX files and run them through pdflatex"
# @echo " text to make text files"
# @echo " man to make manual pages"
# @echo " texinfo to make Texinfo files"
# @echo " info to make Texinfo files and run them through makeinfo"
# @echo " gettext to make PO message catalogs"
# @echo " changes to make an overview of all changed/added/deprecated items"
# @echo " linkcheck to check all external links for integrity"
# @echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " docs to build the docs and copy the static files to the outputdir"
@echo " publish to publish the app to dotcloud"
clean:
-rm -rf $(BUILDDIR)/*
docs:
-rm -rf $(BUILDDIR)/*
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/html
cp sources/index.html $(BUILDDIR)/html/
cp -r sources/gettingstarted $(BUILDDIR)/html/
cp sources/dotcloud.yml $(BUILDDIR)/html/
cp sources/CNAME $(BUILDDIR)/html/
cp sources/.nojekyll $(BUILDDIR)/html/
cp sources/nginx.conf $(BUILDDIR)/html/
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
connect:
@echo pushing changes to staging site
@cd _build/html/ ; \
@dotcloud list ; \
dotcloud connect dockerwebsite
push:
@cd _build/html/ ; \
dotcloud push
github-deploy: docs
rm -fr github-deploy
git clone ssh://git@github.com/dotcloud/docker github-deploy
cd github-deploy && git checkout -f gh-pages && git rm -r * && rsync -avH ../_build/html/ ./ && touch .nojekyll && echo "docker.io" > CNAME && git add * && git commit -m "Updating docs"
$(VERSIONS):
@echo "Hello world"
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Docker.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Docker.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Docker"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Docker"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

74
docs/README.md Normal file
View File

@@ -0,0 +1,74 @@
Docker documentation and website
================================
Documentation
-------------
This is your definite place to contribute to the docker documentation. The documentation is generated from the
.rst files under sources.
The folder also contains the other files to create the http://docker.io website, but you can generally ignore
most of those.
Installation
------------
* Work in your own fork of the code, we accept pull requests.
* Install sphinx: ``pip install sphinx``
* If pip is not available you can probably install it using your favorite package manager as **python-pip**
Usage
-----
* change the .rst files with your favorite editor to your liking
* run *make docs* to clean up old files and generate new ones
* your static website can now be found in the _build dir
* to preview what you have generated, cd into _build/html and then run 'python -m SimpleHTTPServer 8000'
Working using github's file editor
----------------------------------
Alternatively, for small changes and typo's you might want to use github's built in file editor. It allows
you to preview your changes right online. Just be carefull not to create many commits.
Images
------
When you need to add images, try to make them as small as possible (e.g. as gif).
Notes
-----
* The index.html and gettingstarted.html files are copied from the source dir to the output dir without modification.
So changes to those pages should be made directly in html
* For the template the css is compiled from less. When changes are needed they can be compiled using
lessc ``lessc main.less`` or watched using watch-lessc ``watch-lessc -i main.less -o main.css``
Guides on using sphinx
----------------------
* To make links to certain pages create a link target like so:
```
.. _hello_world:
Hello world
===========
This is.. (etc.)
```
The ``_hello_world:`` will make it possible to link to this position (page and marker) from all other pages.
* Notes, warnings and alarms
```
# a note (use when something is important)
.. note::
# a warning (orange)
.. warning::
# danger (red, use sparsely)
.. danger::
* Code examples
Start without $, so it's easy to copy and paste.

0
docs/sources/.nojekyll Normal file
View File

1
docs/sources/CNAME Normal file
View File

@@ -0,0 +1 @@
docker.io

View File

@@ -0,0 +1,101 @@
:title: Base commands
:description: Common usage and commands
:keywords: Examples, Usage
The basics
=============
Starting Docker
---------------
If you have used one of the quick install paths', Docker may have been installed with upstart, Ubuntu's
system for starting processes at boot time. You should be able to run ``docker help`` and get output.
If you get ``docker: command not found`` or something like ``/var/lib/docker/repositories: permission denied``
you will need to specify the path to it and manually start it.
.. code-block:: bash
# Run docker in daemon mode
sudo <path to>/docker -d &
Running an interactive shell
----------------------------
.. code-block:: bash
# Download a base image
docker pull base
# Run an interactive shell in the base image,
# allocate a tty, attach stdin and stdout
docker run -i -t base /bin/bash
Starting a long-running worker process
--------------------------------------
.. code-block:: bash
# Start a very useful long-running process
JOB=$(docker run -d 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
Listing all running containers
------------------------------
.. code-block:: bash
docker ps
Expose a service on a TCP port
------------------------------
.. code-block:: bash
# Expose port 4444 of this container, and tell netcat to listen on it
JOB=$(docker run -d -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's public address
# Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work.
IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }')
echo hello world | nc $IP $PORT
# Verify that the network connection worked
echo "Daemon received: $(docker logs $JOB)"
Committing (saving) an image
-----------------------------
Save your containers state to a container image, so the state can be re-used.
When you commit your container only the differences between the image the container was created from
and the current state of the container will be stored (as a diff). See which images you already have
using ``docker images``
.. code-block:: bash
# Commit your container to a new named image
docker commit <container_id> <some_name>
# List your containers
docker images
You now have a image state from which you can create new instances.
Read more about :ref:`working_with_the_repository` or continue to the complete :ref:`cli`

View File

@@ -0,0 +1,53 @@
:title: Command Line Interface
:description: Docker's CLI command description and usage
:keywords: Docker, Docker documentation, CLI, command line
.. _cli:
Command Line Interface
======================
Docker Usage
~~~~~~~~~~~~
To list available commands, either run ``docker`` with no parameters or execute
``docker help``::
$ docker
Usage: docker COMMAND [arg...]
A self-sufficient runtime for linux containers.
...
Available Commands
~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 1
command/attach
command/commit
command/diff
command/export
command/history
command/images
command/import
command/info
command/inspect
command/kill
command/login
command/logs
command/port
command/ps
command/pull
command/push
command/restart
command/rm
command/rmi
command/run
command/start
command/stop
command/tag
command/version
command/wait

View File

@@ -0,0 +1,9 @@
===========================================
``attach`` -- Attach to a running container
===========================================
::
Usage: docker attach CONTAINER
Attach to a running container

View File

@@ -0,0 +1,11 @@
===========================================================
``commit`` -- Create a new image from a container's changes
===========================================================
::
Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY [TAG]]
Create a new image from a container's changes
-m="": Commit message

View File

@@ -0,0 +1,9 @@
=======================================================
``diff`` -- Inspect changes on a container's filesystem
=======================================================
::
Usage: docker diff CONTAINER [OPTIONS]
Inspect changes on a container's filesystem

View File

@@ -0,0 +1,9 @@
=================================================================
``export`` -- Stream the contents of a container as a tar archive
=================================================================
::
Usage: docker export CONTAINER
Export the contents of a filesystem as a tar archive

View File

@@ -0,0 +1,9 @@
===========================================
``history`` -- Show the history of an image
===========================================
::
Usage: docker history [OPTIONS] IMAGE
Show the history of an image

View File

@@ -0,0 +1,12 @@
=========================
``images`` -- List images
=========================
::
Usage: docker images [OPTIONS] [NAME]
List images
-a=false: show all images
-q=false: only show numeric IDs

View File

@@ -0,0 +1,9 @@
==========================================================================
``import`` -- Create a new filesystem image from the contents of a tarball
==========================================================================
::
Usage: docker import [OPTIONS] URL|- [REPOSITORY [TAG]]
Create a new filesystem image from the contents of a tarball

View File

@@ -0,0 +1,9 @@
===========================================
``info`` -- Display system-wide information
===========================================
::
Usage: docker info
Display system-wide information.

View File

@@ -0,0 +1,9 @@
==========================================================
``inspect`` -- Return low-level information on a container
==========================================================
::
Usage: docker inspect [OPTIONS] CONTAINER
Return low-level information on a container

View File

@@ -0,0 +1,9 @@
====================================
``kill`` -- Kill a running container
====================================
::
Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
Kill a running container

View File

@@ -0,0 +1,9 @@
============================================================
``login`` -- Register or Login to the docker registry server
============================================================
::
Usage: docker login
Register or Login to the docker registry server

View File

@@ -0,0 +1,9 @@
=========================================
``logs`` -- Fetch the logs of a container
=========================================
::
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container

View File

@@ -0,0 +1,9 @@
=========================================================================
``port`` -- Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
=========================================================================
::
Usage: docker port [OPTIONS] CONTAINER PRIVATE_PORT
Lookup the public-facing port which is NAT-ed to PRIVATE_PORT

View File

@@ -0,0 +1,13 @@
=========================
``ps`` -- List containers
=========================
::
Usage: docker ps [OPTIONS]
List containers
-a=false: Show all containers. Only running containers are shown by default.
-notrunc=false: Don't truncate output
-q=false: Only display numeric IDs

View File

@@ -0,0 +1,9 @@
=========================================================================
``pull`` -- Pull an image or a repository from the docker registry server
=========================================================================
::
Usage: docker pull NAME
Pull an image or a repository from the registry

View File

@@ -0,0 +1,9 @@
=======================================================================
``push`` -- Push an image or a repository to the docker registry server
=======================================================================
::
Usage: docker push NAME
Push an image or a repository to the registry

View File

@@ -0,0 +1,9 @@
==========================================
``restart`` -- Restart a running container
==========================================
::
Usage: docker restart [OPTIONS] NAME
Restart a running container

View File

@@ -0,0 +1,9 @@
============================
``rm`` -- Remove a container
============================
::
Usage: docker rm [OPTIONS] CONTAINER
Remove a container

View File

@@ -0,0 +1,9 @@
==========================
``rmi`` -- Remove an image
==========================
::
Usage: docker rmimage [OPTIONS] IMAGE
Remove an image

View File

@@ -0,0 +1,19 @@
===========================================
``run`` -- Run a command in a new container
===========================================
::
Usage: docker run [OPTIONS] IMAGE COMMAND [ARG...]
Run a command in a new container
-a=map[]: Attach to stdin, stdout or stderr.
-d=false: Detached mode: leave the container running in the background
-e=[]: Set environment variables
-h="": Container host name
-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

View File

@@ -0,0 +1,9 @@
======================================
``start`` -- Start a stopped container
======================================
::
Usage: docker start [OPTIONS] NAME
Start a stopped container

View File

@@ -0,0 +1,9 @@
====================================
``stop`` -- Stop a running container
====================================
::
Usage: docker stop [OPTIONS] NAME
Stop a running container

View File

@@ -0,0 +1,11 @@
=========================================
``tag`` -- Tag an image into a repository
=========================================
::
Usage: docker tag [OPTIONS] IMAGE REPOSITORY [TAG]
Tag an image into a repository
-f=false: Force

View File

@@ -0,0 +1,3 @@
==================================================
``version`` -- Show the docker version information
==================================================

View File

@@ -0,0 +1,9 @@
===================================================================
``wait`` -- Block until a container stops, then print its exit code
===================================================================
::
Usage: docker wait [OPTIONS] NAME
Block until a container stops, then print its exit code.

View File

@@ -0,0 +1,16 @@
:title: docker documentation
:description: -- todo: change me
:keywords: todo: change me
Commands
========
Contents:
.. toctree::
:maxdepth: 2
basics
workingwithrepository
cli

View File

@@ -0,0 +1,42 @@
.. _working_with_the_repository:
Working with the repository
============================
Connecting to the repository
----------------------------
You create a user on the central docker repository by running
.. code-block:: bash
docker login
If your username does not exist it will prompt you to also enter a password and your e-mail address. It will then
automatically log you in.
Committing a container to a named image
---------------------------------------
In order to commit to the repository it is required to have committed your container to an image with your namespace.
.. code-block:: bash
# for example docker commit $CONTAINER_ID dhrp/kickassapp
docker commit <container_id> <your username>/<some_name>
Pushing a container to the repository
-----------------------------------------
In order to push an image to the repository you need to have committed your container to a named image (see above)
Now you can commit this image to the repository
.. code-block:: bash
# for example docker push dhrp/kickassapp
docker push <image-name>

View File

@@ -0,0 +1,25 @@
:title: Building blocks
:description: An introduction to docker and standard containers?
:keywords: containers, lxc, concepts, explanation
Building blocks
===============
.. _images:
Images
------
An original container image. These are stored on disk and are comparable with what you normally expect from a stopped virtual machine image. Images are stored (and retrieved from) repository
Images are stored on your local file system under /var/lib/docker/images
.. _containers:
Containers
----------
A container is a local version of an image. It can be running or stopped, The equivalent would be a virtual machine instance.
Containers are stored on your local file system under /var/lib/docker/containers

View File

@@ -0,0 +1,128 @@
:title: Introduction
:description: An introduction to docker and standard containers?
:keywords: containers, lxc, concepts, explanation
:note: This version of the introduction is temporary, just to make sure we don't break the links from the website when the documentation is updated
Introduction
============
Docker - The 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.
Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
- **Heterogeneous payloads** Any combination of binaries, libraries, configuration files, scripts, virtualenvs, jars, gems, tarballs, you name it. No more juggling between domain-specific tools. Docker can deploy and run them all.
- **Any server** Docker can run on any x64 machine with a modern linux kernel - whether it's a laptop, a bare metal server or a VM. This makes it perfect for multi-cloud deployments.
- **Isolation** docker isolates processes from each other and from the underlying host, using lightweight containers.
- **Repeatability** Because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.
What is a Standard Container?
-----------------------------
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.
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.
A great analogy for this is the shipping container. Just like Standard Containers are a fundamental unit of software delivery, shipping containers (http://bricks.argz.com/ins/7823-1/12) are a fundamental unit of physical delivery.
Standard operations
~~~~~~~~~~~~~~~~~~~
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.
Content-agnostic
~~~~~~~~~~~~~~~~~~~
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.
Infrastructure-agnostic
~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
Designed for automation
~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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.
Industrial-grade delivery
~~~~~~~~~~~~~~~~~~~~~~~~~~
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 *less time* than it takes a software team to deliver its code from one datacenter to another sitting 10 miles away.
With Standard Containers we can put an end to that embarrassment, by making INDUSTRIAL-GRADE DELIVERY of software a reality.
Standard Container Specification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(TODO)
Image format
~~~~~~~~~~~~
Standard operations
~~~~~~~~~~~~~~~~~~~
- Copy
- Run
- Stop
- Wait
- Commit
- Attach standard streams
- List filesystem changes
- ...
Execution environment
~~~~~~~~~~~~~~~~~~~~~
Root filesystem
^^^^^^^^^^^^^^^
Environment variables
^^^^^^^^^^^^^^^^^^^^^
Process arguments
^^^^^^^^^^^^^^^^^
Networking
^^^^^^^^^^
Process namespacing
^^^^^^^^^^^^^^^^^^^
Resource limits
^^^^^^^^^^^^^^^
Process monitoring
^^^^^^^^^^^^^^^^^^
Logging
^^^^^^^
Signals
^^^^^^^
Pseudo-terminal allocation
^^^^^^^^^^^^^^^^^^^^^^^^^^
Security
^^^^^^^^

View File

@@ -0,0 +1,17 @@
:title: docker documentation
:description: -- todo: change me
:keywords: todo: change me
Concepts
========
Contents:
.. toctree::
:maxdepth: 1
introduction
buildingblocks

View File

@@ -0,0 +1,127 @@
:title: Introduction
:description: An introduction to docker and standard containers?
:keywords: containers, lxc, concepts, explanation
Introduction
============
Docker - The 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.
Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
- **Heterogeneous payloads** Any combination of binaries, libraries, configuration files, scripts, virtualenvs, jars, gems, tarballs, you name it. No more juggling between domain-specific tools. Docker can deploy and run them all.
- **Any server** Docker can run on any x64 machine with a modern linux kernel - whether it's a laptop, a bare metal server or a VM. This makes it perfect for multi-cloud deployments.
- **Isolation** docker isolates processes from each other and from the underlying host, using lightweight containers.
- **Repeatability** Because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.
.. image:: http://www.docker.io/_static/lego_docker.jpg
What is a Standard Container?
-----------------------------
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.
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.
A great analogy for this is the shipping container. Just like Standard Containers are a fundamental unit of software delivery, shipping containers (http://bricks.argz.com/ins/7823-1/12) are a fundamental unit of physical delivery.
Standard operations
~~~~~~~~~~~~~~~~~~~
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.
Content-agnostic
~~~~~~~~~~~~~~~~~~~
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.
Infrastructure-agnostic
~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
Designed for automation
~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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.
Industrial-grade delivery
~~~~~~~~~~~~~~~~~~~~~~~~~~
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 *less time* than it takes a software team to deliver its code from one datacenter to another sitting 10 miles away.
With Standard Containers we can put an end to that embarrassment, by making INDUSTRIAL-GRADE DELIVERY of software a reality.
Standard Container Specification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(TODO)
Image format
~~~~~~~~~~~~
Standard operations
~~~~~~~~~~~~~~~~~~~
- Copy
- Run
- Stop
- Wait
- Commit
- Attach standard streams
- List filesystem changes
- ...
Execution environment
~~~~~~~~~~~~~~~~~~~~~
Root filesystem
^^^^^^^^^^^^^^^
Environment variables
^^^^^^^^^^^^^^^^^^^^^
Process arguments
^^^^^^^^^^^^^^^^^
Networking
^^^^^^^^^^
Process namespacing
^^^^^^^^^^^^^^^^^^^
Resource limits
^^^^^^^^^^^^^^^
Process monitoring
^^^^^^^^^^^^^^^^^^
Logging
^^^^^^^
Signals
^^^^^^^
Pseudo-terminal allocation
^^^^^^^^^^^^^^^^^^^^^^^^^^
Security
^^^^^^^^

247
docs/sources/conf.py Normal file
View File

@@ -0,0 +1,247 @@
# -*- coding: utf-8 -*-
#
# Docker documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 19 12:34:07 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
#disable the parmalinks on headers, I find them really annoying
html_add_permalinks = None
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Docker'
copyright = u'2013, Team Docker'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'docker'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
html_theme_path = ['../theme']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['static_files']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Dockerdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Docker.tex', u'Docker Documentation',
u'Team Docker', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'docker', u'Docker Documentation',
[u'Team Docker'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Docker', u'Docker Documentation',
u'Team Docker', 'Docker', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

View File

@@ -0,0 +1,101 @@
Contributing to Docker
======================
Want to hack on Docker? Awesome! There are instructions to get you
started on the website: http://docker.io/gettingstarted.html
They are probably not perfect, please let us know if anything feels
wrong or incomplete.
Contribution guidelines
-----------------------
Pull requests are always welcome
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
If your pull request is not accepted on the first try, don't be
discouraged! If there's a problem with the implementation, hopefully you
received feedback on what to improve.
We're trying very hard to keep Docker lean and focused. We don't 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 *on top of* docker.
Discuss your design on the mailing list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We recommend discussing your plans `on the mailing
list <https://groups.google.com/forum/?fromgroups#!forum/docker-club>`__
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.
Create issues...
~~~~~~~~~~~~~~~~
Any significant improvement should be documented as `a github
issue <https://github.com/dotcloud/docker/issues>`__ before anybody
starts working on it.
...but check for existing issues first!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please take a moment to check that an issue doesn't 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.
Conventions
~~~~~~~~~~~
Fork the repo and make changes on your fork in a feature branch:
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
issue
- If it's a feature branch, create an enhancement issue to announce your
intentions, and name it XXX-something where XXX is the number of the issue.
Submit unit tests for your changes. Go has a great test framework built in; use
it! Take a look at existing tests for inspiration. Run the full test suite on
your branch before submitting a pull request.
Make sure you include relevant updates or additions to documentation when
creating or modifying features.
Write clean code. Universally formatted code promotes ease of writing, reading,
and maintenance. Always run ``go fmt`` before committing your changes. Most
editors have plugins that do this automatically, and there's also a git
pre-commit hook:
.. code-block:: bash
curl -o .git/hooks/pre-commit https://raw.github.com/edsrzf/gofmt-git-hook/master/fmt-check && chmod +x .git/hooks/pre-commit
Pull requests descriptions should be as clear as possible and include a
reference to all the issues that they address.
Code review comments may be added to your pull request. Discuss, then make the
suggested modifications and push additional commits to your feature branch. Be
sure to post a comment after pushing. The new commits will show up in the pull
request automatically, but the reviewers will not be notified unless you
comment.
Before the pull request is merged, make sure that you squash your commits into
logical units of work using ``git rebase -i`` and ``git push -f``. After every
commit the test suite should be passing. Include documentation changes in the
same commit so that a revert would remove all traces of the feature or fix.
Commits that fix or close an issue should include a reference like ``Closes #XXX``
or ``Fixes #XXX``, which will automatically close the issue when merged.
Add your name to the AUTHORS file, but make sure the list is sorted and your
name and email address match your git configuration. The AUTHORS file is
regenerated occasionally from the git commit history, so a mismatch may result
in your changes being overwritten.

View File

@@ -0,0 +1,33 @@
:title: Setting up a dev environment
:description: Guides on how to contribute to docker
:keywords: Docker, documentation, developers, contributing, dev environment
Setting up a dev environment
============================
Instructions that have been verified to work on Ubuntu 12.10,
.. code-block:: bash
sudo apt-get -y install lxc wget bsdtar curl golang git
export GOPATH=~/go/
export PATH=$GOPATH/bin:$PATH
mkdir -p $GOPATH/src/github.com/dotcloud
cd $GOPATH/src/github.com/dotcloud
git clone git@github.com:dotcloud/docker.git
cd docker
go get -v github.com/dotcloud/docker/...
go install -v github.com/dotcloud/docker/...
Then run the docker daemon,
.. code-block:: bash
sudo $GOPATH/bin/docker -d
Run the ``go install`` command (above) to recompile docker.

View File

@@ -0,0 +1,14 @@
:title: Contributing to Docker
:description: Guides on how to contribute to docker
:keywords: Docker, documentation, developers, contributing, dev environment
Contributing
============
.. toctree::
:maxdepth: 1
contributing
devenvironment

View File

@@ -0,0 +1,2 @@
www:
type: static

View File

@@ -0,0 +1,4 @@
.. note::
This example assumes you have Docker running in daemon mode. For more information please see :ref:`running_examples`

View File

@@ -0,0 +1,50 @@
:title: Hello world example
:description: A simple hello world example with Docker
:keywords: docker, example, hello world
.. _hello_world:
Hello World
===========
.. include:: example_header.inc
This is the most basic example available for using Docker.
Download the base container
.. code-block:: bash
# Download a base image
docker pull base
The *base* image is a minimal *ubuntu* based container, alternatively you can select *busybox*, a bare
minimal linux system. The images are retrieved from the docker repository.
.. code-block:: bash
#run a simple echo command, that will echo hello world back to the console over standard out.
docker run base /bin/echo hello world
**Explanation:**
- **"docker run"** run a command in a new container
- **"base"** is the image we want to run the command inside of.
- **"/bin/echo"** is the command we want to run in the container
- **"hello world"** is the input for the echo command
**Video:**
See the example in action
.. raw:: html
<div style="margin-top:10px;">
<iframe width="560" height="350" src="http://ascii.io/a/2603/raw" frameborder="0"></iframe>
</div>
Continue to the :ref:`hello_world_daemon` example.

View File

@@ -0,0 +1,84 @@
:title: Hello world daemon example
:description: A simple hello world daemon example with Docker
:keywords: docker, example, hello world, daemon
.. _hello_world_daemon:
Hello World Daemon
==================
.. include:: example_header.inc
The most boring daemon ever written.
This example assumes you have Docker installed and with the base image already imported ``docker pull base``.
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.
**Steps:**
.. code-block:: bash
CONTAINER_ID=$(docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done")
We are going to run a simple hello world daemon in a new container made from the base image.
- **"docker run -d "** run a command in a new container. We pass "-d" so it runs as a daemon.
- **"base"** is the image we want to run the command inside of.
- **"/bin/sh -c"** is the command we want to run in the container
- **"while true; do echo hello world; sleep 1; done"** is the mini script we want to run, that will just print hello world once a second until we stop it.
- **$CONTAINER_ID** 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.
.. code-block:: bash
docker logs $CONTAINER_ID
Check the logs make sure it is working correctly.
- **"docker logs**" This will return the logs for a container
- **$CONTAINER_ID** The Id of the container we want the logs for.
.. code-block:: bash
docker attach $CONTAINER_ID
Attach to the container to see the results in realtime.
- **"docker attach**" This will allow us to attach to a background process to see what is going on.
- **$CONTAINER_ID** The Id of the container we want to attach too.
.. code-block:: bash
docker ps
Check the process list to make sure it is running.
- **"docker ps"** this shows all running process managed by docker
.. code-block:: bash
docker stop $CONTAINER_ID
Stop the container, since we don't need it anymore.
- **"docker stop"** This stops a container
- **$CONTAINER_ID** The Id of the container we want to stop.
.. code-block:: bash
docker ps
Make sure it is really stopped.
**Video:**
See the example in action
.. raw:: html
<div style="margin-top:10px;">
<iframe width="560" height="350" src="http://ascii.io/a/2562/raw" frameborder="0"></iframe>
</div>
Continue to the :ref:`python_web_app` example.

View File

@@ -0,0 +1,20 @@
:title: Docker Examples
:description: Examples on how to use Docker
:keywords: docker, hello world, examples
Examples
============
Contents:
.. toctree::
:maxdepth: 1
running_examples
hello_world
hello_world_daemon
python_web_app
running_redis_service
running_ssh_service

View File

@@ -0,0 +1,88 @@
:title: Python Web app example
:description: Building your own python web app using docker
:keywords: docker, example, python, web app
.. _python_web_app:
Building a python web app
=========================
.. include:: example_header.inc
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.
**Steps:**
.. code-block:: bash
docker pull shykes/pybuilder
We are downloading the "shykes/pybuilder" docker image
.. code-block:: bash
URL=http://github.com/shykes/helloflask/archive/master.tar.gz
We set a URL variable that points to a tarball of a simple helloflask web app
.. code-block:: bash
BUILD_JOB=$(docker run -d -t shykes/pybuilder:latest /usr/local/bin/buildapp $URL)
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.
.. code-block:: bash
docker attach $BUILD_JOB
[...]
We attach to the new container to see what is going on. Ctrl-C to disconnect
.. code-block:: bash
BUILD_IMG=$(docker commit $BUILD_JOB _/builds/github.com/hykes/helloflask/master)
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.
.. code-block:: bash
WEB_WORKER=$(docker run -d -p 5000 $BUILD_IMG /usr/local/bin/runapp)
- **"docker run -d "** run a command in a new container. We pass "-d" so it runs as a daemon.
- **"-p 5000"** the web app is going to listen on this port, so it must be mapped from the container to the host system.
- **"$BUILD_IMG"** is the image we want to run the command inside of.
- **/usr/local/bin/runapp** is the command which starts the web app.
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.
.. code-block:: bash
docker logs $WEB_WORKER
* Running on http://0.0.0.0:5000/
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 http://0.0.0.0:5000/" in the log output.
.. code-block:: bash
WEB_PORT=$(docker port $WEB_WORKER 5000)
lookup the public-facing port which is NAT-ed store the private port used by the container and store it inside of the WEB_PORT variable.
.. code-block:: bash
curl http://`hostname`:$WEB_PORT
Hello world!
access the web app using curl. If everything worked as planned you should see the line "Hello world!" inside of your console.
**Video:**
See the example in action
.. raw:: html
<div style="margin-top:10px;">
<iframe width="720" height="350" src="http://ascii.io/a/2573/raw" frameborder="0"></iframe>
</div>
Continue to :ref:`running_ssh_service`.

View File

@@ -0,0 +1,22 @@
:title: Running the Examples
:description: An overview on how to run the docker examples
:keywords: docker, examples, how to
.. _running_examples:
Running The Examples
--------------------
All the examples assume your machine is running the docker daemon. To run the docker daemon in the background, simply type:
.. code-block:: bash
sudo docker -d &
Now you can run docker in client mode: all commands will be forwarded to the docker daemon, so the client
can run from any account.
.. code-block:: bash
# now you can run docker commands from any account.
docker help

View File

@@ -0,0 +1,81 @@
:title: Running a Redis service
:description: Installing and running an redis service
:keywords: docker, example, package installation, networking, redis
.. _running_redis_service:
Create a redis service
======================
.. include:: example_header.inc
Very simple, no frills, redis service.
Open a docker container
-----------------------
.. code-block:: bash
docker run -i -t base /bin/bash
Building your image
-------------------
Update your docker container, install the redis server. Once installed, exit out of docker.
.. code-block:: bash
apt-get update
apt-get install redis-server
exit
Snapshot the installation
-------------------------
.. code-block:: bash
docker ps -a # grab the container id (this will be the last one in the list)
docker commit <container_id> <your username>/redis
Run the service
---------------
Running the service with `-d` runs the container in detached mode, leaving the
container running in the background. Use your snapshot.
.. code-block:: bash
docker run -d -p 6379 <your username>/redis /usr/bin/redis-server
Test 1
++++++
Connect to the container with the redis-cli.
.. code-block:: bash
docker ps # grab the new container id
docker inspect <container_id> # grab the ipaddress of the container
redis-cli -h <ipaddress> -p 6379
redis 10.0.3.32:6379> set docker awesome
OK
redis 10.0.3.32:6379> get docker
"awesome"
redis 10.0.3.32:6379> exit
Test 2
++++++
Connect to the host os with the redis-cli.
.. code-block:: bash
docker ps # grab the new container id
docker port <container_id> 6379 # grab the external port
ifconfig # grab the host ip address
redis-cli -h <host ipaddress> -p <external port>
redis 192.168.0.1:49153> set docker awesome
OK
redis 192.168.0.1:49153> get docker
"awesome"
redis 192.168.0.1:49153> exit

View File

@@ -0,0 +1,32 @@
:title: Running an SSH service
:description: A screencast of installing and running an sshd service
:keywords: docker, example, package installation, networking
.. _running_ssh_service:
Create an ssh daemon service
============================
.. include:: example_header.inc
**Video:**
I've create a little screencast to show how to create a sshd service and connect to it. It is something like 11
minutes and not entirely smooth, but gives you a good idea.
.. raw:: html
<div style="margin-top:10px;">
<iframe width="800" height="400" src="http://ascii.io/a/2637/raw" frameborder="0"></iframe>
</div>
You can also get this sshd container by using
::
docker pull dhrp/sshd
The password is 'screencast'

47
docs/sources/faq.rst Normal file
View File

@@ -0,0 +1,47 @@
FAQ
===
Most frequently asked questions.
--------------------------------
1. **How much does Docker cost?**
Docker is 100% free, it is open source, so you can use it without paying.
2. **What open source license are you using?**
We are using the Apache License Version 2.0, see it here: https://github.com/dotcloud/docker/blob/master/LICENSE
3. **Does Docker run on Mac OS X or Windows?**
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 MacOSX_ and Windows_ intallation guides.
4. **How do containers compare to virtual machines?**
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.
5. **Can I help by adding some questions and answers?**
Definitely! You can fork `the repo`_ and edit the documentation sources.
42. **Where can I find more answers?**
You can find more answers on:
* `IRC: docker on freenode`_
* `Github`_
* `Ask questions on Stackoverflow`_
* `Join the conversation on Twitter`_
.. _Windows: ../documentation/installation/windows.html
.. _MacOSX: ../documentation/installation/macos.html
.. _the repo: http://www.github.com/dotcloud/docker
.. _IRC\: docker on freenode: irc://chat.freenode.net#docker
.. _Github: http://www.github.com/dotcloud/docker
.. _Ask questions on Stackoverflow: http://stackoverflow.com/search?q=docker
.. _Join the conversation on Twitter: http://twitter.com/getdocker
Looking for something else to read? Checkout the :ref:`hello_world` example.

View File

@@ -0,0 +1,210 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Docker - the Linux container runtime</title>
<meta name="description" content="Docker encapsulates heterogeneous payloads in standard containers">
<meta name="viewport" content="width=device-width">
<!-- twitter bootstrap -->
<link rel="stylesheet" href="../_static/css/bootstrap.min.css">
<link rel="stylesheet" href="../_static/css/bootstrap-responsive.min.css">
<!-- main style file -->
<link rel="stylesheet" href="../_static/css/main.css">
<!-- vendor scripts -->
<script src="../_static/js/vendor/jquery-1.9.1.min.js" type="text/javascript" ></script>
<script src="../_static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js" type="text/javascript" ></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-dotcloud">
<div class="container" style="text-align: center;">
<div style="float: right" class="pull-right">
<ul class="nav">
<li><a href="../">Introduction</a></li>
<li class="active"><a href="./">Getting started</a></li>
<li class=""><a href="http://docs.docker.io/en/latest/concepts/containers/">Documentation</a></li>
</ul>
<div class="social links" style="float: right; margin-top: 14px; margin-left: 12px">
<a class="twitter" href="http://twitter.com/getdocker">Twitter</a>
<a class="github" href="https://github.com/dotcloud/docker/">GitHub</a>
</div>
</div>
<div style="margin-left: -12px; float: left;">
<a href="../index.html"><img style="margin-top: 12px; height: 38px" src="../_static/img/docker-letters-logo.gif"></a>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span12 titlebar"><h1 class="pageheader">GETTING STARTED</h1>
</div>
</div>
</div>
<div class="container">
<div class="alert alert-info">
<strong>Docker is still under heavy development.</strong> It should not yet be used in production. Check <a href="http://github.com/dotcloud/docker">the repo</a> for recent progress.
</div>
<div class="row">
<div class="span6">
<section class="contentblock">
<h2>
<a name="installing-on-ubuntu-1204-and-1210" class="anchor" href="#installing-on-ubuntu-1204-and-1210"><span class="mini-icon mini-icon-link"></span>
</a>Installing on Ubuntu</h2>
<p><strong>Requirements</strong></p>
<ul>
<li>Ubuntu 12.04 (LTS) (64-bit)</li>
<li> or Ubuntu 12.10 (quantal) (64-bit)</li>
</ul>
<ol>
<li>
<p><strong>Install dependencies</strong></p>
The linux-image-extra package is only needed on standard Ubuntu EC2 AMIs in order to install the aufs kernel module.
<pre>sudo apt-get install linux-image-extra-`uname -r`</pre>
</li>
<li>
<p><strong>Install Docker</strong></p>
<p>Add the Ubuntu PPA (Personal Package Archive) sources to your apt sources list, update and install.</p>
<p>You may see some warnings that the GPG keys cannot be verified.</p>
<div class="highlight">
<pre>sudo sh -c "echo 'deb http://ppa.launchpad.net/dotcloud/lxc-docker/ubuntu precise main' >> /etc/apt/sources.list"</pre>
<pre>sudo apt-get update</pre>
<pre>sudo apt-get install lxc-docker</pre>
</div>
</li>
<li>
<p><strong>Run!</strong></p>
<div class="highlight">
<pre>docker run -i -t ubuntu /bin/bash</pre>
</div>
</li>
Continue with the <a href="http://docs.docker.io/en/latest/examples/hello_world/">Hello world</a> example.
</ol>
</section>
<section class="contentblock">
<h2>Contributing to Docker</h2>
<p>Want to hack on Docker? Awesome! We have some <a href="http://docs.docker.io/en/latest/contributing/contributing/">instructions to get you started</a>. They are probably not perfect, please let us know if anything feels wrong or incomplete.</p>
</section>
</div>
<div class="span6">
<section class="contentblock">
<h2>Quick install on other operating systems</h2>
<p><strong>For other operating systems we recommend and provide a streamlined install with virtualbox,
vagrant and an Ubuntu virtual machine.</strong></p>
<ul>
<li><a href="http://docs.docker.io/en/latest/installation/vagrant/">Mac OS X and other linuxes</a></li>
<li><a href="http://docs.docker.io/en/latest/installation/windows/">Windows</a></li>
</ul>
</section>
<section class="contentblock">
<h2>More resources</h2>
<ul>
<li><a href="irc://chat.freenode.net#docker">IRC: docker on freenode</a></li>
<li><a href="http://www.github.com/dotcloud/docker">Github</a></li>
<li><a href="http://stackoverflow.com/tags/docker/">Ask questions on Stackoverflow</a></li>
<li><a href="http://twitter.com/getdocker/">Join the conversation on Twitter</a></li>
</ul>
</section>
<section class="contentblock">
<div id="wufoo-z7x3p3">
Fill out my <a href="http://dotclouddocker.wufoo.com/forms/z7x3p3">online form</a>.
</div>
<script type="text/javascript">var z7x3p3;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'dotclouddocker',
'formHash':'z7x3p3',
'autoResize':true,
'height':'577',
'async':true,
'header':'show'};
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'wufoo.com/scripts/embed/form.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
try { z7x3p3 = new WufooForm();z7x3p3.initialize(options);z7x3p3.display(); } catch (e) {}};
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
})(document, 'script');</script>
</section>
</div>
</div>
</div>
<div class="container">
<footer id="footer" class="footer">
<div class="row">
<div class="span12 social">
Docker is a project by <a href="http://www.dotcloud.com">dotCloud</a>
</div>
</div>
<div class="row">
<div class="emptyspace" style="height: 40px">
</div>
</div>
</footer>
</div>
<!-- bootstrap javascipts -->
<script src="../_static/js/vendor/bootstrap.min.js" type="text/javascript"></script>
<!-- Google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6096819-11']);
_gaq.push(['_setDomainName', 'docker.io']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>

289
docs/sources/index.html Normal file
View File

@@ -0,0 +1,289 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" xmlns="http://www.w3.org/1999/html"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Docker - the Linux container runtime</title>
<meta name="description" content="Docker encapsulates heterogeneous payloads in standard containers">
<meta name="viewport" content="width=device-width">
<!-- twitter bootstrap -->
<link rel="stylesheet" href="_static/css/bootstrap.min.css">
<link rel="stylesheet" href="_static/css/bootstrap-responsive.min.css">
<!-- main style file -->
<link rel="stylesheet" href="_static/css/main.css">
<!-- vendor scripts -->
<script src="_static/js/vendor/jquery-1.9.1.min.js" type="text/javascript" ></script>
<script src="_static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js" type="text/javascript" ></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-dotcloud">
<div class="container" style="text-align: center;">
<div class="pull-right" >
<ul class="nav">
<li class="active"><a href="./">Introduction</a></li>
<li ><a href="gettingstarted/">Getting started</a></li>
<li class=""><a href="http://docs.docker.io/en/latest/concepts/containers/">Documentation</a></li>
</ul>
<div class="social links" style="float: right; margin-top: 14px; margin-left: 12px">
<a class="twitter" href="http://twitter.com/getdocker">Twitter</a>
<a class="github" href="https://github.com/dotcloud/docker/">GitHub</a>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="text-center">
<img src="_static/img/docker-letters-logo.gif">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span12">
<section class="contentblock header">
<div class="span6" style="margin:10px 0px 0px 30px; float: right; ">
<div class="js-video" >
<iframe width="640" height="360" src="http://www.youtube.com/embed/wW9CAH9nSLs?feature=player_detailpage&rel=0&modestbranding=1&start=11" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<div style="text-align: center; padding: 50px 30px 50px 30px;">
<h1>Docker</h1>
<h2>The Linux container runtime</h2>
</div>
<div style="display: block; text-align: center; padding: 10px 30px 50px 30px;">
<p>
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.
</p>
<p>
Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
</p>
</div>
<div style="display: block; text-align: center;">
<a class="btn btn-custom btn-large" href="gettingstarted/">Let's get started</a>
</div>
<br style="clear: both"/>
</section>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span3">
<section class="contentblock">
<h4>Heterogeneous payloads</h4>
<p>Any combination of binaries, libraries, configuration files, scripts, virtualenvs, jars, gems, tarballs, you name it. No more juggling between domain-specific tools. Docker can deploy and run them all.</p>
</section>
</div>
<div class="span3">
<section class="contentblock">
<h4>Any server</h4>
<p>Docker can run on any x64 machine with a modern linux kernel - whether it's a laptop, a bare metal server or a VM. This makes it perfect for multi-cloud deployments.</p>
</section>
</div>
<div class="span3">
<section class="contentblock">
<h4>Isolation</h4>
<p>docker isolates processes from each other and from the underlying host, using lightweight containers.</p>
</section>
</div>
<div class="span3">
<section class="contentblock">
<h4>Repeatability</h4>
<p>Because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.</p>
</section>
</div>
</div>
</div>
<style>
.twitterblock {
min-height: 75px;
}
.twitterblock img {
float: left;
margin-right: 10px;
}
</style>
<div class="container">
<div class="row">
<div class="span6">
<section class="contentblock twitterblock">
<img src="https://twimg0-a.akamaihd.net/profile_images/2491994496/rbevyyq6ykp6bnoby2je_bigger.jpeg">
<em>John Willis @botchagalupe:</em> IMHO docker is to paas what chef was to Iaas 4 years ago
</section>
</div>
<div class="span6">
<section class="contentblock twitterblock">
<img src="https://twimg0-a.akamaihd.net/profile_images/3348427561/9d7f08f1e103a16c8debd169301b9944_bigger.jpeg">
<em>John Feminella @superninjarobot:</em> So, @getdocker is pure excellence. If you've ever wished for arbitrary, PaaS-agnostic, lxc/aufs Linux containers, this is your jam!
</section>
</div>
</div>
<div class="row">
<div class="span6">
<section class="contentblock twitterblock">
<img src="https://si0.twimg.com/profile_images/3408403010/4496ccdd14e9b7285eca04c31a740207_bigger.jpeg">
<em>David Romulan @destructuring:</em> I haven't had this much fun since AWS
</section>
</div>
<div class="span6">
<section class="contentblock twitterblock">
<img src="https://si0.twimg.com/profile_images/780893320/My_Avatar_bigger.jpg">
<em>Ricardo Gladwell @rgladwell:</em> wow @getdocker is either amazing or totally stupid
</section>
</div>
</div>
</div>
<!-- <p>Docker encapsulates heterogeneous payloads in <a href="#container">Standard Containers</a>, and runs them on any server with strong guarantees of isolation and repeatability.</p>
<p>It is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.</p>
-->
<div class="container">
<div class="row">
<div class="span6">
<section class="contentblock">
<!-- <img src="_static/lego_docker.jpg" width="600px" style="float:right; margin-left: 10px"> -->
<h2>Notable features</h2>
<ul>
<li>Filesystem isolation: each process container runs in a completely separate root filesystem.</li>
<li>Resource isolation: system resources like cpu and memory can be allocated differently to each process container, using cgroups.</li>
<li>Network isolation: each process container runs in its own network namespace, with a virtual interface and IP address of its own.</li>
<li>Copy-on-write: root filesystems are created using copy-on-write, which makes deployment extremeley fast, memory-cheap and disk-cheap.</li>
<li>Logging: the standard streams (stdout/stderr/stdin) of each process container is collected and logged for real-time or batch retrieval.</li>
<li>Change management: changes to a container's filesystem can be committed into a new image and re-used to create more containers. No templating or manual configuration required.</li>
<li>Interactive shell: docker can allocate a pseudo-tty and attach to the standard input of any container, for example to run a throwaway interactive shell.</li>
</ul>
<h2>Under the hood</h2>
<p>Under the hood, Docker is built on the following components:</p>
<ul>
<li>The <a href="http://blog.dotcloud.com/kernel-secrets-from-the-paas-garage-part-24-c">cgroup</a> and <a href="http://blog.dotcloud.com/under-the-hood-linux-kernels-on-dotcloud-part">namespacing</a> capabilities of the Linux kernel;</li>
<li><a href="http://aufs.sourceforge.net/aufs.html">AUFS</a>, a powerful union filesystem with copy-on-write capabilities;</li>
<li>The <a href="http://golang.org">Go</a> programming language;</li>
<li><a href="http://lxc.sourceforge.net/">lxc</a>, a set of convenience scripts to simplify the creation of linux containers.</li>
</ul>
</section>
</div>
<div class="span6">
<section class="contentblock">
<div id="wufoo-z7x3p3">
Fill out my <a href="http://dotclouddocker.wufoo.com/forms/z7x3p3">online form</a>.
</div>
<script type="text/javascript">var z7x3p3;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'dotclouddocker',
'formHash':'z7x3p3',
'autoResize':true,
'height':'577',
'async':true,
'header':'show'};
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'wufoo.com/scripts/embed/form.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
try { z7x3p3 = new WufooForm();z7x3p3.initialize(options);z7x3p3.display(); } catch (e) {}};
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
})(document, 'script');</script>
</section>
<section class="contentblock">
<h3 id="twitter">Twitter</h3>
<a class="twitter-timeline" href="https://twitter.com/getdocker" data-widget-id="312730839718957056">Tweets by @getdocker</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</section>
</div>
</div>
</div> <!-- end container -->
<div class="container">
<footer id="footer" class="footer">
<div class="row">
<div class="span12">
Docker is a project by <a href="http://www.dotcloud.com">dotCloud</a>
</div>
</div>
<div class="row">
<div class="emptyspace" style="height: 40px">
</div>
</div>
</footer>
</div>
<!-- bootstrap javascipts -->
<script src="_static/js/vendor/bootstrap.min.js" type="text/javascript"></script>
<!-- Google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6096819-11']);
_gaq.push(['_setDomainName', 'docker.io']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>

21
docs/sources/index.rst Normal file
View File

@@ -0,0 +1,21 @@
:title: docker documentation
:description: docker documentation
:keywords:
Documentation
=============
This documentation has the following resources:
.. toctree::
:maxdepth: 1
concepts/index
installation/index
examples/index
contributing/index
commandline/index
faq
.. image:: http://www.docker.io/_static/lego_docker.jpg

View File

@@ -0,0 +1,88 @@
Amazon EC2
==========
Please note this is a community contributed installation path. The only 'official' installation is using the
:ref:`ubuntu_linux` installation path. This version may sometimes be out of date.
Installation
------------
Docker can now be installed on Amazon EC2 with a single vagrant command. Vagrant 1.1 or higher is required.
1. Install vagrant from http://www.vagrantup.com/ (or use your package manager)
2. Install the vagrant aws plugin
::
vagrant plugin install vagrant-aws
3. Get the docker sources, this will give you the latest Vagrantfile.
::
git clone https://github.com/dotcloud/docker.git
4. Check your AWS environment.
Create a keypair specifically for EC2, give it a name and save it to your disk. *I usually store these in my ~/.ssh/ folder*.
Check that your default security group has an inbound rule to accept SSH (port 22) connections.
5. Inform Vagrant of your settings
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.
::
export AWS_ACCESS_KEY_ID=xxx
export AWS_SECRET_ACCESS_KEY=xxx
export AWS_KEYPAIR_NAME=xxx
export AWS_SSH_PRIVKEY=xxx
The environment variables are:
* ``AWS_ACCESS_KEY_ID`` - The API key used to make requests to AWS
* ``AWS_SECRET_ACCESS_KEY`` - The secret key to make AWS API requests
* ``AWS_KEYPAIR_NAME`` - The name of the keypair used for this EC2 instance
* ``AWS_SSH_PRIVKEY`` - The path to the private key for the named keypair, for example ``~/.ssh/docker.pem``
You can check if they are set correctly by doing something like
::
echo $AWS_ACCESS_KEY_ID
6. Do the magic!
::
vagrant up --provider=aws
If it stalls indefinitely on ``[default] Waiting for SSH to become available...``, Double check your default security
zone on AWS includes rights to SSH (port 22) to your container.
If you have an advanced AWS setup, you might want to have a look at the https://github.com/mitchellh/vagrant-aws
7. Connect to your machine
.. code-block:: bash
vagrant ssh
8. Your first command
Now you are in the VM, run docker
.. code-block:: bash
docker
Continue with the :ref:`hello_world` example.

View File

@@ -0,0 +1,65 @@
.. _arch_linux:
Arch Linux
==========
Please note this is a community contributed installation path. The only 'official' installation is using the
:ref:`ubuntu_linux` installation path. This version may sometimes be out of date.
Installing on Arch Linux is not officially supported but can be handled via
either of the following AUR packages:
* `lxc-docker <https://aur.archlinux.org/packages/lxc-docker/>`_
* `lxc-docker-git <https://aur.archlinux.org/packages/lxc-docker-git/>`_
The lxc-docker package will install the latest tagged version of docker.
The lxc-docker-git package will build from the current master branch.
Dependencies
------------
Docker depends on several packages which are specified as dependencies in
either AUR package.
* aufs3
* bridge-utils
* go
* iproute2
* linux-aufs_friendly
* lxc
Installation
------------
The instructions here assume **yaourt** is installed. See
`Arch User Repository <https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages>`_
for information on building and installing packages from the AUR if you have not
done so before.
Keep in mind that if **linux-aufs_friendly** is not already installed that a
new kernel will be compiled and this can take quite a while.
::
yaourt -S lxc-docker-git
Starting Docker
---------------
Prior to starting docker modify your bootloader to use the
**linux-aufs_friendly** kernel and reboot your system.
There is a systemd service unit created for docker. To start the docker service:
::
sudo systemctl start docker
To start on system boot:
::
sudo systemctl enable docker

View File

@@ -0,0 +1,53 @@
.. _binaries:
Binaries
========
**Please note this project is currently under heavy development. It should not be used in production.**
Right now, the officially supported distributions are:
- Ubuntu 12.04 (precise LTS) (64-bit)
- Ubuntu 12.10 (quantal) (64-bit)
Install dependencies:
---------------------
::
sudo apt-get install lxc bsdtar
sudo apt-get install linux-image-extra-`uname -r`
The linux-image-extra package is needed on standard Ubuntu EC2 AMIs in order to install the aufs kernel module.
Install the docker binary:
::
wget http://get.docker.io/builds/Linux/x86_64/docker-master.tgz
tar -xf docker-master.tgz
sudo cp ./docker-master /usr/local/bin
Note: docker currently only supports 64-bit Linux hosts.
Run the docker daemon
---------------------
::
sudo docker -d &
Run your first container!
-------------------------
::
docker run -i -t ubuntu /bin/bash
Continue with the :ref:`hello_world` example.

Some files were not shown because too many files have changed in this diff Show More