Compare commits

..

993 Commits

Author SHA1 Message Date
Michael Crosby
5bc2ff8a36 Bump to version 1.4.1
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-15 15:57:00 -08:00
Brian Goff
a83dadbeaf Fix volumes-from/bind-mounts passed in on start
Fixes #9628
Slightly reverts #8683, HostConfig on start is _not_ deprecated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-12-15 15:54:06 -08:00
Michael Crosby
eac27ad46d Add test to enforce volume build content
This tests ensures that the content from a dir within a build is carried
over even if VOLUME for that dir is specified in the Dockerfile.  This
test ensures this long standing functionality.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-15 15:53:55 -08:00
Jessie Frazelle
0e4e200071 Merge pull request #9345 from jfrazelle/bump_v1.4.0
Bump version to 1.4.0
2014-12-11 16:31:29 -08:00
Jessica Frazelle
4595d4fb03 Bump version to v1.4.0
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-11 15:00:44 -08:00
Jessica Frazelle
debf60b466 Merge branch master into bump_v1.4.0
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-11 15:00:03 -08:00
Jessie Frazelle
ce1393cb55 Merge pull request #9616 from cyphar/9608-builder-fix-incomplete-chown-walk-addcontext
builder: internals: fix incomplete chown walk when fixing permissions
2014-12-11 13:54:08 -08:00
Michael Crosby
4d318db749 Merge pull request #9620 from tiborvass/merge_release_v1.3.3
Merge release v1.3.3
2014-12-11 13:53:32 -08:00
Tibor Vass
9f48be69e5 Change version to 1.3.3-dev
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:35:22 -05:00
unclejack
5b851982da Bump version to v1.3.3
Conflicts:
	VERSION

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:33:20 -05:00
Tibor Vass
fdabd6b14e docs: Add release notes
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:29:28 -05:00
unclejack
bff1d9dbce validate image ID properly & before load
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>

Conflicts:
	graph/load.go
2014-12-11 16:29:27 -05:00
Arnaud Porterie
af2021955c Add integration test for xz path issue
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>

Conflicts:
	integration-cli/docker_cli_build_test.go
2014-12-11 16:29:15 -05:00
Michael Crosby
001ac15b54 Decompress archive before streaming the unpack in a chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/archive.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/archive.go
2014-12-11 16:29:13 -05:00
Michael Crosby
7862f831fe Update chroot apply layer to handle decompression outside chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/diff.go
2014-12-11 16:28:24 -05:00
Cristian Staretu
e4ba82d50e Add build tests covering extraction in chroot
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00
unclejack
a57eee2229 integ-cli: add test for links in volumes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00
unclejack
7496cbbccc integ-cli: add build test for absolute symlink
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00
Tibor Vass
0e71a48d4e Add another symlink breakout test
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	integration-cli/docker_cli_build_test.go
2014-12-11 16:26:51 -05:00
Tibor Vass
5f0f0c228d symlink: add more tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:26:01 -05:00
Tibor Vass
ff4d05ed73 symlink: cleanup names and break big test into multiple smaller ones
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:26:01 -05:00
Tibor Vass
b7f352b0fb Refactor of symlink tests to remove testdata dir
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-11 16:26:01 -05:00
Tianon Gravi
fa3ec89515 Simplify FollowSymlinkInScope based on Go 1.3.3's EvalSymlinks
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-12-11 16:26:01 -05:00
Tibor Vass
be8f9a2313 Merge pull request #9617 from tiborvass/bump_v1.3.3
Bump v1.3.3
2014-12-11 15:31:43 -05:00
Aleksa Sarai
916cba9c58 builder: internals: fix incomplete chown walk when fixing permissions
This patch fixes the permission fixing code used by addContext, which
would not be responsible for Lchown-ing top-level directories added to a
destination that didn't exist prior to untar-ing the context.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-12-12 06:07:16 +11:00
Vincent Batts
74bbb93571 Merge pull request #9258 from rhvgoyal/transaction-id-improvements
devmapper fix usage of pool transaction id
2014-12-11 12:58:18 -05:00
unclejack
d344625847 Bump version to v1.3.3 2014-12-11 17:37:17 +02:00
Hans Rødtang
496c2748cf Updated cover tool import path.
Signed-off-by: Hans Rødtang <hansrodtang@gmail.com>
2014-12-11 17:37:17 +02:00
Vincent Batts
6700580bbc Merge pull request #9604 from crosbymichael/registry-fruit-loops
Prevent infinite loop with var overshadowing
2014-12-11 10:36:47 -05:00
Michael Crosby
9a7a1e5be0 Refactor put image function's redirect loop
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-10 18:11:27 -08:00
Michael Crosby
3b4de1070f Prevent loop with var overshadowing
Incase of a 3xx redirect the var was being overshowed and ever changed
causing an infinite loop.

Fixes #9480

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-10 17:43:21 -08:00
Tibor Vass
ee8504bc5a docs: Add release notes
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-10 18:19:10 -05:00
James Turnbull
eba451b659 Merge pull request #9566 from jfrazelle/btrfs-overlayfs
add note to docs about overlay + btrfs unsupported
2014-12-11 09:32:10 +11:00
Jessica Frazelle
340ea25ac1 add note to docs about overlay + btrfs
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-10 14:29:41 -08:00
Alexander Morozov
5ca4ba9ed0 Merge pull request #9597 from icecrime/9467-chown_regression
Fix permissions on ADD/COPY
2014-12-10 11:47:33 -08:00
Arnaud Porterie
cfc24769a2 Fix permissions on ADD/COPY
Fix a regression introduced in PR#9467 when a single file was added or
copied.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-10 11:09:03 -08:00
Michael Crosby
b905f88ee5 Merge pull request #9582 from Mic92/tls_interactive_exec
Fix interactive TLS postContainersAttach
2014-12-10 10:37:50 -08:00
Michael Crosby
428c263a6c Merge pull request #9099 from vbatts/vbatts-tarsum_spec
pkg/tarsum: specification on TarSum checksum algorithm
2014-12-10 10:24:48 -08:00
Jörg Thalheim
a25168d28d Fix interactive TLS postContainersAttach
related to 266a1044de

Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
2014-12-10 08:57:38 +01:00
Jessie Frazelle
3076115e2c Merge pull request #9588 from LK4D4/remove_stderr_from_build
Use Set for stderr "logs" job in builder
2014-12-09 19:48:29 -08:00
Alexandr Morozov
a62cbdeb47 Use Set for stderr "logs" job in builder
Because engine implicitly adds his stder to job stderr

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-12-09 19:08:24 -08:00
Michael Crosby
fb810d18bd Merge pull request #9318 from shishir-a412ed/doc-cpu-share
Enhanced description for 'docker run' command, -c/--cpu-shares flag
2014-12-09 17:21:09 -08:00
Alexander Morozov
fa7e01794f Merge pull request #9537 from icecrime/9476-tty_stdin_redirect
Forbid client piping to tty enabled container
2014-12-09 15:17:44 -08:00
Arnaud Porterie
67e3ddb75f Forbid client piping to tty enabled container
Forbid `docker run -t` with a redirected stdin (such as `echo test |
docker run -ti busybox cat`). Forbid `docker exec -t` with a redirected
stdin. Forbid `docker attach` with a redirect stdin toward a tty enabled
container.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-09 14:30:49 -08:00
Brian Goff
243a640d3e Add test for exec tty stdin close
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-12-09 14:30:49 -08:00
Alexander Morozov
2687287289 Merge pull request #9575 from brahmaroutu/lxcconf_9501
User should get error message on wrong config
2014-12-09 14:10:38 -08:00
Srini Brahmaroutu
8dcbd6ab63 User should get error message on wrong config
closes #9501

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-12-09 21:52:07 +00:00
Alexandr Morozov
994e4a1c69 Change path breakout detection logic in archive package
Fixes #9375

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>

Conflicts:
	integration-cli/docker_cli_cp_test.go
		removed extra test
2014-12-09 23:16:03 +02:00
Arnaud Porterie
0de96a8163 Fix client-side HTTP hijacking over TLS
Properly CloseWrite() the client socket once done with stdin when using
TLS connection (this used to rely on an erroneous type assertion).

Fixes #8658.
Fixes #8642.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: Michael Crosby <crosby.michael@gmail.com>
2014-12-09 14:56:17 -05:00
Michael Crosby
c8fc8768b6 Flush stdin from within chroot archive
This makes sure that we don't buffer in memory and that we also flush
stdin from diff as well as untar.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/chrootarchive/diff.go
2014-12-09 14:56:17 -05:00
Lewis Marshall
f2008c5359 Fix chroot untar for zero padded archive from slow reader
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2014-12-09 14:56:16 -05:00
unclejack
acf1720b3f validate image ID properly & before load
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-09 14:56:16 -05:00
Arnaud Porterie
0e9a7bc3ce Add integration test for xz path issue
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>

Conflicts:
	integration-cli/docker_cli_build_test.go
2014-12-09 14:56:16 -05:00
Michael Crosby
313a1b7620 Decompress archive before streaming the unpack in a chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/archive.go
	pkg/chrootarchive/archive.go
2014-12-09 14:56:16 -05:00
Michael Crosby
62d83404b5 Update chroot apply layer to handle decompression outside chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/archive.go
2014-12-09 14:56:16 -05:00
Cristian Staretu
aef842e7df Add build tests covering extraction in chroot
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-09 14:56:16 -05:00
unclejack
e629e255d8 integ-cli: add test for links in volumes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-09 14:56:16 -05:00
unclejack
134f8e6b47 integ-cli: add build test for absolute symlink
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-09 14:56:16 -05:00
Tibor Vass
1cd89729d5 Add another symlink breakout test
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-09 14:56:16 -05:00
Tibor Vass
566146bc13 symlink: add more tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-09 14:56:16 -05:00
Tibor Vass
1ebafeb635 symlink: cleanup names and break big test into multiple smaller ones
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-09 14:56:16 -05:00
Tibor Vass
18193ae0a3 Refactor of symlink tests to remove testdata dir
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-12-09 14:56:16 -05:00
Tianon Gravi
cd745d5c6e Simplify FollowSymlinkInScope based on Go 1.3.3's EvalSymlinks
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-12-09 14:56:16 -05:00
Michael Crosby
bb24f99d74 Merge pull request #9356 from cc272309126/fix-exec-paused-container
Fix the issue that when docker exec a paused container, it will always
2014-12-09 11:01:44 -08:00
Michael Crosby
64ebffe7b6 Merge pull request #9467 from icecrime/9401-restrict_add_chown_scope
Reduce permissions changes scope after ADD/COPY
2014-12-09 10:40:23 -08:00
Michael Crosby
86efd1a102 Merge pull request #9447 from ashahab-altiscale/7687-lxc-cap-add-cap-drop
LXC CAP ADD CAP DROP IN TEMPLATE
2014-12-09 10:35:52 -08:00
Tianon Gravi
ca2ebaeafe Merge pull request #9581 from vbatts/vbatts-fix_gh9138
contrib: fix the docker-device-tool
2014-12-09 09:30:37 -08:00
shishir-a412ed
2597bffe9a Added description for 'docker run' command, -c/--cpu-shares flag
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2014-12-09 09:55:56 -05:00
James Turnbull
c587a3faf6 Merge pull request #9558 from philips/fixup-typo-in-systemd-article
docs: docker.service not services
2014-12-09 23:10:17 +11:00
James Turnbull
74b29e8b45 Merge pull request #9559 from philips/use-dropins-in-systemd-article
docs: use systemd drop-ins instead of copying
2014-12-09 23:09:52 +11:00
unclejack
f568b282fe Merge pull request #9573 from crosbymichael/flush-stdin
Flush stdin from within chroot archive
2014-12-09 01:54:01 +02:00
Fred Lifton
03d1622ab8 Merge pull request #9522 from SvenDowideit/add-some-cap-add-examples
Add some cap add examples
2014-12-08 15:50:25 -08:00
Michael Crosby
d1535131d2 Flush stdin from within chroot archive
This makes sure that we don't buffer in memory and that we also flush
stdin from diff as well as untar.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-08 15:41:07 -08:00
Tibor Vass
c9285a08b1 Merge pull request #9539 from flynn/chroot-untar-empty-archive-slow
Fix chroot untar for zero padded archive from slow reader
2014-12-08 17:59:21 -05:00
Alexander Morozov
0d94196999 Merge pull request #9567 from jfrazelle/8333-net-link-error
Throw error when container links to --net host container
2014-12-08 14:36:44 -08:00
Jessica Frazelle
6743be44ca Running a container that links to a container with --net host
should throw an error.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-08 11:33:18 -08:00
Jessie Frazelle
58ce0146e1 Merge pull request #9512 from duglin/Issue9404
Make 'docker build' send non-err output to stdout
2014-12-08 11:08:13 -08:00
Arnaud Porterie
12252e39a0 Merge pull request #9489 from crosbymichael/info-root
Return docker's root dir in docker -D info
2014-12-08 09:05:00 -08:00
Brandon Philips
2d51d71561 docs: use systemd drop-ins instead of copying
Copying the entire docker service file isn't necessary to add an
environment variable, instead use a drop-in configuration file. The nice
side-effect is that the user gets any vendor updates to the
docker.service file.

Signed-off-by: Brandon Philips <brandon.philips@coreos.com>
2014-12-07 18:45:50 -08:00
Brandon Philips
e0792e7ece docs: remove a trailing whitespace
Signed-off-by: Brandon Philips <brandon.philips@coreos.com>
2014-12-07 18:45:43 -08:00
Brandon Philips
1ae7be716e docs: docker.service not services
Minor but important typo in the new systemd guide introduced in #9347.

Signed-off-by: Brandon Philips <brandon.philips@coreos.com>
2014-12-07 18:35:37 -08:00
Jessie Frazelle
53d5299a40 Merge pull request #9497 from icecrime/86580-tls_interactive_exec
Fix interactive exec over TLS
2014-12-06 13:12:06 -08:00
Arnaud Porterie
f91a79e071 Merge pull request #9543 from ErikDubbelboer/racefix
Removed race condition
2014-12-06 09:08:36 -08:00
Erik Dubbelboer
46b1194d99 Removed race condition
If two interrupts were fired really quickly interruptCount could have been incremented twice before the LoadUint32 making cleanup not being called at all.

Signed-off-by: Erik Dubbelboer <erik@dubbelboer.com>
2014-12-06 22:52:19 +08:00
Lewis Marshall
c128c134d7 Fix chroot untar for zero padded archive from slow reader
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2014-12-06 02:44:31 +00:00
Abin Shahab
fdf7457683 LXC CAP ADD CAP DROP IN TEMPLATE
Added cap-drop and cap-add in lxc template
Docker-DCO-1.1-Signed-off-by: Abin Shahab <ashahab@altiscale.com> (github: ashahab-altiscale)
2014-12-05 23:08:22 +00:00
Alexander Morozov
984b072a37 Merge pull request #9479 from jlhawn/tarsum_test_fix
Correct TarSum benchmarks: 9kTar and 9kTarGzip
2014-12-05 14:47:54 -08:00
Michael Crosby
654da4e151 Return docker's root dir in docker -D info
This adds the docker daemon's root directory to docker info when running
in debug mode.  This allows the user to view the root directory where
docker is writing and storing state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 12:13:25 -08:00
Jessie Frazelle
52a52909a8 Merge pull request #9488 from crosbymichael/update-libcontainer-dec3
Update libcontainer to 53eca435e63db58b06cf796d3a9
2014-12-05 12:05:06 -08:00
Michael Crosby
2525a04594 Merge pull request #9493 from SvenDowideit/note-lxc-conf-pitfall
Note that using -lxc-conf to change things Docker manages has pitfalls
2014-12-05 11:16:19 -08:00
Michael Crosby
8bfe4d906e Merge pull request #9528 from SvenDowideit/add-license-to-docs
Add Apache license and link to the docs
2014-12-05 11:15:47 -08:00
Sven Dowideit
522e631096 I was talking to someone whom i listen to, and she noted that our docs don't mention the license
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-12-05 21:06:11 +10:00
Sven Dowideit
5f2000944b Add a fuse example, combining both SYS_ADMIN and --device
inspired by #9448 and #9487

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)

Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-12-05 16:42:48 +10:00
Sven Dowideit
48a596a804 add --cap-add=NET_ADMIN to make a new network device
inspired by #9452

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)

Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-12-05 16:30:54 +10:00
Sven Dowideit
8dfcbf62ed Merge pull request #9272 from SvenDowideit/pr_out_try_out_a_different_phrase_for_icc
Try out a different phrase for --icc
2014-12-05 16:22:51 +10:00
James Turnbull
a10b0cd23f Merge pull request #9504 from davidmat/patch-1
Update Amazon EC2 Docker installation instructions
2014-12-04 21:57:45 -08:00
James Turnbull
ebf89cf219 Merge pull request #9507 from jsternberg/docker-build-docs-formatting-fix
Fixing docs formatting for the forcerm flag on docker build
2014-12-04 21:54:14 -08:00
Fred Lifton
84dc2c83cb Merge pull request #9464 from SvenDowideit/sven_tries_webhooks
Add some extra details to webhook docs
2014-12-04 19:44:26 -08:00
James Turnbull
0bd51836c8 Merge pull request #9516 from SvenDowideit/tweak-sidebar-css-for-more-spacing
this v spacing irritated me while i was reading
2014-12-04 19:26:08 -08:00
Sven Dowideit
b266ad9c60 Show image of the Build trigger screen, and add a little search engine fodder for it.
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-12-05 13:05:38 +10:00
Sven Dowideit
b4b899264e Add some extra details to webhook docs
Update the webhook JSON payloads to real ones,
and show there is a difference between an automated build webhook payload and a normal repo payload

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)

Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-12-05 12:13:22 +10:00
Sven Dowideit
11a75ec97f this v spacing irritated me while i was reading
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-12-05 12:01:13 +10:00
Arnaud Porterie
f3cedce360 Reduce permissions changes scope after ADD/COPY
Permissions after an ADD or COPY build instructions are now restricted
to the scope of files potentially modified by the operation rather than
the entire impacted tree.

Fixes #9401.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-04 17:16:22 -08:00
Sven Dowideit
8e59bda173 Merge pull request #9388 from SvenDowideit/update-docs-from-cli
Auto-update documentation from the output of the cli.
2014-12-05 11:11:28 +10:00
Sven Dowideit
e01baa6be7 Auto-update documentation from the output of the cli.
I've re-jigged the run man page so that each option's text begins with the
cli's help text for that flag, and then ay subsequent lines in the man page
are carried forward.

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-12-05 10:43:38 +10:00
Michael Crosby
6e7a210db6 Merge pull request #9510 from crosbymichael/chrootarchive
Use consistent ApplyLayer in overlayfs
2014-12-04 14:21:26 -08:00
Doug Davis
5c91bb93a7 Make 'docker build' send non-err output to stdout
Right now 'docker build' will send:
   Sending build context to Docker daemon
to stderr, instead of stdout.  This PR fixes that.

I looked in the rest of api/client/commands.go for other cases
that might do this and only one jumped out at me:
  https://github.com/docker/docker/blob/master/api/client/commands.go#L2202
but I think if I changed that to go to stdout then it'll mess people up
who are expecting just the container ID to be printed to the screen and
there is no --quiet type of flag we can check.

Closes #9404

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-12-04 14:06:40 -08:00
Michael Crosby
f47d6b9b9d Use consistent ApplyLayer in overlayfs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-04 12:03:44 -08:00
David Mat
da667581cf Update Amazon EC2 Docker installation instructions
The installation guide for EC2 is outdated, as the current version of Amazon Linux (2014.09) is now Docker ready. No need to go through the manual route anymore. The official AMI has Docker packages in the repository now (this was the 'pre-release' option in the outdated instructions).

Docker-DCO-1.1-Signed-off-by: David Mat <david@davidmat.com> (github: davidmat)
2014-12-04 21:02:29 +01:00
Jessie Frazelle
bfde3f2cd1 Merge pull request #9494 from jfrazelle/cleanup
Cleanup unnecessary abstractions in integration-cli
2014-12-04 11:29:21 -08:00
cc272309126
1bb02117db Fix the issue when docker exec a paused container, it will always hang.
Add the test case of this issue.

Docker-DCO-1.1-Signed-off-by: Chen Chao <cc272309126@gmail.com> (github: cc272309126)
2014-12-05 03:10:44 +08:00
Jonathan A. Sternberg
eb7d646a44 Fixing docs formatting for the forcerm flag on docker build
Signed-off-by: Jonathan A. Sternberg <jonathansternberg@gmail.com>
2014-12-04 12:35:31 -05:00
James Turnbull
603fe40661 Merge pull request #9495 from SvenDowideit/aws-cli-exclude-still-broken
Something changed, broke the docs release script, and it seems that --ex...
2014-12-04 03:14:34 -05:00
Arnaud Porterie
266a1044de Fix interactive exec over TLS
The code no longer assumes a net.TCPConn underlying the HTTP connection
in order to close attached streams.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-03 23:43:03 -08:00
Josh Hawn
385917e22c Correctly close generated benchmark archives
Another update to TarSum tests, this patch fixes an issue where
the benchmarks were generating archives incorrectly by not closing
the tarWriter.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-03 22:26:06 -08:00
Sven Dowideit
6d560e197c Something changed, broke the docs release script, and it seems that --exclude still doesn't work, so I'm removing it
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-12-04 16:10:55 +10:00
Jessica Frazelle
6fd818f3ef Fix output format where no variable specified in mount pkg
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 19:02:51 -08:00
Jessica Frazelle
4ee3a318a1 Run 'go vet' on integration-cli.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 18:45:51 -08:00
Jessica Frazelle
fa753e67ae Remove unnessary abstraction deepEqual
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 17:52:06 -08:00
Sven Dowideit
b91d330088 Note that using -lxc-conf to change things Docker manages has pitfalls
Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-12-04 11:49:06 +10:00
Jessica Frazelle
02a021119f Remove unnecessary abstraction nLines
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 17:47:28 -08:00
Jessica Frazelle
7ba9a18ade cleanup: remove startCommand function, only used once, and
unecessary abstraction.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 17:43:26 -08:00
Jessica Frazelle
7c7026bd22 Be consistent about libtrust import path.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 17:36:14 -08:00
James Turnbull
e15ffa45a6 Merge pull request #9486 from ClusterHQ/9484-fromSrc-api-docs
Document fromSrc more clearly
2014-12-03 20:31:44 -05:00
Jessie Frazelle
8520fd55b6 Merge pull request #9451 from erikh/fix-sqlite
graphdb: initialize the database semi-idempotently on every connection, not just new installs.
2014-12-03 17:17:20 -08:00
Michael Crosby
e2a4b730ca Merge pull request #9490 from jfrazelle/fix-test-cmd-eff
Fix tests with old cmd function.
2014-12-03 16:29:31 -08:00
Jessica Frazelle
e201d5bcd4 Fix tests with old cmd function.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 15:53:19 -08:00
Jessie Frazelle
67fda33197 Merge pull request #9089 from cpuguy83/8942_create_volumes_on_create
Initialize volumes when container is created
2014-12-03 15:42:09 -08:00
Michael Crosby
269b37503e Update libcontainer to 53eca435e63db58b06cf796d3a9
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-03 14:53:11 -08:00
Jean-Paul Calderone
0888c1880f Update the most recent released version of the docs as well.
Signed-off-by: Jean-Paul Calderone <exarkun@twistedmatrix.com>
2014-12-03 17:14:08 -05:00
Jean-Paul Calderone
826f809d09 Talk about URL support and the real meaning of - in the latest fromSrc API documentation.
Signed-off-by: Jean-Paul Calderone <exarkun@twistedmatrix.com>
2014-12-03 17:13:48 -05:00
Alexander Morozov
c8ccfcb930 Merge pull request #9482 from ncdc/TempArchive-close-bug
Fix invalid argument error on push
2014-12-03 14:13:15 -08:00
Andy Goldstein
48ec176cd5 Fix invalid argument error on push
With 32ba6ab from #9261, TempArchive now closes the underlying file and
cleans it up as soon as the file's contents have been read. When pushing
an image, PushImageLayerRegistry attempts to call Close() on the layer,
which is a TempArchive that has already been closed. In this situation,
Close() returns an "invalid argument" error.

Add a Close method to TempArchive that does a no-op if the underlying
file has already been closed.

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
2014-12-03 16:12:24 -05:00
Michael Crosby
5d49d2bb7a Merge pull request #9426 from lhuard1A/overlay_rename
Rename overlayfs to overlay
2014-12-03 10:57:42 -08:00
Josh Hawn
92fd49f7ca Correct TarSum benchmarks: 9kTar and 9kTarGzip
These two cases did not actually read the same content with each iteration
of the benchmark. After the first read, the buffer was consumed. This patch
corrects this by using a bytes.Reader and seeking to the beginning of the
buffer at the beginning of each iteration.

Unfortunately, this benchmark was not actually as fast as we believed. But
the new results do bring its results closer to those of the other benchmarks.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-03 10:44:05 -08:00
Vivek Goyal
17b75a21a6 devmapper: Use transactions during device deletion
Use transaction logic during device deletion and do rollback if transaction
is not complete. Following is the sequence of events.

- Open transaction and save to metafile
- Delete device from pool
- Delete device metadata file from disk
- Close Transaction

If docker crashes without closing transaction then rollback will take
place upon next docker start.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
c115c4aa45 devmapper: Use transaction mechanism during device or snap device creation
Finally this patch uses the notion of transaction for device or snapshot
device creation. 

Following is sequence of event.

- Open a trasaction and save details in a file.
- Create a new device/snapshot device
- If a new device id is used, refresh transaction with new device id details.
- Create device metadata file
- Close transaction.

If docker crashes anywhere in between without closing transaction, then
upon next start, docker will figure out that there was a pending transaction
and it will roll back transaction. That is it will do following.

- Delete Device from pool
- Delete device metadata file
- Remove transaction file to mark no transaction is pending.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
e28a419e11 devmapper: Find a free device Id to use for device creation
Finally, we seem to have all the bits to keep track of all used device
Ids and find a free device Id to use when creating a  new device. Start
using it.

Ideally we should completely move away from retry logic when pool returns
-EEXISTS. For now I have retained that logic and I simply output a warning.
When things are stable, we should be able to get rid of it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
14d0dd855e devmapper: Open code createDevice() and createSnapDevice()
Open code createDevice() and createSnapDevice() and move all the logic
in the caller.

This is a sheer code reorganization so that all device Id allocation
logic is in one function. That way in case of erros, one can easily
cleanup and mark device Id free again. (Later patches benefit from
it).

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
a44c23fe66 devmapper: Provide a helper function getNextDeviceId()
Right now we are accessing devices.NextDeviceId directly and also 
incrementing it at various places.

Instead provide a helper function which is responsile for
incrementing NextDeviceId and return next deviceId. 

This is just code structuring. This will help later once we
convert this function to find a free device Id and it goes
through a bitmap of used/free device Ids.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
39dc7829de devmapper: Construct initial device Id map from device meta files
When docker starts, build a used/free Device Id map from the per
device meta files we already have. These meta files have the data
which device Ids are in use. Parse these files and mark device as
used in the map.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
4d39e056aa devmapper: Keep track of used device Ids in a bitmap
Currently devicemapper backend does not keep track of used device Ids in
the pool. It tries a device Id and if that device Id exists in pool, it
tries with a different Id and keeps on doing this in a loop till it succeeds.

This worked fine so far but now we are moving to transaction based
device creation and deletion. We will keep deviceId information in 
transaction which will be rolled back if docker crashed before transaction
was complete.

If we store a deviceId in transaction and later figure out it already
existed in pool and docker crashed, then we will rollback and remove
that existing device Id from pool (which we should not have).

That means, we should know free device Id in pool in advance before
we put that device Id in transaction.

Hence this patch creates a bitmap (one bit each for a deviceId), and
sets the bit if device Id is used otherwise resets it. This patch
is just preparing the ground right now. Actual usage will follow
in later patches.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
359a38b26a devmapper: Use a common delete function for all device deletion operation
Right now setupBaseImage() uses deleteDevice() to delete uninitialized
base image while rest of the code uses DeleteDevice(). Change it and
use a common function everywhere for the sake of uniformity.

I can't see what harm can be done by doing little extra locking done
by DeleteDevice().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
f078bcd8e5 devmapper: Rename NewTransactionId to OpenTransactionId
Very soon we will have the notion of an open transaction and keep its
details in a metafile.

When a new transaction is opened, we allocate a new transaction Id, 
do the device creation/deletion and then we will close the transaction.

I thought that OpenTransactionId better represents the semantics of
transaction Id associated with an open transaction instead of NewtransactionId.

This patch just does the renaming. No functionality change.

I have also introduced a structure "Transaction" which will keep all
the details associated with a transaction. Later patches will add more
fields in this structure.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
7b0a1b814b devmapper: Allocate new transaction Id using current transaction Id
Currently new transaction Id is created using allocateTransactionId()
function. This function takes NewTransactionId and bumps up by one 
to create NewTransactionId.

I think ideally we should be bumping up devices.TransactionId by 1
to come up with NewTransactionId. Because idea is that devices.TransactionId
contains the current pool transaction Id and to come up with a new
transaction Id bump it up by one.

Current code is not wrong as we are keeping NewTransactionId and
TransactionId in sync. But it will be more direct if we look at
devices.TransactionId to come up with NewTransactionId. That way
we don't have to even initialize NewTransactionId during startup
as first time somebody wants to do a transaction, it will be
allocated fresh.

So simplify the code a bit. No functionality change.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
6d347aeb69 devmapper: Remove unnecessary condition check in updatePoolTransactionId()
Currently updatePoolTransactionId() checks if NewTransactionId and
TransactionId are not same only then update the transaction Id in pool. This
check is redundant. Currently we call updatePoolTransactionId() only from
two places and both of these first allocate a new transaction Id.

Also updatePoolTransactionId() should only be called after allocating
new transaction Id otherwise it does not make any sense.

Remove the redundant check and reduce confusion.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
ad9118c696 devmapper: Create new helper function for device and snap creation
Create two new helper functions for device and snap device creation. These
functions will not only create the device and also register the device.

Again, makes the code structure better and keeps all transaction logic
contained to functions instead of spilling over into functions like
setupBaseImage or AddDevice().

Just the code reorganization. No functionality change.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
442247927b devmapper: Provide a function unregisterDevice()
Currently registerDevice() adds a device to in-memory table, saves metadata
and also updates the pool transaction ID.

Now move transaciton Id update out of registerDevice() and provide a new
function unregisterDevice() which does the reverse of registerDevice().
This will simplify some code down the line and make it more structured.

This is just code reorganization and should not change functionality.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
7b2b15d3e9 devmapper: Use device id as specified by caller
Currently devicemapper CreateDevice and CreateSnapDevice keep on retrying
device creation till a suitable device id is found. 

With new transaction mechanism we need to store device id in transaction
before it has been created.

So change the logic in such a way that caller decides the devices Id to
use. If that device Id is not available, caller bumps up the device Id
and retries.

That way caller can update transaciton too when it tries a new Id. Transaction
related patches will come later in the series.
  
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
5be77901cd devmapper: Do not add back device into hash map if meta file removal failed
When we are deleting a device, we also delete associated metadata file. If
that file removal fails, we are adding back the device in in-memory
table. I really can't see what's the point. When next lookup takes place
it will be automatically loaded if need be. Remove that code.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
824a87f7ef devmapper: Move pool id query and migration of old data in separate function
Right now initMetaData() first queries the pool for current transaciton Id
and then it migrates the old metafile.

Move pool transaction Id query and file migration in separate functions
for better code reuse and organization.

Given we have removed device transaction Id dependency from saveMetaData(),
we don't have to query pool transaction Id before migrating files.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
0db6cc85ed devmapper: Remove transaction Id update from saveMetaData()
Right now saveMetaData() is kind of little overloaded function. It is
supposed to save file metadata to disk. But in addition if user has
bumped up NewTransactionId before calling saveMetaData(), then it will
also update the transaction ID in pool.

Keep saveMetaData() simple and let it just save the file. Any update
of pool transaction ID is done inline in the code which needs it.

Also create an helper function updatePoolTransactionId() to update pool
transaction Id.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
004d8b9b33 devmapper: Remove unnecessary call to allocateTransactionId() during device removal
Remove call to allocateTransactionId() during device removal. This seems to
be unnecessary and it is not clear what this call is doing.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
b721d6d8d0 devmapper: Do not check for transaction id during device metadata loading
Again, just because device transaction id is greater than pool transaction
id, it does not guarantee that device is in the pool. So do not check
of this during loading of device metadata.

Docker needs to deal with it. And device activation will fail when we try
to activate a device for whom metafile is present but there is no device
in the pool.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
bb00453e58 devmapper: Do not check for pool transaction id during old metadata migration
Current code is associating a transaction id with each device and if pool
transaction id is greater that value, then current code assumes that device
is there in pool.

Transaction id of pool is a mechanism so that during device creation and
removal one can define a transaction and during startup figure out if
transaction was complete or not. I think we are using transaction id 
throughout the code little inappropriately.

For example, if a device is being deleted, it is possible that we deleted
the device from pool but before we could delete metafile docker crashed.
When docker comes back it will think that device is in the pool (due to
device transaction id being less than pool transaction id) but device
is not in the pool.

Similary, it could happen that some data in the pool is corrupted and
during pool repair some devices are lost (without docker knowing about
it). In that case tool pool transaction id will be higher than device
transaction id and there are no guaratees that device is actually in
the pool.

So move away from this model where we think that a device is in pool if pool
transaction id is greater than device transaction Id. Per device
transaction Id just says that after device creation this should be pool's
transaction Id and nothing more.

Transaction id is per pool property (as opposed to per device property) and
will be used internally to figure out if last transaction was complete or
not and recover from failure during docker startup.  

If for some reason metafile is present but device is not in pool, then 
device activation will fail later.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Lénaïc Huard
2352f00e4f Remove the last references to overlayfs
This only renames docker internal structures.
It has no impact on the end-user.

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-03 14:06:19 +01:00
Lénaïc Huard
d680ca5c96 Rename the overlay storage driver
so that docker is started with `docker -d -s overlay` instead of `docker -d -s overlayfs`

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-03 13:57:23 +01:00
Sven Dowideit
070a519a9b fixes as per feedback
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-12-03 12:46:23 +10:00
Sven Dowideit
94d67d5d5b Try out a different phrase for --icc
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-12-03 12:46:23 +10:00
Sven Dowideit
a74c12177f 80-char limit
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-12-03 12:46:16 +10:00
Michal Minar
a2aa78f6ec Doc: described storage-driver options in cli reference
Documented --storage-opt=[] option in cli reference page. Content taken
from:

  daemon/graphdriver/devmapper/README.md

Signed-off-by: Michal Minar <miminar@redhat.com>

Docker-DCO-1.1-Signed-off-by: Michal Minar <miminar@redhat.com> (github: SvenDowideit)
2014-12-03 12:46:16 +10:00
Michal Minar
aa00ad47e2 Man: describe storage options
Documented --storage-opt=[] option in man page. Content taken from:

  daemon/graphdriver/devmapper/README.md

Signed-off-by: Michal Minar <miminar@redhat.com>

Docker-DCO-1.1-Signed-off-by: Michal Minar <miminar@redhat.com> (github: SvenDowideit)
2014-12-03 12:46:16 +10:00
Michal Minar
a61a4a3188 Man: describe --icc option better
Current description is misleading. It make an impression the --icc=false
prevents containers to talk with each other.

Signed-off-by: Michal Minar <miminar@redhat.com>

Docker-DCO-1.1-Signed-off-by: Michal Minar <miminar@redhat.com> (github: SvenDowideit)
2014-12-03 12:46:16 +10:00
Sven Dowideit
70c4b4eded Merge pull request #9429 from sindhus/patch-1
Fix dead link in oracle.md
2014-12-03 12:38:17 +10:00
Fred Lifton
315520b845 Merge pull request #9430 from sindhus/patch-3
Fix dead link cli.md
2014-12-02 16:06:48 -08:00
Michael Crosby
bc7ef42716 Merge pull request #9463 from jlhawn/tarsum_test_fix
Fix TarSum iteration test
2014-12-02 15:55:07 -08:00
Josh Hawn
8d9e25dbdd Fix TarSum iteration test
I noticed that 3 of the tarsum test cases had expected a tarsum with
a sha256 hash of
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
As I've been working with sha256 quite a bit lately, it struck me that
this is the initial digest value for sha256, which means that no data
was processed. However, these tests *do* process data. It turns out that
there was a bug in the test handling code which did not wait for tarsum
to end completely. This patch corrects these test cases.

I'm unaware of anywhere else in the code base where this would be an issue,
though we definitily need to look out in the future to ensure we are
completing tarsum reads (waiting for EOF).

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-02 15:28:13 -08:00
James Turnbull
1e81a69618 Merge pull request #9460 from shin-/docs_webhooks2
Webhooks documentation: additional improvements
2014-12-02 17:42:26 -05:00
James Turnbull
6a98ce2fc0 Merge pull request #9273 from programmerq/dockerimages_hub
refer to the registry instead of the hub
2014-12-02 17:15:04 -05:00
Joffrey F
bcef353557 Webhooks documentation: second pass addressing @fredlf's comments
Signed-off-by: Joffrey F <joffrey@docker.com>
2014-12-02 13:49:17 -08:00
Jessie Frazelle
906c7211e6 Merge pull request #9457 from icecrime/engine_logf
Remove unused Engine.Logf method
2014-12-02 12:17:11 -08:00
Arnaud Porterie
59da197de8 Remove unused Engine.Logf
The `Engine.Logf` method was unused and confusing.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-02 10:47:57 -08:00
Alexander Morozov
50445e4d0c Merge pull request #9435 from cpuguy83/9414_fix_exec_api_error_no_cmd
Check for no `Cmd` on exec create endpoint
2014-12-02 10:28:44 -08:00
Michael Crosby
e40bbf3b9a Merge pull request #9441 from LK4D4/retry_any_error_on_portmap
Try other port on any error from Map
2014-12-02 09:51:50 -08:00
Jeff Anderson
46437d1a60 Update dockerimages.md
remove 'public registry'

Signed-off-by: Jeff Anderson <jeff@docker.com>
2014-12-02 10:48:39 -07:00
Michael Crosby
5ec3a038a0 Merge pull request #9442 from icecrime/8658-tls_attach_hangs
Fix client-side HTTP hijacking over TLS
2014-12-02 09:47:29 -08:00
Erik Hollensbe
fb06e1c6eb graphdb: initialize the database semi-idempotently on every connection.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-12-02 03:02:25 -08:00
Lénaïc Huard
c57317893a Rename overlayfs to overlay
Since Linux 3.18-rc6, overlayfs has been renamed overlay.

This change was introduced by the following commit in linux.git:
ef94b1864d1ed5be54376404bb23d22ed0481feb ovl: rename filesystem type to "overlay"

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-02 10:02:59 +01:00
Arnaud Porterie
e98e56bb1e Fix client-side HTTP hijacking over TLS
Properly CloseWrite() the client socket once done with stdin when using
TLS connection (this used to rely on an erroneous type assertion).

Fixes #8658.
Fixes #8642.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: Michael Crosby <crosby.michael@gmail.com>
2014-12-01 18:13:52 -08:00
Sven Dowideit
b487d2f2ff Merge pull request #9330 from TomasTomecek/master
docs: man docker-images: inconsistent naming
2014-12-02 11:42:29 +10:00
James Turnbull
b241571102 Merge pull request #9431 from sindhus/patch-4
Fix dead link build.md
2014-12-01 20:29:48 -05:00
Victor Vieux
65e75998af Merge pull request #9425 from HuKeping/master
inspect: format the output of docker inspect
2014-12-01 16:51:47 -08:00
Alexandr Morozov
a00a1a1fca Try other port on any error from Map
Sometimes other programs can bind on ports from our range, so we just
skip this ports on allocation.

Fixes #9293
Probably fixes #8714

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-01 16:26:30 -08:00
Brian Goff
c8a3d31332 Check for no Cmd on exec create endpoint
Fixes #9414

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-12-01 17:54:15 -05:00
Jessie Frazelle
bdaf562b4c Merge pull request #9438 from crosbymichael/label-std-mounts
Label std mounts
2014-12-01 14:37:42 -08:00
Michael Crosby
92c840c87d Merge pull request #9439 from blakery/master
Cleanup: remove obsolete workaround
2014-12-01 13:14:47 -08:00
Michael Crosby
305e9cd2fa Label standard mounts within loop
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-01 14:54:14 -05:00
Michael Crosby
42522d29c7 Merge pull request #9407 from hqhq/hq_fix_comments
flag: fix the comments
2014-12-01 11:27:06 -08:00
Michael Crosby
2df1365819 Merge pull request #9424 from irachex/pprof_block
Attach goroutine blocking profiler
2014-12-01 11:13:05 -08:00
unclejack
8ddb42fbfd Merge pull request #9378 from LK4D4/change_breakout_detection
Change symlink breakout detection logic in archive package
2014-12-01 19:23:18 +02:00
Blake Geno
9200fdd197 remove obsolete workaround
Signed-off-by: Blake Geno <blakegeno@gmail.com>
2014-12-01 11:44:13 -05:00
Sindhu S
7754ef1f06 Fix dead link build.md 2014-12-01 19:35:58 +05:30
Sindhu S
b1dc0db56a Fix dead link cli.md 2014-12-01 19:28:02 +05:30
Sindhu S
ffda2035e5 Fix dead link in oracle.md 2014-12-01 19:07:04 +05:30
Huayi Zhang
51172493ab Attach goroutine blocking profiler
/debug/pprof/block is 404 currently

Signed-off-by: Huayi Zhang <irachex@gmail.com>
2014-12-01 16:46:59 +08:00
HuKeping
921346be48 inspect: format the output of docker inspect
Prior to this patch, one would get the output of docker inspect xxx
as below:

user@server:/mnt$ docker inspect ubuntu
[{
    "Architecture": "amd64",

    ...

    "VirtualSize": 199257566
}
]user@server:/mnt$

The last ']' was on the same line with the prompt, i wonder if it is
really what we want it be, it is a little weird, so i add a '\n' to it.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2014-12-01 16:28:08 +08:00
James Turnbull
653be15f17 Merge pull request #9421 from nealmcb/9418-registry_api-source-link
Fixes #9418 Docker Registry now open source
2014-12-01 01:11:49 -05:00
Neal McBurnett
4bf72613fe Fixes #9418 Docker Registry now open source
Signed-off-by: Neal McBurnett <neal@mcburnett.org>
2014-11-30 21:12:57 -07:00
Sven Dowideit
595cd5279e Merge pull request #9194 from flavio/update_installation_docs
Update installation docs
2014-12-01 13:18:12 +10:00
Sven Dowideit
3fce883a95 Merge pull request #9322 from javawizard/patch-1
Correct inaccuracy in docker pull documentation
2014-12-01 12:53:33 +10:00
Flavio Castelli
47d8ec0a42 Cover openSUSE and SUSE Linux Enterprise on the same page
Updated the documentation to cover the installation of Docker on
openSUSE and on SUSE Linux Enterprise.

Docker-DCO-1.1-Signed-off-by: Flavio Castelli <fcastelli@suse.com> (github: flavio)
2014-12-01 01:23:38 +01:00
Alexander Boyd
eb8e84c48a Correct inaccuracy in docker pull documentation
Signed-off-by: Alexander Boyd <alex@opengroove.org>
2014-11-29 23:36:19 -07:00
Qiang Huang
9cc73c62e6 flag: fix the comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2014-11-30 01:58:16 +08:00
James Turnbull
353ff40181 Merge pull request #9332 from jacobat/patch-1
Update documentation for EXPOSE
2014-11-29 09:27:49 -05:00
Jacob Atzen
8432224f0e Update documentation for EXPOSE
The documentation for EXPOSE seems to indicate, that EXPOSE is only relevant in
the context of links, which is not the case.

Signed-off-by: Jacob Atzen <jatzen@gmail.com>
2014-11-29 15:18:18 +01:00
James Turnbull
0675d7bbba Merge pull request #9335 from jamtur01/typo
Removed extraneous )
2014-11-29 02:14:10 -05:00
James Turnbull
5336f44630 Merge pull request #9396 from a-ba/fix-docs-update
fixed regression in docs-update.py
2014-11-29 02:12:54 -05:00
James Turnbull
9aad1a7d10 Merge pull request #9321 from shin-/docs_webhooks2
Expanded documentation for Webhooks 2.0
2014-11-29 02:11:38 -05:00
Jessie Frazelle
19844140d3 Merge pull request #9400 from emilymaier/9389-fix
Fixes race condition in test. Closes #9389.
2014-11-28 21:02:52 -07:00
Fred Lifton
2c97cc3995 Merge pull request #9227 from SvenDowideit/add-client-ip-to-hosts
Add an example of how to add your client IP to the container hosts file
2014-11-28 17:44:11 -08:00
Fred Lifton
11069f257f Merge pull request #9337 from shishir-a412ed/deprecated-images-t-v
Removing description for 'docker images' -t and -v flags, since they are deprecated.
2014-11-28 17:35:36 -08:00
Fred Lifton
6a4d4fb2f5 Merge pull request #9347 from SvenDowideit/extract-systemd-docs
Extract the systemd docs from various places and add a little more
2014-11-28 17:12:00 -08:00
Emily Maier
9c5e61c24c Fixes race condition in test. Closes #9389.
Signed-off-by: Emily Maier <emily@emilymaier.net>
2014-11-28 13:48:50 -05:00
Alexandr Morozov
be5bfbe221 Change path breakout detection logic in archive package
Fixes #9375

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-28 09:44:47 -08:00
Anthony Baire
9f8c14026c fixed regression in docs-update.py
17500eb renamed 'help' as 'help_string', but there was a miss


Signed-off-by: Anthony Baire <Anthony.Baire@irisa.fr>
2014-11-28 13:36:27 +01:00
Tomas Tomecek
095027944f docs: man docker-images: inconsistent naming
Synopsis is mentioning "NAME" while description is describing "REPOSITORY".

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2014-11-28 08:57:07 +01:00
James Turnbull
4083fa2620 Merge pull request #9285 from therealprologic/update-crux-docs
Updated installation docs for CRUX as a Docker Host.
2014-11-27 02:36:05 -05:00
Sven Dowideit
54050083d1 Add an example of how to add your client IP to the container hosts file
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-11-27 16:36:55 +10:00
James Turnbull
07e9ea86ca Merge pull request #9329 from acbodine/9296-dockervolume-doc-mount-behaviour-fix
Closes #9296 adds a more detailed note about the mount behavior with -v ...
2014-11-27 00:22:19 -05:00
James Turnbull
d3707a9411 Merge pull request #9359 from bfirsh/update-note-format-in-docs-style-guide
Update format of notes in docs style guide
2014-11-26 22:39:31 -05:00
James Turnbull
9e56c614a1 Merge pull request #9368 from msteinert/builder-md-typo
Fix a small typo
2014-11-26 22:39:19 -05:00
Sven Dowideit
ff327f9d57 Merge pull request #9282 from SvenDowideit/explain-VIRTUAL-SIZE
Explain what the VIRTUAL SIZE means
2014-11-27 12:19:09 +10:00
Sven Dowideit
498f208ade Explain what the VIRTUAL SIZE means
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-11-27 12:06:40 +10:00
Fred Lifton
ec07bb48fc Merge pull request #9275 from jfriedly/userguide-typos
Fix typos in the user guide main page
2014-11-26 17:03:59 -08:00
Sven Dowideit
d53b586ff1 Extract the systemd docs from various places and add a little more
Signed-off-by: Sven Dowideit <SvenDowideit@docker.com>
2014-11-27 10:17:46 +10:00
Alexander Morozov
9974fce28a Merge pull request #9366 from yoheiueda/increase-memory-limit
Increase memory limit in integration-cli test cases
2014-11-26 12:09:39 -08:00
Jessie Frazelle
6d171c5340 Merge pull request #9367 from jfrazelle/no-windows-for-you-yet
Windows should not be in "official release" yet
2014-11-26 11:59:21 -08:00
Jessica Frazelle
750dc335a9 Windows should not be officially released.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-26 11:50:07 -08:00
Vincent Batts
b47ff77b5c Merge pull request #9006 from snitm/thin-pool-improvements
Thin pool improvements
2014-11-26 14:44:09 -05:00
Michael Steinert
8b881df9b1 Fix a small typo
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
2014-11-26 13:09:44 -06:00
Yohei Ueda
64fd3e89c7 Increase memory limit in test cases
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-27 03:22:16 +09:00
Ben Firshman
12bc51603b Update format of notes in docs style guide
It seems like all of the notes in the docs are this format.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-11-26 15:15:10 +00:00
Michael Crosby
75b47467aa Merge pull request #9346 from jfrazelle/fix-events-test
fix tests where cmd function does not exist
2014-11-25 18:53:08 -08:00
Jessica Frazelle
8635b0248a fix where cmd function dne
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-25 18:34:08 -08:00
Jessie Frazelle
00c2a8f323 Merge pull request #9208 from duglin/Issue8703
Add support for docker exec to return cmd exitStatus
2014-11-25 18:03:51 -08:00
Jessie Frazelle
9160e01cef Merge pull request #8893 from vieux/filter_events
Events filtering (daemon side)
2014-11-25 17:52:27 -08:00
Doug Davis
90928eb114 Add support for docker exec to return cmd exitStatus
Note - only support the non-detached mode of exec right now.
Another PR will add -d support.

Closes #8703

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-25 17:49:25 -08:00
Michael Crosby
6a0177ed2e Merge pull request #8767 from erikh/update_parents_hosts_part2
Links test cleanup
2014-11-25 17:17:35 -08:00
Vincent Batts
79064a2820 Merge pull request #9279 from yoheiueda/termios-via-cgo
Use termios via CGO
2014-11-25 20:04:26 -05:00
Erik Hollensbe
68bc8de111 Test for updating hosts files via links.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-11-25 16:48:36 -08:00
Erik Hollensbe
20575d20ba Break some routines out of the mutable files test for future use
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-11-25 16:46:09 -08:00
Michael Crosby
1eb5e5d25f Merge pull request #9030 from cpuguy83/cleanup_host_parser
Cleanup ParseHost
2014-11-25 16:15:48 -08:00
Victor Vieux
f0f0e316aa fix tests
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-26 00:00:56 +00:00
Brian Goff
bd4fe9b986 Cleanup ParseHost
Current implementation is comingling things that ought not be together.
There are _some_ similarities between parsing for the different proto
types, but they are more different than alike, making the code extremely
difficult to reason about.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-25 18:55:40 -05:00
unclejack
1dadc51adc Merge pull request #9342 from unclejack/add_tarsum_maintainers
pkg/tarsum: add maintainers & add missing s
2014-11-26 01:45:51 +02:00
unclejack
3db5ea1617 pkg/tarsum: add maintainers & add missing s
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-11-26 00:44:16 +02:00
Michael Crosby
93be7c0e52 Merge pull request #9262 from rhatdan/debug
Allow developers to build docker with debuginfo included
2014-11-25 14:21:00 -08:00
Joffrey F
c83cd5c7ac Expanded documentation for Webhooks 2.0 (chains and callbacks information)
Signed-off-by: Joffrey Fuhrer <joffrey@gmail.com>
2014-11-25 22:22:04 +01:00
Dan Walsh
61b2766e75 Label content created for containers with the private label
Currently this content gets a system label and is not writable based on
SELinux controls.  This patch will set the labels to the correct label.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-11-25 14:12:26 -05:00
Shishir Mahajan
b4b9624447 Removing description for 'docker images' -t and -v flags, since they are deprecated
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2014-11-25 14:11:13 -05:00
Dan Walsh
61586414ca Merge branch 'master' of github.com:docker/docker into debug
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-11-25 14:09:19 -05:00
Jessie Frazelle
7ebcdad030 Merge pull request #9238 from albers/bash-completion
Add missing options to bash completion for the run and create commands
2014-11-25 09:27:31 -08:00
James Turnbull
ec8c53228a Removed extraneous )
Docker-DCO-1.1-Signed-off-by: James Turnbull <james@lovedthanlost.net> (github: jamtur01)
2014-11-25 10:38:16 -05:00
Yohei Ueda
dfcf05a5d0 Use termios via CGO only on Linux
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-25 20:49:01 +09:00
Harald Albers
eac9f2e5c4 Minor bash completion cleanup
The -n and --networking options were removed because they are
unsupported. 
Bash completion should not reveal the existence of otherwise
undocumented unsupported options.

Signed-off-by: Harald Albers <github@albersweb.de>
2014-11-25 08:53:13 +01:00
Harald Albers
2e863e8a38 Add missing options to bash completion for the run and create commands
Signed-off-by: Harald Albers <github@albersweb.de>
2014-11-25 08:53:12 +01:00
Andrew C. Bodine
efb8e8a345 Closes #9296 adds a more detailed note about the mount behavior with -v flag
Signed-off-by: Andrew C. Bodine <acbodine@us.ibm.com>
2014-11-24 23:41:49 -08:00
Vincent Batts
7f84174109 tarsum: updates for jamtur01 comments
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-24 23:18:48 -05:00
Vincent Batts
3d6e63e0c4 pkg/tarsum: review cleanup
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-24 23:18:48 -05:00
Vincent Batts
3e08fb5ad2 pkg/tarsum: review amendments
(separate commit to preserve github conversation)

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-24 23:18:48 -05:00
Vincent Batts
f30fee69b1 pkg/tarsum: specification on TarSum checksum
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-24 23:18:47 -05:00
Jessie Frazelle
27127437a6 Merge pull request #9224 from tianon/custom-debootstrap
Allow for custom debootstrap wrappers like qemu-debootstrap in contrib/mkimage/debootstrap
2014-11-24 18:11:59 -08:00
Mike Snitzer
b9f1b0a751 devmapper: cleanup some extraneous branching in setupBaseImage()
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-11-24 20:06:41 -05:00
Tibor Vass
498985a039 Merge pull request #9325 from unclejack/add_1.3.2_relnotes
docs: Add 1.3.2 release notes
2014-11-24 20:06:34 -05:00
Tibor Vass
4dd3368b51 docs: Add 1.3.2 release notes
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 03:02:27 +02:00
Tibor Vass
e6ec703df3 Merge pull request #9323 from unclejack/merge_release_v1.3.2
Merge release v1.3.2 to master
2014-11-24 19:26:36 -05:00
Jessie Frazelle
2ad98b0cfa Merge pull request #9324 from crosbymichael/git-urls
Move IsGIT and IsURL to urlutil package
2014-11-24 16:07:42 -08:00
Tibor Vass
b21e1d4a00 Add v1.3.2 changelog & bump version to 1.3.2-dev
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-11-25 02:07:01 +02:00
unclejack
2ec2237909 graph/load: add build tags to fix make cross
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-11-25 02:06:45 +02:00
Michael Crosby
5794b5373e Update code for use of urlutil pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-24 18:47:42 -05:00
Michael Crosby
fc66a22df6 Merge pull request #9173 from vbatts/vbatts-dm_clarify_TaskCreate
pkg/devicemapper: clarify TaskCreate and createTask
2014-11-24 15:45:54 -08:00
Victor Vieux
4996d46a36 Merge pull request #9289 from duglin/mflagSetTest
Add missing unit testcase for new IsSet() func in mflag
2014-11-24 15:26:25 -08:00
Michael Crosby
feca1b1780 Move git and url checks into pkg
This moves the IsGIT and IsURL functions out of the generic `utils`
package and into their own `urlutil` pkg.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-24 18:10:37 -05:00
Tibor Vass
f6d9780229 archive: do not call FollowSymlinkInScope in createTarFile
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
unclejack
330171e1d9 pkg/chrootarchive: provide TMPDIR for ApplyLayer
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-25 01:03:41 +02:00
Tibor Vass
31d1d73303 archive: prevent breakout in ApplyLayer
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass
1852cc3841 archive: prevent breakout in Untar
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass
221617dbcd archive: add breakout tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	pkg/archive/archive.go
		fixed conflict which git couldn't fix with the added BreakoutError

Conflicts:
	pkg/archive/archive_test.go
		fixed conflict in imports
2014-11-25 01:03:41 +02:00
unclejack
209deff963 don't call reexec.Init from chrootarchive
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)

Conflicts:
	daemon/graphdriver/aufs/aufs_test.go
		fixed conflict caused by imports
2014-11-25 01:03:40 +02:00
Tibor Vass
9c01bc249d pkg/chrootarchive: pass TarOptions via CLI arg
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	graph/load.go
		fixed conflict in imports
2014-11-25 01:03:40 +02:00
unclejack
1cb17f03d0 add pkg/chrootarchive and use it on the daemon
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)

Conflicts:
	builder/internals.go
	daemon/graphdriver/aufs/aufs.go
	daemon/volumes.go
		fixed conflicts in imports
2014-11-25 01:03:40 +02:00
Michael Crosby
fa1484d12c Add AppArmorProfile to container inspect json
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-25 01:03:40 +02:00
Michael Crosby
294843ef23 Move security opts to HostConfig
These settings need to be in the HostConfig so that they are not
committed to an image and cannot introduce a security issue.

We can safely move this field from the Config to the HostConfig
without any regressions because these settings are consumed at container
created and used to populate fields on the Container struct.  Because of
this, existing settings will be honored for containers already created
on a daemon with custom security settings and prevent values being
consumed via an Image.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	daemon/create.go
		changing config to hostConfig was required to fix the
		 build
2014-11-25 01:02:30 +02:00
Michael Crosby
df7c22dd23 Merge pull request #9162 from aidanhs/patch-1
Allow git@ urls for more than just github
2014-11-24 14:51:52 -08:00
unclejack
faab87cc36 pkg/symlink: avoid following out of scope
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-25 00:27:05 +02:00
Tibor Vass
6f514d28c0 Merge pull request #9316 from tiborvass/bump_v1.3.2
Bump v1.3.2
2014-11-24 16:49:28 -05:00
Jessie Frazelle
39284be960 Merge pull request #9263 from cpuguy83/docs_cleanup_exec_api
Cleanup exec API docs and available params
2014-11-24 13:35:45 -08:00
Aidan Hobson Sayers
c7e4cc4a53 Allow git@ prefixes for any hosted git service
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
2014-11-24 20:49:54 +00:00
Tianon Gravi
748fe7a0fa Merge pull request #9291 from vincentbernat/fix/zsh-completion-update-2
zsh: correctly parse available subcommands (completion)
2014-11-24 13:36:58 -07:00
Michael Crosby
b4757445ae Merge pull request #9301 from krivenok/master
Fixed typo in documentation.
2014-11-24 12:27:56 -08:00
Michael Crosby
5e19ecf25c Merge pull request #9281 from unclejack/build_pull_flag
build: add pull flag to force image pulling
2014-11-24 12:10:45 -08:00
Jessie Frazelle
fefaf6a73d Merge pull request #9290 from vaijab/registry-address
registry: fix ServerAddress setting
2014-11-24 12:02:12 -08:00
Jessie Frazelle
66266a0ed9 Merge pull request #9312 from daehyeok/deprecated_cmd
remove deprecated cmd function in integration-cli
2014-11-24 11:58:13 -08:00
Michael Crosby
cbc401ccfa Merge pull request #9303 from rmetzler/patch-1
Empty Line should fix Markdown unordered list
2014-11-24 11:55:21 -08:00
Vincent Batts
e07daa58d9 contrib: fix the docker-device-tool
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-11-24 13:49:09 -05:00
Vaidas Jablonskis
d96832cbd2 registry: fix ServerAddress setting
This ensures that ServerAddress is set, while previously it was getting
set after configFile.Configs.

Signed-off-by: Vaidas Jablonskis <jablonskis@gmail.com>
2014-11-24 18:26:41 +00:00
Dmitry V. Krivenok
5deedef42c Made wording a bit more generic. 2014-11-24 21:22:54 +03:00
Daehyeok Mun
7fbbd515b1 remove deprecated cmd function in integration-cli
Remove deprecated cmd function in integration-cli
and change cmd to dockerCmd in all test files

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2014-11-25 00:32:38 +09:00
Richard Metzler
91a8b916b0 Empty Line should fix Markdown unordered list
Without the line break the list would render as one single paragraph.
2014-11-23 23:57:43 +01:00
Dmitry V. Krivenok
745e3f77a1 Fixed typo in documentation. 2014-11-23 22:59:35 +03:00
Vincent Bernat
34fe2a3725 zsh: correctly parse available subcommands
A lot of flags have been added on the output of `docker help`. Use a
more robust method to extract the list of available subcommands by
spotting the `Command:` line and the next blank line.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
2014-11-23 00:45:14 +01:00
Doug Davis
88afbc4d94 Add missing unit testcase for new IsSet() func in mflag
Forgot to add this when I did PR #9259

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-22 05:37:36 -08:00
James Mills
30979ad5a0 Updated installation docs for CRUX as a Docker Host.
Docker-DCO-1.1-Signed-off-by: James Mills <prologic@shortcircuit.net.au> (github: therealprologic)
2014-11-22 17:18:11 +10:00
Jessie Frazelle
c59b308b6b Merge pull request #9223 from vbatts/vbatts-overlay_notfound
overlayfs: more helpful output when not supported
2014-11-21 19:58:01 -08:00
Mike Snitzer
553b50bd37 devmapper: remove unnecessary else branch in getPoolName()
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-11-21 21:36:23 -05:00
Brian Goff
d4ba00bd42 Cleanup exec API docs and available params
Adds pertitent information about what is expected in the json payload
and comments out unsupported (exec) features in runConfig.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-21 21:11:07 -05:00
Jessie Frazelle
d7626e97b6 Merge pull request #9188 from somaopensource/8777-fix
Fix for #8777 (continuing PR #9061)
2014-11-21 17:57:56 -08:00
Vincent Batts
acdf766069 pkg/devicemapper: clarify TaskCreate and createTask
* Rename and expose createTask() to TaskCreateNamed()
* add comments

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-21 20:54:50 -05:00
Michael Crosby
fb1540199e Merge pull request #9183 from vbatts/dm_udevwait
devmapper: Call UdevWait() even in failure path
2014-11-21 17:28:37 -08:00
Vincent Batts
104d27a07b Merge pull request #9267 from crosbymichael/devmapper-mknod
Mknod more loopbacks for devmapper
2014-11-21 20:23:43 -05:00
Michael Crosby
e820365b67 Merge pull request #9086 from vbatts/vbatts-tarsum_more_tests
pkg/tarsum: adding more tests
2014-11-21 17:12:55 -08:00
Michael Crosby
496db275d5 Merge pull request #9185 from djmaze/patch-1
Fix link to MAINTAINERS.md in CONTRIBUTING.md
2014-11-21 16:40:27 -08:00
Michael Crosby
f8509e7940 Mknod more loopbacks for devmapper
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-21 16:20:35 -08:00
Martin Honermeyer
20218f3971 Fix link to MAINTAINERS.md in CONTRIBUTING.md
Signed-off-by: Martin Honermeyer <maze@strahlungsfrei.de>
2014-11-22 01:18:40 +01:00
unclejack
07b7bdb4fc Merge pull request #9270 from jfrazelle/8919-tag-output
Output image with tag name when image is not found
2014-11-22 01:56:31 +02:00
Michael Crosby
c78bf8d86a Merge pull request #9265 from vieux/daemon_labels
add daemon labels (displayed in docker info)
2014-11-21 15:14:27 -08:00
Tibor Vass
17ba356e9a Merge pull request #9158 from tianon/minor-makefile-preamble-reorg
Add some minor reorganization to the Makefile preamble
2014-11-21 18:02:11 -05:00
Tianon Gravi
82f33d86a7 Add some minor reorganization to the Makefile preamble
The gist here is a reemphasizing of the explicitly "user mutable" bits by putting them first (and hopefully improving readability a little bit in the process).

Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-11-21 15:49:09 -07:00
Sven Dowideit
44159f38d2 Merge pull request #9209 from SvenDowideit/shared-disk-space-images
If an image has more than one repo name or tag, it'll be listed more tha...
2014-11-21 14:07:45 -08:00
Vincent Batts
a43ee077dc Merge pull request #9149 from swagiaal/fix-configureBridge-comment
Remove reference to 'ifaceName' from configureBridge comment.
2014-11-21 16:37:28 -05:00
Vincent Batts
a5277764ae Merge pull request #9009 from a-ba/fix-export-repo
fix missing layers when exporting a full repository
2014-11-21 15:44:27 -05:00
Victor Vieux
62a7d75512 key=values -> key=value
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-21 19:15:22 +00:00
unclejack
054e57a622 build: add pull flag to force image pulling
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-11-21 19:59:44 +02:00
Alexander Morozov
0f2de5158f Merge pull request #9261 from unclejack/fix_test_tmp_cleanup
fix cleanup of /tmp in tests
2014-11-21 08:48:04 -08:00
Arnaud Porterie
ce8ebaf0e0 Merge pull request #9225 from icecrime/win_make_binary
Adapt project/make.sh for Windows builds
2014-11-21 08:37:19 -08:00
unclejack
4180579313 graphdriver/aufs: fix tmp cleanup in tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-21 18:31:45 +02:00
Yohei Ueda
244af451e9 Use termios via CGO
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-21 22:12:03 +09:00
Joel Friedly
2d2b3535ca Fix typos in the user guide main page
Signed-off-by: Joel Friedly <joelfriedly@gmail.com>
2014-11-21 03:17:00 +00:00
Alexander Morozov
e3f3259e00 Merge pull request #9271 from jfrazelle/iptables-errors
Typed errors for iptables chain raw command output. YAYYYYYY.
2014-11-20 19:03:38 -08:00
Jessica Frazelle
f6c7194539 Apply same typed iptables errors to network driver.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-20 18:07:15 -08:00
Jessica Frazelle
6cc75574b3 Typed errors for iptables chain raw command output. YAYYYYYY.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-20 18:07:11 -08:00
Michael Crosby
532e502e9c Merge pull request #9259 from duglin/Issue9221
Make --tlsverify enable tls regardless of value specified
2014-11-20 17:41:31 -08:00
Michael Crosby
5d67a3faea Merge pull request #9248 from vbatts/vbatts-fix_gh9241
pkg/tarsum: actually init the TarSum struct
2014-11-20 17:15:15 -08:00
Jeff Anderson
7b20c1fd18 refer to the registry instead of the hub
Signed-off-by: Jeff Anderson <jeff@docker.com>
2014-11-20 16:54:46 -08:00
unclejack
5cde77d003 Merge pull request #9269 from crosbymichael/update-libcontainer-nov20
Update libcontainer to 84c1636580a356db88b079d118b94abe6a1a0acd
2014-11-21 02:50:04 +02:00
Doug Davis
ae9bd580af Make --tlsverify enable tls regardless of value specified
I also needed to add a mflag.IsSet() function that allows you to check
to see if a certain flag was actually specified on the cmd line.

Per #9221 - also tweaked the docs to fix a typo.

Closes #9221

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-20 16:09:06 -08:00
Fred Lifton
29f4ea2cd5 Merge pull request #9220 from SvenDowideit/add-apache-foreground-eg
Add an example that shows starting apache in the foreground
2014-11-20 16:02:38 -08:00
Michael Crosby
c1a40d9279 Merge pull request #9228 from SvenDowideit/update-tlsverify-doc
tlsverify flag has no dash
2014-11-20 15:19:31 -08:00
Jessica Frazelle
e527be1f14 Fix tag output where image is not found.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-20 15:09:09 -08:00
Lei Jitang
7a7890950d Fix create container output messages.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Signed-off-by: Jessica Frazelle <jess@docker.com>
2014-11-20 15:03:27 -08:00
Michael Crosby
56c3753631 Revert "Support hairpin NAT"
This reverts commit 95a400e6e1.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-20 14:22:32 -08:00
Sven Dowideit
8d3b13bd7a Add an example that shows starting apache in the foreground
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-20 14:21:05 -08:00
Michael Crosby
4acdb7ddc7 Merge pull request #9260 from LK4D4/increase_proxy_timeout
Increase timeout for userland proxy starting
2014-11-20 14:20:31 -08:00
Michael Crosby
f42176434a Update libcontainer to 84c1636580a356db88b079d118b
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-20 14:19:24 -08:00
Michael Crosby
9a917e732c Merge pull request #9174 from dqminh/docker-exec-env
Set correct env variables for `docker exec` commands
2014-11-20 13:31:51 -08:00
Michael Crosby
58b6f31a7a Merge pull request #8251 from duglin/Issue2333
Add support for ENV of the form: ENV name=value ...
2014-11-20 13:12:24 -08:00
Victor Vieux
284cbda9ce docs nits
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 19:54:03 +00:00
Victor Vieux
7ff3b81054 events filtering
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 19:46:48 +00:00
Victor Vieux
2fe36baa0a add daemon labels
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 19:23:58 +00:00
Tibor Vass
998b591a71 Merge pull request #9201 from vieux/add_hostname_docker_info
Add hostname and ID docker info
2014-11-20 13:11:16 -05:00
Daniel, Dao Quang Minh
2bceaae423 test case for preserving env in exec session
Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-11-20 13:05:37 -05:00
Dan Walsh
bce9ed0e4c Allow developers to build docker with debuginfo included
If you execute

DEBUG=-g hack/make.sh dynbinary

Docker will be build with the debug info making it easier to use
cgdb or lightide to debug.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-11-20 12:59:50 -05:00
Doug Davis
1314e1586f Add support for ENV of the form: ENV name=value ...
still supports the old form: ENV name value

Also, fixed an issue with the parser where it would ignore lines
at the end of the Dockerfile that ended with \

Closes #2333

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-20 09:54:28 -08:00
Victor Vieux
8ef36dcfe7 update docs
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 17:40:08 +00:00
Victor Vieux
227f4bbdb3 Hostname -> Name
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 17:40:08 +00:00
Victor Vieux
6e92dfdfd8 Update libtrust version
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 17:39:54 +00:00
unclejack
db7fded17f integ-cli: fix cleanup in build tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:38:41 +02:00
unclejack
98307c8fae integ-cli: fix cleanup in test which mounts tmpfs
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:37:46 +02:00
unclejack
4508bd94b0 pkg/symlink: fix cleanup for tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:36:54 +02:00
unclejack
32ba6ab83c pkg/archive: fix TempArchive cleanup w/ one read
This fixes the removal of TempArchives which can read with only one
read. Such archives weren't getting removed because EOF wasn't being
triggered.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:34:35 +02:00
unclejack
769b79866a pkg/system: fix cleanup in tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:33:15 +02:00
Alexandr Morozov
72c55e8215 Increase timeout for userland proxy starting
Fixes #8883

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-20 09:02:42 -08:00
Oh Jinkyun
4deac03c65 Fix for #8777
Now filter name is trimmed and lowercased before evaluation for case
insensitive and whitespace trimemd check.

Signed-off-by: Oh Jinkyun <tintypemolly@gmail.com>
2014-11-20 13:36:46 +09:00
Michael Crosby
739d917d70 Merge pull request #9226 from crosbymichael/container-net-test
Add test for --net container:<id>
2014-11-19 17:57:45 -08:00
Michael Crosby
d4ca9e5cce Merge pull request #9211 from mtesselH/login
Fixed a bug - no panic anymore when logining in without TTY
2014-11-19 17:52:35 -08:00
Michael Crosby
71209f7579 Add test for --net container:<id>
This adds an integration test for checking that the network namespace
fds are the same when a container joins another container's network
namespace.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-19 17:43:04 -08:00
Michael Crosby
adc344dfde Merge pull request #9180 from chenchun/master
Clean config path of bind mount volume
2014-11-19 17:41:46 -08:00
Vincent Batts
cb57c38848 overlayfs: add --storage-driver doc
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-19 19:36:05 -05:00
Sven Dowideit
3e5cb0c84f Merge pull request #9191 from duglin/Issue8775
Be clearer in docs about COPY/ADD dirs
2014-11-19 15:26:20 -08:00
Jessie Frazelle
eb3bbde6d1 Merge pull request #9251 from tonistiigi/use-format-logging-functions
Fix misuses of format based logging functions
2014-11-19 15:25:42 -08:00
Sven Dowideit
c7e6ad8e98 Merge pull request #9144 from miminar/sigproxy_tty
Corrected description of --sig-proxy
2014-11-19 14:52:01 -08:00
Alexander Morozov
bca63b4f48 Merge pull request #9249 from tonistiigi/integration-cli-cleanup
Make sure integration-cli tests clean up
2014-11-19 14:27:13 -08:00
Tonis Tiigi
6705477673 Fix misuses of format based logging functions
Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-11-19 23:59:02 +02:00
Tonis Tiigi
bbb245defe Fix deleteImages() helper for multiple names
Pass every image name as separate argument.

Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-11-19 23:42:16 +02:00
Arnaud Porterie
ce86d5ae68 Adapt project/make.sh for Windows builds
Fixes:
- link -H windows is not compatible with -linkmode external
- under Cygwin go does not play well with cygdrive type paths

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-11-19 13:41:57 -08:00
Tonis Tiigi
da3d3b97eb Make sure integration-cli test clean up
Common patterns:
- Multiple images were built with same name but only one cleanup.
- Containers were deleted after images.
- Images not removed after retagging.

Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-11-19 23:41:46 +02:00
Josh Hawn
e257863a9a Add unit test for tarSum.Sum() with no data
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-19 15:55:21 -05:00
Vincent Batts
6a74f071af pkg/tarsum: actually init the TarSum struct
closes #9241

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-19 15:46:03 -05:00
Michal Minar
1cd12efb5d Updated sig-proxy text also in zsh completion script
Signed-off-by: Michal Minar <miminar@redhat.com>
2014-11-19 09:09:42 +01:00
Vincent Batts
3287ca1e45 overlayfs: more helpful output when not supported
based on https://github.com/docker/docker/pull/7619#discussion_r20385086

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-11-18 22:53:04 -05:00
Sven Dowideit
c8926bb579 Merge pull request #9203 from somaopensource/fix_link
fix link to PACKAGERS.md
2014-11-18 18:23:33 -08:00
Chun Chen
f4acfeebda Clean config path of bind mount volume
Signed-off-by: Chun Chen <chenchun.feed@gmail.com>
2014-11-19 10:13:10 +08:00
Sven Dowideit
57b6993c2c If an image has more than one repo name or tag, it'll be listed more than once
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-18 18:06:22 -08:00
Sven Dowideit
a0fb8eca30 tlsverify flag has no dash
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-18 17:42:33 -08:00
James Turnbull
af54dc215f Merge pull request #9219 from acbodine/cleanup-remote-api-docs-start
Cleanup: fixes start response status code typo in examples
2014-11-18 20:25:36 -05:00
Michael Crosby
1bac8f5322 Merge pull request #9039 from ashahab-altiscale/8617-lxc-volume
Have lxc create mount points if they don't exist
2014-11-18 17:24:16 -08:00
Victor Vieux
f676891192 Merge pull request #8905 from 13W/x-registry-auth
allow to use x-registry-auth header with enabled cors
2014-11-18 17:21:22 -08:00
Michael Crosby
0722c9b536 Merge pull request #9187 from icecrime/update_authors_file
Update AUTHORS file
2014-11-18 16:31:07 -08:00
Tianon Gravi
e393ca672e Merge pull request #9218 from tianon/check-overlayfs
Add CONFIG_OVERLAYFS_FS to check-config.sh
2014-11-18 16:56:56 -07:00
Michael Crosby
ca4be114e9 Merge pull request #9216 from jfrazelle/typo-steam
Fix steam where it should be stream.
2014-11-18 15:29:33 -08:00
Jessie Frazelle
9854b0aa40 Merge pull request #8150 from dqminh/pull-output-non-terminal
Pull: print some data instead of newlines when output is not a terminal
2014-11-18 16:20:42 -07:00
Tianon Gravi
33e0de15d7 Allow for custom debootstrap wrappers like qemu-debootstrap in contrib/mkimage/debootstrap
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-11-18 15:13:35 -07:00
Andrew C. Bodine
f9cdad3272 Cleanup: fixes start response status code typo in examples
Signed-off-by: Andrew C. Bodine <acbodine@us.ibm.com>
2014-11-18 11:32:51 -08:00
Tianon Gravi
54a6e6d122 Add CONFIG_OVERLAYFS_FS to check-config.sh
Also, added some slight adjustment to the AUFS_FS output/note to make it more clear what it applies to.

Example output:
```console
$ ./contrib/check-config.sh
info: reading kernel config from /proc/config.gz ...

Generally Necessary:
- cgroup hierarchy: properly mounted [/sys/fs/cgroup]
- CONFIG_NAMESPACES: enabled
- CONFIG_NET_NS: enabled
- CONFIG_PID_NS: enabled
- CONFIG_IPC_NS: enabled
- CONFIG_UTS_NS: enabled
- CONFIG_DEVPTS_MULTIPLE_INSTANCES: enabled
- CONFIG_CGROUPS: enabled
- CONFIG_CGROUP_CPUACCT: enabled
- CONFIG_CGROUP_DEVICE: enabled
- CONFIG_CGROUP_FREEZER: enabled
- CONFIG_CGROUP_SCHED: enabled
- CONFIG_MACVLAN: enabled
- CONFIG_VETH: enabled
- CONFIG_BRIDGE: enabled
- CONFIG_NF_NAT_IPV4: enabled
- CONFIG_IP_NF_FILTER: enabled
- CONFIG_IP_NF_TARGET_MASQUERADE: enabled
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE: enabled
- CONFIG_NETFILTER_XT_MATCH_CONNTRACK: enabled
- CONFIG_NF_NAT: enabled
- CONFIG_NF_NAT_NEEDED: enabled

Optional Features:
- CONFIG_MEMCG_SWAP: enabled
- CONFIG_RESOURCE_COUNTERS: enabled
- CONFIG_CGROUP_PERF: missing
- Storage Drivers:
  - "aufs":
    - CONFIG_AUFS_FS: missing
      (note that some kernels include AUFS patches but not the AUFS_FS flag)
    - CONFIG_EXT4_FS_POSIX_ACL: enabled
    - CONFIG_EXT4_FS_SECURITY: enabled
  - "btrfs":
    - CONFIG_BTRFS_FS: enabled
  - "devicemapper":
    - CONFIG_BLK_DEV_DM: enabled
    - CONFIG_DM_THIN_PROVISIONING: enabled
    - CONFIG_EXT4_FS: enabled
    - CONFIG_EXT4_FS_POSIX_ACL: enabled
    - CONFIG_EXT4_FS_SECURITY: enabled
  - "overlayfs":
    - CONFIG_OVERLAYFS_FS: missing
```

Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-11-18 12:20:49 -07:00
Jessica Frazelle
7fe8d0aeeb Fix steam where it should be stream.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-18 10:49:01 -08:00
Doug Davis
b4346c4810 Be clearer in docs about COPY/ADD dirs
COPY/ADD just copies the contents of dirs, not dirs themselves.
This PR tries to clear that up in the docs.

Closes #8775

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-18 04:33:53 -08:00
James Turnbull
660eadae3d Merge pull request #9189 from satnam6502/docfix
Consistently use sudo docker
2014-11-18 01:17:48 -05:00
James Turnbull
4fff1505eb Merge pull request #9193 from somaopensource/docs_misspelling
Fix misspelling
2014-11-18 01:16:27 -05:00
Marianna
e6fd57b90b Fixed a bug - no panic anymore when logining in without TTY
Fixes #8956

Signed-off-by: Marianna <mtesselh@gmail.com>
2014-11-17 19:41:27 -08:00
Michael Crosby
379c0da464 Merge pull request #8937 from vbatts/vbatts-mount_optional_fields
pkg/mount: include optional field
2014-11-17 18:25:00 -08:00
Michael Crosby
17dfa126ba Merge pull request #9204 from jfrazelle/9056-rmi
Fix for rmi throws error "no such id".
2014-11-17 18:08:52 -08:00
Sven Dowideit
e2d08bd5ea Merge pull request #8749 from brahmaroutu/resize_uponstart_8728_2
Fix the documentation and integration test for container resize
2014-11-17 17:24:58 -08:00
Satnam Singh
b273c447e0 Consistently use sudo docker
Signed-off-by: Satnam Singh <satnam@raintown.org>
2014-11-17 17:14:39 -08:00
Jessica Frazelle
ac40e7cbb3 Fix for rmi -f when error "no such id". (9056)
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-17 17:04:10 -08:00
Jessie Frazelle
882db5f885 Merge pull request #8993 from SvenDowideit/make-ps-size-docs-clearer
makes the -s --size option documentation clearer #8950
2014-11-17 17:42:27 -07:00
Jessie Frazelle
3527d5b817 Merge pull request #9205 from crosbymichael/update-libcontainer-nov17
Update libcontainer to 28cb5f9dfd6f3352c610a4f1502
2014-11-17 16:49:35 -07:00
Jessica Frazelle
a0605107d7 Add test for bug (9056) where rmi -f fails with "no such id".
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-17 15:12:55 -08:00
Vincent Batts
83d7db3e50 pkg/mount: testing mountinfo fields
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-17 16:17:06 -05:00
Michael Crosby
975fa5487c Update libcontainer to 28cb5f9dfd6f3352c610a4f1502
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-17 12:16:37 -08:00
Daehyeok Mun
a3068a109c fix link to PACKAGERS.md
fix link from /hack/PACKAGERS.md to /project/PACKAGERS.md

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2014-11-18 05:03:00 +09:00
Jessie Frazelle
ecaba0eb4a Merge pull request #9197 from somaopensource/remove_obsolete_comment
Remove obsolete comments
2014-11-17 12:53:23 -07:00
Victor Vieux
8545155c41 add docs
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-17 19:26:43 +00:00
Victor Vieux
9a85f60c75 add ID and Hostname in docker info
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-17 19:23:41 +00:00
Srini Brahmaroutu
91fb9b2f5a Fix the documentation and integration test for container resize
Closes #8728

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-11-17 18:38:08 +00:00
Daehyeok Mun
d5098fde9a Remove obsolete comments
In the below comment line, already codes for log exists so
following comment is obsolete.
// TODO log

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2014-11-17 23:27:03 +09:00
Arnaud Porterie
ab7a6544b0 Update AUTHORS file
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-11-16 23:41:25 -08:00
Arnaud Porterie
34cb92e2d4 Merge pull request #8699 from shuai-z/fix-portalloc
Fix corner cases in ipallocator and portallocator
2014-11-16 22:10:40 -08:00
Daehyeok Mun
bdaa76e8cf Fix misspelling
Fix misspelling from independant to independent

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2014-11-17 04:23:22 +09:00
Alexandr Morozov
61e4b4e1d0 Merge pull request #8335 from duglin/Issue5198
Add --log-level support - Issue #5198
2014-11-15 10:53:31 -08:00
Tibor Vass
08201d021e Merge pull request #9113 from Azure/windows-client
Windows port of Docker Client
2014-11-15 10:40:31 -08:00
Doug Davis
2facc04673 Add --log-level support
Next steps, in another PR, would be:
- make all logging go through the logrus stuff
- I'd like to see if we can remove the env var stuff (like DEBUG) but we'll see

Closes #5198

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-15 09:00:48 -08:00
Vivek Goyal
edc6df256d devmapper: Call UdevWait() even in failure path
Currently we set up a cookie and upon failure not call UdevWait(). This
does not cleanup the cookie and associated semaphore and system will
soon max out on total number of semaphores.

To avoid this, call UdevWait() even in failure path which in turn will
cleanup associated semaphore.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-15 09:41:27 -05:00
Ahmet Alp Balkan
b7703a992e Add windows/(386,amd64) to cross platforms list
Edited make scripts to append .exe to windows binary

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
5a38680bd2 Fix input volume path check on Windows
used path package instead of path/filepath so that --volumes and
--device parameters to always validate paths as unix paths instead of
OS-dependent path convention

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
d4dbb70832 Use USERPROFILE path on Windows as home directory
Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
John Gossman
e45b0f9271 Remove unused sysinfo parameter to runconfig.Parse
Removing dead code.

Signed-off-by: John Gossman <johngos@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
2180aa4f6f Refactor pkg/archive with a platform-independent stat struct
pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
3d2fae353f Extract mknod, umask, lstat to pkg/system
Some parts of pkg/archive is called on both client/daemon code. To get
it compiling on Windows, these funcs are extracted into files with
build tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan
b64c9b521a Extract TreeSize to daemon build
TreeSize uses syscall.Stat_t which is not available on Windows.
It's called only on daemon path, therefore extracting it to daemon
with build tag 'daemon'

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:53 -08:00
Ahmet Alp Balkan
376ae7780b Consolidate tmpdir implementations, include Windows
Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:53 -08:00
Ahmet Alp Balkan
91a86670aa Extract client signals to pkg/signal
SIGCHLD and SIGWINCH used in api/client (cli code) are not
available on Windows. Extracting into separate files with build
tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:53 -08:00
John Gossman
975b6e598d Refactor pkg/term package for Windows tty support
Signed-off-by: John Gossman <johngos@microsoft.com>
2014-11-14 18:20:53 -08:00
Michael Crosby
8682bac309 Merge pull request #9151 from tonistiigi/aufs-clipping-fix
Fix AUFS silent mount errors on many layers
2014-11-14 17:35:07 -08:00
Michael Crosby
c89062bafc Merge pull request #9164 from vbatts/vbatts-dm_removedevice
pkg/devicemapper: cleanup removeDevice differences
2014-11-14 16:56:02 -08:00
Solomon Hykes
b7ca8f6f73 Merge pull request #9178 from shykes/hack-to-project
Rename hack to project
2014-11-14 15:23:19 -08:00
Solomon Hykes
10c0e72de8 Merge pull request #9177 from shykes/hack-docs-small-improvements
Small improvements to contribution docs
2014-11-14 15:15:21 -08:00
Solomon Hykes
d32d9300ed Merge pull request #9116 from erikh/update_contributing
Update CONTRIBUTING to reflect new PR-docs process.
2014-11-14 14:52:17 -08:00
Tibor Vass
36503981f0 Merge pull request #9100 from tiborvass/insecure-registry-cidr
Add the possibility of specifying a subnet for --insecure-registry
2014-11-14 13:45:48 -08:00
Michael Crosby
25643f8932 Merge pull request #9172 from vbatts/vbatts-dm_maintainer
pkg/devicemapper: missed MAINTAINERS on split
2014-11-14 13:29:34 -08:00
Tianon Gravi
8bb6957d3b Merge pull request #9165 from hansrodtang/master
Updated cover tool import path.
2014-11-14 14:10:20 -07:00
unclejack
916a10dd91 Merge pull request #7619 from alexlarsson/overlayfs
Add overlayfs graph backend
2014-11-14 22:59:59 +02:00
Tibor Vass
5937663a08 Rewrite documentation for insecure registries
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-14 12:32:56 -08:00
Tibor Vass
6aba75db4e Add the possibility of specifying a subnet for --insecure-registry
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-14 12:31:11 -08:00
Vincent Batts
cef27e1d6c pkg/devicemapper: defer udev wait during removal
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-14 15:17:33 -05:00
Michael Crosby
df603eb4e4 Merge pull request #9108 from vieux/handle_redirects
handle GET redirects over HTTP
2014-11-14 12:07:22 -08:00
Victor Vieux
454f56e37e use _, _ string
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-14 19:31:52 +00:00
Michael Crosby
07996d82c7 Merge pull request #9074 from rhatdan/shm
Allow IPC namespace to be shared between containers or with the host
2014-11-14 10:34:00 -08:00
Brian Goff
7107898d5c Initialize volumes when container is created
Fixes #8942
Current behavior is that volumes aren't initialized until start.
Volumes still need to be initialized on start since VolumesFrom and
Binds can be passed in as part of HostConfig on start, however anything
that's already been initialized will just be skipped as is the current
behavior.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-14 11:37:03 -05:00
Vincent Batts
3ec623ee2f pkg/devicemapper: missed MAINTAINERS on split
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-14 11:12:23 -05:00
Anthony Baire
b37fdc5dd1 fix missing layers when exporting a full repository
Therer is a bug in the 'skip' decision when exporting a repository
(`docker save repo`)

Only the layers of the first image are included in the archive (the
layers of the next images are missing)

Signed-off-by: Anthony Baire <Anthony.Baire@irisa.fr>
2014-11-14 14:41:35 +01:00
unclejack
7b7af6dbae Merge pull request #8999 from yoheiueda/test-unit-without-parallel
Make test-unit runnable without parallel
2014-11-14 15:39:51 +02:00
James Turnbull
70a3f4e8e2 Merge pull request #9156 from pixelistik/patch-1
Fix typo "infortmation" in docs for `docker run`
2014-11-14 08:02:12 -05:00
Hans Rødtang
b4336803f3 Updated cover tool import path.
Signed-off-by: Hans Rødtang <hansrodtang@gmail.com>
2014-11-14 06:16:41 +01:00
Jessie Frazelle
870a695375 Merge pull request #9011 from vbatts/vbatts-btrfs_information
btrfs: information for the information gods
2014-11-13 20:47:07 -08:00
Vincent Batts
c9a7662208 pkg/devicemapper: cleanup removeDevice differences
Fixes failure on RemoveDevice when host is AUFS, and running
devicemapper test docker-in-docker

https://gist.github.com/tonistiigi/59559cbfb3f2df26b29c

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-13 22:43:03 -05:00
Michael Crosby
967354d488 Merge pull request #9131 from vieux/empty_lines_dockerinfo
Do not display empty lines in docker info if the key doesn't exists
2014-11-13 19:08:32 -08:00
Victor Vieux
4f5be9da86 Do not display empty lines in docker info if the key doesn't exists
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-14 02:50:34 +00:00
Michael Crosby
5c863f983d Merge pull request #9107 from ashahab-altiscale/9062-linked-container
Share network namespace of containers with lxc
2014-11-13 18:25:38 -08:00
Michael Crosby
039aa2741f Merge pull request #8964 from jlhawn/image_checksum
Compute TarSum on storage of image layer content
2014-11-13 18:07:20 -08:00
unclejack
3aa2245914 Merge pull request #8869 from jlhawn/tarsum_version
Finalize TarSum Version 1 w/ refactor
2014-11-14 01:12:22 +02:00
pixelistik
cbf2879349 Fix typo "infortmation" in docs for docker run 2014-11-13 23:26:49 +01:00
Vincent Batts
d7c37b5a28 Dockerfile: buildtags for old btrfs
Since the build uses ubuntu 14.04, which has an old btrfs, include the
buildtags needed for this old version to not break the build.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-13 16:44:00 -05:00
Vincent Batts
25154682a5 btrfs: build tag to enable showing version info
be default it is on, with build tags to disable the version info

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-13 16:43:53 -05:00
Jessie Frazelle
b0d219eef0 Merge pull request #9152 from duglin/DockerBuildEnvs
Allow a few more DOCKER_* env vars to pass thru Makefile
2014-11-13 12:52:36 -08:00
Jessie Frazelle
06899e0810 Merge pull request #9064 from recursive-madman/patch-1
Proposed fix for #8979
2014-11-13 12:24:22 -08:00
Vincent Batts
447a1a9bad Merge pull request #9104 from tiborvass/issecure-check-in-new-endpoint
registry: refactor registry.IsSecure calls into registry.NewEndpoint
2014-11-13 14:59:26 -05:00
Michael Crosby
b9fb9787b6 Merge pull request #8930 from vbatts/vbatts-mount_freebsd_fields
pkg/mount: adding fields supported by freebsd
2014-11-13 11:54:16 -08:00
Michael Crosby
e4105e4535 Merge pull request #8897 from vbatts/vbatts-mount_sharedsubtree
pkg/mount: sharedsubtree options and testing
2014-11-13 11:26:29 -08:00
Doug Davis
912b0f0f73 Allow a few more DOCKER_* env vars to pass thru Makefile
I was trying to just build the Docker client but DOCKER_CLIENTONLY wasn't
getting passed thru from the shell to the container building docker.

So, this PR passes this var (via the -e option) on the docker run command
so we pick it up from the devs shell when running "make ...".

While in there I pulled all of the "-e" options into a new Makefile variable
so its easy to see just the list of env vars we pass along.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-13 11:25:11 -08:00
Mike Snitzer
e49567ba72 devmapper: disable discards by default if dm.thinpooldev was specified
User may still enable discards by setting dm.blkdiscard=true

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-11-13 13:37:47 -05:00
Tonis Tiigi
6d97339ca2 Fix AUFS silent mount errors on many layers
Fixes #1171
Fixes #6465

Data passed to mount(2) is clipped to PAGE_SIZE if its bigger. Previous 
implementation checked if error was returned and then started to append layers 
one by one. But if the PAGE_SIZE clipping appeared in between the paths, in the 
permission sections or in xino definition the call would not error and 
remaining layers would just be skipped(or some other unknown situation).

This also optimizes system calls as it tries to mount as much as possible with 
the first mount.


Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-11-13 20:13:13 +02:00
Tianon Gravi
70e3cdcdd9 Merge pull request #8644 from tamsky/pull-7698-docfix
Add mention of e2fsprogs to runtime dependencies.
2014-11-13 11:07:13 -07:00
Tianon Gravi
abceeb2ef5 Merge pull request #8960 from LK4D4/add_nf_filter_check
Add check for IP_NF_FILTER
2014-11-13 11:03:29 -07:00
Alexandr Morozov
8f763a09d3 Merge pull request #9143 from coolljt0725/cleanup_defaulttag
Cleanup:change "latest" to graph.DEFAULTTAG
2014-11-13 09:00:00 -08:00
Sami Wagiaalla
a01f1e707e Remove reference to 'ifaceName' from configureBridge comment.
The argument ifaceName was removed in a much earlier commit.

Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2014-11-13 10:19:56 -05:00
Tibor Vass
fbe10c83d8 registry: parse INDEXSERVERADDRESS into a URL for easier check in isSecure
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-13 07:02:24 -08:00
Michal Minar
e71f241c4b Corrected description of --sig-proxy
Signal proxy does work only in non-TTY mode (--tty=false). Man pages and
commands should not lie about it.

Signed-off-by: Michal Minar <miminar@redhat.com>
2014-11-13 10:50:06 +01:00
Lei Jitang
3c3968692d Cleanup:change latest to graph.DEFAULTTAG
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2014-11-13 16:21:34 +08:00
Victor Vieux
5fbfec333a update timeout
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-13 03:21:18 +00:00
Tibor Vass
78e859f3c3 Put mock registry address in insecureRegistries for unit tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-12 20:34:03 -06:00
Tibor Vass
4455f51760 registry: refactor registry.IsSecure calls into registry.NewEndpoint
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-12 20:34:03 -06:00
Mike Snitzer
2b10749cdd devmapper: Add option for specifying an lvm2 created thin-pool device
Ideally lvm2 would be used to create/manage the thin-pool volume that is
then handed to docker to exclusively create/manage the thin and thin
snapshot volumes needed for it's containers.  Managing the thin-pool
outside of docker makes for the most feature-rich method of having
docker utilize device mapper thin provisioning as the backing storage
for docker's containers.  lvm2-based thin-pool management feature
highlights include: automatic or interactive thin-pool resize support,
dynamically change thin-pool features, automatic thinp metadata checking
when lvm2 activates the thin-pool, etc.

Docker will not activate/deactivate the specified thin-pool device but
it will exclusively manage/create thin and thin snapshot volumes in it.

Docker will not take ownership of the specified thin-pool device unless
it has 0 data blocks used and a transaction id of 0.  This should help
guard against using a thin-pool that is already in use.

Also fix typos in setupBaseImage() relative to the thin volume type of
the base image.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-11-12 21:03:04 -05:00
Mike Snitzer
ad6467f9e1 devmapper: use proper DM_UDEV_DISABLE_*_FLAG when creating the thin-pool
Otherwise udev can unecessarily execute various rules (and issue
scanning IO, etc) against the thin-pool -- which can never be a
top-level device.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-11-12 21:03:04 -05:00
Vincent Batts
42861f3b45 Merge pull request #8986 from vbatts/vbatts-pkg_devicemapper_bindings
devicemapper: split out devicemapper bindings
2014-11-12 19:59:36 -05:00
Erik Hollensbe
460036cdef Update CONTRIBUTING to reflect new PR-docs process.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-11-12 16:01:25 -08:00
Michael Crosby
9670871e01 Merge pull request #8982 from rhvgoyal/save-restore-device-id
Save restore device Id: issue #8978
2014-11-12 15:41:27 -08:00
Alexandr Morozov
e12572f265 Merge pull request #9031 from cpuguy83/cleanup_api_server_creation
Cleanup api server creation
2014-11-12 15:37:34 -08:00
Erik Hollensbe
33382385c3 Merge pull request #9124 from erikh/secure-localhost
Secure localhost registry (carry of #8898)
2014-11-12 15:25:15 -08:00
Solomon Hykes
2e27263aac Merge pull request #9127 from vishh/maintainer
Adding Vish as a maintainer for daemon.
2014-11-12 15:02:17 -08:00
Vishnu Kannan
06bf79552d Adding Vish as a maintainer for daemon code.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-11-12 22:55:32 +00:00
Michael Crosby
3ef2fc7f0f Merge pull request #9105 from stevenburgess/archiveCommentFix
Fix comment to match the arg name
2014-11-12 14:52:27 -08:00
Michael Crosby
08f5edce30 Merge pull request #8479 from vishh/OOM
Provide Out Of Memory information in container status
2014-11-12 14:15:29 -08:00
Erik Hollensbe
11380a109e registry: always treat 127.0.0.1 as insecure for all cases anytime anywhere
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-11-12 12:14:43 -08:00
Johan Euphrosine
28ee373e19 registry: default --insecure-registry to localhost and 127.0.0.1
Signed-off-by: Johan Euphrosine <proppy@google.com>
2014-11-12 09:12:42 -08:00
Dan Walsh
497fc8876e Allow IPC namespace to be shared between containers or with the host
Some workloads rely on IPC for communications with other processes.  We
would like to split workloads between two container but still allow them
to communicate though shared IPC.

This patch mimics the --net code to allow --ipc=host to not split off
the IPC Namespace.  ipc=container:CONTAINERID to share ipc between containers

If you share IPC between containers, then you need to make sure SELinux labels
match.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-11-12 11:29:58 -05:00
Vivek Goyal
15c74bebc1 devmapper: Take care of some review comments
Took care of some review comments from crosbymichael.

v2:
- Return "err = nil" if file deviceset-metadata file does not exist.
- Use json.Decoder() interface for loading deviceset metadata.

v3:
- Reverted back to json marshal interface in loadDeviceSetMetaData().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-12 09:36:32 -05:00
Jessie Frazelle
6ad1cd5d0f Merge pull request #9102 from brahmaroutu/add_tag_9001
improve error message to print the tag
2014-11-12 02:37:40 -07:00
Solomon Hykes
1396cff375 Merge pull request #9079 from SvenDowideit/pr_out_update_roadmap_md_based_on_10_21_2014_dgab_meeting
Update ROADMAP.md based on 10/21/2014 DGAB meeting
2014-11-11 23:00:25 -08:00
James Turnbull
492c4fc1a8 Merge pull request #9106 from duglin/TyposRemoteAPI
Add missing comma in docs
2014-11-11 22:48:30 -05:00
Victor Vieux
6ca144ef3d fix unix socket
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-12 00:37:58 +00:00
Victor Vieux
4b4ad26b97 handle GET redirects
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-12 00:37:58 +00:00
Doug Davis
814bc06d7b Add missing comma in docs
Found by Michael Voznesensky <voznesenskym@gmail.com>

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-11 15:18:20 -08:00
Steven Burgess
64a335ceac Fix comment to match the arg name
Signed-off-by: Steven Burgess <steven.a.burgess@hotmail.com>
2014-11-11 18:01:08 -05:00
unclejack
e546c8cc1d Merge pull request #9041 from unclejack/lxc_maintainers_comment
execdriver/lxc: add comment to MAINTAINERS
2014-11-12 00:27:11 +02:00
Srini Brahmaroutu
bc45428220 improve error message to print the tag
Closes #9001

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-11-11 22:18:40 +00:00
Tibor Vass
e08d1f6af2 Merge pull request #9095 from proppy/is-secure-test
registry: add tests for IsSecure
2014-11-11 16:52:36 -05:00
Johan Euphrosine
75e3b35bf1 registry: add tests for IsSecure
Signed-off-by: Johan Euphrosine <proppy@google.com>
2014-11-11 11:02:32 -08:00
unclejack
c0499494df Merge pull request #9090 from unclejack/archive_interface
pkg/archive: add interface for Untar
2014-11-11 20:57:58 +02:00
Fred Lifton
d6a4d045f7 Merge pull request #8840 from decadent/fix-da-copy-directive-reference
Nuh uh... quoth the build log: Source can't be a URL for COPY
2014-11-11 10:57:00 -08:00
Fred Lifton
9e0fac3da8 Merge pull request #9082 from SvenDowideit/pr_out_add_some_details_about_the_lifecycle_of_commands_started_with_docker_exec
Add some details about the lifecycle of commands started with docker exec
2014-11-11 10:55:12 -08:00
Jessie Frazelle
a131032422 Merge pull request #9091 from duglin/CleanupIntTests
Cleanup some integration-cli output
2014-11-11 10:56:29 -07:00
Doug Davis
0cef21cfba Cleanup some integration-cli output
I noticed a few things that were bugging me in the output
of the integration-cli tests.
- one of the tests used println to stdout so we had garage sent to the screen
- some of the test, in their final log message, didn't include the name of
  the group/file e.g.  daemon - run,iptables   was just   run,iptables

And yes, I noticed this because I'm anal :-)  but also because we should keep
the output of the tests as clean as possible so its easy to spot it when
things go bad.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-11 08:44:32 -08:00
unclejack
14692d0d41 pkg/archive: add interface for Untar
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-11 18:28:33 +02:00
Tibor Vass
2a517fe103 Merge pull request #8726 from krallin/failed-start-breaks-volumes-from
Fix: a failed Start() breaks --volumes-from on subsequent Start()'s
2014-11-11 10:49:33 -05:00
Vincent Batts
5cd9b7513f pkg/tarsum: adding more tests
Ensuring case size of headers will still be accounted for.
https://github.com/docker/docker/pull/8869#discussion_r20114401

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-11 08:48:11 -05:00
James Turnbull
2ff203f0a6 Merge pull request #9071 from fredlf/add-docs-readme
Add link to Docs README.
2014-11-11 07:25:09 -05:00
Abin Shahab
adb07b53e0 LINKED CONTAINER ID PASSED TO LXC
This passed the --net=container:CONTINER_ID to lxc-start as --share-net
Docker-DCO-1.1-Signed-off-by: Abin Shahab <ashahab@altiscale.com> (github: ashahab-altiscale)
2014-11-11 09:10:15 +00:00
Recursive Madman
5cd53195fd Don't loose precision when parsing image size on 32 bit machines. Presumably fixes #8979.
Signed-off-by: Recursive Madman <recursive.madman@gmx.de>
2014-11-11 09:24:45 +01:00
Sven Dowideit
447387474a Add some details about the lifecycle of commands started with docker exec
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-11 15:56:27 +10:00
Erik Hollensbe
0b4132782a Merge pull request #9048 from coaku/b_xzk_rm_redundant_trim
Remove redundant stripComment
2014-11-10 21:53:22 -08:00
Sven Dowideit
703ef3caa8 Merge pull request #9050 from prasincs/patch-1
Additional info for docker binary
2014-11-10 20:22:05 -08:00
Fred Lifton
ca0885729d Fix 80 char. error
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-11-10 17:50:12 -08:00
Scott Johnston
d94de133f4 Update ROADMAP.md based on 10/21/2014 DGAB meeting
The Docker Governance Advisory Board (DGAB) met for the first time Tue 10/21/2014.
Among other topics, the DGAB reviewed and refreshed the Docker Project Statement of Direction.

(Sven added from the Pull Req #9055)
Docker-DCO-1.1-Signed-off-by: Scott Johnston <scott.johnston@docker.com> (github: j0hnst0n)

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-11 11:43:37 +10:00
Sven Dowideit
67c7faa002 Merge pull request #9065 from tobegit3hub/master
Remove the redundant include_search in mkdocs.yml
2014-11-10 17:24:07 -08:00
Solomon Hykes
a1789a2eab Merge pull request #9032 from fredlf/revise-docs-maintainers
Revise Docs Maintainers list
2014-11-10 17:11:25 -08:00
Prasanna Gautam
48424df685 properly line wrapping
Signed-off-by: Prasanna Gautam <prasannagautam@gmail.com>
2014-11-10 20:06:22 -05:00
Sven Dowideit
970e404e9b Merge pull request #9069 from cpuguy83/docs_for_pr8509
Add missing docs for #8509
2014-11-10 17:04:28 -08:00
gautam, prasanna
cf19df4683 fixing punctuation and grammar
Signed-off-by: Prasanna Gautam <prasannagautam@gmail.com>
2014-11-10 18:05:02 -05:00
Brian Goff
dacae746b7 Cleanup api server creation
Current implementation is hard to reason about because of trying to mix
unix/tcp server implementations, even though they are quite different.
This cleans that up.

Also makes it possible to create and manage a new API server easily,
e.g. for adding an introspection socket to a container.

Built in such a way as to allow a non-HTTP server to work as well, such
as libchan.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-10 16:20:35 -05:00
Michael Crosby
84f25414c1 Merge pull request #9014 from LK4D4/fix_parent_failing
Not fail on updating parent links
2014-11-10 12:53:16 -08:00
Jessie Frazelle
4fcd3dd748 Merge pull request #8716 from duglin/Issue8331
Use the HTTP Last-Modified http header as the mtime value for ADD cmd when present
2014-11-10 13:03:57 -07:00
Fred Lifton
67ca7415e7 Add link to Docs README.
Linking to the docs readme to help would-be contributors discover the style guide and docs contribution guidelines.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-11-10 11:33:16 -08:00
Alexandr Morozov
3c5155ac16 Merge pull request #9028 from unclejack/add_yeong-sil_jang
pkg/namesgenerator: add Yeong-Sil Jang
2014-11-10 10:07:27 -08:00
Brian Goff
271f54aea3 Add missing docs for #8509
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-10 12:25:17 -05:00
Arnaud Porterie
0f21d9aea7 Merge pull request #6810 from phemmer/4442-hairpin-nat
Support hairpin NAT
2014-11-10 08:53:01 -08:00
Thomas Orozco
fb62e18441 Fix: Failed Start breaks VolumesFrom
Running parseVolumesFromSpec on all VolumesFrom specs before initialize
any mounts endures that we don't leave container.Volumes in an
inconsistent (partially initialized) if one of out mount groups is not
available (e.g. the container we're trying to mount from does not
exist).

Keeping container.Volumes in a consistent state ensures that next time
we Start() the container, it'll run prepareVolumes() again.

The attached test demonstrates that when a container fails to start due
to a missing container specified in VolumesFrom, it "remembers" a Volume
that worked.

Fixes: #8726

Signed-off-by: Thomas Orozco <thomas@orozco.fr>
2014-11-10 17:32:16 +01:00
tobe
b92d7cd60d Remove the redundant include_search in mkdocs.yml 2014-11-10 20:23:46 +08:00
James Turnbull
e4fe85fc95 Merge pull request #9052 from andreyst/master
Fix typo in Docker Links chapter of User Guide
2014-11-10 00:10:38 -05:00
James Turnbull
1e75c9e8b4 Merge pull request #9057 from andi5/typo-best-practices
Fix mkdir typo in dockerfile_best-practices.md.
2014-11-10 00:10:20 -05:00
James Turnbull
2d30473927 Merge pull request #9029 from ovh/fix/doc
Fix Docker Hub tags list specification
2014-11-10 00:05:34 -05:00
gautam, prasanna
3600bcb531 limiting to 80 chars
Signed-off-by: Prasanna Gautam < prasannagautam@gmail.com >
2014-11-09 19:54:00 -05:00
Andreas Köhler
b95f9c10ff Fix mkdir typo in dockerfile_best-practices.md. 2014-11-10 01:00:05 +01:00
Solomon Hykes
32e61b8f5c Move 'hack' to the less confusing 'project'
We might want to break it up into smaller pieces (eg. tools in one
place, documents in another) but let's worry about that later.

Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-11-09 21:50:28 +00:00
Solomon Hykes
4cf0aa711e Move GOVERNANCE.md to hack/
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-11-09 21:41:13 +00:00
Solomon Hykes
2d688b0a78 In contribution docs, emphasize that bug reports are appreciated!
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-11-09 21:41:12 +00:00
Solomon Hykes
543127e211 Improve "security reports" section in contribution docs.
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-11-09 21:41:08 +00:00
Andrey Stolbovsky
932cc23081 Fix typo in Docker Links chapter of User Guide 2014-11-09 23:23:45 +03:00
Prasanna Gautam
22afaa628f Additional info for docker binary
Signed-off-by: Prasanna Gautam <prasannagautam@gmail.com>

I found that certain docker installations do not handle binding to the source directory quite right. Just writing it based on help from backjlack and tibor in IRC.
2014-11-09 10:28:45 -05:00
xuzhaokui
6c79ee7d1e Remove the redundant stripComment.
Signed-off-by: xuzhaokui <cynicholas@gmail.com>
2014-11-09 23:07:44 +08:00
unclejack
ef150d023a pkg/namesgenerator: add Yeong-Sil Jang
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-08 16:36:41 +02:00
unclejack
6f8e42ac74 execdriver/lxc: add comment to MAINTAINERS
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-08 16:27:25 +02:00
unclejack
b18efeeb7a Merge pull request #9023 from cyphar/libcontainer-update-to-new-interface
Update vendor'd `libcontainer` and update to use new `user` interface.
2014-11-08 16:17:28 +02:00
Vishnu Kannan
46f2944977 Address comments.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-11-08 00:14:08 +00:00
Vishnu Kannan
f96e04ffc7 This patch adds ability in docker to detect out of memory conditions in containers.
Since the containers can handle the out of memory kernel kills gracefully, docker
will only provide out of memory information as an additional metadata as part of
container status.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-11-08 00:14:08 +00:00
Aleksa Sarai
3ac4aa0d6b *: transition to new libcontainer/user API
This patch fixes the compilation errors in Docker due to changes in the
libcontainer/user API. There is no functionality change due to this
patch.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-11-08 10:03:12 +11:00
Aleksa Sarai
a10cca257f vendor: update vendor'd libcontainer version
This patch updates the vendor'd libcontainer version, so that Docker can
take advantage of the updates to the `user` API.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-11-08 09:57:20 +11:00
Doug Davis
2e482c86bc Use the HTTP Last-Modified http header as the mtime value for ADD cmd when present
Closes #8331

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-07 13:58:05 -08:00
Fred Lifton
480b5e9c62 Revise Docs Maintainers list
Removing Sonat from docs maintainers because he no longer has time to complete all the responsibilities. Many thanks to Sonat for his help.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-11-07 13:13:01 -08:00
Alexandr Morozov
349f67632f Merge pull request #8931 from vbatts/vbatts-mount_pid_mountinfo
pkg/mount: mountinfo from specified pid
2014-11-07 12:04:52 -08:00
Vincent Batts
64e7a1722d pkg/mount: mountinfo from specified pid
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-07 13:37:23 -05:00
Vincent Giersch
c30ccc62e4 Fix Docker Hub tags list specification
The current implementation of the Docker Hub returns a list of objects
containing the tag name and the layer id.

Docker-DCO-1.1-Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
2014-11-07 17:16:42 +01:00
Yohei Ueda
dad58737ae Export envvars necessary for unit-test
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-07 16:54:25 +09:00
Sven Dowideit
6dc11cc992 makes the -s --size option documentation clearer #8950
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2014-11-07 11:56:56 +10:00
Alexandr Morozov
b83fc07d88 Not fail on updating parent links
Fixes #8796

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-06 15:30:23 -08:00
Fred Lifton
3afe9dbd24 Merge pull request #8970 from georgexsh/hyphen
unify `–`(en dash) to `-` when specifying options
2014-11-06 14:48:48 -08:00
Alexandr Morozov
734419e9c7 Merge pull request #8711 from duglin/Issue8160
Add import/pull events to the stream
2014-11-06 14:29:02 -08:00
Vincent Batts
318b11f62f btrfs: information for the information gods
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-06 16:17:10 -05:00
Vivek Goyal
0f57c90245 docker-remove-redundant-json-tags
In previous patch I had introduce json:"-" tags to be on safer side to make
sure certain fields are not marshalled/unmarshalled. But struct fields
starting with small letter are not exported so they will not be marshalled
anyway. So remove json:"-" tags from there.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-06 15:59:25 -05:00
Doug Davis
ef7415258b Add import/pull events to the stream
Closes #8160

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-06 12:12:41 -08:00
Michael Crosby
dd62d256cb Merge pull request #8963 from blakery/master
Cleanup: made GetDefaultNetworkMtu private
2014-11-06 12:02:18 -08:00
Michael Crosby
546884fd20 Merge pull request #8977 from LK4D4/vet_fixes
Fix vet errors
2014-11-06 11:59:05 -08:00
Michael Crosby
6a6be5bd5a Merge pull request #8983 from LK4D4/consistent_hosts
Consistent hosts
2014-11-06 11:51:28 -08:00
Alexandr Morozov
048d0c4e84 Test for etchosts consistency
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-06 11:36:09 -08:00
Alexandr Morozov
6cbe1fa726 Make /etc/hosts records consistent
Fixes #8972

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-06 11:36:00 -08:00
Michael Crosby
55f9b0c874 Merge pull request #9005 from vbatts/vbatts-devmapper_add_maintainer
devmapper: add vbatts to MAINTAINERS
2014-11-06 11:26:40 -08:00
Vincent Batts
2fbfa29318 devmapper: add vbatts to MAINTAINERS
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-06 14:06:52 -05:00
Michael Crosby
68a25a5b74 Merge pull request #8988 from crosbymichael/update-libcontainer-nov1
Update libcontainer to fd6df76562137aa3b18e44b790c
2014-11-06 11:02:29 -08:00
Jessie Frazelle
a72f3c568b Merge pull request #8990 from duglin/Issue8379a
Make sure that if a container can't start we set the exitcode to non-zero value
2014-11-06 10:44:10 -08:00
Yohei Ueda
5bd5ef5a0a Make test-unit runnable without parallel
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-07 02:40:13 +09:00
Alexandr Morozov
ff911d5f34 Merge pull request #8998 from yoheiueda/dont-remove-tmpdir
Fix the unit test not to remove /tmp
2014-11-06 08:59:02 -08:00
Yohei Ueda
2329354dc3 Fix the unit test not to remove /tmp
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2014-11-07 02:43:59 +09:00
Tianon Gravi
b35a0ba81b Merge pull request #8974 from unclejack/bump_fpm
bump fpm to 1.3.2
2014-11-06 09:37:25 -07:00
Jessie Frazelle
6fcc9141d7 Merge pull request #8953 from golubbe/master
Create governance doc and show links to DGAB materials in google doc
2014-11-05 22:13:05 -08:00
Doug Davis
69a5b827dc See #8379 - if the container doesn't start I added code to make sure that if no other processing sets the container.exitCode to a non-zero value when we make sure its done before we return. I also made sure that while trying to start the CMD/ENTRYPOINT, if it fails, then we set the container.exitCode to the exitStatus from the exec().
Closes #8379

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-05 18:23:42 -08:00
Abin Shahab
b36bf98174 LXC TEMPLATE WILL CREATE MOUNT
Lxc driver was throwing errors for mounts where the mount point does not exist in the container.
This adds a create=dir/file mount option to the lxc template, to alleviate this issue.

Docker-DCO-1.1-Signed-off-by: Abin Shahab <ashahab@altiscale.com> (github: ashahab-altiscale)
2014-11-06 02:14:03 +00:00
Michael Crosby
ed556fb38f Update docker with syncpipe changes
We removed the syncpipe package and replaced it with specific calls to
create a new *os.File from a specified fd passed to the process.  This
reduced code and an extra object to manage the container's init
lifecycle.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-06 01:14:13 +00:00
Michael Crosby
7f5ebdcaac Update libcontainer to fd6df76562137aa3b18e44b790c
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-06 01:12:41 +00:00
Sven Dowideit
56261daf32 Merge pull request #8683 from cpuguy83/fix_api_docs
Bring API docs inline with 1.3
2014-11-05 16:34:27 -08:00
Erik Hollensbe
a733afb256 Merge pull request #8987 from erikh/exec_stdin_close
Close stdin after execution with `docker exec -i`
2014-11-05 15:42:05 -08:00
Erik Hollensbe
165624062e Close stdin after execution with docker exec -i
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-11-05 15:12:24 -08:00
Vincent Batts
e2f8fbfbcc devicemapper: split out devicemapper bindings
This is a first pass at splitting out devicemapper into separate, usable
bindings.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-05 18:10:38 -05:00
golubbe
d453d8b321 Create GOVERNANCE.md
Information on Governance Advisory Board and associated proposals

Signed-off-by: Ben Golub <ben.golub@docker.com>
2014-11-05 21:48:17 +00:00
Fred Lifton
f10fefe408 Merge pull request #8874 from whoshuu/patch-1
Fix apparent copy paste mistake
2014-11-05 12:24:53 -08:00
Vivek Goyal
ff56531de4 devmapper: Fix gofmt related build failures
My pull request failed the build due to gofmat issues. I have run gofmt
on specified files and this commit fixes it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-05 14:39:54 -05:00
Josh Hawn
059e589c34 Compute TarSum on storage of image layer content
Now, newly created/imported layers will have the checksum of
the layer diff computed and stored in the image json file.

For now, it is not an error if the computed checksum does not
match an existing checksum, only a warning message is logged. The
eventual goal is to use the checksums in the image JSON to verify
the integrity of the layer contents when doing `docker load` or
`docker pull`, and error out if it does not match.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-05 10:17:55 -08:00
Alexandr Morozov
18d9f1978b Fix vet errors
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-05 08:26:22 -08:00
Daniel, Dao Quang Minh
aeeb0d59d3 print everything except progress in non-terminal
Instead of only checking `Progress != nil` (which is always true because
the server sends `"progressDetail":{}` when it doesnt have the progress), we
also check if `Progress.String() != ""`, which should be sufficient to filter
out the progress data.

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-11-05 10:44:31 -05:00
Brian Goff
e86223e7b3 Bring API docs inline with 1.3
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-05 09:38:44 -05:00
Vivek Goyal
8c9e5e5e05 devmapper: Save and restore NextDeviceId in a file
The way thin-pool right now is designed, user space is supposed to keep
track of what device ids have already been used. If user space tries to
create a new thin/snap device and device id has already been used, thin
pool retuns -EEXIST.

Upon receiving -EEXIST, current docker implementation simply tries the
NextDeviceId++ and keeps on doing this till it finds a free device id.

This approach has two issues.

- It is little suboptimal.
- If device id already exists, current kenrel implementation spits out
  a messsage on console.

[17991.140135] device-mapper: thin: Creation of new snapshot 33 of device 3 failed.

Here kenrel is trying to tell user that device id 33 has already been used.
And this shows up for every device id docker tries till it reaches a point
where device ids are not used. So if there are thousands of container and
one is trying to create a new container after fresh docker start, expect
thousands of such warnings to flood console.

This patch saves the NextDeviceId in a file in
/var/lib/docker/devmapper/metadata/deviceset-metadata and reads it back
when docker starts. This way we don't retry lots of device ids which 
have already been used. 

There might be some device ids which are free but we will get back to them
once device numbers wrap around (24bit limit on device ids).

This patch should cut down on number of kernel warnings.

Notice that I am creating a deviceset metadata file which is a global file
for this pool. So down the line if we need to save more data we should be
able to do that.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-05 09:25:02 -05:00
Vivek Goyal
8e9a18039b devmapper: Export nextDeviceId so that json.Marshal() can operate on it
I was trying to save nextDeviceId to a file but it would not work and
json.Marshal() will do nothing. Then some search showed that I need to
make first letter of struct field capital, exporting this field and
now json.Marshal() works.

This is a preparatory patch for the next one.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-05 09:25:02 -05:00
Vivek Goyal
67fbd34d83 devmapper: Move file write and rename functionality in a separate function
Currently we save device metadata and have a helper function saveMetadata()
which converts data in json format as well as saves it to file. For
converting data in json format, one needs to know what is being saved.

Break this function down in two functions. One function only has file
write capability and takes in argument about byte array of json data.
Now this function does not have to know what data is being saved. It
only knows about a stream of json data is being saved to a file.

This allows me to reuse this function to save a different type of
metadata. In this case I am planning to save NextDeviceId so that
docker can use this device Id upon next restart. Otherwise docker
starts from 0 which is suboptimal.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-11-05 09:25:02 -05:00
Blake Geno
cbb88741e4 Removed fixme from utils_test.go
Signed-off-by: Blake Geno <blakegeno@gmail.com>
2014-11-05 08:36:08 -05:00
James Turnbull
a61c4dc959 Merge pull request #8876 from whoshuu/docpatch-2
Remove out-of-context code block
2014-11-05 10:52:50 +01:00
unclejack
03f67aa46a bump fpm to 1.3.2
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-05 10:12:57 +02:00
unclejack
662efd95c7 Merge pull request #8577 from vbatts/vbatts-registry_certs
registry: don't iterate through certs
2014-11-05 09:46:24 +02:00
James Turnbull
387c892126 Merge pull request #8915 from gDD/patch-1
Remove extra line feed typo
2014-11-05 08:22:09 +01:00
James Turnbull
49ecc499d7 Merge pull request #8908 from medimatrix/patch-1
Grammatical mistake in docs
2014-11-05 08:21:00 +01:00
George Xie
c81337d5db unify (en dash) to - when specifying options
Signed-off-by: Xie Shi <georgexsh@gmail.com>
2014-11-05 13:50:59 +08:00
Josh Hawn
a7aa2c8ad2 Finalize TarSum Version 1 w/ refactor
The current Dev version of TarSum includes hashing of extended
file attributes and omits inclusion of modified time headers.

I refactored the logic around the version differences to make it
more clear that the difference between versions is in how tar
headers are selected and ordered.

TarSum Version 1 is now declared with the new Dev version continuing
to track it.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-04 21:38:52 -08:00
Sven Dowideit
0d513b5a84 Merge pull request #8900 from nhsiehgit/updatefooter
Updatefooter
2014-11-04 17:14:58 -08:00
Tibor Vass
b79211f4ae Merge pull request #8345 from duglin/Issue5184
Add a better error message when we get an unknown http issue
2014-11-04 20:07:41 -05:00
Doug Davis
6fdaa66652 Add a better error message when we get an unknown http issue
Closes #5184

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-04 16:46:41 -08:00
Sven Dowideit
098ccba6bd Merge pull request #8892 from fredlf/relnotes-edit
Edits and refinements to 1.3.1 release notes.
2014-11-04 16:43:07 -08:00
Blake Geno
224999d9c2 made getDefaultNetworkMtu private
Signed-off-by: Blake Geno <blakegeno@gmail.com>
2014-11-04 18:53:34 -05:00
Nathan Hsieh
ebeccee968 Updated footer to match rest of site
Signed-off-by: Nathan Hsieh <hsieh.nathan@gmail.com>
2014-11-04 15:28:38 -08:00
Alexandr Morozov
e621f99923 Add check for IP_NF_FILTER
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-04 14:47:13 -08:00
Tianon Gravi
c478143ec0 Merge pull request #8404 from danjpgriffin/master
Preserve extended attributes and acls on archlinux build
2014-11-04 14:14:10 -07:00
Vincent Batts
a368e064a9 registry: don't iterate through certs
the golang tls.Conn does a fine job of that.
http://golang.org/src/pkg/crypto/tls/handshake_client.go?#L334

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-04 16:12:23 -05:00
Tianon Gravi
14e65b4f81 Merge pull request #8936 from jfrazelle/drone-server
Switch Travis for Drone
2014-11-04 11:18:39 -07:00
Tianon Gravi
c6cf978b4b Merge pull request #8700 from unclejack/install_no_pull
contrib/install.sh: remove pull of hello-world
2014-11-04 10:28:43 -07:00
Solomon Hykes
59d4161f69 Merge pull request #8950 from Bertg/patch-1
makes the -s --size option documentation clearer
2014-11-04 09:09:15 -08:00
unclejack
f9d80712d9 contrib/install.sh: remove pull of hello-world
This removes the pull of the hello-world image from install.sh to
address privacy concerns.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 19:05:47 +02:00
Alexandr Morozov
b8678aa7f5 Merge pull request #8946 from unclejack/stream_decode
Decode JSON to avoid ReadFile
2014-11-04 09:02:40 -08:00
Bert Goethals
762ffda95d makes the -s --size option documentation clearer 2014-11-04 17:49:39 +01:00
Jessie Frazelle
a34f31b488 Merge pull request #8871 from tonistiigi/start-wait-hijack
Wait for hijack on docker start command
2014-11-04 08:46:56 -08:00
Tibor Vass
fa59fe997c Merge pull request #8877 from erikh/proxy_error_check
proxy: Fix a potential panic handling error states.
2014-11-04 11:40:02 -05:00
Tibor Vass
6718791ea2 Merge pull request #8813 from jlhawn/aufs_exclude_on_tar_layer
Exclude `.wh..wh.*` AUFS metadata on layer export
2014-11-04 11:38:12 -05:00
Arnaud Porterie
edae8830a9 Merge pull request #8906 from dqminh/remove-copy-directory
change util.CopyDirectory to archive.CopyWithTar
2014-11-04 08:02:35 -08:00
Alexandr Morozov
9eb8fcd58a Merge pull request #8390 from MalteJ/set-macaddress
Adding docker-cli run param to set MAC address
2014-11-04 07:54:59 -08:00
Malte Janduda
28605bc4d5 enhancing set-macaddress docu #2
Signed-off-by: Malte Janduda <mail@janduda.net>
2014-11-04 15:19:47 +01:00
unclejack
f665be55fe volume: stream JSON & Decode
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 16:15:07 +02:00
unclejack
4dbbe4f51a image: stream img JSON & Decode in LoadImage
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 16:15:00 +02:00
unclejack
4bc28f4e6b daemon/container: stream & decode JSON
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 16:14:47 +02:00
Sven Dowideit
b68d7d39bc Merge pull request #8924 from pdericson/api-doc-fix
Fix typo in api docs: stdou -> stdout
2014-11-03 23:09:16 -08:00
shuai-z
4c97832297 fixed the way of iterating over the range of map.
Fixed the following errors:
1. Request(0) causes a dead loop when the map is full and map.last == BEGIN.
2. When map.last is the only available port (or ip), Request(0) returns ErrAllPortsAllocated (or ErrNoAvailableIPs). Exception is when map.last == BEGIN.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-11-04 13:46:53 +08:00
Patrick Hemmer
95a400e6e1 Support hairpin NAT
This re-applies commit b39d02b with additional iptables rules to solve the issue with containers routing back into themselves.

The previous issue with this attempt was that the DNAT rule would send traffic back into the container it came from. When this happens you have 2 issues.
1) reverse path filtering. The container is going to see the traffic coming in from the outside and it's going to have a source address of itself. So reverse path filtering will kick in and drop the packet.
2) direct return mismatch. Assuming you turned reverse path filtering off, when the packet comes back in, it's goign to have a source address of itself, thus when the reply traffic is sent, it's going to have a source address of itself. But the original packet was sent to the host IP address, so the traffic will be dropped because it's coming from an address which the original traffic was not sent to (and likely with an incorrect port as well).

The solution to this is to masquerade the traffic when it gets routed back into the origin container. However for this to work you need to enable hairpin mode on the bridge port, otherwise the kernel will just drop the traffic.
The hairpin mode set is part of libcontainer, while the MASQ change is part of docker.

This reverts commit 63c303eecd.

Docker-DCO-1.1-Signed-off-by: Patrick Hemmer <patrick.hemmer@gmail.com> (github: phemmer)
2014-11-03 23:09:08 -05:00
Vincent Batts
91b4ac320f pkg/mount: include optional field
one linux, the optional field designates the sharedsubtree information,
if any.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-03 22:05:04 -05:00
Tibor Vass
5b03a21963 Merge pull request #8799 from jlhawn/remove_jsondata_arg
Remove `jsonData` argument from `image.StoreImage`
2014-11-03 20:55:40 -05:00
Jessica Frazelle
4b4b88a873 Switch travis status to drone.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-03 17:48:50 -08:00
Jessica Frazelle
471adb73a9 Remove travis CI.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-03 17:46:33 -08:00
Josh Hawn
26184de8ab Remove jsonData argument from image.StoreImage
The argument specified the json data to save to disk when registering
a new image into the image graph. If it is nil, then the given image
is serialized to json and that is written by default. This default
behavior is sufficient if the given image was originally deserialzed
from this jsonData to begin with which has always been the case.

Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-03 17:39:21 -08:00
Tibor Vass
54d6d12556 Merge pull request #8863 from vbatts/vbatts-archive_stat
./pkg/archive: clean up Stat_t assertion
2014-11-03 19:14:39 -05:00
Tibor Vass
b8ab729ae6 Merge pull request #8590 from jfrazelle/8307-iptables-d-restart-fix
On daemon shutdown iptables cleanup successfully
2014-11-03 18:29:51 -05:00
Fred Lifton
06f366bf00 Added missing item from Changelog
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-11-03 13:51:51 -08:00
Fred Lifton
1a1b0f223d Edits and refinements to 1.3.1 release notes.
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-11-03 13:50:42 -08:00
Michael Crosby
a7dea37b78 Merge pull request #8901 from dmcgowan/v2_registry_mirror_check
Skip V2 registry and immediately fallback to V1 when mirrors are provided
2014-11-03 13:37:55 -08:00
Tibor Vass
a85f58719f Merge pull request #8739 from duglin/CleanupDockerIgnores
Do some cleanup on .dockerignore paths
2014-11-03 16:05:24 -05:00
Tibor Vass
38d3888194 Merge pull request #8932 from duglin/UpdateLogrus
Update logrus to the latest so we can use ParseLevel() for PR #8335
2014-11-03 16:00:22 -05:00
Fred Lifton
8872c2903a Merge pull request #8907 from icecrime/clarify_user_instruction_doc
Clarify USER instruction documentation
2014-11-03 11:58:56 -08:00
Doug Davis
a12d897394 Update logrus to v0.6.0 so we can use ParseLevel() for PR #8335
Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-03 11:57:30 -08:00
Michael Crosby
025363848b Merge pull request #8927 from bfirsh/dont-pass-args-to-help-when-command-doesnt-exist
Fix help text being incorrect with multiple args
2014-11-03 11:23:57 -08:00
Michael Crosby
9ef9bfd151 Merge pull request #8929 from LK4D4/fix_filter_hang
Fix deadlock in ps exited filter
2014-11-03 11:07:24 -08:00
Vincent Batts
0e217c4a9e pkg/mount: adding fields supported by freebsd
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-11-03 14:01:50 -05:00
Alexandr Morozov
03ea2166b6 Fix deadlock in ps exited filter
Fixes #8909

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-03 10:51:03 -08:00
Fred Lifton
0e4bf159a2 Merge pull request #8928 from tianon/not-200-chars-anymore
Update "official repos" doc to mention 100 char short desc limit
2014-11-03 10:05:39 -08:00
Tianon Gravi
693b9d335c Update "official repos" doc to mention 100 char short desc limit
The Hub no longer accepts short descriptions over 100 characters.

Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-11-03 10:12:05 -07:00
Ben Firshman
ef004ec03f Fix help text being incorrect with multiple args
E.g. "docker foobar run" would have printed "Command not found:
foobar" and printed the help text for "run". It should instead
print the root help message for docker.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-11-03 16:46:01 +00:00
Peter Ericson
4437573c96 Fix typo in api docs: stdou -> stdout 2014-11-03 10:52:50 +00:00
Malte Janduda
971fc2253a enhancing set-macaddress docu
Signed-off-by: Malte Janduda <mail@janduda.net>
2014-11-03 11:43:27 +01:00
Doug Davis
c0f0f5c988 Do some cleanup on .dockerignore paths
While working on the fix for #8330 I noticed a few things:
1 - the split() call for the .dockerignore process will generate a blank
    "exclude".  While this isn't causing an issue right now, I got worried
	that in the future some code later on might interpret "" as something bad,
	like "everything" or ".".  So I added a check for an empty "exclude"
	and skipped it
2 - if someone puts "foo" in their .dockerignore then we'll skip "foo".
    However, if they put "./foo" then we won't due to the painfully
	simplistic logic of go's filepath.Match algorithm.  To help things
	a little (and to treat ./Dockerfile just like Dockerfile) I added
	code to filepath.Clean() each entry in .dockerignore.  It should
	result in the same semantic path but ensure that no matter how the
	user expresses the path, we'll match it.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-02 11:29:46 -08:00
Mengdi Gao
795533ede7 Remove extra line feed typo
The removed extra line feed broke the paragraph at https://docs.docker.com/userguide/dockerizing/
2014-11-02 22:55:36 +08:00
Médi-Rémi Hashim
d22d32d61f Grammatical mistake in docs
Change `The team can now use this image by run their own containers.` to `The team can now use this image by running their own containers.`
2014-11-01 21:22:43 +00:00
Arnaud Porterie
de9bf24750 Clarify USER instruction documentation
Reuse WORKDIR wording to specify that the USER instructions affect the
following RUN, CMD, and ENTRYPOINT instructions.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-11-01 14:04:51 -07:00
Daniel, Dao Quang Minh
e5ecfd3b17 change util.CopyDirectory to archive.CopyWithTar
Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-11-01 12:23:08 -04:00
Vladimir Bulyga
f12b7b4bc2 allow to use x-registry-auth header with enabled cors
Signed-off-by: Vladimir Bulyga <xx@ccxx.cc>
2014-11-01 19:22:28 +03:00
Malte Janduda
f2df38050e Adding docker-cli run param to set MAC address
Signed-off-by: Malte Janduda <mail@janduda.net>
2014-11-01 15:35:09 +01:00
Derek McGowan
9d6391a9eb Skip V2 registry and immediately fallback to V1 when mirrors are provided
Since V2 registry does not yet implement mirrors, when mirrors are given automatically fallback to V1 without checking V2 first.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2014-10-31 18:10:48 -07:00
Fred Lifton
4d4a7b81bf Merge pull request #8884 from thomasleveil/userguide-so26652877
Reword a sentence bringing confusion about docker links
2014-10-31 17:09:16 -07:00
Jessie Frazelle
92bb497201 Merge pull request #8167 from brahmaroutu/expose_ports_1834
adding support for port ranges on --expose
2014-10-31 16:20:08 -07:00
Srini Brahmaroutu
fd774a818c adding support for port ranges on --expose
Closes #1834

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-10-31 23:06:30 +00:00
Jessie Frazelle
9cc71b4597 Merge pull request #8468 from laktek/master
Fix URL check in build from Git.
2014-10-31 14:43:21 -07:00
Michael Crosby
7cb12133ae Merge pull request #8818 from coolljt0725/fix_exec_help
Fix docker exec help messages.
2014-10-31 14:36:01 -07:00
Michael Crosby
a92393bb17 Merge pull request #8878 from thaJeztah/patch-1
Typo in 1.3.1 change log
2014-10-31 14:32:25 -07:00
Jessie Frazelle
058aa0cbc2 Merge pull request #8894 from vieux/fix_docs_filter
add missing 'current filter' to ps
2014-10-31 14:26:29 -07:00
Jessie Frazelle
7a2dc8b889 Merge pull request #8895 from erikh/proxy_udp_size
pkg/proxy: Bump the maximum size of a UDP packet.
2014-10-31 13:11:54 -07:00
Vincent Batts
7a3a938712 pkg/mount: testing for linux sharedsubtree mounts
* shared
* shared/slave
* unbindable
* private

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-31 15:31:34 -04:00
Erik Hollensbe
5a73be8e9f pkg/proxy: Bump the maximum size of a UDP packet.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-31 18:56:07 +00:00
Victor Vieux
f95d73dfd4 add missing 'current filter' to ps
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-31 18:28:10 +00:00
Michael Crosby
0f9f5f3fdf Merge pull request #8839 from irachex/dns-search-doc
Add docs for --dns-search=.
2014-10-31 11:25:57 -07:00
Vincent Batts
06bd66a1f8 pkg/mount: add more sharesubtree options
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-31 13:29:35 -04:00
Thomas LEVEIL
906985123a Reword a sentence bringing confusion about docker links
As [discovered][1] doing user support, the sentence `You've learned that a link creates a
source container that can provide information about itself to a recipient container` brings
confusion.

[1]: http://stackoverflow.com/questions/26652877/how-to-avoid-redundant-container-linking-in-docker-when-propagating-ip-addresses/26654203?noredirect=1#comment41945048_26654203

Signed-off-by: Thomas LEVEIL <thomasleveil@gmail.com>
2014-10-31 13:00:59 +00:00
Sebastiaan van Stijn
29965246a7 Typo in 1.3.1 change log
Replaced envrionment -> environment

Signed-off-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
2014-10-31 08:31:20 +01:00
Erik Hollensbe
ad5b307d0f proxy: Fix a potential panic handling error states.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-31 04:20:26 +00:00
Huu Nguyen
8453cf0671 Remove out-of-context code block
Signed-off-by: Huu Nguyen <whoshuu@gmail.com>
2014-10-30 23:58:14 -04:00
Huu Nguyen
b16f3736ed Fix apparent copy paste mistake
The note under the RUN header refers to the CMD instruction. It should refer to the RUN instruction instead.

Signed-off-by: Huu Nguyen <whoshuu@gmail.com>
2014-10-30 23:22:51 -04:00
Huayi Zhang
eaa050fdb8 Mapping change in code
Signed-off-by: Huayi Zhang <irachex@gmail.com>
2014-10-31 09:57:54 +08:00
Sven Dowideit
107898a773 Merge pull request #8837 from sawalls/patch-2
ubuntulinux.md - old commands, typo, section movement
2014-10-30 18:48:24 -07:00
Lei Jitang
d8b17d785a Fix docker exec command help messages
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2014-10-31 09:36:07 +08:00
Fred Lifton
c2ff42552a Merge pull request #8873 from SvenDowideit/de-cleanup-Dockerfile
Yes, the review really should have picked up this spelling mistake
2014-10-30 18:32:28 -07:00
Scott Walls
bc62a35ffb ubuntulinux.md - old commands, typo, section movement
- Removed some commands related to autocomplete/symlinks that don't seem to be required anymore on Ubuntu 14.04
- Fixed one minor typo ("see LINK _for_ details," not "see LINK details")
- Moved section "Giving non-root access" to top level, rather than being under Ubuntu 13 (the section isn't specific to Ubuntu 13, and even references Ubuntu 14).

Signed-off-by: Scott Walls <sawalls@umich.edu>
2014-10-30 18:28:37 -07:00
Sven Dowideit
bfe21f095d Yes, the review really should have picked up this spelling mistake
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-31 11:10:17 +10:00
Jessie Frazelle
f68b8b33e6 Merge pull request #8850 from shuai-z/clean-mount
Clear the internal state before raising error.
2014-10-30 18:01:01 -07:00
Jessie Frazelle
aca253d6d0 Merge pull request #8866 from tonistiigi/fix-8832-logs-panic
Fix panic on slow log consumer.
2014-10-30 17:40:46 -07:00
Jessie Frazelle
793fb26bff Merge pull request #8510 from hqhq/graphdriver_bug
daemon: resolve the graphdriver to show
2014-10-30 17:40:30 -07:00
Tibor Vass
6d6dc2c1a1 Merge pull request #8870 from tiborvass/merge_release_v1.3.1
Merge release v1.3.1
2014-10-30 20:24:34 -04:00
Tibor Vass
b9fcdb8191 Change version to 1.3.1-dev
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-10-30 19:45:07 -04:00
Tibor Vass
4a17e6eedd Bump to version v1.3.1
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	VERSION
2014-10-30 19:44:54 -04:00
Tibor Vass
05c18a2434 Fix login command
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-10-30 19:44:44 -04:00
Tibor Vass
e43d9f713e Docs edits for dropping SSLv3 and under + release notes for 1.3.1
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	docs/sources/index.md

Conflicts:
	docs/sources/index.md
2014-10-30 19:44:42 -04:00
Tibor Vass
6a1ff022b0 Do not verify certificate when using --insecure-registry on an HTTPS registry
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	registry/registry.go
	registry/registry_test.go
	registry/service.go
	registry/session.go

Conflicts:
	registry/endpoint.go
	registry/registry.go
2014-10-30 19:44:09 -04:00
Michael Crosby
afade4236d Don't hard code true for auth job
Signed-off-by: Michael Crosby <michael@docker.com>

Conflicts:
	registry/service.go
2014-10-30 19:41:55 -04:00
Michael Crosby
48f7384d63 Expand documentation for --insecure-registries
Signed-off-by: Michael Crosby <michael@docker.com>
2014-10-30 19:41:55 -04:00
Michael Crosby
f29b2e48eb Refactor IsSecure change
Fix issue with restoring the tag store and setting static configuration
from the daemon. i.e. the field on the TagStore struct must be made
internal or the json.Unmarshal in restore will overwrite the insecure
registries to be an empty struct.

Signed-off-by: Michael Crosby <michael@docker.com>

Conflicts:
	graph/pull.go
	graph/push.go
	graph/tags.go
2014-10-30 19:41:55 -04:00
unclejack
380c8320a7 make http usage for registry explicit
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)

Conflicts:
	daemon/config.go
	daemon/daemon.go
	graph/pull.go
	graph/push.go
	graph/tags.go
	registry/registry.go
	registry/service.go
2014-10-30 19:41:55 -04:00
Victor Vieux
28af4a1efb Merge pull request #8867 from vbatts/vbatts-relocate_mount_operation
mount: move the MakePrivate to pkg/mount
2014-10-30 16:39:20 -07:00
Tonis Tiigi
79a77a396e Wait for hijack on docker start command
With current implementation there was a possibility
that /start responds quicker than /attach, meaning that
some output would be clipped.

Fixed so the implementation matches with `docker run`.

This also fixes the flaky test results for TestCreateEchoStdout.

Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-10-31 01:13:31 +02:00
Vincent Batts
930a756ad5 mount: move the MakePrivate to pkg/mount
The logic is unrelated to graphdriver.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-30 17:04:56 -04:00
Vincent Batts
5e02468e76 ./pkg/archive: clean up Stat_t assertion
inspired by @tonistiigi comment
(https://github.com/docker/docker/pull/8046/files#r19579960)

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-30 16:50:33 -04:00
Tonis Tiigi
c2cf97a074 Fix panic on slow log consumer.
Fixes #8832

All stdio streams need to finish writing before the
connection can be closed.

Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-10-30 22:24:57 +02:00
Fred Lifton
c3762c3abf Merge pull request #8822 from wilsaj/patch-2
Update host integration article
2014-10-30 12:19:36 -07:00
Michael Crosby
d0197f4f7e Merge pull request #8856 from unclejack/reexec_pkg
pkg/reexec: move reexec code to a new package
2014-10-30 12:14:37 -07:00
Tonis Tiigi
417e48e4a0 Generalize consumeSlow and add stop support
Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-10-30 21:11:33 +02:00
Tonis Tiigi
8a81c46272 Move consumeSlow() under test utils
Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-10-30 20:55:08 +02:00
Andy Wilson
9542ea7218 doc: Update host integration article
Update for changes in docker 1.2. Running the docker daemon with "-r=false" has been deprecated in favor of per-container restart policies.

Signed-off-by: wilsaj <wilson.andrew.j+github@gmail.com>
2014-10-30 13:39:45 -05:00
Huayi Zhang
36ffbd7acf Add docs for --dns-search=.
PR 6720 introduce that use `--dns-search=.` will not set `search` in `/etc/resolv.conf`.

Signed-off-by: Huayi Zhang <irachex@gmail.com>
2014-10-30 21:04:35 +08:00
unclejack
acd64278f1 pkg/reexec: move reexec code to a new package
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-30 14:48:30 +02:00
James Turnbull
b63a254522 Merge pull request #8747 from SvenDowideit/lets-tell-them-more-about-exec
Add a link to some documentation about exec.
2014-10-30 07:56:55 -04:00
shuai-z
05ff40b07a Clear the internal state ourselves before raising error.
If we need to raise an error, make sure the internal state is clean, because
a successful driver.Get() may have its internal state changed (eg. counting,
or mounts), while callers will only do that after a succussful Mount().

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-10-30 13:31:19 +08:00
Sven Dowideit
74564e51ad Merge pull request #8500 from fredlf/style-guide
Adds new Docs Style Guide.
2014-10-29 17:26:29 -07:00
Fred Lifton
461d33eeb0 Adds new Docs Style Guide.
Includes changes to mkdocs yml and removes style info from docs Read Me, adding a link instead.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

Conflicts:
	docs/README.md

Revisions to style guide based on review.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

More Style Guide revisions based on review.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

A few more style guide copy edits

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-29 16:43:58 -07:00
Victor Vieux
265a89a605 Merge pull request #8387 from vbatts/vbatts-registry_test_enpoint
registry/endpoint: make it testable
2014-10-29 13:36:17 -07:00
unclejack
73057168fa Merge pull request #8046 from vbatts/vbatts-archive_preserve_hard_links
archive: preserve hardlinks in Tar and Untar
2014-10-29 22:04:23 +02:00
Jessie Frazelle
565340c90c Merge pull request #8669 from monsterzz/8668-dualstack-registry
Use dual-stack Dialer when talking to registy
2014-10-29 12:03:12 -07:00
Vincent Batts
f14a9ed011 archive: cleanup and more information
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-10-29 14:52:59 -04:00
Vincent Batts
f710a8d774 archive: example app for diffing directories
By default is a demo of file differences, but can be used to create a
tar of changes between an old and new path.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-10-29 14:52:59 -04:00
Vincent Batts
f9f8044363 archive: preserve hardlinks in Tar and Untar
* integration test for preserving hardlinks

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-10-29 14:52:52 -04:00
Jessie Frazelle
f936a10d80 Merge pull request #8571 from ncdc/3631-stdout-premature-eof
Fix stdout premature EOF
2014-10-29 11:36:32 -07:00
Jessica Frazelle
e171eda998 fix for iptables cleanup 8307
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-29 10:59:20 -07:00
Jessica Frazelle
d98b117962 Add test for #8307.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-29 10:59:20 -07:00
Tibor Vass
006d2334d1 Merge pull request #8846 from LK4D4/fix_compilation
Fix compilation issue bringed by #8319
2014-10-29 12:50:53 -04:00
Alexandr Morozov
4da2572424 Fix compilation issue bringed by #8319
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-29 09:31:35 -07:00
Jessie Frazelle
fd19e473fc Merge pull request #8319 from MalteJ/ipv6-ipallocator
Implementing IPv6 functionality for ipallocator
2014-10-29 09:20:52 -07:00
decadent
ed5e776a22 Updated the COPY directive reference: Source can't be a URL for COPY (+ formatting error fixes)
Signed-off-by: Roman Dudin <katrmr@gmail.com>
2014-10-29 12:36:38 +03:00
Sven Dowideit
7d538542ca Merge pull request #8790 from cloojure/patch-2
Update faq.md
2014-10-28 19:55:00 -07:00
Sven Dowideit
f1ddda6cf7 Merge pull request #8808 from nhsiehgit/dockerfiletut
changed dockerfile back button to look nicer
2014-10-28 19:41:18 -07:00
Tibor Vass
290222c3dd Merge pull request #8352 from zachborboa/patch-1
Fix typo
2014-10-28 22:39:05 -04:00
Solomon Hykes
f0327c99dd Merge pull request #8198 from jfrazelle/add-jessie-to-various-maintainers
Adding self to various maintainers files.
2014-10-28 19:35:28 -07:00
James Turnbull
e11dd26a6c Merge pull request #8734 from alex/patch-2
Replace fast with quickly
2014-10-28 22:11:43 -04:00
Sven Dowideit
90221e28d6 Merge pull request #8646 from ndeloof/patch-3
Update docker_remote_api.md
2014-10-28 19:08:55 -07:00
James Turnbull
75ae546377 Merge pull request #8750 from matm/patch-2
dockerimages.md: typo fix
2014-10-28 22:04:43 -04:00
James Turnbull
01454a50cc Merge pull request #8762 from fredlf/tutorial-tweaks
Tweaks to Dockerfile tutorial
2014-10-28 22:04:23 -04:00
Michael Crosby
9d65017069 Merge pull request #8836 from jfrazelle/hub-login-error
Fix error on successful login.
2014-10-28 18:09:17 -07:00
Jessica Frazelle
35703d4f0c Fix error on successful login.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-28 17:42:03 -07:00
Alexandr Morozov
674e11183a Merge pull request #8833 from jfrazelle/revert-gccgo-changes
Revert gccgo changes
2014-10-28 16:44:39 -07:00
Jessica Frazelle
7041eb00be Revert "finally, use code generation for INITSHA1 & INITPATH too"
This reverts commit c7c620dd9f.

Conflicts:
	.gitignore
	hack/make.sh
	hack/make/dynbinary

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-28 16:29:01 -07:00
Jessica Frazelle
ec1420cc2b Revert "use code generation for GITCOMMIT/VERSION too"
This reverts commit 85744a35de.

Conflicts:
	.gitignore
	hack/make.sh

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-28 16:27:23 -07:00
Sven Dowideit
321c85d03d Merge pull request #8717 from yosifkit/docs-dockerfile
Cleanup docs Dockerfile, so it matches best practices.
2014-10-28 16:25:50 -07:00
Jessica Frazelle
17e0a15386 Revert "Use code generation to set IAMSTATIC instead of -X"
This reverts commit 3e10b93106.

Conflicts:
	.gitignore
	hack/make.sh
	hack/make/dynbinary

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-28 16:25:50 -07:00
Michael Crosby
d176d1bfb4 Merge pull request #8828 from crosbymichael/update-libcontainer-oct4
Update libcontainer to f60d7b9195f8dc0b5d343abbc3293d
2014-10-28 16:14:28 -07:00
Michael Crosby
622e100553 Update libcontainer f60d7b9195f8dc0b5d343abbc3293d
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-28 22:19:01 +00:00
Jessie Frazelle
eb1b785e67 Merge pull request #8772 from aluzzardi/docker-info-mem-cpu
Expose # of CPUs and memory available on docker info.
2014-10-28 14:14:10 -07:00
Nathan Hsieh
7597f27276 changed dockerfile back button to look nicer
Signed-off-by: Nathan Hsieh <hsieh.nathan@gmail.com>
2014-10-28 11:52:49 -07:00
Josh Hawn
0d97e082c3 Exclude .wh..wh.* AUFS metadata on layer export
In an effort to make layer content 'stable' between import
and export from two different graph drivers, we must resolve
an issue where AUFS produces metadata files in its layers
which other drivers explicitly ignore when importing.

The issue presents itself like this:

    - Generate a layer using AUFS
    - On commit of that container, the new stored layer contains
      AUFS metadata files/dirs. The stored layer content has some
      tarsum value: '1234567'
    - `docker save` that image to a USB drive and `docker load`
      into another docker engine instance which uses another
      graph driver, say 'btrfs'
    - On load, this graph driver explicitly ignores any AUFS metadata
      that it encounters. The stored layer content now has some
      different tarsum value: 'abcdefg'.

The only (apparent) useful aufs metadata to keep are the psuedo link
files located at `/.wh..wh.plink/`. Thes files hold information at the
RW layer about hard linked files between this layer and another layer.
The other graph drivers make sure to copy up these psuedo linked files
but I've tested out a few different situations and it seems that this
is unnecessary (In my test, AUFS already copies up the other hard linked
files to the RW layer).

This changeset adds explicit exclusion of the AUFS metadata files and
directories (NOTE: not the whiteout files!) on commit of a container
using the AUFS storage driver.

Also included is a change to the archive package. It now explicitly
ignores the root directory from being included in the resulting tar archive
for 2 reasons: 1) it's unnecessary. 2) It's another difference between
what other graph drivers produce when exporting a layer to a tar archive.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-10-28 10:14:05 -07:00
Alexander Larsson
453552c838 Add overlayfs graph backend
This backend uses the overlayfs union filesystem for containers
plus hard link file sharing for images.

Each container/image can have a "root" subdirectory which is a plain
filesystem hierarchy, or they can use overlayfs.

If they use overlayfs there is a "upper" directory and a "lower-id"
file, as well as "merged" and "work" directories. The "upper"
directory has the upper layer of the overlay, and "lower-id" contains
the id of the parent whose "root" directory shall be used as the lower
layer in the overlay. The overlay itself is mounted in the "merged"
directory, and the "work" dir is needed for overlayfs to work.

When a overlay layer is created there are two cases, either the
parent has a "root" dir, then we start out with a empty "upper"
directory overlaid on the parents root. This is typically the
case with the init layer of a container which is based on an image.
If there is no "root" in the parent, we inherit the lower-id from
the parent and start by making a copy if the parents "upper" dir.
This is typically the case for a container layer which copies
its parent -init upper layer.

Additionally we also have a custom implementation of ApplyLayer
which makes a recursive copy of the parent "root" layer using
hardlinks to share file data, and then applies the layer on top
of that. This means all chile images share file (but not directory)
data with the parent.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-10-28 11:31:30 +01:00
Tibor Vass
29ebb53b52 Merge pull request #8806 from takama/ioreader
excluding unused transformation to []byte
2014-10-27 20:58:53 -04:00
Sven Dowideit
413f2efba1 Merge pull request #8807 from erikh/builder_docs
builder: Update documentation WRT environment replacement
2014-10-27 17:40:09 -07:00
Erik Hollensbe
e377716b37 builder: Update documentation WRT environment replacement
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-27 23:37:27 +00:00
unclejack
039f225768 Merge pull request #8802 from jlhawn/vfs_copydir_use_archive_copywithtar
Use archive.CopyWithTar in vfs.Create
2014-10-28 00:08:44 +02:00
Tibor Vass
55702ae3d6 Merge pull request #8809 from erikh/builder_cmd_sh_fix
builder: Restore /bin/sh handling in CMD when entrypoint is specified with JSON
2014-10-27 18:07:08 -04:00
Erik Hollensbe
24545c18c3 builder: Restore /bin/sh handling in CMD when entrypoint is specified with JSON
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-27 21:50:22 +00:00
Tibor Vass
e590aa2c7a Merge pull request #8778 from erikh/builder_fixes
Builder: Environment replacement fixes
2014-10-27 16:58:05 -04:00
Jessie Frazelle
d42bcc065a Merge pull request #8805 from vieux/update_sysinfo_to_logrus
update `pkg` to logrus
2014-10-27 12:26:52 -07:00
Igor Dolzhikov
b65eb8d215 excluding unused transformation to []byte
Signed-off-by: Igor Dolzhikov <bluesriverz@gmail.com>
2014-10-28 01:04:36 +06:00
Victor Vieux
0a37f836ad update sysinfo to logrus
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-27 18:59:02 +00:00
Josh Hawn
b6db23cffe Use archive.CopyWithTar in vfs.Create
The vfs storage driver currently shells out to the `cp` binary on the host
system to perform an 'archive' copy of the base image to a new directory.
The archive option preserves the modified time of the files which are created
but there was an issue where it was unable to preserve the modified time of
copied symbolic links on some host systems with an outdated version of `cp`.

This change no longer relies on the host system implementation and instead
utilizes the `CopyWithTar` function found in `pkg/archive` which is used
to copy from source to destination directory using a Tar archive, which
should correctly preserve file attributes.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-10-27 11:38:22 -07:00
Alexandr Morozov
339173dd5b Merge pull request #8743 from vieux/hostconfig_start
do not send hostconfig at start, as we do on create now
2014-10-27 11:09:57 -07:00
Erik Hollensbe
4e74cd498b builder: whitelist verbs useful for environment replacement.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-27 17:38:25 +00:00
Erik Hollensbe
be49867cab builder: handle escapes without swallowing all of them.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-27 17:38:24 +00:00
Joe Ferguson
9a03652d96 Cleanup docs Dockerfile, so it matches best practices.
Docker-DCO-1.1-Signed-off-by: Joseph Ferguson <joe@infosiftr.com> (github: yosifkit)
2014-10-27 09:35:27 -07:00
Jessie Frazelle
80d35c7fd0 Merge pull request #8782 from shuai-z/rm-clean
removed redundant Clean
2014-10-27 09:23:10 -07:00
Jessie Frazelle
15b6b7be01 Merge pull request #8770 from LK4D4/logrus_support
Logrus support
2014-10-27 09:05:24 -07:00
Tibor Vass
2b41736205 Merge pull request #8641 from vbatts/vbatts-archive_test_and_benchmark
archive: tests and benchmarks for hardlinks
2014-10-27 09:55:19 -04:00
Alan Thompson
6e208b7f1c Update faq.md
Minor language clarification.
2014-10-26 19:57:52 -07:00
shuai-z
ce407ccff4 removed redundant Clean
The doc (or src) says: The result is Cleaned.

http://golang.org/pkg/path/filepath/#Join

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-10-26 13:55:29 +08:00
Lakshan Perera
d3ac9ea98e Add HasValidGITPrefix to utils/utils.go
This will allow us to use a common Git prefix check for both api/clients/commands.go and
builder/job.go. Previous prefix check in build from Git (in builder/jobs.go) ignored valid prefixes such as "git@", "http://" or "https://".

Signed-off-by: Lakshan Perera <lakshan@laktek.com>
2014-10-26 03:25:25 +00:00
Tianon Gravi
5631ffbdfd Merge pull request #6992 from mschurenko/master
include --releasever=/ in mkimage-yum.sh
2014-10-25 02:03:32 -06:00
Tianon Gravi
10d3315080 Merge pull request #8643 from jfrazelle/fix-amazon-linux-dist
Fix amazon linux dist
2014-10-24 19:26:27 -06:00
Tibor Vass
350e1b783d Merge pull request #8321 from erikh/ui_save_output
docker save: Do not save to a terminal.
2014-10-24 19:37:14 -04:00
Andrea Luzzardi
61f8001c23 Expose # of CPUs and memory available on docker info.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-24 15:56:37 -07:00
Alexandr Morozov
c681bea062 Merge pull request #8744 from erikh/empty_entrypoint_inheritance
builder: some small fixups + fix a bug where empty entrypoints would not override inheritance.
2014-10-24 15:31:15 -07:00
Alexandr Morozov
ee7dd44c01 Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:11:48 -07:00
Alexandr Morozov
b99dcb3c7e Remove pkg/log
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:24 -07:00
Alexandr Morozov
b3b4043345 Use common logging in engine
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:24 -07:00
Alexandr Morozov
7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Alexandr Morozov
6229a36432 Vendor logrus logging framework
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:01:52 -07:00
Tibor Vass
d515590d15 Merge pull request #8325 from mwhudson/do-not-use-X
Stop using -X flag to set global variables
2014-10-24 17:30:45 -04:00
James Turnbull
78075abf81 Merge pull request #8746 from aluzzardi/bump-api-v1.16
Bump API to v1.16.
2014-10-24 16:47:48 -04:00
Vincent Batts
3eba719400 registry/endpoint: make it testable
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-24 16:27:17 -04:00
Fred Lifton
fcae37402a Add back Best Practices link.
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-24 13:17:14 -07:00
Victor Vieux
665cd10d59 Merge pull request #8760 from jfrazelle/8745-output-log
Client should use go log package.
2014-10-24 13:13:30 -07:00
Jessie Frazelle
9094c19a6d Merge pull request #8315 from dqminh/save-start-error
Save start error into State.Error when the container fails to start
2014-10-24 13:13:00 -07:00
Jessica Frazelle
a7aedca4a1 Client should use go log package.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-24 13:03:46 -07:00
Fred Lifton
cc45b13ad4 Tweaks to Dockerfile tutorial
Made a few tweaks to Dockerfile tutorial links and removed some cruft from the tutorial itself.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-24 12:00:47 -07:00
Andrea Luzzardi
ca6cc65609 Bump API to v1.16.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-24 11:25:44 -07:00
Vincent Batts
0fdf7839a2 archive: tests and benchmarks for hardlinks
Adding moar information, so benchmark comparisons can be moar
comparative.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-24 08:58:31 -04:00
Nicolas De loof
ab03e898ff Document alternate command to check encrypted TCP socket
as curl command seems to fail on OSX Mavericks

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2014-10-24 09:15:15 +02:00
Mathias Monnerville
417fde550e dockerimages.md: typo fix 2014-10-24 09:09:20 +02:00
Sven Dowideit
7f1ea7129e Add a link to some documentation about exec.
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-24 12:41:19 +10:00
James Turnbull
c6f242b88f Merge pull request #8722 from SvenDowideit/sven-cannot-bash
Add --dryrun to allow testing to the docs-release site, and then fix the...
2014-10-23 21:37:55 -04:00
James Turnbull
8f79bd964f Merge pull request #8695 from SvenDowideit/add-details-to-entrypoint-docs
Rewrite ENTRYPOINT documentation covering all the combinations with exam...
2014-10-23 21:37:36 -04:00
Sven Dowideit
4bae6235c0 Add --dryrun to allow testing to the docs-release site, and then fix the double dollar mistake
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-24 11:36:07 +10:00
Michael Crosby
0e6242122d Merge pull request #8671 from shuai-z/master
Port number 49153(BeginPortRange) would be returned twice, causing dupli...
2014-10-23 17:37:38 -07:00
Erik Hollensbe
cdd6e97910 builder: some small fixups + fix a bug where empty entrypoints would not override inheritance.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-24 00:23:25 +00:00
Victor Vieux
12028fc159 do not send hostconfig at start, as we do on create now
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-24 00:22:21 +00:00
Victor Vieux
a71b2ec54a Merge pull request #8737 from brahmaroutu/resize_uponstart_8728
Allowing resize tty to only work when container is started
2014-10-23 17:20:10 -07:00
Andrea Luzzardi
a76c924e6a Merge pull request #8453 from estesp/8444-create-bridge-error
Gracefully handle network bridge without IP association at startup
2014-10-23 17:00:21 -07:00
Michael Hudson-Doyle
c7c620dd9f finally, use code generation for INITSHA1 & INITPATH too
Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
2014-10-24 11:01:19 +13:00
Michael Hudson-Doyle
85744a35de use code generation for GITCOMMIT/VERSION too
Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
2014-10-24 10:58:39 +13:00
Michael Hudson-Doyle
3e10b93106 Use code generation to set IAMSTATIC instead of -X
Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
2014-10-24 10:56:51 +13:00
Srini Brahmaroutu
78a272ce14 Allowing resize tty to only work when container is started
Addresses #8728

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-10-23 21:31:34 +00:00
Jessie Frazelle
88e6693912 Merge pull request #8736 from crosbymichael/update-libcontainer-oct3
Update libcontainer to aab3f6d17f2f56606f07f3a6eb6
2014-10-23 14:07:36 -07:00
Phil Estes
1262b5f605 Gracefully handle network bridge without IP association at startup
Addresses #8444

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-10-23 16:19:12 -04:00
Alexandr Morozov
77dcab133c Merge pull request #8735 from estesp/fix-test-timeout-on-drone
Up test timeout to 10s based on recent drone.io timeout failures
2014-10-23 13:02:34 -07:00
Michael Crosby
45c511fd5a Merge pull request #8733 from estesp/error-string-http-status-fix
Fix error string mapping to HTTP response code to ignore case
2014-10-23 12:10:21 -07:00
Michael Crosby
291b84610f Update libcontainer to aab3f6d17f2f56606f07f3a6eb6
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-23 19:00:05 +00:00
Phil Estes
ee17b93df9 Up test timeout to 10s based on recent drone.io timeout failures
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-10-23 14:30:39 -04:00
Phil Estes
6589044b5b Fix volume test using "find" to properly call find with /hello path
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-10-23 14:13:11 -04:00
Alex Gaynor
3a1eafb488 Replace fast with quickly
Technically an adverb should be used there :-)
2014-10-23 11:06:36 -07:00
Fred Lifton
8b40d385b5 Removed James' email address
Changed email address for abuse reports from James to abuse@
2014-10-23 10:54:40 -07:00
Phil Estes
9b430f4ec1 Fix error string mapping to HTTP response code to ignore case
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-10-23 13:34:06 -04:00
unclejack
1aa67071cb Merge pull request #8550 from aluzzardi/f-meminfo
system: Add MemInfo utility.
2014-10-23 09:31:28 +03:00
shuai-z
2c2edabca5 added test, gofmtd
Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-10-23 11:35:12 +08:00
shuai-z
9451cf39ef Port number 49153(BeginPortRange) would be returned twice, causing duplication and potential errors.
If we first request port 49153 (BeginPortRange) explicitly, and later some time request the next free port (of same ip/proto) by calling RequestPort() with port number 0, we will again get 49153 returned, even if it's currently in use. Because findPort() blindly retured BeginPortRange the first run, without checking if it has already been taken.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-10-23 10:49:33 +08:00
Daniel, Dao Quang Minh
fb6ee865a9 save start error into State.Error
when a container failed to start, saves the error message into State.Error so
that it can be retrieved when calling `docker inspect` instead of having to
look at the log

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-10-22 22:42:37 -04:00
Sven Dowideit
0390d04d8a Rewrite ENTRYPOINT documentation covering all the combinations with examples.
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-23 12:12:08 +10:00
Alexandr Morozov
5343ede602 Merge pull request #8718 from jfrazelle/run-redirect-test-fix
TestRunRedirectStdout kept failing with timed out.
2014-10-22 19:11:12 -07:00
Sven Dowideit
bb3e33154d Merge pull request #8673 from SvenDowideit/whats-docker-version
DOCKER_VERSION and docker-version havn't been implemented.
2014-10-22 19:03:54 -07:00
James Turnbull
ba14ddf85b Merge pull request #8708 from torstehu/fix-url
Correct url from github.com/dotcloud/docker{,-py}
2014-10-22 18:57:42 -04:00
Jessica Frazelle
93e17b2eca TestRunRedirectStdout kept failing with timed out.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-22 15:51:14 -07:00
Andrea Luzzardi
e0c9d7b654 Add MemInfo to the system pkg.
MemInfo provides a simple API to get memory information from the
system.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-22 14:05:45 -07:00
Andy Goldstein
5572dbb750 Fix stdout premature EOF
Never close attached stream before both stdout and stderr have written
all their buffered contents. Remove stdinCloser because it is not needed
any more as the stream is closed anyway after attach has finished.

Fixes #3631

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
2014-10-22 16:34:42 -04:00
Torstein Husebø
64cb772538 Correct url from github.com/dotcloud/docker{,-py}
to github.com/docker/docker{,-py}

Signed-off-by: Torstein Husebø <torstein@huseboe.net>
2014-10-22 16:57:39 +02:00
unclejack
25c32d3167 Merge pull request #8672 from estesp/CmdRun-fix-typos-comments
Clean up comment sections and fix typos in CmdRun
2014-10-22 14:32:39 +03:00
unclejack
c694c66e2f Merge pull request #8692 from jfrazelle/8690-latest-tag-problem
Fix problem where building Dockerfile `FROM name:latest`
2014-10-22 10:55:57 +03:00
Sven Dowideit
6aeda16995 Merge pull request #8682 from wpp/update_linking_documentation
Update linking documentation
2014-10-21 21:01:51 -07:00
Sven Dowideit
a9258f7849 Merge pull request #8680 from wilsaj/patch-1
Docfix: fix cli dashes in boot2docker resizing article
2014-10-21 21:00:53 -07:00
James Turnbull
ca500e0039 Merge pull request #8651 from flisky/patch-1
fix a small typo
2014-10-21 23:40:34 -04:00
James Turnbull
6f4529a598 Merge pull request #8670 from SvenDowideit/link-to-run-reference-from-cli.md
Link to run reference from cli doc
2014-10-21 23:38:57 -04:00
Tibor Vass
47cb56f20f Merge pull request #8691 from crosbymichael/fix-integration-race
Fix racy integration tests
2014-10-21 21:06:01 -04:00
Jessica Frazelle
373fd1ce16 Fixes #8690
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-21 16:47:43 -07:00
Michael Crosby
95d1cd0bde Merge pull request #8661 from estesp/8555-start-exit-code
Return container exit code with start -a/-i
2014-10-21 16:22:15 -07:00
Michael Crosby
ba5370c116 Fix racy integration tests
Do not run containers in the background in the integration tests if you
depend on the run completing.  It is better especially if you just want
to ensure that the run has completed with a `true` to just run in
foreground and use a known name for the container to query it after it
has stopped.

The failures can be reproduced on most machines by giving your dind
container one core and a cpushare.

docker run -c 200 --cpuset 0 -ti --rm --privileged -e
DOCKER_GRAPHDRIVER=vfs docker hack/make.sh binary test-integration-cli

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-21 22:51:09 +00:00
Alexandr Morozov
a07ee0db62 Merge pull request #8684 from erikh/onbuild_case_insensitive
builder: handle cases where onbuild is not uppercase.
2014-10-21 15:24:15 -07:00
Erik Hollensbe
a34831f016 builder: handle cases where onbuild is not uppercase.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-21 20:17:37 +00:00
Philipp Weissensteiner
5df2c878a1 Update container linking documentation
As of 1.3 `docker ps` no longer shows links between containers.
This updates the documentation to reflect that change.

    sudo docker docker inspect -f "{{ .HostConfig.Links }}" web

Signed-off-by: Philipp Weissensteiner <mail@philippweissensteiner.com>
2014-10-21 21:58:05 +02:00
Andy Wilson
36dae27fa2 fix cli dashes in boot2docker resizing article
The CLI commands had long dashes that won't work on most terminals when copy pasting.

Signed-off-by: wilsaj <wilson.andrew.j+github@gmail.com>
2014-10-21 11:38:19 -05:00
Tibor Vass
9df3e45ba9 Merge pull request #8423 from unclejack/lint_changes
lint changes part 1
2014-10-21 12:15:58 -04:00
Tibor Vass
cf44d6f9cc Merge pull request #8665 from cpuguy83/8659_clean_paths_for_volumes
Clean volume paths
2014-10-21 11:17:03 -04:00
Qiang Huang
7cf322dffc daemon: resolve the graphdriver to show
graphdriver is not always specified when the log printed, because
it's provided in another thread. This patch will fix this.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2014-10-21 15:00:25 +08:00
Sven Dowideit
6ed610fb80 DOCKER_VERSION and docker-version havn't been implemented.
So far, it looks like the declarations are not used, and so its safer not to
confuse people into thinking they do something.

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-21 16:04:11 +10:00
Zach Borboa
d0f12a0f73 Fix typo
Signed-off-by: Zach Borboa <zachborboa@gmail.com>
2014-10-20 18:46:39 -07:00
Sven Dowideit
9e137ceb57 Link to run reference from cli doc
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-21 11:21:11 +10:00
Victor Vieux
a10876d355 Merge pull request #8573 from estesp/integration-test-migrate
Migrate container GET API tests from integration to integration-cli
2014-10-20 18:06:40 -07:00
Alexandr Morozov
a0781f3ea9 Merge pull request #8509 from cpuguy83/make_copy_support_volumes
Make container.Copy support volumes
2014-10-20 17:34:30 -07:00
Brian Goff
ef98fe0763 Make container.Copy support volumes
Fixes #1992

Right now when you `docker cp` a path which is in a volume, the cp
itself works, however you end up getting files that are in the
container's fs rather than the files in the volume (which is not in the
container's fs).
This makes it so when you `docker cp` a path that is in a volume it
follows the volume to the real path on the host.

archive.go has been modified so that when you do `docker cp mydata:/foo
.`, and /foo is the volume, the outputed folder is called "foo" instead
of the volume ID (because we are telling it to tar up
`/var/lib/docker/vfs/dir/<some id>` and not "foo", but the user would be
expecting "foo", not the ID

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-10-20 20:23:01 -04:00
Gleb M Borisov
fdd2abe7b3 Use dual-stack Dialer when talking to registy
Signed-off-by: Gleb M. Borisov <borisov.gleb@gmail.com>
2014-10-21 03:59:11 +04:00
Brian Goff
964f9965c7 Clean volume paths
Fixes #8659

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-10-20 19:07:56 -04:00
Tibor Vass
af52f8edcf Merge pull request #8638 from LK4D4/fix_8632
Don't write pull output to stdout on container creating
2014-10-20 18:10:47 -04:00
Alexandr Morozov
52784c09b7 Merge pull request #8543 from brahmaroutu/filter_containers_7599
Adding capability to filter by name, id or status to list containers api
2014-10-20 15:04:24 -07:00
Michael Crosby
b90ab68f2a Merge pull request #8511 from coolljt0725/fix_tag
Fix tag an existed tag name of a repository
2014-10-20 14:32:23 -07:00
Michael Crosby
0c7d2ff2d4 Merge pull request #8559 from rhatdan/404
On Red Hat Registry Servers we return 404 on certification errors.
2014-10-20 14:13:34 -07:00
Tianon Gravi
551047a64e Merge pull request #8657 from vincentbernat/update/zsh-completion-2
zsh: update zsh completion for docker command
2014-10-20 14:48:00 -06:00
Srini Brahmaroutu
1634625353 Adding capability to filter by name, id or status to list containers api
Closes #7599

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-10-20 18:33:20 +00:00
Dan Walsh
69fe3e1a34 On Red Hat Registry Servers we return 404 on certification errors.
We do this to prevent leakage of information, we don't want people
to be able to probe for existing content.

According to RFC 2616, "This status code (404) is commonly used when the server does not
wish to reveal exactly why the request has been refused, or when no other response i
is applicable."

https://www.ietf.org/rfc/rfc2616.txt

10.4.4 403 Forbidden

   The server understood the request, but is refusing to fulfill it.
   Authorization will not help and the request SHOULD NOT be repeated.
   If the request method was not HEAD and the server wishes to make
   public why the request has not been fulfilled, it SHOULD describe the
   reason for the refusal in the entity.  If the server does not wish to
   make this information available to the client, the status code 404
   (Not Found) can be used instead.

10.4.5 404 Not Found

   The server has not found anything matching the Request-URI. No
   indication is given of whether the condition is temporary or
   permanent. The 410 (Gone) status code SHOULD be used if the server
   knows, through some internally configurable mechanism, that an old
   resource is permanently unavailable and has no forwarding address.
   This status code is commonly used when the server does not wish to
   reveal exactly why the request has been refused, or when no other
   response is applicable.

When docker is running through its certificates, it should continue
trying with a new certificate even if it gets back a 404 error code.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-10-20 13:20:48 -04:00
Vincent Bernat
ed7934fd63 zsh: update zsh completion for docker command
zsh completion is updated with the content of
felixr/docker-zsh-completion.

The major change since the last merge is the addition of
exec/create (but they were already present in the docker repository) as
well as pause/unpause/logout/events and the use of short/long options
when they are available. Some missing options were also added.

12f00abd7178 Add completion for `exec'
4e2faa075f9a Merge `run' and `create' commands.
34134de077de Add missing long/short options for most commands.
d09f62339ab5 Add completion for `pause' and `unpause'
e4754c3b3b9d Add completion for `logout'
e0935eb3d5d2 Add completion for `events'
dae353cb9afb Add completion for `create`

Docker-DCO-1.1-Signed-off-by: Vincent Bernat <vincent@bernat.im> (github: vincentbernat)
2014-10-20 15:33:17 +02:00
尹吉峰
3d10d50c6d small typo 2014-10-20 14:17:33 +08:00
James Turnbull
528c15afed Merge pull request #8622 from Coaxial/patch-1
Update dockerimages.md
2014-10-20 01:16:20 -04:00
James Turnbull
5160fbb447 Merge pull request #8649 from mavenugo/master
Fixed a minor docs issue in a Dockerfile Example
2014-10-20 01:14:54 -04:00
Lei Jitang
c496f24157 Add docker tag tests.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2014-10-20 11:10:31 +08:00
Madhu Venugopal
18141652ba Fixed a minor docs issue in a Dockerfile Example
The Dockerfile Instruction to create the .vnc directory results in a failure :
-storepasswd failed for file: /root/.vnc/passwd

Signed-off-by: Madhu Venugopal <madhu@socketplane.io>
2014-10-19 10:16:30 -07:00
Phil Estes
d2cd8e77a6 Clean up comment sections and fix typos in CmdRun
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-10-19 02:47:53 -04:00
Phil Estes
65edb07065 Return container exit code with start -a/-i
Addresses #8555

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2014-10-18 23:00:20 -04:00
Marc Tamsky
91502ba66b Add mention of e2fsprogs to runtime dependencies.
Signed-off-by: Marc Tamsky <mtamsky@gmail.com> (github: tamsky)
2014-10-17 16:58:07 -07:00
Jessica Frazelle
b7249317c1 check ID in os-release instead
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-17 16:51:36 -07:00
Amit Bakshi
dbe24a048b install.sh: Fix for Amazon's Linux AMI
Use /etc/os-release to determine distro

Contents of /etc/os-release on Amazon Linux AMI 2014.09:
NAME="Amazon Linux AMI"
VERSION="2014.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2014.09"
PRETTY_NAME="Amazon Linux AMI 2014.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2014.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

Signed-off-by: Amit Bakshi <ambakshi@gmail.com>
Signed-off-by: Jessica Frazelle <jess@docker.com>
2014-10-17 16:19:28 -07:00
Jessie Frazelle
005029cbdd Merge pull request #8483 from duglin/TabTest
Add a testcase to make sure we don't squash tabs or convert them to spaces
2014-10-17 16:03:22 -07:00
Doug Davis
c980fe09b7 Add a testcase to make sure we don't squash tabs or convert them to spaces
This is in response to @SvenDowideit asking if we had a "tab" testcase
in https://github.com/docker/docker/issues/2315#issuecomment-58133508
I couldn't find one so I'm adding one

Closes #2315

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-10-17 15:52:48 -07:00
Alexandr Morozov
75fd1b614d Merge pull request #8639 from erikh/fix_escapes
builder: fix escaping for ENV variables.
2014-10-17 15:50:37 -07:00
Erik Hollensbe
df0e0c7683 builder: fix escaping for ENV variables.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-17 21:47:35 +00:00
Jessie Frazelle
3c325f89e5 Merge pull request #8415 from LK4D4/use_logs_in_builder
Use logs instead of attach for builder
2014-10-17 13:32:13 -07:00
Alexandr Morozov
2db1caee4f Make daemon.Attach private
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 13:20:02 -07:00
Alexandr Morozov
6f09d064bd Use logs instead of attach for builder
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 13:20:02 -07:00
Jessie Frazelle
b357f76e5d Merge pull request #8565 from LK4D4/remove_fixtures_copy_tests
Remove fixtures copy tests
2014-10-17 13:10:30 -07:00
Tianon Gravi
fb5e6526d8 Merge pull request #8561 from albers/bash-completion
Fix support for --env-file in bash completion
2014-10-17 13:26:24 -06:00
Alexandr Morozov
93d3c8e71d Just remove integration-cli/build_tests/TestCopy/MultipleFilesToFile because it wasn't used
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:58:12 -07:00
Alexandr Morozov
98e7608b4c Rewrite TestBuildCopyDisallowRemote to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:58:12 -07:00
Alexandr Morozov
c8a5d56fd7 Rewrite TestBuildCopyEtcToRoot to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:57:48 -07:00
Alexandr Morozov
6582ea574c Rewrite TestBuildCopyWholeDirToRoot to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:57:30 -07:00
Alexandr Morozov
4a029259ff Rewrite TestBuildCopyDirContentToExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:57:07 -07:00
Alexandr Morozov
832618afc6 Rewrite TestBuildCopyDirContentToRoot to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:56:49 -07:00
Alexandr Morozov
24d83afd52 Rewrite TestBuildCopySingleFileToNonExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:56:28 -07:00
Alexandr Morozov
2248109ff8 Rewrite TestBuildCopySingleFileToExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:56:01 -07:00
Alexandr Morozov
d41cba6aed Rewrite TestBuildCopySingleFileToWorkdir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:55:34 -07:00
Alexandr Morozov
83c5dced10 Rewrite TestBuildCopySingleFileToRoot to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:55:04 -07:00
Alexandr Morozov
e45c92153d Rewrite TestBuildCopyAddMultipleFiles to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:54:29 -07:00
James Turnbull
04932e38af Merge pull request #8614 from ryanrdetzel/master
exec docs syntax fix
2014-10-17 14:38:43 -04:00
Jessie Frazelle
5a20dc67b0 Merge pull request #8567 from LK4D4/add_log_done
Add logDone for TestBuildAddSingleFileToNonExistDir
2014-10-17 11:20:12 -07:00
Jessie Frazelle
09ceae5c9c Merge pull request #8486 from duglin/Issue5701
Add failing testcase for single quotes in CMD
2014-10-17 11:11:49 -07:00
Alexandr Morozov
ad136e1ae3 Don't write pull output to stdout on container creating
Fixes #8632

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-17 11:08:53 -07:00
Tibor Vass
6ac9768eaf Merge pull request #8569 from jfrazelle/Cleanup-errorOut-resp
Cleanup: integration-cli (get rid of errorOut)
2014-10-17 13:36:00 -04:00
Alexandr Morozov
83761be409 Merge pull request #8635 from blakery/master
Cleanup: Removed unused function layerArchive
2014-10-17 10:28:22 -07:00
Michael Crosby
9b795108c7 Merge pull request #8621 from zhgwenming/lxc
Fix lxc driver build issue on Mac OS X
2014-10-17 09:17:25 -07:00
Tibor Vass
10f78974ca Merge pull request #8588 from dqminh/remove-sslv3
remove sslv3 from server's TLS supported versions
2014-10-17 12:05:48 -04:00
Blake Geno
7cff8db4a3 Removed unused function layerArchive
Signed-off-by: Blake Geno <blakegeno@gmail.com>
2014-10-17 10:49:21 -04:00
Pierre
4e8f69bfe0 Update dockerimages.md
The container ID in the text didn't match the container ID from the figure above it.
2014-10-16 22:16:29 -04:00
Albert Zhang
210db1234d Fix lxc driver build issue on Mac OS X
Docker-DCO-1.1-Signed-off-by: Albert Zhang <zhgwenming@gmail.com> (github: zhgwenming)
2014-10-17 09:41:23 +08:00
Fred Lifton
6ce4f82ebe Merge pull request #8531 from SvenDowideit/move-registry-search-to-registry-api
Move registry search API docs into the registry API document.
2014-10-16 18:27:37 -07:00
Sven Dowideit
57263ef0d6 Merge pull request #8591 from fredlf/1.3release-notes
Edits and additions to release notes.
2014-10-16 18:26:11 -07:00
Fred Lifton
d79defb747 Edits and additions to release notes.
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

Added link for CVEs.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

Fixed some URLs.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-16 18:16:52 -07:00
Fred Lifton
b61ad60675 Edits and additions to release notes.
Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)

Added link for CVEs.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-16 18:06:32 -07:00
Sven Dowideit
62cb97278d Merge pull request #8599 from irachex/commit_docs
Fix commit api document
2014-10-16 16:10:49 -07:00
Alexandr Morozov
cb106e74a1 Merge pull request #8238 from vbatts/vbatts-daemon_timestamps
daemon logging: unifying output and timestamps
2014-10-16 15:55:49 -07:00
Fred Lifton
2e35d7c905 Merge pull request #8544 from SvenDowideit/link-to-latest-b2d-installers
Link directly to the 'latest' release alias
2014-10-16 15:52:24 -07:00
Fred Lifton
69e3a55560 Merge pull request #8516 from jamtur01/sshd
Minor changes to SSHd example
2014-10-16 15:44:10 -07:00
Jessica Frazelle
5af7facf18 Cleanup errorOut remove errorOut functions
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
66ac7420a9 Cleanup errorOut resp run tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
842d4b6b0a Cleanup errorOut resp log tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
9f52d8e6e7 Cleanup errorOut resp restart tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
6f1c8ff4c4 Cleanup errorOut resp exec tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
eeb0097294 Cleanup errorOut resp pull tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
dd248dee3c Cleanup errorOut resp in images tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
50c3e7537c Cleanup errorOut resp in version tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
f013506aad Cleanup errorOut resp in push tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
764030ec92 Cleanup errorOut resp in top tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
b1e3c9e9cd Cleanup errorOut resp in build tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
0c87424007 Cleanup errorOut resp in save tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
0e3744ec89 Cleanup errorOut resp in rmi tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Jessica Frazelle
ac24cabd9d Cleanup errorOut resp in inspect tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:19 -07:00
Jessica Frazelle
d33f2bdb11 Cleanup errorOut resp in ps tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:19 -07:00
Jessica Frazelle
ef787eb824 Cleanup errorOut resp in search tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:19 -07:00
Jessica Frazelle
73eadbc6a1 Cleanup errorOut resp in docker_utils.go
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:16 -07:00
Jessica Frazelle
ac62c5439a Cleanup errorOut resp in diff test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
7d38ae7041 Cleanup errorOut resp in links test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
f7b3a6b292 Cleanup errorOut resp in history test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
b59d5a9dd2 Cleanup errorOut resp in info test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
0faf87598f Cleanup errorOut resp in kill test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
17842840ec Cleanup errorOut resp in nat test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
6b858b59ed Cleanup errorOut resp in create test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
475235ba7e Cleanup errorOut resp in tag test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
b645df1d39 Cleanup errorOut resp in export test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
88d65cbdf4 Cleanup errorOut resp in port test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Jessica Frazelle
3182ee5c9b Cleanup errorOut resp in commit test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Cleanup errorOut resp in commit test

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:05:00 -07:00
Doug Davis
9edf967824 Add failing testcase for single quotes in CMD
Closes #5701

This is due to @SvenDowideit comment at: https://github.com/docker/docker/issues/5701#issuecomment-58133541
where he asked for a testcase showing the error case.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-10-16 14:40:55 -07:00
Phil Estes
d8cd8165a9 Migrate container GET API tests from integration to integration-cli
An initial start to migration of the API tests from integration to
the integration-cli model.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
(github: estesp)
2014-10-16 17:34:28 -04:00
Michael Crosby
2f9ffe5b6a Merge pull request #8232 from vbatts/vbatts-devmapper_getDeps
devmapper: include dm_deps information in debug
2014-10-16 14:13:21 -07:00
Michael Crosby
0e67cf0627 Merge pull request #8380 from cpuguy83/moar_names
Add more names
2014-10-16 14:04:15 -07:00
Michael Crosby
4b594721c4 Merge pull request #8465 from SvenDowideit/document-device-flag-permission-options
Add info on --device flag permissions ':rwm'
2014-10-16 14:00:09 -07:00
Michael Crosby
f0eb1ef4e1 Merge pull request #8526 from vbatts/vbatts-too_many_open_files
client: even cleaner use of Transport
2014-10-16 13:53:31 -07:00
Michael Crosby
b3cda9fc7e Merge pull request #8566 from jfrazelle/Cleanup-fmt-%q
Cleanup: integration-cli ('%s' with %q)
2014-10-16 13:51:46 -07:00
Victor Vieux
1183abc4aa Merge pull request #8549 from vieux/pkg_units
add BytesSize in pkg/units
2014-10-16 13:44:50 -07:00
Michael Crosby
d1aca045b3 Merge pull request #8612 from jfrazelle/8611-ip-masq-iptables
Setting iptables=false should propagate to ip-masq=false
2014-10-16 13:35:37 -07:00
Ryan Detzel
b8b9930a8a Docs syntax fix
the flags must come before the container name.
2014-10-16 15:57:38 -04:00
Michael Crosby
40a6461d16 Merge pull request #8606 from tianon/release-home
Fix more missing HOME references
2014-10-16 12:12:38 -07:00
Michael Crosby
c3237cc9d8 Merge pull request #8608 from crosbymichael/merge_release_v1.3.0
Merge release v1.3.0
2014-10-16 12:12:21 -07:00
James Turnbull
3d0d2fd183 Merge pull request #8609 from gesellix/patch-2
fix minor docs error
2014-10-16 15:06:00 -04:00
Jessica Frazelle
3893e220e8 Setting iptables=false should propagate to ip-masq=false
Signed-off-by: Jessica Frazelle <jess@docker.com>
2014-10-16 11:52:14 -07:00
Tobias Gesellchen
143f438e6e fix minor docs error
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2014-10-16 19:36:36 +02:00
Michael Crosby
db21b556ce Change version to 1.3.0-dev
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-16 17:22:42 +00:00
Michael Crosby
30806ebc0f Merge branch 'release' into merge_release_v1.3.0 2014-10-16 17:22:27 +00:00
Tianon Gravi
d040de6dd4 Fix more missing HOME references
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-10-16 10:14:26 -06:00
Huayi Zhang
f6140060e3 Fix commit api document
The commit message field should be `comment`, not `m`
https://github.com/docker/docker/blob/master/api/server/server.go#L478

Signed-off-by: Huayi Zhang <irachex@gmail.com>
2014-10-16 18:10:58 +08:00
Sven Dowideit
2eb9c0bfd4 Merge pull request #8595 from fredlf/signed-image-doco
Expanded release notes
2014-10-15 23:20:14 -07:00
Daniel, Dao Quang Minh
7a062b2b8f Avoid fallback to SSL protocols < TLS1.0
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-10-15 22:39:51 -04:00
Fred Lifton
74d0485885 Expanded release notes
Made it clear signed images is a preview feature and added a little more info about how the feature works.

Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredlf)
2014-10-15 16:08:07 -07:00
Alexandr Morozov
fcfe80f633 Minor fix of tests names
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-14 11:47:01 -07:00
Alexandr Morozov
fbaa41b5aa Add logDone for TestBuildAddSingleFileToNonExistDir
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-14 11:17:41 -07:00
Jessica Frazelle
949ab47710 Replace '%s' in test utils
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-14 10:59:38 -07:00
Jessica Frazelle
c091397d51 Replace '%s' in run tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-14 10:59:19 -07:00
Jessica Frazelle
be31a66b7a Replace '%s' in rm tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-14 10:59:11 -07:00
Jessica Frazelle
a44296603f Replace '%s' in diff tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-14 10:59:01 -07:00
Jessica Frazelle
91f33fcaaa Replace '%s' in create tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-14 10:58:35 -07:00
Harald Albers
ba311ee58a Fix support for --env-file in bash completion
Signed-off-by: Harald Albers <github@albersweb.de>
2014-10-14 17:45:29 +02:00
Victor Vieux
ae4689f14d add BytesSize in pkg/units
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-14 03:54:32 +00:00
Sven Dowideit
6b285c4cd6 Move registry search API docs into the registry API document.
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-14 11:53:10 +10:00
Sven Dowideit
380fe94614 Link directly to the 'latest' release alias
Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
2014-10-14 09:20:55 +10:00
Sven Dowideit
2709c4677c Add info on --device flag permissions ':rwm'
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
2014-10-13 17:41:12 +10:00
Vincent Batts
da42ae536c client: even cleaner use of Transport
First off, sorry for the noise. This is a cleaner step of #8508

Found more of a root cause of the open file handles.
After more testing I found that the open file descriptors will still
occur for TCP:// connections to the daemon, causing client and/or daemon
to fail.

The issue was instantiating a new http.Transport on _ever_ client
request. So each instance held the prior connection alive, but was only
ever used once.

By moving it out to the initilization of DockerCli, we can now have
reuse of idled connections. Simplifies the garbage overhead of the
client too, though that's not usually a deal.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-12 22:32:55 -04:00
James Turnbull
f1c319f77c Minor changes to SSHd example
Docker-DCO-1.1-Signed-off-by: James Turnbull <james@lovedthanlost.net> (github: jamtur01)
2014-10-11 16:30:36 -04:00
Lei Jitang
5e6f16e342 Fix the bug of tag a existed tag name of a repository.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2014-10-10 09:18:12 +08:00
unclejack
9e45069e0a pkg/graphdb: some linting
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:57:27 +03:00
unclejack
ae3b59c171 registry: lint
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:34:39 +03:00
unclejack
d1a85078b5 pkg/timeutils: lint and add comments
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:27:56 +03:00
unclejack
d202ff2ece pkg/units: lint
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:19:41 +03:00
unclejack
39fe2a3e4e pkg/truncindex: lint and add comments
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:00:58 +03:00
Erik Hollensbe
115436e038 docker save: Do not save to a terminal.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-06 09:50:40 -07:00
unclejack
d29c7e51cf pkg/version: lint and add comments 2014-10-06 18:41:53 +03:00
Dan Griffin
e857716d2d Preserve extended attributes and acls on archlinux build
Failure to do this means that file capabilites are not preserved in the image.
Ping fails to work as a non-root user if cap_net_raw is capability is not set

Signed-off-by: Dan Griffin <dgriffin@peer1.com>
2014-10-06 09:58:33 +01:00
Brian Goff
ed55a2db06 Add more names
Docker-DCO-1.1-Signed-off-by: Brian Goff <bgoff@cpuguy83-mbp.home> (github: cpuguy83)
2014-10-03 10:17:42 -04:00
Malte Janduda
f5f4d2d9cb Implementing IPv6 functionality for ipallocator
Closes #6975

Signed-off-by: Malte Janduda <mail@janduda.net>
2014-10-02 00:25:02 +02:00
Jessica Frazelle
6c60e8c784 Adding self to various maintainers files.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-09-29 15:43:07 -07:00
Vincent Batts
92df943fbf daemon logging: unifying output and timestamps
A little refactor of the ./pkg/log so engine can have a logger instance

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-09-26 14:44:46 -04:00
Vincent Batts
8e7aa44f0e devmapper: include dm_deps information in debug
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-09-25 10:59:23 -04:00
mschurenko
56fa079906 add --releasever=/ to mkimage-yum.sh
I didn't realize the commit required a Docker-DCO so it failed the travis-ci build. So I removed the commit from my forked repo. Now it looks like there is a pull request with no commit. So here it is again:

Needed to add '--releasever=/' flag to run yum groupinstall on Centos7 (didn't try on anything else). This snippet from yum man page explains why:

```
Note: You may also want to use the option --releasever=/ when creating the installroot as otherwise the $releasever value is taken from the rpmdb within the installroot (and thus.  will  be  empty,  before  creation).
```

Docker-DCO-1.1-Signed-off-by: Matt Schurenko <matt.schurenko@gmail.com> (github: mschurenko)
2014-07-12 12:15:42 -07:00
567 changed files with 20914 additions and 5447 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
.vagrant*
bin
docker/docker
*.exe
.*.swp
a.out
*.orig

View File

@@ -1,8 +1,10 @@
# Generate AUTHORS: hack/generate-authors.sh
# Generate AUTHORS: project/generate-authors.sh
# Tip for finding duplicates (besides scanning the output of AUTHORS for name
# duplicates that aren't also email duplicates): scan the output of:
# git log --format='%aE - %aN' | sort -uf
#
# For explanation on this file format: man git-shortlog
<charles.hooper@dotcloud.com> <chooper@plumata.com>
<daniel.mizyrycki@dotcloud.com> <daniel@dotcloud.com>
@@ -29,6 +31,7 @@ Andy Smith <github@anarkystic.com>
<victor.vieux@docker.com> <dev@vvieux.com>
<victor.vieux@docker.com> <victor@docker.com>
<victor.vieux@docker.com> <vieux@docker.com>
<victor.vieux@docker.com> <victorvieux@gmail.com>
<dominik@honnef.co> <dominikh@fork-bomb.org>
<ehanchrow@ine.com> <eric.hanchrow@gmail.com>
Walter Stanish <walter@pratyeka.org>
@@ -54,6 +57,7 @@ Jean-Baptiste Dalido <jeanbaptiste@appgratis.com>
<proppy@google.com> <proppy@aminche.com>
<michael@docker.com> <michael@crosbymichael.com>
<michael@docker.com> <crosby.michael@gmail.com>
<michael@docker.com> <crosbymichael@gmail.com>
<github@developersupport.net> <github@metaliveblog.com>
<brandon@ifup.org> <brandon@ifup.co>
<dano@spotify.com> <daniel.norberg@gmail.com>
@@ -63,10 +67,13 @@ Jean-Baptiste Dalido <jeanbaptiste@appgratis.com>
<sjoerd-github@linuxonly.nl> <sjoerd@byte.nl>
<solomon@docker.com> <solomon.hykes@dotcloud.com>
<solomon@docker.com> <solomon@dotcloud.com>
<solomon@docker.com> <s@docker.com>
Sven Dowideit <SvenDowideit@home.org.au>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@fosiki.com>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@docker.com>
Sven Dowideit <SvenDowideit@home.org.au> <¨SvenDowideit@home.org.au¨>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@users.noreply.github.com>
Sven Dowideit <SvenDowideit@home.org.au> <sven@t440s.home.gateway>
unclejack <unclejacksons@gmail.com> <unclejack@users.noreply.github.com>
<alexl@redhat.com> <alexander.larsson@gmail.com>
Alexandr Morozov <lk4d4math@gmail.com>
@@ -97,3 +104,24 @@ Matthew Heon <mheon@redhat.com> <mheon@mheonlaptop.redhat.com>
<andrew.weiss@outlook.com> <andrew.weiss@microsoft.com>
Francisco Carriedo <fcarriedo@gmail.com>
<julienbordellier@gmail.com> <git@julienbordellier.com>
<ahmetb@microsoft.com> <ahmetalpbalkan@gmail.com>
<lk4d4@docker.com> <lk4d4math@gmail.com>
<arnaud.porterie@docker.com> <icecrime@gmail.com>
<baloo@gandi.net> <superbaloo+registrations.github@superbaloo.net>
Brian Goff <cpuguy83@gmail.com>
<cpuguy83@gmail.com> <bgoff@cpuguy83-mbp.home>
<ewindisch@docker.com> <eric@windisch.us>
<frank.rosquin+github@gmail.com> <frank.rosquin@gmail.com>
Hollie Teal <hollie@docker.com>
<hollie@docker.com> <hollie.teal@docker.com>
<hollie@docker.com> <hollietealok@users.noreply.github.com>
<huu@prismskylabs.com> <whoshuu@gmail.com>
Jessica Frazelle <jess@docker.com> Jessie Frazelle <jfrazelle@users.noreply.github.com>
<jess@docker.com> <jfrazelle@users.noreply.github.com>
<konrad.wilhelm.kleine@gmail.com> <kwk@users.noreply.github.com>
<tintypemolly@gmail.com> <tintypemolly@Ohui-MacBook-Pro.local>
<estesp@linux.vnet.ibm.com> <estesp@gmail.com>
<github@gone.nl> <thaJeztah@users.noreply.github.com>
Thomas LEVEIL <thomasleveil@gmail.com> Thomas LÉVEIL <thomasleveil@users.noreply.github.com>
<oi@truffles.me.uk> <timruffles@googlemail.com>
<Vincent.Bernat@exoscale.ch> <bernat@luffy.cx>

View File

@@ -1,39 +0,0 @@
# Note: right now we don't use go-specific features of travis.
# Later we might automate "go test" etc. (or do it inside a docker container...?)
language: go
go:
# This should match the version in the Dockerfile.
- 1.3.1
# Test against older versions too, just for a little extra retrocompat.
- 1.2
# Let us have pretty experimental Docker-based Travis workers.
# (These spin up much faster than the VM-based ones.)
sudo: false
# Disable the normal go build.
install:
- export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper' # btrfs and devicemapper fail to compile thanks to a couple missing headers (which we can't install thanks to "sudo: false")
- export AUTO_GOPATH=1
# some of Docker's unit tests don't work inside Travis (yet!), so we purge those test files for now
- rm -f daemon/graphdriver/btrfs/*_test.go # fails to compile (missing header)
- rm -f daemon/graphdriver/devmapper/*_test.go # fails to compile (missing header)
- rm -f daemon/execdriver/lxc/*_test.go # fails to run (missing "lxc-start")
- rm -f daemon/graphdriver/aufs/*_test.go # fails to run ("backing file system is unsupported for this graph driver")
- rm -f daemon/graphdriver/vfs/*_test.go # fails to run (not root, which these tests assume "/var/tmp/... no owned by uid 0")
- rm -f daemon/networkdriver/bridge/*_test.go # fails to run ("Failed to initialize network driver")
- rm -f graph/*_test.go # fails to run ("mkdir /tmp/docker-test.../vfs/dir/foo/etc/postgres: permission denied")
- rm -f pkg/mount/*_test.go # fails to run ("permission denied")
before_script:
- env | sort
script:
- hack/make.sh validate-dco
- hack/make.sh validate-gofmt
- DOCKER_CLIENTONLY=1 ./hack/make.sh dynbinary
- ./hack/make.sh dynbinary dyntest-unit
# vim:set sw=2 ts=2:

239
AUTHORS
View File

@@ -1,69 +1,87 @@
# This file lists all individuals having contributed content to the repository.
# For how it is generated, see `hack/generate-authors.sh`.
# For how it is generated, see `project/generate-authors.sh`.
Aanand Prasad <aanand.prasad@gmail.com>
Aaron Feng <aaron.feng@gmail.com>
Aaron Huslage <huslage@gmail.com>
Abel Muiño <amuino@gmail.com>
Abhinav Ajgaonkar <abhinav316@gmail.com>
Abin Shahab <ashahab@altiscale.com>
Adam Miller <admiller@redhat.com>
Adam Singer <financeCoding@gmail.com>
Aditya <aditya@netroy.in>
Adrian Mouat <adrian.mouat@gmail.com>
Adrien Folie <folie.adrien@gmail.com>
Ahmet Alp Balkan <ahmetb@microsoft.com>
AJ Bowen <aj@gandi.net>
Al Tobey <al@ooyala.com>
alambike <alambike@gmail.com>
Alan Thompson <cloojure@gmail.com>
Albert Callarisa <shark234@gmail.com>
Albert Zhang <zhgwenming@gmail.com>
Aleksa Sarai <cyphar@cyphar.com>
Alex Gaynor <alex.gaynor@gmail.com>
Alex Warhawk <ax.warhawk@gmail.com>
Alexander Larsson <alexl@redhat.com>
Alexander Shopov <ash@kambanaria.org>
Alexandr Morozov <lk4d4math@gmail.com>
Alexandr Morozov <lk4d4@docker.com>
Alexey Kotlyarov <alexey@infoxchange.net.au>
Alexey Shamrin <shamrin@gmail.com>
Alex Gaynor <alex.gaynor@gmail.com>
Alexis THOMAS <fr.alexisthomas@gmail.com>
Alex Warhawk <ax.warhawk@gmail.com>
almoehi <almoehi@users.noreply.github.com>
Al Tobey <al@ooyala.com>
Álvaro Lázaro <alvaro.lazaro.g@gmail.com>
amangoel <amangoel@gmail.com>
Amit Bakshi <ambakshi@gmail.com>
AnandkumarPatel <anandkumarpatel@gmail.com>
Andre Dublin <81dublin@gmail.com>
Anand Patil <anand.prabhakar.patil@gmail.com>
Andrea Luzzardi <aluzzardi@gmail.com>
Andrea Turli <andrea.turli@gmail.com>
Andreas Köhler <andi5.py@gmx.net>
Andreas Savvides <andreas@editd.com>
Andreas Tiefenthaler <at@an-ti.eu>
Andrea Turli <andrea.turli@gmail.com>
Andre Dublin <81dublin@gmail.com>
Andrew Duckworth <grillopress@gmail.com>
Andrew France <andrew@avito.co.uk>
Andrew Macgregor <andrew.macgregor@agworld.com.au>
Andrew Munsell <andrew@wizardapps.net>
Andrews Medina <andrewsmedina@gmail.com>
Andrew Weiss <andrew.weiss@outlook.com>
Andrew Williams <williams.andrew@gmail.com>
Andrews Medina <andrewsmedina@gmail.com>
Andrey Petrov <andrey.petrov@shazow.net>
Andrey Stolbovsky <andrey.stolbovsky@gmail.com>
Andy Chambers <anchambers@paypal.com>
andy diller <dillera@gmail.com>
Andy Goldstein <agoldste@redhat.com>
Andy Kipp <andy@rstudio.com>
Andy Rothfusz <github@developersupport.net>
Andy Smith <github@anarkystic.com>
Andy Wilson <wilson.andrew.j+github@gmail.com>
Anthony Bishopric <git@anthonybishopric.com>
Anton Löfgren <anton.lofgren@gmail.com>
Anton Nikitin <anton.k.nikitin@gmail.com>
Antony Messerli <amesserl@rackspace.com>
apocas <petermdias@gmail.com>
Arnaud Porterie <icecrime@gmail.com>
ArikaChen <eaglesora@gmail.com>
Arnaud Porterie <arnaud.porterie@docker.com>
Arthur Gautier <baloo@gandi.net>
Asbjørn Enge <asbjorn@hanafjedle.net>
averagehuman <averagehuman@users.noreply.github.com>
Avi Miller <avi.miller@oracle.com>
Barnaby Gray <barnaby@pickle.me.uk>
Barry Allard <barry.allard@gmail.com>
Bartłomiej Piotrowski <b@bpiotrowski.pl>
bdevloed <boris.de.vloed@gmail.com>
Ben Firshman <ben@firshman.co.uk>
Benjamin Atkin <ben@benatkin.com>
Benoit Chesneau <bchesneau@gmail.com>
Ben Sargent <ben@brokendigits.com>
Ben Toews <mastahyeti@gmail.com>
Ben Wiklund <ben@daisyowl.com>
Benjamin Atkin <ben@benatkin.com>
Benoit Chesneau <bchesneau@gmail.com>
Bernerd Schaefer <bj.schaefer@gmail.com>
Bert Goethals <bert@bertg.be>
Bhiraj Butala <abhiraj.butala@gmail.com>
bin liu <liubin0329@users.noreply.github.com>
Blake Geno <blakegeno@gmail.com>
Bouke Haarsma <bouke@webatoom.nl>
Boyd Hemphill <boyd@feedmagnet.com>
Brandon Liu <bdon@bdon.org>
@@ -80,10 +98,13 @@ Brian Shumate <brian@couchbase.com>
Brice Jaglin <bjaglin@teads.tv>
Briehan Lombaard <briehan.lombaard@gmail.com>
Bruno Bigras <bigras.bruno@gmail.com>
Bruno Binet <bruno.binet@gmail.com>
Bruno Renié <brutasse@gmail.com>
Bryan Bess <squarejaw@bsbess.com>
Bryan Matsuo <bryan.matsuo@gmail.com>
Bryan Murphy <bmurphy1976@gmail.com>
Burke Libbey <burke@libbey.me>
Byung Kang <byung.kang.ctr@amrdec.army.mil>
Caleb Spare <cespare@gmail.com>
Calen Pennington <cale@edx.org>
Cameron Boehmer <cameron.boehmer@gmail.com>
@@ -95,56 +116,68 @@ Charlie Lewis <charliel@lab41.org>
Chewey <prosto-chewey@users.noreply.github.com>
Chia-liang Kao <clkao@clkao.org>
Chris Alfonso <calfonso@redhat.com>
Chris Armstrong <chris@opdemand.com>
chrismckinnel <chris.mckinnel@tangentlabs.co.uk>
Chris Snow <chsnow123@gmail.com>
Chris St. Pierre <chris.a.st.pierre@gmail.com>
chrismckinnel <chris.mckinnel@tangentlabs.co.uk>
Christian Berendt <berendt@b1-systems.de>
ChristoperBiscardi <biscarch@sketcht.com>
Christophe Troestler <christophe.Troestler@umons.ac.be>
Christopher Currie <codemonkey+github@gmail.com>
Christopher Rigor <crigor@gmail.com>
Christophe Troestler <christophe.Troestler@umons.ac.be>
Ciro S. Costa <ciro.costa@usp.br>
Clayton Coleman <ccoleman@redhat.com>
Colin Dunklau <colin.dunklau@gmail.com>
Colin Rice <colin@daedrum.net>
Colin Walters <walters@verbum.org>
Cory Forsyth <cory.forsyth@gmail.com>
cpuguy83 <cpuguy83@gmail.com>
cressie176 <github@stephen-cresswell.net>
Cruceru Calin-Cristian <crucerucalincristian@gmail.com>
Daan van Berkel <daan.v.berkel.1980@gmail.com>
Daehyeok.Mun <daehyeok@gmail.com>
Dafydd Crosby <dtcrsby@gmail.com>
Dan Buch <d.buch@modcloth.com>
Dan Cotora <dan@bluevision.ro>
Dan Griffin <dgriffin@peer1.com>
Dan Hirsch <thequux@upstandinghackers.com>
Dan Keder <dan.keder@gmail.com>
Dan McPherson <dmcphers@redhat.com>
Dan Stine <sw@stinemail.com>
Dan Walsh <dwalsh@redhat.com>
Dan Williams <me@deedubs.com>
Daniel, Dao Quang Minh <dqminh89@gmail.com>
Daniel Exner <dex@dragonslave.de>
Daniel Farrell <dfarrell@redhat.com>
Daniel Garcia <daniel@danielgarcia.info>
Daniel Gasienica <daniel@gasienica.ch>
Daniel Menet <membership@sontags.ch>
Daniel Mizyrycki <daniel.mizyrycki@dotcloud.com>
Daniel Norberg <dano@spotify.com>
Daniel Nordberg <dnordberg@gmail.com>
Daniel Robinson <gottagetmac@gmail.com>
Daniel Von Fange <daniel@leancoder.com>
Daniel YC Lin <dlin.tw@gmail.com>
Daniel, Dao Quang Minh <dqminh89@gmail.com>
Dan Keder <dan.keder@gmail.com>
Dan McPherson <dmcphers@redhat.com>
Danny Berger <dpb587@gmail.com>
Danny Yates <danny@codeaholics.org>
Dan Stine <sw@stinemail.com>
Dan Walsh <dwalsh@redhat.com>
Dan Williams <me@deedubs.com>
Darren Coxall <darren@darrencoxall.com>
Darren Shepherd <darren.s.shepherd@gmail.com>
David Anderson <dave@natulte.net>
David Calavera <david.calavera@gmail.com>
David Corking <dmc-source@dcorking.com>
Davide Ceretti <davide.ceretti@hogarthww.com>
David Gageot <david@gageot.net>
David Gebler <davidgebler@gmail.com>
David Mcanulty <github@hellspark.com>
David Pelaez <pelaez89@gmail.com>
David Röthlisberger <david@rothlis.net>
David Sissitka <me@dsissitka.com>
Dawn Chen <dawnchen@google.com>
decadent <decadent@users.noreply.github.com>
Deni Bertovic <deni@kset.org>
Derek <crq@kernel.org>
Derek McGowan <derek@mcgstyle.net>
Deric Crago <deric.crago@gmail.com>
Deshi Xiao <dxiao@redhat.com>
Dinesh Subhraveti <dineshs@altiscale.com>
Djibril Koné <kone.djibril@gmail.com>
dkumor <daniel@dkumor.com>
@@ -154,11 +187,13 @@ Dominik Honnef <dominik@honnef.co>
Don Spaulding <donspauldingii@gmail.com>
Doug Davis <dug@us.ibm.com>
doug tangren <d.tangren@gmail.com>
Dr Nic Williams <drnicwilliams@gmail.com>
dragon788 <dragon788@users.noreply.github.com>
Dražen Lučanin <kermit666@gmail.com>
Dr Nic Williams <drnicwilliams@gmail.com>
Dustin Sallings <dustin@spy.net>
Edmund Wagner <edmund-wagner@web.de>
Eiichi Tsukata <devel@etsukata.com>
Eike Herzbach <eike@herzbach.net>
Eivind Uggedal <eivind@uggedal.com>
Elias Probst <mail@eliasprobst.eu>
Emil Hernvall <emil@quench.at>
@@ -166,17 +201,19 @@ Emily Rose <emily@contactvibe.com>
Eric Hanchrow <ehanchrow@ine.com>
Eric Lee <thenorthsecedes@gmail.com>
Eric Myhre <hash@exultant.us>
Eric Windisch <eric@windisch.us>
Eric Paris <eparis@redhat.com>
Eric Windisch <ewindisch@docker.com>
Erik Hollensbe <github@hollensbe.org>
Erik Inge Bolsø <knan@redpill-linpro.com>
Erik Kristensen <erik@erikkristensen.com>
Erno Hopearuoho <erno.hopearuoho@gmail.com>
Eugene Yakubovich <eugene.yakubovich@coreos.com>
eugenkrizo <eugen.krizo@gmail.com>
evanderkoogh <info@erronis.nl>
Evan Hazlett <ejhazlett@gmail.com>
Evan Krall <krall@yelp.com>
Evan Phoenix <evan@fallingsnow.net>
Evan Wies <evan@neomantra.net>
evanderkoogh <info@erronis.nl>
Eystein Måløy Stenberg <eystein.maloy.stenberg@cfengine.com>
ezbercih <cem.ezberci@gmail.com>
Fabio Falci <fabiofalci@gmail.com>
@@ -186,49 +223,60 @@ Faiz Khan <faizkhan00@gmail.com>
Fareed Dudhia <fareeddudhia@googlemail.com>
Felix Rabe <felix@rabe.io>
Fernando <fermayo@gmail.com>
Filipe Brandenburger <filbranden@google.com>
Flavio Castelli <fcastelli@suse.com>
FLGMwt <ryan.stelly@live.com>
Francisco Carriedo <fcarriedo@gmail.com>
Francisco Souza <f@souza.cc>
Frank Macreery <frank@macreery.com>
Fred Lifton <fred.lifton@docker.com>
Frank Rosquin <frank.rosquin+github@gmail.com>
Frederick F. Kautz IV <fkautz@alumni.cmu.edu>
Frederik Loeffert <frederik@zitrusmedia.de>
Fred Lifton <fred.lifton@docker.com>
Freek Kalter <freek@kalteronline.org>
Gabe Rosenhouse <gabe@missionst.com>
Gabor Nagy <mail@aigeruth.hu>
Gabriel Monroy <gabriel@opdemand.com>
Galen Sampson <galen.sampson@gmail.com>
Gareth Rushgrove <gareth@morethanseven.net>
gautam, prasanna <prasannagautam@gmail.com>
Geoffrey Bachelet <grosfrais@gmail.com>
George Xie <georgexsh@gmail.com>
Gereon Frey <gereon.frey@dynport.de>
German DZ <germ@ndz.com.ar>
Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl>
Giuseppe Mazzotta <gdm85@users.noreply.github.com>
Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Gleb M Borisov <borisov.gleb@gmail.com>
Glyn Normington <gnormington@gopivotal.com>
Goffert van Gool <goffert@phusion.nl>
golubbe <ben.golub@dotcloud.com>
Graydon Hoare <graydon@pobox.com>
Greg Thornton <xdissent@me.com>
grunny <mwgrunny@gmail.com>
Guilherme Salgado <gsalgado@gmail.com>
Guillaume Dufour <gdufour.prestataire@voyages-sncf.com>
Guillaume J. Charmes <guillaume.charmes@docker.com>
Gurjeet Singh <gurjeet@singh.im>
Guruprasad <lgp171188@gmail.com>
Hans Rødtang <hansrodtang@gmail.com>
Harald Albers <github@albersweb.de>
Harley Laue <losinggeneration@gmail.com>
Hector Castro <hectcastro@gmail.com>
Henning Sprang <henning.sprang@gmail.com>
Hobofan <goisser94@gmail.com>
Hollie Teal <hollie.teal@docker.com>
Hollie Teal <hollietealok@users.noreply.github.com>
hollietealok <hollie@docker.com>
Hollie Teal <hollie@docker.com>
Huayi Zhang <irachex@gmail.com>
Hugo Duncan <hugo@hugoduncan.org>
Hunter Blanks <hunter@twilio.com>
Hu Tao <hutao@cn.fujitsu.com>
Huu Nguyen <huu@prismskylabs.com>
hyeongkyu.lee <hyeongkyu.lee@navercorp.com>
Ian Babrou <ibobrik@gmail.com>
Ian Bull <irbull@gmail.com>
Ian Main <imain@redhat.com>
Ian Truslove <ian.truslove@gmail.com>
Igor Dolzhikov <bluesriverz@gmail.com>
ILYA Khlopotov <ilya.khlopotov@gmail.com>
inglesp <peter.inglesby@gmail.com>
Isaac Dupree <antispam@idupree.com>
@@ -236,8 +284,8 @@ Isabel Jimenez <contact.isabeljimenez@gmail.com>
Isao Jonas <isao.jonas@gmail.com>
Ivan Fraixedes <ifcdev@gmail.com>
Jack Danger Canty <jackdanger@squareup.com>
Jake Moshenko <jake@devtable.com>
jakedt <jake@devtable.com>
Jake Moshenko <jake@devtable.com>
James Allen <jamesallen0108@gmail.com>
James Carr <james.r.carr@gmail.com>
James DeFelice <james.defelice@ishisystems.com>
@@ -245,6 +293,7 @@ James Harrison Fisher <jameshfisher@gmail.com>
James Kyle <james@jameskyle.org>
James Mills <prologic@shortcircuit.net.au>
James Turnbull <james@lovedthanlost.net>
Jan Keromnes <janx@linux.com>
Jan Pazdziora <jpazdziora@redhat.com>
Jan Toebes <jan@toebes.info>
Jaroslaw Zabiello <hipertracker@gmail.com>
@@ -256,31 +305,35 @@ Jason McVetta <jason.mcvetta@gmail.com>
Jason Plum <jplum@devonit.com>
Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Jean-Baptiste Dalido <jeanbaptiste@appgratis.com>
Jean-Paul Calderone <exarkun@twistedmatrix.com>
Jeff Lindsay <progrium@gmail.com>
Jeff Welch <whatthejeff@gmail.com>
Jeffrey Bolle <jeffreybolle@gmail.com>
Jeff Welch <whatthejeff@gmail.com>
Jeremy Grosser <jeremy@synack.me>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com>
Jesse Dubay <jesse@thefortytwo.net>
Jessica Frazelle <jess@docker.com>
Jezeniel Zapanta <jpzapanta22@gmail.com>
Jilles Oldenbeuving <ojilles@gmail.com>
Jim Alateras <jima@comware.com.au>
Jim Perrin <jperrin@centos.org>
Jimmy Cuadra <jimmy@jimmycuadra.com>
Jim Perrin <jperrin@centos.org>
Jiří Župka <jzupka@redhat.com>
Joe Beda <joe.github@bedafamily.com>
Joe Ferguson <joe@infosiftr.com>
Joel Handwell <joelhandwell@gmail.com>
Joe Shaw <joe@joeshaw.org>
Joe Van Dyk <joe@tanga.com>
Joel Handwell <joelhandwell@gmail.com>
Joffrey F <joffrey@docker.com>
Johan Euphrosine <proppy@google.com>
Johan Rydberg <johan.rydberg@gmail.com>
Johannes 'fish' Ziemke <github@freigeist.org>
Johan Rydberg <johan.rydberg@gmail.com>
John Costa <john.costa@gmail.com>
John Feminella <jxf@jxf.me>
John Gardiner Myers <jgmyers@proofpoint.com>
John Gossman <johngos@microsoft.com>
John OBrien III <jobrieniii@yahoo.com>
John Warwick <jwarwick@gmail.com>
Jon Wedaman <jweede@gmail.com>
Jonas Pfenniger <jonas@pfenniger.name>
Jonathan Boulle <jonathanboulle@gmail.com>
Jonathan Camp <jonathan@irondojo.com>
@@ -288,22 +341,25 @@ Jonathan McCrohan <jmccrohan@gmail.com>
Jonathan Mueller <j.mueller@apoveda.ch>
Jonathan Pares <jonathanpa@users.noreply.github.com>
Jonathan Rudenberg <jonathan@titanous.com>
Jon Wedaman <jweede@gmail.com>
Joost Cassee <joost@cassee.net>
Jordan Arentsen <blissdev@gmail.com>
Jordan Sissel <jls@semicomplete.com>
Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
Joseph Hager <ajhager@gmail.com>
Josh <jokajak@gmail.com>
Josh Hawn <josh.hawn@docker.com>
Josh <jokajak@gmail.com>
Josh Poimboeuf <jpoimboe@redhat.com>
Josiah Kiehl <jkiehl@riotgames.com>
JP <jpellerin@leapfrogonline.com>
Julian Taylor <jtaylor.debian@googlemail.com>
Julien Barbier <write0@gmail.com>
Julien Bordellier <julienbordellier@gmail.com>
Julien Dubois <julien.dubois@gmail.com>
Justin Force <justin.force@gmail.com>
Justin Plock <jplock@users.noreply.github.com>
Justin Simonelis <justin.p.simonelis@gmail.com>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com>
Jyrki Puttonen <jyrkiput@gmail.com>
Karan Lyons <karan@karanlyons.com>
Karl Grzeszczak <karlgrz@gmail.com>
Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
@@ -311,57 +367,68 @@ Kawsar Saiyeed <kawsar.saiyeed@projiris.com>
Keli Hu <dev@keli.hu>
Ken Cochrane <kencochrane@gmail.com>
Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
Kevin "qwazerty" Houdebert <kevin.houdebert@gmail.com>
Kevin Clark <kevin.clark@gmail.com>
Kevin J. Lynagh <kevin@keminglabs.com>
Kevin Menard <kevin@nirvdrum.com>
Kevin "qwazerty" Houdebert <kevin.houdebert@gmail.com>
Kevin Wallace <kevin@pentabarf.net>
Keyvan Fatehi <keyvanfatehi@gmail.com>
kies <lleelm@gmail.com>
Kim BKC Carlbacker <kim.carlbacker@gmail.com>
kim0 <email.ahmedkamal@googlemail.com>
Kim BKC Carlbacker <kim.carlbacker@gmail.com>
Kimbro Staken <kstaken@kstaken.com>
Kiran Gangadharan <kiran.daredevil@gmail.com>
knappe <tyler.knappe@gmail.com>
Kohei Tsuruta <coheyxyz@gmail.com>
Konrad Kleine <konrad.wilhelm.kleine@gmail.com>
Konstantin Pelykh <kpelykh@zettaset.com>
krrg <krrgithub@gmail.com>
Kyle Conroy <kyle.j.conroy@gmail.com>
kyu <leehk1227@gmail.com>
Lachlan Coote <lcoote@vmware.com>
Lajos Papp <lajos.papp@sequenceiq.com>
Lakshan Perera <lakshan@laktek.com>
lalyos <lalyos@yahoo.com>
Lance Chen <cyen0312@gmail.com>
Lars R. Damerow <lars@pixar.com>
Laurie Voss <github@seldo.com>
leeplay <hyeongkyu.lee@navercorp.com>
Lei Jitang <leijitang@huawei.com>
Len Weincier <len@cloudafrica.net>
Leszek Kowalski <github@leszekkowalski.pl>
Levi Gross <levi@levigross.com>
Lewis Peckover <lew+github@lew.io>
Liang-Chi Hsieh <viirya@gmail.com>
limsy <seongyeol37@gmail.com>
Lokesh Mandvekar <lsm5@fedoraproject.org>
Louis Opter <kalessin@kalessin.fr>
lukaspustina <lukas.pustina@centerdevice.com>
lukemarsden <luke@digital-crocus.com>
Madhu Venugopal <madhu@socketplane.io>
Mahesh Tiyyagura <tmahesh@gmail.com>
Malte Janduda <mail@janduda.net>
Manfred Zabarauskas <manfredas@zabarauskas.com>
Manuel Meurer <manuel@krautcomputing.com>
Manuel Woelker <github@manuel.woelker.org>
Marc Abramowitz <marc@marc-abramowitz.com>
Marc Kuo <kuomarc2@gmail.com>
Marc Tamsky <mtamsky@gmail.com>
Marco Hennings <marco.hennings@freiheit.com>
Marc Tamsky <mtamsky@gmail.com>
Marcus Farkas <toothlessgear@finitebox.com>
Marcus Ramberg <marcus@nordaaker.com>
marcuslinke <marcus.linke@gmx.de>
Marcus Ramberg <marcus@nordaaker.com>
Marek Goldmann <marek.goldmann@gmail.com>
Marius Voila <marius.voila@gmail.com>
Mark Allen <mrallen1@yahoo.com>
Mark McGranaghan <mmcgrana@gmail.com>
Marko Mikulicic <mmikulicic@gmail.com>
Marko Tibold <marko@tibold.nl>
Markus Fix <lispmeister@gmail.com>
Martijn van Oosterhout <kleptog@svana.org>
Martin Redmond <martin@tinychat.com>
Mason Malone <mason.malone@gmail.com>
Mateusz Sulima <sulima.mateusz@gmail.com>
Mathias Monnerville <mathias@monnerville.com>
Mathieu Le Marec - Pasquet <kiorky@cryptelium.net>
Matt Apperson <me@mattapperson.com>
Matt Bachmann <bachmann.matt@gmail.com>
@@ -372,17 +439,24 @@ Matthias Klumpp <matthias@tenstral.net>
Matthias Kühnle <git.nivoc@neverbox.com>
mattymo <raytrac3r@gmail.com>
mattyw <mattyw@me.com>
Max Shytikov <mshytikov@gmail.com>
Maxim Treskin <zerthurd@gmail.com>
Maxime Petazzoni <max@signalfuse.com>
Maxim Treskin <zerthurd@gmail.com>
Max Shytikov <mshytikov@gmail.com>
Médi-Rémi Hashim <medimatrix@users.noreply.github.com>
meejah <meejah@meejah.ca>
Mengdi Gao <usrgdd@gmail.com>
Mert Yazıcıoğlu <merty@users.noreply.github.com>
Michael Brown <michael@netdirect.ca>
Michael Crosby <michael@docker.com>
Michael Gorsuch <gorsuch@github.com>
Michael Hudson-Doyle <michael.hudson@linaro.org>
Michael Neale <michael.neale@gmail.com>
Michael Prokop <github@michael-prokop.at>
Michael Stapelberg <michael+gh@stapelberg.de>
Michaël Pailloncy <mpapo.dev@gmail.com>
Michael Prokop <github@michael-prokop.at>
Michael Scharf <github@scharf.gr>
Michael Stapelberg <michael+gh@stapelberg.de>
Michael Thies <michaelthies78@gmail.com>
Michal Jemala <michal.jemala@gmail.com>
Michiel@unhosted <michiel@unhosted.org>
Miguel Angel Fernández <elmendalerenda@gmail.com>
Mike Chelen <michael.chelen@gmail.com>
@@ -395,32 +469,40 @@ Mohit Soni <mosoni@ebay.com>
Morgante Pell <morgante.pell@morgante.net>
Morten Siebuhr <sbhr@sbhr.dk>
Mrunal Patel <mrunalp@gmail.com>
mschurenko <matt.schurenko@gmail.com>
Mustafa Akın <mustafa91@gmail.com>
Nan Monnand Deng <monnand@gmail.com>
Naoki Orii <norii@cs.cmu.edu>
Nate Jones <nate@endot.org>
Nathan Hsieh <hsieh.nathan@gmail.com>
Nathan Kleyn <nathan@nathankleyn.com>
Nathan LeClaire <nathan.leclaire@docker.com>
Nelson Chen <crazysim@gmail.com>
Niall O'Higgins <niallo@unworkable.org>
Nicholas E. Rabenau <nerab@gmx.at>
Nick Payne <nick@kurai.co.uk>
Nick Stenning <nick.stenning@digital.cabinet-office.gov.uk>
Nick Stinemates <nick@stinemates.org>
Nicolas De loof <nicolas.deloof@gmail.com>
Nicolas Dudebout <nicolas.dudebout@gatech.edu>
Nicolas Goy <kuon@goyman.com>
Nicolas Kaiser <nikai@nikai.net>
NikolaMandic <mn080202@gmail.com>
noducks <onemannoducks@gmail.com>
Nolan Darilek <nolan@thewordnerd.info>
O.S. Tezer <ostezer@gmail.com>
nzwsch <hi@nzwsch.com>
OddBloke <daniel@daniel-watkins.co.uk>
odk- <github@odkurzacz.org>
Oguz Bilgic <fisyonet@gmail.com>
Oh Jinkyun <tintypemolly@gmail.com>
Ole Reifschneider <mail@ole-reifschneider.de>
Olivier Gambier <dmp42@users.noreply.github.com>
O.S. Tezer <ostezer@gmail.com>
pandrew <letters@paulnotcom.se>
Pascal Borreli <pascal@borreli.com>
Pascal Hartig <phartig@rdrei.net>
Patrick Hemmer <patrick.hemmer@gmail.com>
pattichen <craftsbear@gmail.com>
Paul <paul9869@gmail.com>
Paul Annesley <paul@annesley.cc>
Paul Bowsher <pbowsher@globalpersonals.co.uk>
Paul Hammond <paul@paulhammond.org>
@@ -428,25 +510,39 @@ Paul Jimenez <pj@place.org>
Paul Lietar <paul@lietar.net>
Paul Morie <pmorie@gmail.com>
Paul Nasrat <pnasrat@gmail.com>
Paul <paul9869@gmail.com>
Paul Weaver <pauweave@cisco.com>
Pavlos Ratis <dastergon@gentoo.org>
Peter Bourgon <peter@bourgon.org>
Peter Braden <peterbraden@peterbraden.co.uk>
Peter Ericson <pdericson@gmail.com>
Peter Salvatore <peter@psftw.com>
Peter Waller <p@pwaller.net>
Phil <underscorephil@gmail.com>
Phil Spitler <pspitler@gmail.com>
Phil Estes <estesp@linux.vnet.ibm.com>
Philipp Weissensteiner <mail@philippweissensteiner.com>
Phillip Alexander <git@phillipalexander.io>
Phil Spitler <pspitler@gmail.com>
Phil <underscorephil@gmail.com>
Piergiuliano Bossi <pgbossi@gmail.com>
Pierre-Alain RIVIERE <pariviere@ippon.fr>
Pierre <py@poujade.org>
Piotr Bogdan <ppbogdan@gmail.com>
pixelistik <pixelistik@users.noreply.github.com>
Prasanna Gautam <prasannagautam@gmail.com>
Przemek Hejman <przemyslaw.hejman@gmail.com>
pysqz <randomq@126.com>
Qiang Huang <h.huangqiang@huawei.com>
Quentin Brossard <qbrossard@gmail.com>
r0n22 <cameron.regan@gmail.com>
Rafal Jeczalik <rjeczalik@gmail.com>
Rafe Colton <rafael.colton@gmail.com>
Rajat Pandit <rp@rajatpandit.com>
Rajdeep Dua <dua_rajdeep@yahoo.com>
Ralph Bean <rbean@redhat.com>
Ramkumar Ramachandra <artagnon@gmail.com>
Ramon van Alteren <ramon@vanalteren.nl>
Recursive Madman <recursive.madman@gmx.de>
Remi Rampin <remirampin@gmail.com>
Renato Riccieri Santos Zannon <renato.riccieri@gmail.com>
rgstephens <greg@udon.org>
Rhys Hiltner <rhys@twitch.tv>
@@ -455,6 +551,7 @@ Richo Healey <richo@psych0tik.net>
Rick Bradley <rick@users.noreply.github.com>
Rick van de Loo <rickvandeloo@gmail.com>
Robert Bachmann <rb@robertbachmann.at>
Robert Bittle <guywithnose@gmail.com>
Robert Obryk <robryk@gmail.com>
Roberto G. Hashioka <roberto.hashioka@docker.com>
Robin Speekenbrink <robin@kingsquare.nl>
@@ -470,25 +567,30 @@ Rovanion Luckey <rovanion.luckey@gmail.com>
Rudolph Gottesheim <r.gottesheim@loot.at>
Ryan Anderson <anderson.ryanc@gmail.com>
Ryan Aslett <github@mixologic.com>
Ryan Detzel <ryan.detzel@gmail.com>
Ryan Fowler <rwfowler@gmail.com>
Ryan O'Donnell <odonnellryanc@gmail.com>
Ryan Seto <ryanseto@yak.net>
Ryan Thomas <rthomas@atlassian.com>
s-ko <aleks@s-ko.net>
Sam Alba <sam.alba@gmail.com>
Sam Bailey <cyprix@cyprix.com.au>
Sam J Sharpe <sam.sharpe@digital.cabinet-office.gov.uk>
Sam Reis <sreis@atlassian.com>
Sam Rijs <srijs@airpost.net>
Samuel Andaya <samuel@andaya.net>
Samuel PHAN <samuel-phan@users.noreply.github.com>
satoru <satorulogic@gmail.com>
Satoshi Amemiya <satoshi_amemiya@voyagegroup.com>
Scott Bessler <scottbessler@gmail.com>
Scott Collier <emailscottcollier@gmail.com>
Scott Johnston <scott@docker.com>
Scott Walls <sawalls@umich.edu>
Sean Cronin <seancron@gmail.com>
Sean P. Kane <skane@newrelic.com>
Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
Sébastien Luttringer <seblu@seblu.net>
Sébastien <sebastien@yoozio.com>
Sébastien Stormacq <sebsto@users.noreply.github.com>
Senthil Kumar Selvaraj <senthil.thecoder@gmail.com>
SeongJae Park <sj38.park@gmail.com>
Shane Canon <scanon@lbl.gov>
@@ -496,28 +598,30 @@ shaunol <shaunol@gmail.com>
Shawn Landden <shawn@churchofgit.com>
Shawn Siefkas <shawn.siefkas@meredith.com>
Shih-Yuan Lee <fourdollars@gmail.com>
shuai-z <zs.broccoli@gmail.com>
Silas Sewell <silas@sewell.org>
Simon Taranto <simon.taranto@gmail.com>
Sindhu S <sindhus@live.in>
Sjoerd Langkemper <sjoerd-github@linuxonly.nl>
s-ko <aleks@s-ko.net>
Solomon Hykes <solomon@docker.com>
Song Gao <song@gao.io>
Soulou <leo@unbekandt.eu>
soulshake <amy@gandi.net>
Sridatta Thatipamala <sthatipamala@gmail.com>
Sridhar Ratnakumar <sridharr@activestate.com>
Srini Brahmaroutu <sbrahma@us.ibm.com>
Steeve Morin <steeve.morin@gmail.com>
Stefan Praszalowicz <stefan@greplin.com>
Stephen Crosby <stevecrozz@gmail.com>
Steven Burgess <steven.a.burgess@hotmail.com>
Steven Merrill <steven.merrill@gmail.com>
sudosurootdev <sudosurootdev@gmail.com>
Sven Dowideit <svendowideit@home.org.au>
Sven Dowideit <SvenDowideit@home.org.au>
Sylvain Bellemare <sylvain.bellemare@ezeep.com>
Sébastien <sebastien@yoozio.com>
Sébastien Luttringer <seblu@seblu.net>
Sébastien Stormacq <sebsto@users.noreply.github.com>
tang0th <tang0th@gmx.com>
Tatsuki Sugiura <sugi@nemui.org>
Ted M. Young <tedyoung@gmail.com>
Tehmasp Chaudhri <tehmasp@gmail.com>
Thatcher Peskens <thatcher@docker.com>
Thermionix <bond711@gmail.com>
@@ -526,25 +630,32 @@ Thomas Bikeev <thomas.bikeev@mac.com>
Thomas Frössman <thomasf@jossystem.se>
Thomas Hansen <thomas.hansen@gmail.com>
Thomas LEVEIL <thomasleveil@gmail.com>
Thomas Orozco <thomas@orozco.fr>
Thomas Schroeter <thomas@cliqz.com>
Tianon Gravi <admwiggin@gmail.com>
Tibor Vass <teabee89@gmail.com>
Tim Bosse <taim@bosboot.org>
Tim Ruffles <oi@truffles.me.uk>
Tim Ruffles <timruffles@googlemail.com>
Tim Terhorst <mynamewastaken+git@gmail.com>
Tim Hockin <thockin@google.com>
Timothy Hobbs <timothyhobbs@seznam.cz>
Tim Ruffles <oi@truffles.me.uk>
Tim Smith <timbot@google.com>
Tim Terhorst <mynamewastaken+git@gmail.com>
tjmehta <tj@init.me>
tjwebb123 <tjwebb123@users.noreply.github.com>
tobe <tobegit3hub@gmail.com>
Tobias Bieniek <Tobias.Bieniek@gmx.de>
Tobias Gesellchen <tobias@gesellix.de>
Tobias Schmidt <ts@soundcloud.com>
Tobias Schwab <tobias.schwab@dynport.de>
Todd Lunter <tlunter@gmail.com>
Tomasz Lipinski <tlipinski@users.noreply.github.com>
Tom Fotherby <tom+github@peopleperhour.com>
Tom Hulihan <hulihan.tom159@gmail.com>
Tom Maaswinkel <tom.maaswinkel@12wiki.eu>
Tommaso Visconti <tommaso.visconti@gmail.com>
Tonis Tiigi <tonistiigi@gmail.com>
Tony Daws <tony@daws.ca>
Torstein Husebø <torstein@huseboe.net>
tpng <benny.tpng@gmail.com>
Travis Cline <travis.cline@gmail.com>
Trent Ogren <tedwardo2@gmail.com>
@@ -560,33 +671,43 @@ Victor Vieux <victor.vieux@docker.com>
Viktor Vojnovski <viktor.vojnovski@amadeus.com>
Vincent Batts <vbatts@redhat.com>
Vincent Bernat <bernat@luffy.cx>
Vincent Bernat <Vincent.Bernat@exoscale.ch>
Vincent Giersch <vincent.giersch@ovh.net>
Vincent Mayers <vincent.mayers@inbloom.org>
Vincent Woo <me@vincentwoo.com>
Vinod Kulkarni <vinod.kulkarni@gmail.com>
Vishal Doshi <vishal.doshi@gmail.com>
Vishnu Kannan <vishnuk@google.com>
Vitor Monteiro <vmrmonteiro@gmail.com>
Vivek Agarwal <me@vivek.im>
Vivek Dasgupta <vdasgupt@redhat.com>
Vivek Goyal <vgoyal@redhat.com>
Vladimir Bulyga <xx@ccxx.cc>
Vladimir Kirillov <proger@wilab.org.ua>
Vladimir Rutsky <altsysrq@gmail.com>
Vojtech Vitek (V-Teq) <vvitek@redhat.com>
waitingkuo <waitingkuo0527@gmail.com>
Walter Leibbrandt <github@wrl.co.za>
Walter Stanish <walter@pratyeka.org>
Ward Vandewege <ward@jhvc.com>
WarheadsSE <max@warheads.net>
Wes Morgan <cap10morgan@gmail.com>
Will Dietz <w@wdtz.org>
Will Rouesnel <w.rouesnel@gmail.com>
Will Weaver <monkey@buildingbananas.com>
William Delanoue <william.delanoue@gmail.com>
William Henry <whenry@redhat.com>
William Riancho <wr.wllm@gmail.com>
William Thurston <thurstw@amazon.com>
Will Rouesnel <w.rouesnel@gmail.com>
Will Weaver <monkey@buildingbananas.com>
wyc <wayne@neverfear.org>
Xiuming Chen <cc@cxm.cc>
xuzhaokui <cynicholas@gmail.com>
Yang Bai <hamo.by@gmail.com>
Yasunori Mahata <nori@mahata.net>
Yohei Ueda <yohei@jp.ibm.com>
Yurii Rashkovskii <yrashk@gmail.com>
Zac Dover <zdover@redhat.com>
Zach Borboa <zachborboa@gmail.com>
Zain Memon <zain@inzain.net>
Zaiste! <oh@zaiste.net>
Zane DeGraffenried <zane.deg@gmail.com>
@@ -594,4 +715,4 @@ Zilin Du <zilin.du@gmail.com>
zimbatm <zimbatm@zimbatm.com>
Zoltan Tombol <zoltan.tombol@gmail.com>
zqh <zqhxuyuan@gmail.com>
Álvaro Lázaro <alvaro.lazaro.g@gmail.com>
尹吉峰 <jifeng.yin@gmail.com>

View File

@@ -1,5 +1,38 @@
# Changelog
## 1.4.1 (2014-12-15)
#### Runtime
- Fix issue with volumes-from and bind mounts not being honored after create
## 1.4.0 (2014-12-11)
#### Notable Features since 1.3.0
+ Set key=value labels to the daemon (displayed in `docker info`), applied with
new `-label` daemon flag
+ Add support for `ENV` in Dockerfile of the form:
`ENV name=value name2=value2...`
+ New Overlayfs Storage Driver
+ `docker info` now returns an `ID` and `Name` field
+ Filter events by event name, container, or image
+ `docker cp` now supports copying from container volumes
- Fixed `docker tag`, so it honors `--force` when overriding a tag for existing
image.
## 1.3.3 (2014-12-11)
#### Security
- Fix path traversal vulnerability in processing of absolute symbolic links (CVE-2014-9356)
- Fix decompression of xz image archives, preventing privilege escalation (CVE-2014-9357)
- Validate image IDs (CVE-2014-9358)
#### Runtime
- Fix an issue when image archives are being read slowly
#### Client
- Fix a regression related to stdin redirection
- Fix a regression with `docker cp` when destination is the current directory
## 1.3.2 (2014-11-20)
#### Security
@@ -32,7 +65,7 @@
#### Builder
- Fix escaping `$` for environment variables
- Fix issue with lowercase `onbuild` Dockerfile instruction
- Restrict envrionment variable expansion to `ENV`, `ADD`, `COPY`, `WORKDIR`, `EXPOSE`, `VOLUME` and `USER`
- Restrict environment variable expansion to `ENV`, `ADD`, `COPY`, `WORKDIR`, `EXPOSE`, `VOLUME` and `USER`
## 1.3.0 (2014-10-14)

View File

@@ -6,27 +6,36 @@ feels wrong or incomplete.
## Topics
* [Security Reports](#security-reports)
* [Reporting Security Issues](#reporting-security-issues)
* [Design and Cleanup Proposals](#design-and-cleanup-proposals)
* [Reporting Issues](#reporting-issues)
* [Build Environment](#build-environment)
* [Contribution Guidelines](#contribution-guidelines)
* [Community Guidelines](#docker-community-guidelines)
## Security Reports
## Reporting Security Issues
Please **DO NOT** file an issue for security related issues. Please send your
reports to [security@docker.com](mailto:security@docker.com) instead.
The Docker maintainers take security very seriously. If you discover a security issue,
please bring it to their attention right away!
Please send your report privately to [security@docker.com](mailto:security@docker.com),
please **DO NOT** file a public issue.
Security reports are greatly appreciated and we will publicly thank you for it. We also
like to send gifts - if you're into Docker shwag make sure to let us know :)
We currently do not offer a paid security bounty program, but are not ruling it out in
the future.
## Design and Cleanup Proposals
When considering a design proposal, we are looking for:
* A description of the problem this design proposal solves
* An issue -- not a pull request -- that describes what you will take action on
* A pull request, not an issue, that modifies the documentation describing
the feature you are proposing, adding new documentation if necessary.
* Please prefix your issue with `Proposal:` in the title
* Please review [the existing Proposals](https://github.com/dotcloud/docker/issues?direction=asc&labels=Proposal&page=1&sort=created&state=open)
before reporting a new issue. You can always pair with someone if you both
* Please review [the existing Proposals](https://github.com/docker/docker/pulls?q=is%3Aopen+is%3Apr+label%3AProposal)
before reporting a new one. You can always pair with someone if you both
have the same idea.
When considering a cleanup task, we are looking for:
@@ -39,6 +48,10 @@ When considering a cleanup task, we are looking for:
## Reporting Issues
A great way to contribute to the project is to send a detailed report when you
encounter an issue. We always appreciate a well-written, thorough bug report,
and will thank you for it!
When reporting [issues](https://github.com/docker/docker/issues) on
GitHub please include your host OS (Ubuntu 12.04, Fedora 19, etc).
Please include:
@@ -62,7 +75,7 @@ docs](http://docs.docker.com/contributing/devenvironment/).
### 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
process them as quickly 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
@@ -159,7 +172,7 @@ component affected. For example, if a change affects `docs/` and `registry/`, it
needs an absolute majority from the maintainers of `docs/` AND, separately, an
absolute majority of the maintainers of `registry/`.
For more details see [MAINTAINERS.md](hack/MAINTAINERS.md)
For more details see [MAINTAINERS.md](project/MAINTAINERS.md)
### Sign your work
@@ -310,7 +323,7 @@ do need a fair way to deal with people who are making our community suck.
will be addressed immediately and are not subject to 3 strikes or
forgiveness.
* Contact james@docker.com to report abuse or appeal violations. In the case of
* Contact abuse@docker.com to report abuse or appeal violations. In the case of
appeals, we know that mistakes happen, and we'll work with you to come up with
a fair solution if there has been a misunderstanding.

View File

@@ -23,7 +23,6 @@
# the case. Therefore, you don't have to disable it anymore.
#
docker-version 0.6.1
FROM ubuntu:14.04
MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
@@ -69,13 +68,16 @@ RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
ENV DOCKER_CROSSPLATFORMS \
linux/386 linux/arm \
darwin/amd64 darwin/386 \
freebsd/amd64 freebsd/386 freebsd/arm
freebsd/amd64 freebsd/386 freebsd/arm
# windows is experimental for now
# windows/amd64 windows/386
# (set an explicit GOARM of 5 for maximum compatibility)
ENV GOARM 5
RUN cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'
# Grab Go's cover tool for dead-simple code coverage testing
RUN go get code.google.com/p/go.tools/cmd/cover
RUN go get golang.org/x/tools/cmd/cover
# TODO replace FPM with some very minimal debhelper stuff
RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
@@ -104,7 +106,7 @@ RUN useradd --create-home --gid docker unprivilegeduser
VOLUME /var/lib/docker
WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor selinux
ENV DOCKER_BUILDTAGS apparmor selinux btrfs_noversion
# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

View File

@@ -1,20 +1,39 @@
.PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli validate
# env vars passed through directly to Docker's build scripts
# to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
# `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these
DOCKER_ENVS := \
-e BUILDFLAGS \
-e DOCKER_CLIENTONLY \
-e DOCKER_EXECDRIVER \
-e DOCKER_GRAPHDRIVER \
-e TESTDIRS \
-e TESTFLAGS \
-e TIMEOUT
# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
# to allow `make BINDDIR=. shell` or `make BINDDIR= test`
# (default to no bind mount if DOCKER_HOST is set)
BINDDIR := $(if $(DOCKER_HOST),,bundles)
DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
# to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
# to allow `make DOCSPORT=9000 docs`
DOCSPORT := 8000
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH))
DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
DOCKER_RUN_DOCKER := docker run --rm -it --privileged -e TIMEOUT -e BUILDFLAGS -e TESTFLAGS -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
# to allow `make DOCSDIR=docs docs-shell`
DOCKER_RUN_DOCS := docker run --rm -it $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) -e AWS_S3_BUCKET
DOCKER_RUN_DOCKER := docker run --rm -it --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET
# for some docs workarounds (see below in "docs-build" target)
GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
default: binary
@@ -34,7 +53,7 @@ docs-shell: docs-build
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
docs-release: docs-build
$(DOCKER_RUN_DOCS) -e BUILD_ROOT "$(DOCKER_DOCS_IMAGE)" ./release.sh
$(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT "$(DOCKER_DOCS_IMAGE)" ./release.sh
test: build
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli

View File

@@ -178,13 +178,14 @@ Contributing to Docker
======================
[![GoDoc](https://godoc.org/github.com/docker/docker?status.png)](https://godoc.org/github.com/docker/docker)
[![Travis](https://travis-ci.org/docker/docker.svg?branch=master)](https://travis-ci.org/docker/docker)
[![Build Status](https://ci.dockerproject.com/github.com/docker/docker/status.svg?branch=master)](https://ci.dockerproject.com/github.com/docker/docker)
Want to hack on Docker? Awesome! There are instructions to get you
started [here](CONTRIBUTING.md).
started [here](CONTRIBUTING.md). If you'd like to contribute to the
documentation, please take a look at this [README.md](https://github.com/docker/docker/blob/master/docs/README.md).
They are probably not perfect, please let us know if anything feels
wrong or incomplete.
These instructions are probably not perfect, please let us know if anything
feels wrong or incomplete.
### Legal
@@ -201,5 +202,7 @@ For more information, please see http://www.bis.doc.gov
Licensing
=========
Docker is licensed under the Apache License, Version 2.0. See LICENSE for full license text.
Docker is licensed under the Apache License, Version 2.0. See
[LICENSE](https://github.com/docker/docker/blob/master/LICENSE) for the full
license text.

View File

@@ -1 +1 @@
1.3.2
1.4.1

View File

@@ -1 +1,2 @@
Victor Vieux <vieux@docker.com> (@vieux)
Jessie Frazelle <jess@docker.com> (@jfrazelle)

View File

@@ -3,12 +3,16 @@ package client
import (
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"os"
"reflect"
"strings"
"text/template"
"time"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/term"
@@ -34,6 +38,7 @@ type DockerCli struct {
isTerminalIn bool
// isTerminalOut describes if client's STDOUT is a TTY
isTerminalOut bool
transport *http.Transport
}
var funcMap = template.FuncMap{
@@ -71,11 +76,11 @@ func (cli *DockerCli) Cmd(args ...string) error {
method, exists := cli.getMethod(args[0])
if !exists {
fmt.Println("Error: Command not found:", args[0])
return cli.CmdHelp(args[1:]...)
return cli.CmdHelp()
}
return method(args[1:]...)
}
return cli.CmdHelp(args...)
return cli.CmdHelp()
}
func (cli *DockerCli) Subcmd(name, signature, description string) *flag.FlagSet {
@@ -100,6 +105,16 @@ func (cli *DockerCli) LoadConfigFile() (err error) {
return err
}
func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error {
// In order to attach to a container tty, input stream for the client must
// be a tty itself: redirecting or piping the client standard input is
// incompatible with `docker run -t`, `docker exec -t` or `docker attach`.
if ttyMode && attachStdin && !cli.isTerminalIn {
return errors.New("cannot enable tty mode on non tty input")
}
return nil
}
func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, proto, addr string, tlsConfig *tls.Config) *DockerCli {
var (
inFd uintptr
@@ -131,6 +146,23 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey,
err = out
}
// The transport is created here for reuse during the client session
tr := &http.Transport{
TLSClientConfig: tlsConfig,
}
// Why 32? See issue 8035
timeout := 32 * time.Second
if proto == "unix" {
// no need in compressing for local communications
tr.DisableCompression = true
tr.Dial = func(_, _ string) (net.Conn, error) {
return net.DialTimeout(proto, addr, timeout)
}
} else {
tr.Dial = (&net.Dialer{Timeout: timeout}).Dial
}
return &DockerCli{
proto: proto,
addr: addr,
@@ -144,5 +176,6 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey,
isTerminalOut: isTerminalOut,
tlsConfig: tlsConfig,
scheme: scheme,
transport: tr,
}
}

View File

@@ -5,6 +5,7 @@ import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
@@ -17,11 +18,11 @@ import (
"runtime"
"strconv"
"strings"
"syscall"
"text/tabwriter"
"text/template"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
@@ -29,7 +30,6 @@ import (
"github.com/docker/docker/nat"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/filters"
@@ -38,6 +38,7 @@ import (
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/pkg/timeutils"
"github.com/docker/docker/pkg/units"
"github.com/docker/docker/pkg/urlutil"
"github.com/docker/docker/registry"
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
@@ -47,6 +48,10 @@ const (
tarHeaderSize = 512
)
var (
acceptedImageFilterTags = map[string]struct{}{"dangling": {}}
)
func (cli *DockerCli) CmdHelp(args ...string) error {
if len(args) > 1 {
method, exists := cli.getMethod(args[:2]...)
@@ -77,6 +82,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
forceRm := cmd.Bool([]string{"-force-rm"}, false, "Always remove intermediate containers, even after unsuccessful builds")
pull := cmd.Bool([]string{"-pull"}, false, "Always attempt to pull a newer version of the image")
if err := cmd.Parse(args); err != nil {
return nil
}
@@ -110,13 +116,13 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
} else {
context = ioutil.NopCloser(buf)
}
} else if utils.IsURL(cmd.Arg(0)) && (!utils.IsGIT(cmd.Arg(0)) || !hasGit) {
} else if urlutil.IsURL(cmd.Arg(0)) && (!urlutil.IsGitURL(cmd.Arg(0)) || !hasGit) {
isRemote = true
} else {
root := cmd.Arg(0)
if utils.IsGIT(root) {
if urlutil.IsGitURL(root) {
remoteURL := cmd.Arg(0)
if !strings.HasPrefix(remoteURL, "git://") && !strings.HasPrefix(remoteURL, "git@") && !utils.IsURL(remoteURL) {
if !urlutil.IsGitTransport(remoteURL) {
remoteURL = "https://" + remoteURL
}
@@ -143,6 +149,11 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
return fmt.Errorf("Error reading .dockerignore: '%s'", err)
}
for _, pattern := range strings.Split(string(ignore), "\n") {
pattern = strings.TrimSpace(pattern)
if pattern == "" {
continue
}
pattern = filepath.Clean(pattern)
ok, err := filepath.Match(pattern, "Dockerfile")
if err != nil {
return fmt.Errorf("Bad .dockerignore pattern: '%s', error: %s", pattern, err)
@@ -169,7 +180,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
// FIXME: ProgressReader shouldn't be this annoying to use
if context != nil {
sf := utils.NewStreamFormatter(false)
body = utils.ProgressReader(context, 0, cli.err, sf, true, "", "Sending build context to Docker daemon")
body = utils.ProgressReader(context, 0, cli.out, sf, true, "", "Sending build context to Docker daemon")
}
// Send the build context
v := &url.Values{}
@@ -208,6 +219,9 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
v.Set("forcerm", "1")
}
if *pull {
v.Set("pull", "1")
}
cli.LoadConfigFile()
headers := http.Header(make(map[string][]string))
@@ -284,7 +298,10 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
// the password or email from the config file, so prompt them
if username != authconfig.Username {
if password == "" {
oldState, _ := term.SaveState(cli.inFd)
oldState, err := term.SaveState(cli.inFd)
if err != nil {
return err
}
fmt.Fprintf(cli.out, "Password: ")
term.DisableEcho(cli.inFd, oldState)
@@ -467,33 +484,69 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
}
out.Close()
fmt.Fprintf(cli.out, "Containers: %d\n", remoteInfo.GetInt("Containers"))
fmt.Fprintf(cli.out, "Images: %d\n", remoteInfo.GetInt("Images"))
fmt.Fprintf(cli.out, "Storage Driver: %s\n", remoteInfo.Get("Driver"))
var driverStatus [][2]string
if err := remoteInfo.GetJson("DriverStatus", &driverStatus); err != nil {
return err
if remoteInfo.Exists("Containers") {
fmt.Fprintf(cli.out, "Containers: %d\n", remoteInfo.GetInt("Containers"))
}
for _, pair := range driverStatus {
fmt.Fprintf(cli.out, " %s: %s\n", pair[0], pair[1])
if remoteInfo.Exists("Images") {
fmt.Fprintf(cli.out, "Images: %d\n", remoteInfo.GetInt("Images"))
}
if remoteInfo.Exists("Driver") {
fmt.Fprintf(cli.out, "Storage Driver: %s\n", remoteInfo.Get("Driver"))
}
if remoteInfo.Exists("DriverStatus") {
var driverStatus [][2]string
if err := remoteInfo.GetJson("DriverStatus", &driverStatus); err != nil {
return err
}
for _, pair := range driverStatus {
fmt.Fprintf(cli.out, " %s: %s\n", pair[0], pair[1])
}
}
if remoteInfo.Exists("ExecutionDriver") {
fmt.Fprintf(cli.out, "Execution Driver: %s\n", remoteInfo.Get("ExecutionDriver"))
}
if remoteInfo.Exists("KernelVersion") {
fmt.Fprintf(cli.out, "Kernel Version: %s\n", remoteInfo.Get("KernelVersion"))
}
if remoteInfo.Exists("OperatingSystem") {
fmt.Fprintf(cli.out, "Operating System: %s\n", remoteInfo.Get("OperatingSystem"))
}
if remoteInfo.Exists("NCPU") {
fmt.Fprintf(cli.out, "CPUs: %d\n", remoteInfo.GetInt("NCPU"))
}
if remoteInfo.Exists("MemTotal") {
fmt.Fprintf(cli.out, "Total Memory: %s\n", units.BytesSize(float64(remoteInfo.GetInt64("MemTotal"))))
}
if remoteInfo.Exists("Name") {
fmt.Fprintf(cli.out, "Name: %s\n", remoteInfo.Get("Name"))
}
if remoteInfo.Exists("ID") {
fmt.Fprintf(cli.out, "ID: %s\n", remoteInfo.Get("ID"))
}
fmt.Fprintf(cli.out, "Execution Driver: %s\n", remoteInfo.Get("ExecutionDriver"))
fmt.Fprintf(cli.out, "Kernel Version: %s\n", remoteInfo.Get("KernelVersion"))
fmt.Fprintf(cli.out, "Operating System: %s\n", remoteInfo.Get("OperatingSystem"))
if remoteInfo.GetBool("Debug") || os.Getenv("DEBUG") != "" {
fmt.Fprintf(cli.out, "Debug mode (server): %v\n", remoteInfo.GetBool("Debug"))
if remoteInfo.Exists("Debug") {
fmt.Fprintf(cli.out, "Debug mode (server): %v\n", remoteInfo.GetBool("Debug"))
}
fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
fmt.Fprintf(cli.out, "Fds: %d\n", remoteInfo.GetInt("NFd"))
fmt.Fprintf(cli.out, "Goroutines: %d\n", remoteInfo.GetInt("NGoroutines"))
fmt.Fprintf(cli.out, "EventsListeners: %d\n", remoteInfo.GetInt("NEventsListener"))
if remoteInfo.Exists("NFd") {
fmt.Fprintf(cli.out, "Fds: %d\n", remoteInfo.GetInt("NFd"))
}
if remoteInfo.Exists("NGoroutines") {
fmt.Fprintf(cli.out, "Goroutines: %d\n", remoteInfo.GetInt("NGoroutines"))
}
if remoteInfo.Exists("NEventsListener") {
fmt.Fprintf(cli.out, "EventsListeners: %d\n", remoteInfo.GetInt("NEventsListener"))
}
if initSha1 := remoteInfo.Get("InitSha1"); initSha1 != "" {
fmt.Fprintf(cli.out, "Init SHA1: %s\n", initSha1)
}
if initPath := remoteInfo.Get("InitPath"); initPath != "" {
fmt.Fprintf(cli.out, "Init Path: %s\n", initPath)
}
if root := remoteInfo.Get("DockerRootDir"); root != "" {
fmt.Fprintf(cli.out, "Docker Root Dir: %s\n", root)
}
}
if len(remoteInfo.GetList("IndexServerAddress")) != 0 {
@@ -504,15 +557,22 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
fmt.Fprintf(cli.out, "Registry: %v\n", remoteInfo.GetList("IndexServerAddress"))
}
}
if !remoteInfo.GetBool("MemoryLimit") {
if remoteInfo.Exists("MemoryLimit") && !remoteInfo.GetBool("MemoryLimit") {
fmt.Fprintf(cli.err, "WARNING: No memory limit support\n")
}
if !remoteInfo.GetBool("SwapLimit") {
if remoteInfo.Exists("SwapLimit") && !remoteInfo.GetBool("SwapLimit") {
fmt.Fprintf(cli.err, "WARNING: No swap limit support\n")
}
if !remoteInfo.GetBool("IPv4Forwarding") {
if remoteInfo.Exists("IPv4Forwarding") && !remoteInfo.GetBool("IPv4Forwarding") {
fmt.Fprintf(cli.err, "WARNING: IPv4 forwarding is disabled.\n")
}
if remoteInfo.Exists("Labels") {
fmt.Fprintln(cli.out, "Labels:")
for _, attribute := range remoteInfo.GetList("Labels") {
fmt.Fprintf(cli.out, " %s\n", attribute)
}
}
return nil
}
@@ -575,7 +635,7 @@ func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
signal.CatchAll(sigc)
go func() {
for s := range sigc {
if s == syscall.SIGCHLD {
if s == signal.SIGCHLD {
continue
}
var sig string
@@ -586,7 +646,7 @@ func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
}
}
if sig == "" {
log.Errorf("Unsupported signal: %d. Discarding.", s)
log.Errorf("Unsupported signal: %v. Discarding.", s)
}
if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/kill?signal=%s", cid, sig), nil, false)); err != nil {
log.Debugf("Error sending signal: %s", err)
@@ -614,18 +674,20 @@ func (cli *DockerCli) CmdStart(args ...string) error {
return nil
}
hijacked := make(chan io.Closer)
if *attach || *openStdin {
if cmd.NArg() > 1 {
return fmt.Errorf("You cannot start and attach multiple containers at once.")
}
steam, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/json", nil, false)
stream, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/json", nil, false)
if err != nil {
return err
}
env := engine.Env{}
if err := env.Decode(steam); err != nil {
if err := env.Decode(stream); err != nil {
return err
}
config := env.GetSubEnv("Config")
@@ -650,8 +712,24 @@ func (cli *DockerCli) CmdStart(args ...string) error {
v.Set("stderr", "1")
cErr = promise.Go(func() error {
return cli.hijack("POST", "/containers/"+cmd.Arg(0)+"/attach?"+v.Encode(), tty, in, cli.out, cli.err, nil, nil)
return cli.hijack("POST", "/containers/"+cmd.Arg(0)+"/attach?"+v.Encode(), tty, in, cli.out, cli.err, hijacked, nil)
})
} else {
close(hijacked)
}
// Acknowledge the hijack before starting
select {
case closer := <-hijacked:
// Make sure that the hijack gets closed when returning (results
// in closing the hijack chan and freeing server's goroutines)
if closer != nil {
defer closer.Close()
}
case err := <-cErr:
if err != nil {
return err
}
}
var encounteredError error
@@ -681,7 +759,16 @@ func (cli *DockerCli) CmdStart(args ...string) error {
log.Errorf("Error monitoring TTY size: %s", err)
}
}
return <-cErr
if attchErr := <-cErr; attchErr != nil {
return attchErr
}
_, status, err := getExitCode(cli, cmd.Arg(0))
if err != nil {
return err
}
if status != 0 {
return &utils.StatusError{StatusCode: status}
}
}
return nil
}
@@ -798,7 +885,7 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
// Remove trailing ','
indented.Truncate(indented.Len() - 1)
}
indented.WriteByte(']')
indented.WriteString("]\n")
if tmpl == nil {
if _, err := io.Copy(cli.out, indented); err != nil {
@@ -857,13 +944,13 @@ func (cli *DockerCli) CmdPort(args ...string) error {
return nil
}
steam, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/json", nil, false)
stream, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/json", nil, false)
if err != nil {
return err
}
env := engine.Env{}
if err := env.Decode(steam); err != nil {
if err := env.Decode(stream); err != nil {
return err
}
ports := nat.PortMap{}
@@ -1195,7 +1282,7 @@ func (cli *DockerCli) CmdPull(args ...string) error {
)
taglessRemote, tag := parsers.ParseRepositoryTag(remote)
if tag == "" && !*allTags {
newRemote = taglessRemote + ":latest"
newRemote = taglessRemote + ":" + graph.DEFAULTTAG
}
if tag != "" && *allTags {
return fmt.Errorf("tag can't be used with --all-tags/-a")
@@ -1244,7 +1331,7 @@ func (cli *DockerCli) CmdPull(args ...string) error {
}
func (cli *DockerCli) CmdImages(args ...string) error {
cmd := cli.Subcmd("images", "[NAME]", "List images")
cmd := cli.Subcmd("images", "[REPOSITORY]", "List images")
quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only show numeric IDs")
all := cmd.Bool([]string{"a", "-all"}, false, "Show all images (by default filter out the intermediate image layers)")
noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output")
@@ -1274,6 +1361,12 @@ func (cli *DockerCli) CmdImages(args ...string) error {
}
}
for name := range imageFilterArgs {
if _, ok := acceptedImageFilterTags[name]; !ok {
return fmt.Errorf("Invalid filter '%s'", name)
}
}
matchName := cmd.Arg(0)
// FIXME: --viz and --tree are deprecated. Remove them in a future version.
if *flViz || *flTree {
@@ -1483,7 +1576,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
cmd = cli.Subcmd("ps", "", "List containers")
quiet = cmd.Bool([]string{"q", "-quiet"}, false, "Only display numeric IDs")
size = cmd.Bool([]string{"s", "-size"}, false, "Display sizes")
size = cmd.Bool([]string{"s", "-size"}, false, "Display total file sizes")
all = cmd.Bool([]string{"a", "-all"}, false, "Show all containers. Only running containers are shown by default.")
noTrunc = cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output")
nLatest = cmd.Bool([]string{"l", "-latest"}, false, "Show only the latest created container, include non-running ones.")
@@ -1692,6 +1785,10 @@ func (cli *DockerCli) CmdEvents(args ...string) error {
cmd := cli.Subcmd("events", "", "Get real time events from the server")
since := cmd.String([]string{"#since", "-since"}, "", "Show all events created since timestamp")
until := cmd.String([]string{"-until"}, "", "Stream events until this timestamp")
flFilter := opts.NewListOpts(nil)
cmd.Var(&flFilter, []string{"f", "-filter"}, "Provide filter values (i.e. 'event=stop')")
if err := cmd.Parse(args); err != nil {
return nil
}
@@ -1701,9 +1798,20 @@ func (cli *DockerCli) CmdEvents(args ...string) error {
return nil
}
var (
v = url.Values{}
loc = time.FixedZone(time.Now().Zone())
v = url.Values{}
loc = time.FixedZone(time.Now().Zone())
eventFilterArgs = filters.Args{}
)
// Consolidate all filter flags, and sanity check them early.
// They'll get process in the daemon/server.
for _, f := range flFilter.GetAll() {
var err error
eventFilterArgs, err = filters.ParseFlag(f, eventFilterArgs)
if err != nil {
return err
}
}
var setTime = func(key, value string) {
format := timeutils.RFC3339NanoFixed
if len(value) < len(format) {
@@ -1721,6 +1829,13 @@ func (cli *DockerCli) CmdEvents(args ...string) error {
if *until != "" {
setTime("until", *until)
}
if len(eventFilterArgs) > 0 {
filterJson, err := filters.ToParam(eventFilterArgs)
if err != nil {
return err
}
v.Set("filters", filterJson)
}
if err := cli.stream("GET", "/events?"+v.Encode(), nil, cli.out, nil); err != nil {
return err
}
@@ -1797,13 +1912,13 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
}
name := cmd.Arg(0)
steam, _, err := cli.call("GET", "/containers/"+name+"/json", nil, false)
stream, _, err := cli.call("GET", "/containers/"+name+"/json", nil, false)
if err != nil {
return err
}
env := engine.Env{}
if err := env.Decode(steam); err != nil {
if err := env.Decode(stream); err != nil {
return err
}
@@ -1827,7 +1942,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
var (
cmd = cli.Subcmd("attach", "CONTAINER", "Attach to a running container")
noStdin = cmd.Bool([]string{"#nostdin", "-no-stdin"}, false, "Do not attach STDIN")
proxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy all received signals to the process (even in non-TTY mode). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.")
proxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy all received signals to the process (non-TTY mode only). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.")
)
if err := cmd.Parse(args); err != nil {
@@ -1859,6 +1974,10 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
tty = config.GetBool("Tty")
)
if err := cli.CheckTtyInput(!*noStdin, tty); err != nil {
return err
}
if tty && cli.isTerminalOut {
if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {
log.Debugf("Error monitoring TTY size: %s", err)
@@ -1994,7 +2113,7 @@ func (cli *DockerCli) pullImageCustomOut(image string, out io.Writer) error {
repos, tag := parsers.ParseRepositoryTag(image)
// pull only the image tagged 'latest' if no tag was specified
if tag == "" {
tag = "latest"
tag = graph.DEFAULTTAG
}
v.Set("fromImage", repos)
v.Set("tag", tag)
@@ -2083,7 +2202,11 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc
stream, statusCode, err := cli.call("POST", "/containers/create?"+containerValues.Encode(), mergedConfig, false)
//if image not found try to pull it
if statusCode == 404 {
fmt.Fprintf(cli.err, "Unable to find image '%s' locally\n", config.Image)
repo, tag := parsers.ParseRepositoryTag(config.Image)
if tag == "" {
tag = graph.DEFAULTTAG
}
fmt.Fprintf(cli.err, "Unable to find image '%s:%s' locally\n", repo, tag)
// we don't want to write to stdout anything apart from container.ID
if err = cli.pullImageCustomOut(config.Image, cli.err); err != nil {
@@ -2124,7 +2247,7 @@ func (cli *DockerCli) CmdCreate(args ...string) error {
flName = cmd.String([]string{"-name"}, "", "Assign a name to the container")
)
config, hostConfig, cmd, err := runconfig.Parse(cmd, args, nil)
config, hostConfig, cmd, err := runconfig.Parse(cmd, args)
if err != nil {
return err
}
@@ -2151,7 +2274,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
var (
flAutoRemove = cmd.Bool([]string{"#rm", "-rm"}, false, "Automatically remove the container when it exits (incompatible with -d)")
flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run the container in the background and print the new container ID")
flSigProxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
flSigProxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
flName = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
flAttach *opts.ListOpts
@@ -2160,7 +2283,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
)
config, hostConfig, cmd, err := runconfig.Parse(cmd, args, nil)
config, hostConfig, cmd, err := runconfig.Parse(cmd, args)
if err != nil {
return err
}
@@ -2169,7 +2292,11 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return nil
}
if *flDetach {
if !*flDetach {
if err := cli.CheckTtyInput(config.AttachStdin, config.Tty); err != nil {
return err
}
} else {
if fl := cmd.Lookup("attach"); fl != nil {
flAttach = fl.Value.(*opts.ListOpts)
if flAttach.Len() != 0 {
@@ -2186,7 +2313,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
config.StdinOnce = false
}
// Disable flSigProxy in case on TTY
// Disable flSigProxy when in TTY mode
sigProxy := *flSigProxy
if config.Tty {
sigProxy = false
@@ -2208,7 +2335,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
)
if !config.AttachStdout && !config.AttachStderr {
// Make this asynchrone in order to let the client write to stdin before having to read the ID
// Make this asynchronous to allow the client to write to stdin before having to read the ID
waitDisplayId = make(chan struct{})
go func() {
defer close(waitDisplayId)
@@ -2220,7 +2347,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return ErrConflictRestartPolicyAndAutoRemove
}
// We need to instanciate the chan because the select needs it. It can
// We need to instantiate the chan because the select needs it. It can
// be closed but can't be uninitialized.
hijacked := make(chan io.Closer)
@@ -2267,8 +2394,8 @@ func (cli *DockerCli) CmdRun(args ...string) error {
// Acknowledge the hijack before starting
select {
case closer := <-hijacked:
// Make sure that hijack gets closed when returning. (result
// in closing hijack chan and freeing server's goroutines.
// Make sure that the hijack gets closed when returning (results
// in closing the hijack chan and freeing server's goroutines)
if closer != nil {
defer closer.Close()
}
@@ -2280,7 +2407,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
}
//start the container
if _, _, err = readBody(cli.call("POST", "/containers/"+runResult.Get("Id")+"/start", hostConfig, false)); err != nil {
if _, _, err = readBody(cli.call("POST", "/containers/"+runResult.Get("Id")+"/start", nil, false)); err != nil {
return err
}
@@ -2320,15 +2447,15 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return err
}
} else {
// No Autoremove: Simply retrieve the exit code
if !config.Tty {
// In non-tty mode, we can't dettach, so we know we need to wait.
// In non-TTY mode, we can't detach, so we must wait for container exit
if status, err = waitForExit(cli, runResult.Get("Id")); err != nil {
return err
}
} else {
// In TTY mode, there is a race. If the process dies too slowly, the state can be update after the getExitCode call
// and result in a wrong exit code.
// No Autoremove: Simply retrieve the exit code
// In TTY mode, there is a race: if the process dies too slowly, the state could
// be updated after the getExitCode call and result in the wrong exit code being reported
if _, status, err = getExitCode(cli, runResult.Get("Id")); err != nil {
return err
}
@@ -2402,7 +2529,10 @@ func (cli *DockerCli) CmdSave(args ...string) error {
if err != nil {
return err
}
} else if cli.isTerminalOut {
return errors.New("Cowardly refusing to save to a terminal. Use the -o flag or redirect.")
}
if len(cmd.Args()) == 1 {
image := cmd.Arg(0)
if err := cli.stream("GET", "/images/"+image+"/get", nil, output, nil); err != nil {
@@ -2450,7 +2580,7 @@ func (cli *DockerCli) CmdLoad(args ...string) error {
}
func (cli *DockerCli) CmdExec(args ...string) error {
cmd := cli.Subcmd("exec", "CONTAINER COMMAND [ARG...]", "Run a command in an existing container")
cmd := cli.Subcmd("exec", "CONTAINER COMMAND [ARG...]", "Run a command in a running container")
execConfig, err := runconfig.ParseExec(cmd, args)
if err != nil {
@@ -2478,10 +2608,16 @@ func (cli *DockerCli) CmdExec(args ...string) error {
return nil
}
if execConfig.Detach {
if !execConfig.Detach {
if err := cli.CheckTtyInput(execConfig.AttachStdin, execConfig.Tty); err != nil {
return err
}
} else {
if _, _, err := readBody(cli.call("POST", "/exec/"+execID+"/start", execConfig, false)); err != nil {
return err
}
// For now don't print this - wait for when we support exec wait()
// fmt.Fprintf(cli.out, "%s\n", execID)
return nil
}
@@ -2544,5 +2680,14 @@ func (cli *DockerCli) CmdExec(args ...string) error {
return err
}
var status int
if _, status, err = getExecExitCode(cli, execID); err != nil {
return err
}
if status != 0 {
return &utils.StatusError{StatusCode: status}
}
return nil
}

View File

@@ -2,6 +2,7 @@ package client
import (
"crypto/tls"
"errors"
"fmt"
"io"
"net"
@@ -10,18 +11,109 @@ import (
"os"
"runtime"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term"
)
type tlsClientCon struct {
*tls.Conn
rawConn net.Conn
}
func (c *tlsClientCon) CloseWrite() error {
// Go standard tls.Conn doesn't provide the CloseWrite() method so we do it
// on its underlying connection.
if cwc, ok := c.rawConn.(interface {
CloseWrite() error
}); ok {
return cwc.CloseWrite()
}
return nil
}
func tlsDial(network, addr string, config *tls.Config) (net.Conn, error) {
return tlsDialWithDialer(new(net.Dialer), network, addr, config)
}
// We need to copy Go's implementation of tls.Dial (pkg/cryptor/tls/tls.go) in
// order to return our custom tlsClientCon struct which holds both the tls.Conn
// object _and_ its underlying raw connection. The rationale for this is that
// we need to be able to close the write end of the connection when attaching,
// which tls.Conn does not provide.
func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Config) (net.Conn, error) {
// We want the Timeout and Deadline values from dialer to cover the
// whole process: TCP connection and TLS handshake. This means that we
// also need to start our own timers now.
timeout := dialer.Timeout
if !dialer.Deadline.IsZero() {
deadlineTimeout := dialer.Deadline.Sub(time.Now())
if timeout == 0 || deadlineTimeout < timeout {
timeout = deadlineTimeout
}
}
var errChannel chan error
if timeout != 0 {
errChannel = make(chan error, 2)
time.AfterFunc(timeout, func() {
errChannel <- errors.New("")
})
}
rawConn, err := dialer.Dial(network, addr)
if err != nil {
return nil, err
}
colonPos := strings.LastIndex(addr, ":")
if colonPos == -1 {
colonPos = len(addr)
}
hostname := addr[:colonPos]
// If no ServerName is set, infer the ServerName
// from the hostname we're connecting to.
if config.ServerName == "" {
// Make a copy to avoid polluting argument or default.
c := *config
c.ServerName = hostname
config = &c
}
conn := tls.Client(rawConn, config)
if timeout == 0 {
err = conn.Handshake()
} else {
go func() {
errChannel <- conn.Handshake()
}()
err = <-errChannel
}
if err != nil {
rawConn.Close()
return nil, err
}
// This is Docker difference with standard's crypto/tls package: returned a
// wrapper which holds both the TLS and raw connections.
return &tlsClientCon{conn, rawConn}, nil
}
func (cli *DockerCli) dial() (net.Conn, error) {
if cli.tlsConfig != nil && cli.proto != "unix" {
return tls.Dial(cli.proto, cli.addr, cli.tlsConfig)
// Notice this isn't Go standard's tls.Dial function
return tlsDial(cli.proto, cli.addr, cli.tlsConfig)
}
return net.Dial(cli.proto, cli.addr)
}
@@ -109,12 +201,11 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
io.Copy(rwc, in)
log.Debugf("[hijack] End of stdin")
}
if tcpc, ok := rwc.(*net.TCPConn); ok {
if err := tcpc.CloseWrite(); err != nil {
log.Debugf("Couldn't send EOF: %s", err)
}
} else if unixc, ok := rwc.(*net.UnixConn); ok {
if err := unixc.CloseWrite(); err != nil {
if conn, ok := rwc.(interface {
CloseWrite() error
}); ok {
if err := conn.CloseWrite(); err != nil {
log.Debugf("Couldn't send EOF: %s", err)
}
}

View File

@@ -8,20 +8,18 @@ import (
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
gosignal "os/signal"
"strconv"
"strings"
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/registry"
@@ -33,22 +31,7 @@ var (
)
func (cli *DockerCli) HTTPClient() *http.Client {
tr := &http.Transport{
TLSClientConfig: cli.tlsConfig,
Dial: func(network, addr string) (net.Conn, error) {
// Why 32? See issue 8035
return net.DialTimeout(cli.proto, cli.addr, 32*time.Second)
},
}
if cli.proto == "unix" {
// XXX workaround for net/http Transport which caches connections, but is
// intended for tcp connections, not unix sockets.
tr.DisableKeepAlives = true
// no need in compressing for local communications
tr.DisableCompression = true
}
return &http.Client{Transport: tr}
return &http.Client{Transport: cli.transport}
}
func (cli *DockerCli) encodeData(data interface{}) (*bytes.Buffer, error) {
@@ -113,7 +96,12 @@ func (cli *DockerCli) call(method, path string, data interface{}, passAuthInfo b
if strings.Contains(err.Error(), "connection refused") {
return nil, -1, ErrConnectionRefused
}
return nil, -1, err
if cli.tlsConfig == nil {
return nil, -1, fmt.Errorf("%v. Are you trying to connect to a TLS-enabled daemon without TLS?", err)
}
return nil, -1, fmt.Errorf("An error occurred trying to connect: %v", err)
}
if resp.StatusCode < 200 || resp.StatusCode >= 400 {
@@ -228,7 +216,7 @@ func waitForExit(cli *DockerCli, containerId string) (int, error) {
// getExitCode perform an inspect on the container. It returns
// the running state and the exit code.
func getExitCode(cli *DockerCli, containerId string) (bool, int, error) {
steam, _, err := cli.call("GET", "/containers/"+containerId+"/json", nil, false)
stream, _, err := cli.call("GET", "/containers/"+containerId+"/json", nil, false)
if err != nil {
// If we can't connect, then the daemon probably died.
if err != ErrConnectionRefused {
@@ -238,7 +226,7 @@ func getExitCode(cli *DockerCli, containerId string) (bool, int, error) {
}
var result engine.Env
if err := result.Decode(steam); err != nil {
if err := result.Decode(stream); err != nil {
return false, -1, err
}
@@ -246,11 +234,31 @@ func getExitCode(cli *DockerCli, containerId string) (bool, int, error) {
return state.GetBool("Running"), state.GetInt("ExitCode"), nil
}
// getExecExitCode perform an inspect on the exec command. It returns
// the running state and the exit code.
func getExecExitCode(cli *DockerCli, execId string) (bool, int, error) {
stream, _, err := cli.call("GET", "/exec/"+execId+"/json", nil, false)
if err != nil {
// If we can't connect, then the daemon probably died.
if err != ErrConnectionRefused {
return false, -1, err
}
return false, -1, nil
}
var result engine.Env
if err := result.Decode(stream); err != nil {
return false, -1, err
}
return result.GetBool("Running"), result.GetInt("ExitCode"), nil
}
func (cli *DockerCli) monitorTtySize(id string, isExec bool) error {
cli.resizeTty(id, isExec)
sigchan := make(chan os.Signal, 1)
gosignal.Notify(sigchan, syscall.SIGWINCH)
gosignal.Notify(sigchan, signal.SIGWINCH)
go func() {
for _ = range sigchan {
cli.resizeTty(id, isExec)

View File

@@ -3,16 +3,19 @@ package api
import (
"fmt"
"mime"
"os"
"path"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/version"
"github.com/docker/libtrust"
)
const (
APIVERSION version.Version = "1.15"
APIVERSION version.Version = "1.16"
DEFAULTHTTPHOST = "127.0.0.1"
DEFAULTUNIXSOCKET = "/var/run/docker.sock"
)
@@ -47,3 +50,25 @@ func MatchesContentType(contentType, expectedType string) bool {
}
return err == nil && mimetype == expectedType
}
// LoadOrCreateTrustKey attempts to load the libtrust key at the given path,
// otherwise generates a new one
func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) {
err := os.MkdirAll(path.Dir(trustKeyPath), 0700)
if err != nil {
return nil, err
}
trustKey, err := libtrust.LoadKeyFile(trustKeyPath)
if err == libtrust.ErrKeyFileDoesNotExist {
trustKey, err = libtrust.GenerateECP256PrivateKey()
if err != nil {
return nil, fmt.Errorf("Error generating key: %s", err)
}
if err := libtrust.SaveKey(trustKeyPath, trustKey); err != nil {
return nil, fmt.Errorf("Error saving key file: %s", err)
}
} else if err != nil {
return nil, fmt.Errorf("Error loading key file: %s", err)
}
return trustKey, nil
}

View File

@@ -3,8 +3,7 @@ package server
import (
"bufio"
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"expvar"
@@ -19,14 +18,17 @@ import (
"strings"
"syscall"
"crypto/tls"
"crypto/x509"
"code.google.com/p/go.net/websocket"
"github.com/docker/libcontainer/user"
"github.com/gorilla/mux"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/listenbuffer"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/systemd"
@@ -39,6 +41,18 @@ var (
activationLock chan struct{}
)
type HttpServer struct {
srv *http.Server
l net.Listener
}
func (s *HttpServer) Serve() error {
return s.srv.Serve(s.l)
}
func (s *HttpServer) Close() error {
return s.l.Close()
}
type HttpApiFunc func(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error
func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
@@ -51,6 +65,18 @@ func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
return conn, conn, nil
}
func closeStreams(streams ...interface{}) {
for _, stream := range streams {
if tcpc, ok := stream.(interface {
CloseWrite() error
}); ok {
tcpc.CloseWrite()
} else if closer, ok := stream.(io.Closer); ok {
closer.Close()
}
}
}
// Check to make sure request's Content-Type is application/json
func checkForJson(r *http.Request) error {
ct := r.Header.Get("Content-Type")
@@ -92,17 +118,18 @@ func httpError(w http.ResponseWriter, err error) {
// FIXME: this is brittle and should not be necessary.
// If we need to differentiate between different possible error types, we should
// create appropriate error types with clearly defined meaning.
if strings.Contains(err.Error(), "No such") {
errStr := strings.ToLower(err.Error())
if strings.Contains(errStr, "no such") {
statusCode = http.StatusNotFound
} else if strings.Contains(err.Error(), "Bad parameter") {
} else if strings.Contains(errStr, "bad parameter") {
statusCode = http.StatusBadRequest
} else if strings.Contains(err.Error(), "Conflict") {
} else if strings.Contains(errStr, "conflict") {
statusCode = http.StatusConflict
} else if strings.Contains(err.Error(), "Impossible") {
} else if strings.Contains(errStr, "impossible") {
statusCode = http.StatusNotAcceptable
} else if strings.Contains(err.Error(), "Wrong login/password") {
} else if strings.Contains(errStr, "wrong login/password") {
statusCode = http.StatusUnauthorized
} else if strings.Contains(err.Error(), "hasn't been activated") {
} else if strings.Contains(errStr, "hasn't been activated") {
statusCode = http.StatusForbidden
}
@@ -300,6 +327,7 @@ func getEvents(eng *engine.Engine, version version.Version, w http.ResponseWrite
streamJSON(job, w, true)
job.Setenv("since", r.Form.Get("since"))
job.Setenv("until", r.Form.Get("until"))
job.Setenv("filters", r.Form.Get("filters"))
return job.Run()
}
@@ -855,20 +883,7 @@ func postContainersAttach(eng *engine.Engine, version version.Version, w http.Re
if err != nil {
return err
}
defer func() {
if tcpc, ok := inStream.(*net.TCPConn); ok {
tcpc.CloseWrite()
} else {
inStream.Close()
}
}()
defer func() {
if tcpc, ok := outStream.(*net.TCPConn); ok {
tcpc.CloseWrite()
} else if closer, ok := outStream.(io.Closer); ok {
closer.Close()
}
}()
defer closeStreams(inStream, outStream)
var errStream io.Writer
@@ -941,6 +956,15 @@ func getContainersByName(eng *engine.Engine, version version.Version, w http.Res
return job.Run()
}
func getExecByID(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if vars == nil {
return fmt.Errorf("Missing parameter 'id'")
}
var job = eng.Job("execInspect", vars["id"])
streamJSON(job, w, false)
return job.Run()
}
func getImagesByName(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if vars == nil {
return fmt.Errorf("Missing parameter")
@@ -1001,6 +1025,9 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
} else {
job.Setenv("rm", r.FormValue("rm"))
}
if r.FormValue("pull") == "1" && version.GreaterThanOrEqualTo("1.16") {
job.Setenv("pull", "1")
}
job.Stdin.Add(r.Body)
job.Setenv("remote", r.FormValue("remote"))
job.Setenv("t", r.FormValue("t"))
@@ -1050,7 +1077,7 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp
w.Header().Set("Content-Type", "application/x-tar")
if err := job.Run(); err != nil {
log.Errorf("%s", err.Error())
if strings.Contains(err.Error(), "No such container") {
if strings.Contains(strings.ToLower(err.Error()), "no such container") {
w.WriteHeader(http.StatusNotFound)
} else if strings.Contains(err.Error(), "no such file or directory") {
return fmt.Errorf("Could not find the file %s in container %s", origResource, vars["name"])
@@ -1106,21 +1133,7 @@ func postContainerExecStart(eng *engine.Engine, version version.Version, w http.
if err != nil {
return err
}
defer func() {
if tcpc, ok := inStream.(*net.TCPConn); ok {
tcpc.CloseWrite()
} else {
inStream.Close()
}
}()
defer func() {
if tcpc, ok := outStream.(*net.TCPConn); ok {
tcpc.CloseWrite()
} else if closer, ok := outStream.(io.Closer); ok {
closer.Close()
}
}()
defer closeStreams(inStream, outStream)
var errStream io.Writer
@@ -1166,7 +1179,7 @@ func optionsHandler(eng *engine.Engine, version version.Version, w http.Response
}
func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Access-Control-Allow-Origin", "*")
w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
}
@@ -1231,6 +1244,7 @@ func AttachProfiler(router *mux.Router) {
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
router.HandleFunc("/debug/pprof/profile", pprof.Profile)
router.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
router.HandleFunc("/debug/pprof/block", pprof.Handler("block").ServeHTTP)
router.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
router.HandleFunc("/debug/pprof/goroutine", pprof.Handler("goroutine").ServeHTTP)
router.HandleFunc("/debug/pprof/threadcreate", pprof.Handler("threadcreate").ServeHTTP)
@@ -1262,6 +1276,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
"/containers/{name:.*}/top": getContainersTop,
"/containers/{name:.*}/logs": getContainersLogs,
"/containers/{name:.*}/attach/ws": wsContainersAttach,
"/exec/{id:.*}/json": getExecByID,
},
"POST": {
"/auth": postAuth,
@@ -1333,9 +1348,14 @@ func ServeRequest(eng *engine.Engine, apiversion version.Version, w http.Respons
return nil
}
// ServeFD creates an http.Server and sets it up to serve given a socket activated
// serveFd creates an http.Server and sets it up to serve given a socket activated
// argument.
func ServeFd(addr string, handle http.Handler) error {
func serveFd(addr string, job *engine.Job) error {
r, err := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"))
if err != nil {
return err
}
ls, e := systemd.ListenFD(addr)
if e != nil {
return e
@@ -1353,7 +1373,7 @@ func ServeFd(addr string, handle http.Handler) error {
for i := range ls {
listener := ls[i]
go func() {
httpSrv := http.Server{Handler: handle}
httpSrv := http.Server{Handler: r}
chErrors <- httpSrv.Serve(listener)
}()
}
@@ -1369,7 +1389,11 @@ func ServeFd(addr string, handle http.Handler) error {
}
func lookupGidByName(nameOrGid string) (int, error) {
groups, err := user.ParseGroupFilter(func(g *user.Group) bool {
groupFile, err := user.GetGroupFile()
if err != nil {
return -1, err
}
groups, err := user.ParseGroupFileFilter(groupFile, func(g user.Group) bool {
return g.Name == nameOrGid || strconv.Itoa(g.Gid) == nameOrGid
})
if err != nil {
@@ -1381,6 +1405,41 @@ func lookupGidByName(nameOrGid string) (int, error) {
return -1, fmt.Errorf("Group %s not found", nameOrGid)
}
func setupTls(cert, key, ca string, l net.Listener) (net.Listener, error) {
tlsCert, err := tls.LoadX509KeyPair(cert, key)
if err != nil {
return nil, fmt.Errorf("Couldn't load X509 key pair (%s, %s): %s. Key encrypted?",
cert, key, err)
}
tlsConfig := &tls.Config{
NextProtos: []string{"http/1.1"},
Certificates: []tls.Certificate{tlsCert},
// Avoid fallback on insecure SSL protocols
MinVersion: tls.VersionTLS10,
}
if ca != "" {
certPool := x509.NewCertPool()
file, err := ioutil.ReadFile(ca)
if err != nil {
return nil, fmt.Errorf("Couldn't read CA certificate: %s", err)
}
certPool.AppendCertsFromPEM(file)
tlsConfig.ClientAuth = tls.RequireAndVerifyClientCert
tlsConfig.ClientCAs = certPool
}
return tls.NewListener(l, tlsConfig), nil
}
func newListener(proto, addr string, bufferRequests bool) (net.Listener, error) {
if bufferRequests {
return listenbuffer.NewListenBuffer(proto, addr, activationLock)
}
return net.Listen(proto, addr)
}
func changeGroup(addr string, nameOrGid string) error {
gid, err := lookupGidByName(nameOrGid)
if err != nil {
@@ -1391,99 +1450,95 @@ func changeGroup(addr string, nameOrGid string) error {
return os.Chown(addr, 0, gid)
}
// ListenAndServe sets up the required http.Server and gets it listening for
// each addr passed in and does protocol specific checking.
func ListenAndServe(proto, addr string, job *engine.Job) error {
var l net.Listener
func setSocketGroup(addr, group string) error {
if group == "" {
return nil
}
if err := changeGroup(addr, group); err != nil {
if group != "docker" {
return err
}
log.Debugf("Warning: could not chgrp %s to docker: %v", addr, err)
}
return nil
}
func setupUnixHttp(addr string, job *engine.Job) (*HttpServer, error) {
r, err := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"))
if err != nil {
return err
return nil, err
}
if proto == "fd" {
return ServeFd(addr, r)
if err := syscall.Unlink(addr); err != nil && !os.IsNotExist(err) {
return nil, err
}
mask := syscall.Umask(0777)
defer syscall.Umask(mask)
if proto == "unix" {
if err := syscall.Unlink(addr); err != nil && !os.IsNotExist(err) {
return err
}
}
var oldmask int
if proto == "unix" {
oldmask = syscall.Umask(0777)
}
if job.GetenvBool("BufferRequests") {
l, err = listenbuffer.NewListenBuffer(proto, addr, activationLock)
} else {
l, err = net.Listen(proto, addr)
}
if proto == "unix" {
syscall.Umask(oldmask)
}
l, err := newListener("unix", addr, job.GetenvBool("BufferRequests"))
if err != nil {
return err
return nil, err
}
if proto != "unix" && (job.GetenvBool("Tls") || job.GetenvBool("TlsVerify")) {
tlsCert := job.Getenv("TlsCert")
tlsKey := job.Getenv("TlsKey")
cert, err := tls.LoadX509KeyPair(tlsCert, tlsKey)
if err != nil {
return fmt.Errorf("Couldn't load X509 key pair (%s, %s): %s. Key encrypted?",
tlsCert, tlsKey, err)
}
tlsConfig := &tls.Config{
NextProtos: []string{"http/1.1"},
Certificates: []tls.Certificate{cert},
// Avoid fallback on insecure SSL protocols
MinVersion: tls.VersionTLS10,
}
if err := setSocketGroup(addr, job.Getenv("SocketGroup")); err != nil {
return nil, err
}
if err := os.Chmod(addr, 0660); err != nil {
return nil, err
}
return &HttpServer{&http.Server{Addr: addr, Handler: r}, l}, nil
}
func setupTcpHttp(addr string, job *engine.Job) (*HttpServer, error) {
if !strings.HasPrefix(addr, "127.0.0.1") && !job.GetenvBool("TlsVerify") {
log.Infof("/!\\ DON'T BIND ON ANOTHER IP ADDRESS THAN 127.0.0.1 IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
}
r, err := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"))
if err != nil {
return nil, err
}
l, err := newListener("tcp", addr, job.GetenvBool("BufferRequests"))
if err != nil {
return nil, err
}
if job.GetenvBool("Tls") || job.GetenvBool("TlsVerify") {
var tlsCa string
if job.GetenvBool("TlsVerify") {
certPool := x509.NewCertPool()
file, err := ioutil.ReadFile(job.Getenv("TlsCa"))
if err != nil {
return fmt.Errorf("Couldn't read CA certificate: %s", err)
}
certPool.AppendCertsFromPEM(file)
tlsConfig.ClientAuth = tls.RequireAndVerifyClientCert
tlsConfig.ClientCAs = certPool
tlsCa = job.Getenv("TlsCa")
}
l, err = setupTls(job.Getenv("TlsCert"), job.Getenv("TlsKey"), tlsCa, l)
if err != nil {
return nil, err
}
l = tls.NewListener(l, tlsConfig)
}
return &HttpServer{&http.Server{Addr: addr, Handler: r}, l}, nil
}
// NewServer sets up the required Server and does protocol specific checking.
func NewServer(proto, addr string, job *engine.Job) (Server, error) {
// Basic error and sanity checking
switch proto {
case "fd":
return nil, serveFd(addr, job)
case "tcp":
if !strings.HasPrefix(addr, "127.0.0.1") && !job.GetenvBool("TlsVerify") {
log.Infof("/!\\ DON'T BIND ON ANOTHER IP ADDRESS THAN 127.0.0.1 IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
}
return setupTcpHttp(addr, job)
case "unix":
socketGroup := job.Getenv("SocketGroup")
if socketGroup != "" {
if err := changeGroup(addr, socketGroup); err != nil {
if socketGroup == "docker" {
// if the user hasn't explicitly specified the group ownership, don't fail on errors.
log.Debugf("Warning: could not chgrp %s to docker: %s", addr, err.Error())
} else {
return err
}
}
}
if err := os.Chmod(addr, 0660); err != nil {
return err
}
return setupUnixHttp(addr, job)
default:
return fmt.Errorf("Invalid protocol format.")
return nil, fmt.Errorf("Invalid protocol format.")
}
}
httpSrv := http.Server{Addr: addr, Handler: r}
return httpSrv.Serve(l)
type Server interface {
Serve() error
Close() error
}
// ServeApi loops through all of the protocols sent in to docker and spawns
@@ -1505,7 +1560,12 @@ func ServeApi(job *engine.Job) engine.Status {
}
go func() {
log.Infof("Listening for HTTP on %s (%s)", protoAddrParts[0], protoAddrParts[1])
chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], job)
srv, err := NewServer(protoAddrParts[0], protoAddrParts[1], job)
if err != nil {
chErrors <- err
return
}
chErrors <- srv.Serve()
}()
}

View File

@@ -14,8 +14,8 @@ import (
"regexp"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/nat"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/runconfig"
)
@@ -31,21 +31,39 @@ func nullDispatch(b *Builder, args []string, attributes map[string]bool, origina
// in the dockerfile available from the next statement on via ${foo}.
//
func env(b *Builder, args []string, attributes map[string]bool, original string) error {
if len(args) != 2 {
return fmt.Errorf("ENV accepts two arguments")
if len(args) == 0 {
return fmt.Errorf("ENV is missing arguments")
}
fullEnv := fmt.Sprintf("%s=%s", args[0], args[1])
if len(args)%2 != 0 {
// should never get here, but just in case
return fmt.Errorf("Bad input to ENV, too many args")
}
for i, envVar := range b.Config.Env {
envParts := strings.SplitN(envVar, "=", 2)
if args[0] == envParts[0] {
b.Config.Env[i] = fullEnv
return b.commit("", b.Config.Cmd, fmt.Sprintf("ENV %s", fullEnv))
commitStr := "ENV"
for j := 0; j < len(args); j++ {
// name ==> args[j]
// value ==> args[j+1]
newVar := args[j] + "=" + args[j+1] + ""
commitStr += " " + newVar
gotOne := false
for i, envVar := range b.Config.Env {
envParts := strings.SplitN(envVar, "=", 2)
if envParts[0] == args[j] {
b.Config.Env[i] = newVar
gotOne = true
break
}
}
if !gotOne {
b.Config.Env = append(b.Config.Env, newVar)
}
j++
}
b.Config.Env = append(b.Config.Env, fullEnv)
return b.commit("", b.Config.Cmd, fmt.Sprintf("ENV %s", fullEnv))
return b.commit("", b.Config.Cmd, commitStr)
}
// MAINTAINER some text <maybe@an.email.address>
@@ -97,6 +115,12 @@ func from(b *Builder, args []string, attributes map[string]bool, original string
name := args[0]
image, err := b.Daemon.Repositories().LookupImage(name)
if b.Pull {
image, err = b.pullImage(name)
if err != nil {
return err
}
}
if err != nil {
if b.Daemon.Graph().IsNotExist(err) {
image, err = b.pullImage(name)
@@ -183,7 +207,7 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
runCmd.SetOutput(ioutil.Discard)
runCmd.Usage = nil
config, _, _, err := runconfig.Parse(runCmd, append([]string{b.image}, args...), nil)
config, _, _, err := runconfig.Parse(runCmd, append([]string{b.image}, args...))
if err != nil {
return err
}

View File

@@ -27,10 +27,10 @@ import (
"path"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/registry"
"github.com/docker/docker/runconfig"
@@ -90,6 +90,7 @@ type Builder struct {
// controls how images and containers are handled between steps.
Remove bool
ForceRemove bool
Pull bool
AuthConfig *registry.AuthConfig
AuthConfigFile *registry.ConfigFile

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
@@ -18,17 +19,17 @@ import (
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon"
imagepkg "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/pkg/urlutil"
"github.com/docker/docker/registry"
"github.com/docker/docker/utils"
)
@@ -217,7 +218,7 @@ func calcCopyInfo(b *Builder, cmdName string, cInfos *[]*copyInfo, origPath stri
origPath = strings.TrimPrefix(origPath, "./")
// In the remote/URL case, download it and gen its hashcode
if utils.IsURL(origPath) {
if urlutil.IsURL(origPath) {
if !allowRemote {
return fmt.Errorf("Source can't be a URL for %s", cmdName)
}
@@ -257,8 +258,21 @@ func calcCopyInfo(b *Builder, cmdName string, cInfos *[]*copyInfo, origPath stri
fmt.Fprintf(b.OutStream, "\n")
tmpFile.Close()
// Remove the mtime of the newly created tmp file
if err := system.UtimesNano(tmpFileName, make([]syscall.Timespec, 2)); err != nil {
// Set the mtime to the Last-Modified header value if present
// Otherwise just remove atime and mtime
times := make([]syscall.Timespec, 2)
lastMod := resp.Header.Get("Last-Modified")
if lastMod != "" {
mTime, err := http.ParseTime(lastMod)
// If we can't parse it then just let it default to 'zero'
// otherwise use the parsed time value
if err == nil {
times[1] = syscall.NsecToTimespec(mTime.UnixNano())
}
}
if err := system.UtimesNano(tmpFileName, times); err != nil {
return err
}
@@ -514,25 +528,19 @@ func (b *Builder) create() (*daemon.Container, error) {
}
func (b *Builder) run(c *daemon.Container) error {
var errCh chan error
if b.Verbose {
errCh = promise.Go(func() error {
// FIXME: call the 'attach' job so that daemon.Attach can be made private
//
// FIXME (LK4D4): Also, maybe makes sense to call "logs" job, it is like attach
// but without hijacking for stdin. Also, with attach there can be race
// condition because of some output already was printed before it.
return <-b.Daemon.Attach(&c.StreamConfig, c.Config.OpenStdin, c.Config.StdinOnce, c.Config.Tty, nil, nil, b.OutStream, b.ErrStream)
})
}
//start the container
if err := c.Start(); err != nil {
return err
}
if errCh != nil {
if err := <-errCh; err != nil {
if b.Verbose {
logsJob := b.Engine.Job("logs", c.ID)
logsJob.Setenv("follow", "1")
logsJob.Setenv("stdout", "1")
logsJob.Setenv("stderr", "1")
logsJob.Stdout.Add(b.OutStream)
logsJob.Stderr.Set(b.ErrStream)
if err := logsJob.Run(); err != nil {
return err
}
}
@@ -641,37 +649,45 @@ func (b *Builder) addContext(container *daemon.Container, orig, dest string, dec
resPath = path.Join(destPath, path.Base(origPath))
}
return fixPermissions(resPath, 0, 0)
return fixPermissions(origPath, resPath, 0, 0, destExists)
}
func copyAsDirectory(source, destination string, destinationExists bool) error {
func copyAsDirectory(source, destination string, destExisted bool) error {
if err := chrootarchive.CopyWithTar(source, destination); err != nil {
return err
}
return fixPermissions(source, destination, 0, 0, destExisted)
}
if destinationExists {
files, err := ioutil.ReadDir(source)
func fixPermissions(source, destination string, uid, gid int, destExisted bool) error {
// If the destination didn't already exist, or the destination isn't a
// directory, then we should Lchown the destination. Otherwise, we shouldn't
// Lchown the destination.
destStat, err := os.Stat(destination)
if err != nil {
// This should *never* be reached, because the destination must've already
// been created while untar-ing the context.
return err
}
doChownDestination := !destExisted || !destStat.IsDir()
// We Walk on the source rather than on the destination because we don't
// want to change permissions on things we haven't created or modified.
return filepath.Walk(source, func(fullpath string, info os.FileInfo, err error) error {
// Do not alter the walk root iff. it existed before, as it doesn't fall under
// the domain of "things we should chown".
if !doChownDestination && (source == fullpath) {
return nil
}
// Path is prefixed by source: substitute with destination instead.
cleaned, err := filepath.Rel(source, fullpath)
if err != nil {
return err
}
for _, file := range files {
if err := fixPermissions(filepath.Join(destination, file.Name()), 0, 0); err != nil {
return err
}
}
return nil
}
return fixPermissions(destination, 0, 0)
}
func fixPermissions(destination string, uid, gid int) error {
return filepath.Walk(destination, func(path string, info os.FileInfo, err error) error {
if err := os.Lchown(path, uid, gid); err != nil && !os.IsNotExist(err) {
return err
}
return nil
fullpath = path.Join(destination, cleaned)
return os.Lchown(fullpath, uid, gid)
})
}

View File

@@ -5,13 +5,13 @@ import (
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/docker/docker/daemon"
"github.com/docker/docker/engine"
"github.com/docker/docker/graph"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/urlutil"
"github.com/docker/docker/registry"
"github.com/docker/docker/utils"
)
@@ -36,6 +36,7 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
noCache = job.GetenvBool("nocache")
rm = job.GetenvBool("rm")
forceRm = job.GetenvBool("forcerm")
pull = job.GetenvBool("pull")
authConfig = &registry.AuthConfig{}
configFile = &registry.ConfigFile{}
tag string
@@ -58,8 +59,8 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
if remoteURL == "" {
context = ioutil.NopCloser(job.Stdin)
} else if utils.IsGIT(remoteURL) {
if !strings.HasPrefix(remoteURL, "git://") {
} else if urlutil.IsGitURL(remoteURL) {
if !urlutil.IsGitTransport(remoteURL) {
remoteURL = "https://" + remoteURL
}
root, err := ioutil.TempDir("", "docker-build-git")
@@ -77,7 +78,7 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
return job.Error(err)
}
context = c
} else if utils.IsURL(remoteURL) {
} else if urlutil.IsURL(remoteURL) {
f, err := utils.Download(remoteURL)
if err != nil {
return job.Error(err)
@@ -112,6 +113,7 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
UtilizeCache: !noCache,
Remove: rm,
ForceRemove: forceRm,
Pull: pull,
OutOld: job.Stdout,
StreamFormatter: sf,
AuthConfig: authConfig,
@@ -124,7 +126,7 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
}
if repoName != "" {
b.Daemon.Repositories().Set(repoName, tag, id, false)
b.Daemon.Repositories().Set(repoName, tag, id, true)
}
return engine.StatusOK
}

View File

@@ -12,6 +12,7 @@ import (
"fmt"
"strconv"
"strings"
"unicode"
)
var (
@@ -41,17 +42,139 @@ func parseSubCommand(rest string) (*Node, map[string]bool, error) {
// parse environment like statements. Note that this does *not* handle
// variable interpolation, which will be handled in the evaluator.
func parseEnv(rest string) (*Node, map[string]bool, error) {
node := &Node{}
rootnode := node
strs := TOKEN_WHITESPACE.Split(rest, 2)
// This is kind of tricky because we need to support the old
// variant: ENV name value
// as well as the new one: ENV name=value ...
// The trigger to know which one is being used will be whether we hit
// a space or = first. space ==> old, "=" ==> new
if len(strs) < 2 {
return nil, nil, fmt.Errorf("ENV must have two arguments")
const (
inSpaces = iota // looking for start of a word
inWord
inQuote
)
words := []string{}
phase := inSpaces
word := ""
quote := '\000'
blankOK := false
var ch rune
for pos := 0; pos <= len(rest); pos++ {
if pos != len(rest) {
ch = rune(rest[pos])
}
if phase == inSpaces { // Looking for start of word
if pos == len(rest) { // end of input
break
}
if unicode.IsSpace(ch) { // skip spaces
continue
}
phase = inWord // found it, fall thru
}
if (phase == inWord || phase == inQuote) && (pos == len(rest)) {
if blankOK || len(word) > 0 {
words = append(words, word)
}
break
}
if phase == inWord {
if unicode.IsSpace(ch) {
phase = inSpaces
if blankOK || len(word) > 0 {
words = append(words, word)
// Look for = and if no there assume
// we're doing the old stuff and
// just read the rest of the line
if !strings.Contains(word, "=") {
word = strings.TrimSpace(rest[pos:])
words = append(words, word)
break
}
}
word = ""
blankOK = false
continue
}
if ch == '\'' || ch == '"' {
quote = ch
blankOK = true
phase = inQuote
continue
}
if ch == '\\' {
if pos+1 == len(rest) {
continue // just skip \ at end
}
pos++
ch = rune(rest[pos])
}
word += string(ch)
continue
}
if phase == inQuote {
if ch == quote {
phase = inWord
continue
}
if ch == '\\' {
if pos+1 == len(rest) {
phase = inWord
continue // just skip \ at end
}
pos++
ch = rune(rest[pos])
}
word += string(ch)
}
}
node.Value = strs[0]
node.Next = &Node{}
node.Next.Value = strs[1]
if len(words) == 0 {
return nil, nil, fmt.Errorf("ENV must have some arguments")
}
// Old format (ENV name value)
var rootnode *Node
if !strings.Contains(words[0], "=") {
node := &Node{}
rootnode = node
strs := TOKEN_WHITESPACE.Split(rest, 2)
if len(strs) < 2 {
return nil, nil, fmt.Errorf("ENV must have two arguments")
}
node.Value = strs[0]
node.Next = &Node{}
node.Next.Value = strs[1]
} else {
var prevNode *Node
for i, word := range words {
if !strings.Contains(word, "=") {
return nil, nil, fmt.Errorf("Syntax error - can't find = in %q. Must be of the form: name=value", word)
}
parts := strings.SplitN(word, "=", 2)
name := &Node{}
value := &Node{}
name.Next = value
name.Value = parts[0]
value.Value = parts[1]
if i == 0 {
rootnode = name
} else {
prevNode.Next = name
}
prevNode = value
}
}
return rootnode, nil, nil
}

View File

@@ -103,10 +103,6 @@ func Parse(rwc io.Reader) (*Node, error) {
for scanner.Scan() {
scannedLine := strings.TrimLeftFunc(scanner.Text(), unicode.IsSpace)
if stripComments(scannedLine) == "" {
continue
}
line, child, err := parseLine(scannedLine)
if err != nil {
return nil, err
@@ -129,6 +125,12 @@ func Parse(rwc io.Reader) (*Node, error) {
break
}
}
if child == nil && line != "" {
line, child, err = parseLine(line)
if err != nil {
return nil, err
}
}
}
if child != nil {

View File

@@ -23,7 +23,6 @@
# the case. Therefore, you don't have to disable it anymore.
#
docker-version 0.6.1
FROM ubuntu:14.04
MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
@@ -76,7 +75,7 @@ ENV GOARM 5
RUN cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'
# Grab Go's cover tool for dead-simple code coverage testing
RUN go get code.google.com/p/go.tools/cmd/cover
RUN go get golang.org/x/tools/cmd/cover
# TODO replace FPM with some very minimal debhelper stuff
RUN gem install --no-rdoc --no-ri fpm --version 1.0.2

View File

@@ -1,4 +1,3 @@
(docker-version)
(from "ubuntu:14.04")
(maintainer "Tianon Gravi <admwiggin@gmail.com> (@tianon)")
(run "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils aufs-tools automake btrfs-tools build-essential curl dpkg-sig git iptables libapparmor-dev libcap-dev libsqlite3-dev lxc=1.0* mercurial pandoc parallel reprepro ruby1.9.1 ruby1.9.1-dev s3cmd=1.1.0* --no-install-recommends")
@@ -11,7 +10,7 @@
(env "DOCKER_CROSSPLATFORMS" "linux/386 linux/arm darwin/amd64 darwin/386 freebsd/amd64 freebsd/386 freebsd/arm")
(env "GOARM" "5")
(run "cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'")
(run "go get code.google.com/p/go.tools/cmd/cover")
(run "go get golang.org/x/tools/cmd/cover")
(run "gem install --no-rdoc --no-ri fpm --version 1.0.2")
(run "git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox")
(run "/bin/echo -e '[default]\\naccess_key=$AWS_ACCESS_KEY\\nsecret_key=$AWS_SECRET_KEY' > /.s3cfg")

15
builder/parser/testfiles/env/Dockerfile vendored Normal file
View File

@@ -0,0 +1,15 @@
FROM ubuntu
ENV name value
ENV name=value
ENV name=value name2=value2
ENV name="value value1"
ENV name=value\ value2
ENV name="value'quote space'value2"
ENV name='value"double quote"value2'
ENV name=value\ value2 name2=value2\ value3
ENV name=value \
name1=value1 \
name2="value2a \
value2b" \
name3="value3a\n\"value3b\"" \
name4="value4a\\nvalue4b" \

10
builder/parser/testfiles/env/result vendored Normal file
View File

@@ -0,0 +1,10 @@
(from "ubuntu")
(env "name" "value")
(env "name" "value")
(env "name" "value" "name2" "value2")
(env "name" "value value1")
(env "name" "value value2")
(env "name" "value'quote space'value2")
(env "name" "value\"double quote\"value2")
(env "name" "value value2" "name2" "value2 value3")
(env "name" "value" "name1" "value1" "name2" "value2a value2b" "name3" "value3an\"value3b\"" "name4" "value4a\\nvalue4b")

View File

@@ -76,7 +76,7 @@ check_flags() {
for flag in "$@"; do
echo "- $(check_flag "$flag")"
done
}
}
if [ ! -e "$CONFIG" ]; then
wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config..."
@@ -135,7 +135,7 @@ flags=(
DEVPTS_MULTIPLE_INSTANCES
CGROUPS CGROUP_CPUACCT CGROUP_DEVICE CGROUP_FREEZER CGROUP_SCHED
MACVLAN VETH BRIDGE
NF_NAT_IPV4 IP_NF_TARGET_MASQUERADE
NF_NAT_IPV4 IP_NF_FILTER IP_NF_TARGET_MASQUERADE
NETFILTER_XT_MATCH_{ADDRTYPE,CONNTRACK}
NF_NAT NF_NAT_NEEDED
)
@@ -153,16 +153,20 @@ check_flags "${flags[@]}"
echo '- Storage Drivers:'
{
echo '- "'$(wrap_color 'aufs' blue)'":'
check_flags AUFS_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /'
check_flags AUFS_FS | sed 's/^/ /'
if ! is_set AUFS_FS && grep -q aufs /proc/filesystems; then
echo " $(wrap_color '(note that some kernels include AUFS patches but not the AUFS_FS flag)' bold black)"
fi
check_flags EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /'
echo '- "'$(wrap_color 'btrfs' blue)'":'
check_flags BTRFS_FS | sed 's/^/ /'
echo '- "'$(wrap_color 'devicemapper' blue)'":'
check_flags BLK_DEV_DM DM_THIN_PROVISIONING EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /'
echo '- "'$(wrap_color 'overlay' blue)'":'
check_flags OVERLAY_FS | sed 's/^/ /'
} | sed 's/^/ /'
echo

View File

@@ -0,0 +1,2 @@
Tianon Gravi <admwiggin@gmail.com> (@tianon)
Jessie Frazelle <jess@docker.com> (@jfrazelle)

View File

@@ -1,8 +1,8 @@
#!bash
#!/bin/bash
#
# bash completion file for core docker commands
#
# This script provides supports completion of:
# This script provides completion of:
# - commands and their options
# - container ids and names
# - image repos and tags
@@ -11,9 +11,9 @@
# To enable the completions either:
# - place this file in /etc/bash_completion.d
# or
# - copy this file and add the line below to your .bashrc after
# bash completion features are loaded
# . docker.bash
# - copy this file to e.g. ~/.docker-completion.sh and add the line
# below to your .bashrc after bash completion features are loaded
# . ~/.docker-completion.sh
#
# Note:
# Currently, the completions will not work if the docker daemon is not
@@ -99,13 +99,60 @@ __docker_pos_first_nonflag() {
echo $counter
}
__docker_resolve_hostname() {
command -v host >/dev/null 2>&1 || return
COMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') )
}
__docker_capabilities() {
# The list of capabilities is defined in types.go, ALL was added manually.
COMPREPLY=( $( compgen -W "
ALL
AUDIT_CONTROL
AUDIT_WRITE
BLOCK_SUSPEND
CHOWN
DAC_OVERRIDE
DAC_READ_SEARCH
FOWNER
FSETID
IPC_LOCK
IPC_OWNER
KILL
LEASE
LINUX_IMMUTABLE
MAC_ADMIN
MAC_OVERRIDE
MKNOD
NET_ADMIN
NET_BIND_SERVICE
NET_BROADCAST
NET_RAW
SETFCAP
SETGID
SETPCAP
SETUID
SYS_ADMIN
SYS_BOOT
SYS_CHROOT
SYSLOG
SYS_MODULE
SYS_NICE
SYS_PACCT
SYS_PTRACE
SYS_RAWIO
SYS_RESOURCE
SYS_TIME
SYS_TTY_CONFIG
WAKE_ALARM
" -- "$cur" ) )
}
_docker_docker() {
case "$prev" in
-H)
return
;;
*)
;;
esac
case "$cur" in
@@ -138,8 +185,6 @@ _docker_build() {
__docker_image_repos_and_tags
return
;;
*)
;;
esac
case "$cur" in
@@ -160,8 +205,6 @@ _docker_commit() {
-m|--message|-a|--author|--run)
return
;;
*)
;;
esac
case "$cur" in
@@ -222,7 +265,7 @@ _docker_create() {
__docker_containers_all
return
;;
-v|--volume)
-v|--volume|--device)
case "$cur" in
*:*)
# TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine)
@@ -255,19 +298,72 @@ _docker_create() {
esac
return
;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf)
--add-host)
case "$cur" in
*:)
__docker_resolve_hostname
return
;;
esac
;;
--cap-add|--cap-drop)
__docker_capabilities
return
;;
*)
--net)
case "$cur" in
container:*)
local cur=${cur#*:}
__docker_containers_all
;;
*)
COMPREPLY=( $( compgen -W "bridge none container: host" -- "$cur") )
if [ "${COMPREPLY[*]}" = "container:" ] ; then
compopt -o nospace
fi
;;
esac
return
;;
--restart)
case "$cur" in
on-failure:*)
;;
*)
COMPREPLY=( $( compgen -W "no on-failure on-failure: always" -- "$cur") )
;;
esac
return
;;
--security-opt)
case "$cur" in
label:*:*)
;;
label:*)
local cur=${cur##*:}
COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "$cur") )
if [ "${COMPREPLY[*]}" != "disable" ] ; then
compopt -o nospace
fi
;;
*)
COMPREPLY=( $( compgen -W "label apparmor" -S ":" -- "$cur") )
compopt -o nospace
;;
esac
return
;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir -c --cpu-shares --name -a --attach -v --volume --link -e --env -p --publish --expose --dns --volumes-from --lxc-conf" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf')
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart')
if [ $cword -eq $counter ]; then
__docker_image_repos_and_tags_and_ids
@@ -288,16 +384,12 @@ _docker_events() {
--since)
return
;;
*)
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--since" -- "$cur" ) )
;;
*)
;;
esac
}
@@ -376,8 +468,6 @@ _docker_inspect() {
-f|--format)
return
;;
*)
;;
esac
case "$cur" in
@@ -403,16 +493,12 @@ _docker_login() {
-u|--username|-p|--password|-e|--email)
return
;;
*)
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-u --username -p --password -e --email" -- "$cur" ) )
;;
*)
;;
esac
}
@@ -452,16 +538,12 @@ _docker_ps() {
-n)
return
;;
*)
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-q --quiet -s --size -a --all --no-trunc -l --latest --since --before -n" -- "$cur" ) )
;;
*)
;;
esac
}
@@ -470,8 +552,6 @@ _docker_pull() {
-t|--tag)
return
;;
*)
;;
esac
case "$cur" in
@@ -499,8 +579,6 @@ _docker_restart() {
-t|--time)
return
;;
*)
;;
esac
case "$cur" in
@@ -520,7 +598,6 @@ _docker_rm() {
return
;;
*)
local force=
for arg in "${COMP_WORDS[@]}"; do
case "$arg" in
-f|--force)
@@ -553,7 +630,7 @@ _docker_run() {
__docker_containers_all
return
;;
-v|--volume)
-v|--volume|--device)
case "$cur" in
*:*)
# TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine)
@@ -586,20 +663,72 @@ _docker_run() {
esac
return
;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf)
--add-host)
case "$cur" in
*:)
__docker_resolve_hostname
return
;;
esac
;;
--cap-add|--cap-drop)
__docker_capabilities
return
;;
*)
--net)
case "$cur" in
container:*)
local cur=${cur#*:}
__docker_containers_all
;;
*)
COMPREPLY=( $( compgen -W "bridge none container: host" -- "$cur") )
if [ "${COMPREPLY[*]}" = "container:" ] ; then
compopt -o nospace
fi
;;
esac
return
;;
--restart)
case "$cur" in
on-failure:*)
;;
*)
COMPREPLY=( $( compgen -W "no on-failure on-failure: always" -- "$cur") )
;;
esac
return
;;
--security-opt)
case "$cur" in
label:*:*)
;;
label:*)
local cur=${cur##*:}
COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "$cur") )
if [ "${COMPREPLY[*]}" != "disable" ] ; then
compopt -o nospace
fi
;;
*)
COMPREPLY=( $( compgen -W "label apparmor" -S ":" -- "$cur") )
compopt -o nospace
;;
esac
return
;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--rm -d --detach -n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env -p --publish --expose --dns --volumes-from --lxc-conf --security-opt" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--rm -d --detach --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt')
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart')
if [ $cword -eq $counter ]; then
__docker_image_repos_and_tags_and_ids
@@ -620,16 +749,12 @@ _docker_search() {
-s|--stars)
return
;;
*)
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--no-trunc --automated -s --stars" -- "$cur" ) )
;;
*)
;;
esac
}
@@ -649,8 +774,6 @@ _docker_stop() {
-t|--time)
return
;;
*)
;;
esac
case "$cur" in
@@ -752,7 +875,7 @@ _docker() {
local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword
local command='docker'
local command='docker' cpos=0
local counter=1
while [ $counter -lt $cword ]; do
case "${words[$counter]}" in

View File

@@ -53,7 +53,7 @@ complete -c docker -f -n '__fish_docker_no_subcommand' -s d -l daemon -d 'Enable
complete -c docker -f -n '__fish_docker_no_subcommand' -l dns -d 'Force docker to use specific DNS servers'
complete -c docker -f -n '__fish_docker_no_subcommand' -s e -l exec-driver -d 'Force the docker runtime to use a specific exec driver'
complete -c docker -f -n '__fish_docker_no_subcommand' -s g -l graph -d 'Path to use as the root of the docker runtime'
complete -c docker -f -n '__fish_docker_no_subcommand' -l icc -d 'Enable inter-container communication'
complete -c docker -f -n '__fish_docker_no_subcommand' -l icc -d 'Allow unrestricted inter-container and Docker daemon host communication'
complete -c docker -f -n '__fish_docker_no_subcommand' -l ip -d 'Default IP address to use when binding container ports'
complete -c docker -f -n '__fish_docker_no_subcommand' -l ip-forward -d 'Disable enabling of net.ipv4.ip_forward'
complete -c docker -f -n '__fish_docker_no_subcommand' -l iptables -d "Disable docker's addition of iptables rules"
@@ -67,7 +67,7 @@ complete -c docker -f -n '__fish_docker_no_subcommand' -s v -l version -d 'Print
# attach
complete -c docker -f -n '__fish_docker_no_subcommand' -a attach -d 'Attach to a running container'
complete -c docker -A -f -n '__fish_seen_subcommand_from attach' -l no-stdin -d 'Do not attach stdin'
complete -c docker -A -f -n '__fish_seen_subcommand_from attach' -l sig-proxy -d 'Proxify all received signal to the process (even in non-tty mode)'
complete -c docker -A -f -n '__fish_seen_subcommand_from attach' -l sig-proxy -d 'Proxify all received signal to the process (non-TTY mode only)'
complete -c docker -A -f -n '__fish_seen_subcommand_from attach' -a '(__fish_print_docker_containers running)' -d "Container"
# build
@@ -185,7 +185,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s l -l latest -d '
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s n -d 'Show n last created containers, include non-running ones.'
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -l no-trunc -d "Don't truncate output"
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s q -l quiet -d 'Only display numeric IDs'
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s s -l size -d 'Display sizes'
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s s -l size -d 'Display total file sizes'
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -l since -d 'Show only containers created since Id or Name, include non-running ones.'
# pull
@@ -237,7 +237,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l name -d 'Assign
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s p -l publish -d "Publish a container's port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) (use 'docker port' to see the actual mapping)"
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l privileged -d 'Give extended privileges to this container'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l rm -d 'Automatically remove the container when it exits (incompatible with -d)'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l sig-proxy -d 'Proxify all received signal to the process (even in non-tty mode)'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l sig-proxy -d 'Proxify all received signal to the process (non-TTY mode only)'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s t -l tty -d 'Allocate a pseudo-tty'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s u -l user -d 'Username or UID'
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s v -l volume -d 'Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)'

View File

@@ -177,7 +177,9 @@ __docker_commands () {
if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands) \
&& ! _retrieve_cache docker_subcommands;
then
_docker_subcommands=(${${${${(f)"$(_call_program commands docker 2>&1)"}[5,-1]}## #}/ ##/:})
local -a lines
lines=(${(f)"$(_call_program commands docker 2>&1)"})
_docker_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
_docker_subcommands=($_docker_subcommands 'help:Show help for a command')
_store_cache docker_subcommands _docker_subcommands
fi
@@ -190,22 +192,23 @@ __docker_subcommand () {
(attach)
_arguments \
'--no-stdin[Do not attach stdin]' \
'--sig-proxy[Proxify all received signal]' \
'--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]' \
':containers:__docker_runningcontainers'
;;
(build)
_arguments \
'--force-rm[Always remove intermediate containers, even after unsuccessful builds]' \
'--force-rm[Always remove intermediate containers]' \
'--no-cache[Do not use cache when building the image]' \
'-q[Suppress verbose build output]' \
{-q,--quiet}'[Suppress verbose build output]' \
'--rm[Remove intermediate containers after a successful build]' \
'-t:repository:__docker_repositories_with_tags' \
{-t,--tag=-}'[Repository, name and tag to be applied]:repository:__docker_repositories_with_tags' \
':path or URL:_directories'
;;
(commit)
_arguments \
'--author=-[Author]:author: ' \
'-m[Commit message]:message: ' \
{-a,--author=-}'[Author]:author: ' \
{-m,--message=-}'[Commit message]:message: ' \
{-p,--pause}'[Pause container during commit]' \
'--run=-[Configuration automatically applied when the image is run]:configuration: ' \
':container:__docker_containers' \
':repository:__docker_repositories_with_tags'
@@ -224,60 +227,40 @@ __docker_subcommand () {
;;
esac
;;
(create)
_arguments \
'-P[Publish all exposed ports to the host]' \
'-a[Attach to stdin, stdout or stderr]' \
'-c=-[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)' \
'--cidfile=-[Write the container ID to the file]:CID file:_files' \
'*--dns=-[Set custom dns servers]:dns server: ' \
'*-e=-[Set environment variables]:environment variable: ' \
'--entrypoint=-[Overwrite the default entrypoint of the image]:entry point: ' \
'*--expose=-[Expose a port from the container without publishing it]: ' \
'-h=-[Container host name]:hostname:_hosts' \
'-i[Keep stdin open even if not attached]' \
'--link=-[Add link to another container]:link:->link' \
'--lxc-conf=-[Add custom lxc options]:lxc options: ' \
'-m=-[Memory limit (in bytes)]:limit: ' \
'--name=-[Container name]:name: ' \
'*-p=-[Expose a container'"'"'s port to the host]:port:_ports' \
'--privileged[Give extended privileges to this container]' \
'-t[Allocate a pseudo-tty]' \
'-u=-[Username or UID]:user:_users' \
'*-v=-[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]:volume: '\
'--volumes-from=-[Mount volumes from the specified container]:volume: ' \
'-w=-[Working directory inside the container]:directory:_directories' \
'(-):images:__docker_images' \
'(-):command: _command_names -e' \
'*::arguments: _normal'
(diff|export)
_arguments '*:containers:__docker_containers'
;;
(events)
_arguments \
'--since=-[Events created since this timestamp]:timestamp: ' \
'--until=-[Events created until this timestamp]:timestamp: '
;;
(exec)
_arguments \
'-d[Detached mode: leave the container running in the background]' \
'-i[Keep stdin open even if not attached]' \
'-t[Allocate a pseudo-tty]' \
{-d,--detach}'[Detached mode: leave the container running in the background]' \
{-i,--interactive}'[Keep stdin open even if not attached]' \
{-t,--tty}'[Allocate a pseudo-tty]' \
':containers:__docker_runningcontainers'
;;
(history)
_arguments \
'--no-trunc[Do not truncate output]' \
'-q[Only show numeric IDs]' \
{-q,--quiet}'[Only show numeric IDs]' \
'*:images:__docker_images'
;;
(images)
_arguments \
'-a[Show all images]' \
{-a,--all}'[Show all images]' \
'*'{-f,--filter=-}'[Filter values]:filter: ' \
'--no-trunc[Do not truncate output]' \
'-q[Only show numeric IDs]' \
{-q,--quiet}'[Only show numeric IDs]' \
'--tree[Output graph in tree format]' \
'--viz[Output graph in graphviz format]' \
':repository:__docker_repositories'
;;
(inspect)
_arguments \
'--format=-[Format the output using the given go template]:template: ' \
{-f,--format=-}'[Format the output using the given go template]:template: ' \
'*:containers:__docker_containers'
;;
(import)
@@ -298,20 +281,29 @@ __docker_subcommand () {
'3:file:_files'
;;
(kill)
_arguments '*:containers:__docker_runningcontainers'
_arguments \
{-s,--signal=-}'[Signal to send]:signal:_signals' \
'*:containers:__docker_runningcontainers'
;;
(load)
_arguments \
{-i,--input=-}'[Read from tar archive file]:tar:_files'
;;
(login)
_arguments \
'-e[Email]:email: ' \
'-p[Password]:password: ' \
'-u[Username]:username: ' \
{-e,--email=-}'[Email]:email: ' \
{-p,--password=-}'[Password]:password: ' \
{-u,--user=-}'[Username]:username: ' \
':server: '
;;
(logout)
_arguments \
':server: '
;;
(logs)
_arguments \
'-f[Follow log output]' \
{-f,--follow}'[Follow log output]' \
{-t,--timestamps}'[Show timestamps]' \
'*:containers:__docker_containers'
;;
(port)
@@ -319,24 +311,32 @@ __docker_subcommand () {
'1:containers:__docker_runningcontainers' \
'2:port:_ports'
;;
(pause|unpause)
_arguments \
'1:containers:__docker_runningcontainers'
;;
(start)
_arguments \
'-a[Attach container'"'"'s stdout/stderr and forward all signals]' \
'-i[Attach container'"'"'s stding]' \
{-a,--attach}'[Attach container'"'"'s stdout/stderr and forward all signals]' \
{-i,--interactive}'[Attach container'"'"'s stding]' \
'*:containers:__docker_stoppedcontainers'
;;
(rm)
_arguments \
'--link[Remove the specified link and not the underlying container]' \
'-v[Remove the volumes associated to the container]' \
{-f,--force}'[Force removal]' \
{-l,--link}'[Remove the specified link and not the underlying container]' \
{-v,--volumes}'[Remove the volumes associated to the container]' \
'*:containers:__docker_stoppedcontainers'
;;
(rmi)
_arguments \
{-f,--force}'[Force removal]' \
'--no-prune[Do not delete untagged parents]' \
'*:images:__docker_images'
;;
(restart|stop)
_arguments '-t[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)' \
_arguments \
{-t,--time=-}'[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)' \
'*:containers:__docker_runningcontainers'
;;
(top)
@@ -352,47 +352,58 @@ __docker_subcommand () {
;;
(ps)
_arguments \
'-a[Show all containers]' \
{-a,--all}'[Show all containers]' \
'--before=-[Show only container created before...]:containers:__docker_containers' \
'-l[Show only the latest created container]' \
'*'{-f,--filter=-}'[Filter values]:filter: ' \
{-l,--latest}'[Show only the latest created container]' \
'-n[Show n last created containers, include non-running one]:n:(1 5 10 25 50)' \
'--no-trunc[Do not truncate output]' \
'-q[Only show numeric IDs]' \
'-s[Display sizes]' \
{-q,--quiet}'[Only show numeric IDs]' \
{-s,--size}'[Display total file sizes]' \
'--since=-[Show only containers created since...]:containers:__docker_containers'
;;
(tag)
_arguments \
'-f[force]'\
{-f,--force}'[force]'\
':image:__docker_images'\
':repository:__docker_repositories_with_tags'
;;
(run)
(create|run)
_arguments \
'-P[Publish all exposed ports to the host]' \
'-a[Attach to stdin, stdout or stderr]' \
'-c[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)' \
{-a,--attach}'[Attach to stdin, stdout or stderr]' \
'*--add-host=-[Add a custom host-to-IP mapping]:host\:ip mapping: ' \
{-c,--cpu-shares=-}'[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)' \
'*--cap-add=-[Add Linux capabilities]:capability: ' \
'*--cap-drop=-[Drop Linux capabilities]:capability: ' \
'--cidfile=-[Write the container ID to the file]:CID file:_files' \
'-d[Detached mode: leave the container running in the background]' \
'--cpuset=-[CPUs in which to allow execution]:CPU set: ' \
{-d,--detach}'[Detached mode: leave the container running in the background]' \
'*--device=-[Add a host device to the container]:device:_files' \
'*--dns=-[Set custom dns servers]:dns server: ' \
'*-e[Set environment variables]:environment variable: ' \
'*--dns-search=-[Set custom DNS search domains]:dns domains: ' \
'*'{-e,--environment=-}'[Set environment variables]:environment variable: ' \
'--entrypoint=-[Overwrite the default entrypoint of the image]:entry point: ' \
'*--env-file=-[Read environment variables from a file]:environment file:_files' \
'*--expose=-[Expose a port from the container without publishing it]: ' \
'-h[Container host name]:hostname:_hosts' \
'-i[Keep stdin open even if not attached]' \
'--link=-[Add link to another container]:link:->link' \
'--lxc-conf=-[Add custom lxc options]:lxc options: ' \
{-h,--hostname=-}'[Container host name]:hostname:_hosts' \
{-i,--interactive}'[Keep stdin open even if not attached]' \
'*--link=-[Add link to another container]:link:->link' \
'*--lxc-conf=-[Add custom lxc options]:lxc options: ' \
'-m[Memory limit (in bytes)]:limit: ' \
'--name=-[Container name]:name: ' \
'*-p[Expose a container'"'"'s port to the host]:port:_ports' \
'--net=-[Network mode]:network mode:(bridge none container: host)' \
{-P,--publish-all}'[Publish all exposed ports]' \
'*'{-p,--publish=-}'[Expose a container'"'"'s port to the host]:port:_ports' \
'--privileged[Give extended privileges to this container]' \
'--restart=-[Restart policy]:restart policy:(no on-failure always)' \
'--rm[Remove intermediate containers when it exits]' \
'--sig-proxy[Proxify all received signal]' \
'-t[Allocate a pseudo-tty]' \
'-u[Username or UID]:user:_users' \
'*-v[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]:volume: '\
'--volumes-from=-[Mount volumes from the specified container]:volume: ' \
'-w[Working directory inside the container]:directory:_directories' \
'*--security-opt=-[Security options]:security option: ' \
'--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]' \
{-t,--tty}'[Allocate a pseudo-tty]' \
{-u,--user=-}'[Username or UID]:user:_users' \
'*-v[Bind mount a volume]:volume: '\
'*--volumes-from=-[Mount volumes from the specified container]:volume: ' \
{-w,--workdir=-}'[Working directory inside the container]:directory:_directories' \
'(-):images:__docker_images' \
'(-):command: _command_names -e' \
'*::arguments: _normal'
@@ -416,6 +427,7 @@ __docker_subcommand () {
;;
(save)
_arguments \
{-o,--output=-}'[Write to file]:file:_files' \
':images:__docker_images'
;;
(wait)

View File

@@ -20,8 +20,6 @@
# docker run --volumes-from chromium-data -v /tmp/.X11-unix:/tmp/.X11-unix \
# -e DISPLAY=unix$DISPLAY chromium
DOCKER_VERSION 1.3
# Base docker image
FROM debian:jessie
MAINTAINER Jessica Frazelle <jess@docker.com>

View File

@@ -17,8 +17,6 @@
# -e DISPLAY=unix$DISPLAY gparted
#
DOCKER-VERSION 1.3
# Base docker image
FROM debian:jessie
MAINTAINER Jessica Frazelle <jess@docker.com>

View File

@@ -3,12 +3,15 @@ package main
import (
"flag"
"fmt"
"github.com/docker/docker/daemon/graphdriver/devmapper"
"os"
"path"
"sort"
"strconv"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver/devmapper"
"github.com/docker/docker/pkg/devicemapper"
)
func usage() {
@@ -60,6 +63,7 @@ func main() {
if *flDebug {
os.Setenv("DEBUG", "1")
log.SetLevel(log.DebugLevel)
}
if flag.NArg() < 1 {
@@ -69,7 +73,7 @@ func main() {
args := flag.Args()
home := path.Join(*root, "devicemapper")
devices, err := devmapper.NewDeviceSet(home, false)
devices, err := devmapper.NewDeviceSet(home, false, nil)
if err != nil {
fmt.Println("Can't initialize device mapper: ", err)
os.Exit(1)
@@ -142,7 +146,7 @@ func main() {
usage()
}
err := devices.RemoveDevice(args[1])
err := devicemapper.RemoveDevice(args[1])
if err != nil {
fmt.Println("Can't remove device: ", err)
os.Exit(1)
@@ -153,7 +157,7 @@ func main() {
usage()
}
err := devices.MountDevice(args[1], args[2], false)
err := devices.MountDevice(args[1], args[2], "")
if err != nil {
fmt.Println("Can't create snap device: ", err)
os.Exit(1)

View File

@@ -2,8 +2,6 @@
# This Dockerfile will create an image that allows to generate upstart and
# systemd scripts (more to come)
#
# docker-version 0.6.2
#
FROM ubuntu:12.10
MAINTAINER Guillaume J. Charmes <guillaume@docker.com>

View File

@@ -1,2 +1,3 @@
Lokesh Mandvekar <lsm5@fedoraproject.org> (@lsm5)
Brandon Philips <brandon.philips@coreos.com> (@philips)
Jessie Frazelle <jess@docker.com> (@jfrazelle)

View File

@@ -0,0 +1,2 @@
Tianon Gravi <admwiggin@gmail.com> (@tianon)
Jessie Frazelle <jess@docker.com> (@jfrazelle)

View File

@@ -60,6 +60,6 @@ mknod -m 600 $DEV/initctl p
mknod -m 666 $DEV/ptmx c 5 2
ln -sf /proc/self/fd $DEV/fd
tar --numeric-owner -C $ROOTFS -c . | docker import - archlinux
tar --numeric-owner --xattrs --acls -C $ROOTFS -c . | docker import - archlinux
docker run -i -t archlinux echo Success.
rm -rf $ROOTFS

View File

@@ -57,7 +57,7 @@ mknod -m 666 "$target"/dev/tty0 c 4 0
mknod -m 666 "$target"/dev/urandom c 1 9
mknod -m 666 "$target"/dev/zero c 1 5
yum -c "$yum_config" --installroot="$target" --setopt=tsflags=nodocs \
yum -c "$yum_config" --installroot="$target" --releasever=/ --setopt=tsflags=nodocs \
--setopt=group_package_types=mandatory -y groupinstall Core
yum -c "$yum_config" --installroot="$target" -y clean all

View File

@@ -15,9 +15,12 @@ done
suite="$1"
shift
# allow for DEBOOTSTRAP=qemu-debootstrap ./mkimage.sh ...
: ${DEBOOTSTRAP:=debootstrap}
(
set -x
debootstrap "${before[@]}" "$suite" "$rootfsDir" "$@"
$DEBOOTSTRAP "${before[@]}" "$suite" "$rootfsDir" "$@"
)
# now for some Docker-specific tweaks

View File

@@ -3,4 +3,5 @@ Victor Vieux <vieux@docker.com> (@vieux)
Michael Crosby <michael@crosbymichael.com> (@crosbymichael)
Cristian Staretu <cristian.staretu@gmail.com> (@unclejack)
Tibor Vass <teabee89@gmail.com> (@tiborvass)
Vishnu Kannan <vishnuk@google.com> (@vishh)
volumes.go: Brian Goff <cpuguy83@gmail.com> (@cpuguy83)

View File

@@ -6,10 +6,10 @@ import (
"os"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/utils"
)
@@ -83,7 +83,6 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) engine.Status {
var (
cStdin io.ReadCloser
cStdout, cStderr io.Writer
cStdinCloser io.Closer
)
if stdin {
@@ -94,7 +93,6 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) engine.Status {
io.Copy(w, job.Stdin)
}()
cStdin = r
cStdinCloser = job.Stdin
}
if stdout {
cStdout = job.Stdout
@@ -103,7 +101,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) engine.Status {
cStderr = job.Stderr
}
<-daemon.Attach(&container.StreamConfig, container.Config.OpenStdin, container.Config.StdinOnce, container.Config.Tty, cStdin, cStdinCloser, cStdout, cStderr)
<-daemon.attach(&container.StreamConfig, container.Config.OpenStdin, container.Config.StdinOnce, container.Config.Tty, cStdin, cStdout, cStderr)
// If we are in stdinonce mode, wait for the process to end
// otherwise, simply return
if container.Config.StdinOnce && !container.Config.Tty {
@@ -113,13 +111,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) engine.Status {
return engine.StatusOK
}
// FIXME: this should be private, and every outside subsystem
// should go through the "container_attach" job. But that would require
// that job to be properly documented, as well as the relationship between
// Attach and ContainerAttach.
//
// This method is in use by builder/builder.go.
func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, tty bool, stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error {
func (daemon *Daemon) attach(streamConfig *StreamConfig, openStdin, stdinOnce, tty bool, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) chan error {
var (
cStdout, cStderr io.ReadCloser
nJobs int
@@ -136,10 +128,10 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
go func() {
log.Debugf("attach: stdin: begin")
defer log.Debugf("attach: stdin: end")
// No matter what, when stdin is closed (io.Copy unblock), close stdout and stderr
if stdinOnce && !tty {
defer cStdin.Close()
} else {
// No matter what, when stdin is closed (io.Copy unblock), close stdout and stderr
defer func() {
if cStdout != nil {
cStdout.Close()
@@ -179,9 +171,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
if stdinOnce && stdin != nil {
defer stdin.Close()
}
if stdinCloser != nil {
defer stdinCloser.Close()
}
_, err := io.Copy(stdout, cStdout)
if err == io.ErrClosedPipe {
err = nil
@@ -195,9 +184,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
} else {
// Point stdout of container to a no-op writer.
go func() {
if stdinCloser != nil {
defer stdinCloser.Close()
}
if cStdout, err := streamConfig.StdoutPipe(); err != nil {
log.Errorf("attach: stdout pipe: %s", err)
} else {
@@ -219,9 +205,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
if stdinOnce && stdin != nil {
defer stdin.Close()
}
if stdinCloser != nil {
defer stdinCloser.Close()
}
_, err := io.Copy(stderr, cStderr)
if err == io.ErrClosedPipe {
err = nil
@@ -235,10 +218,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
} else {
// Point stderr at a no-op writer.
go func() {
if stdinCloser != nil {
defer stdinCloser.Close()
}
if cStderr, err := streamConfig.StderrPipe(); err != nil {
log.Errorf("attach: stdout pipe: %s", err)
} else {
@@ -257,8 +236,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
}
}()
// FIXME: how to 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++ {
log.Debugf("attach: waiting for job %d/%d", i+1, nJobs)
if err := <-errors; err != nil {

View File

@@ -40,6 +40,8 @@ type Config struct {
DisableNetwork bool
EnableSelinuxSupport bool
Context map[string][]string
TrustKeyPath string
Labels []string
}
// InstallFlags adds command-line options to the top-level flag parser for
@@ -57,7 +59,7 @@ func (config *Config) InstallFlags() {
flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)\nthis subnet must be nested in the bridge subnet (which is defined by -b or --bip)")
opts.ListVar(&config.InsecureRegistries, []string{"-insecure-registry"}, "Enable insecure communication with specified registries (no certificate verification for HTTPS and enable HTTP fallback) (e.g., localhost:5000 or 10.20.0.0/16)")
flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Allow unrestricted inter-container and Docker daemon host communication")
flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")
flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support. SELinux does not presently support the BTRFS storage driver")
@@ -68,6 +70,7 @@ func (config *Config) InstallFlags() {
opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "Force Docker to use specific DNS servers")
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
opts.MirrorListVar(&config.Mirrors, []string{"-registry-mirror"}, "Specify a preferred Docker registry mirror")
opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon (displayed in `docker info`)")
// Localhost is by default considered as an insecure registry
// This is a stop-gap for people who are running a private registry on localhost (especially on Boot2docker).
@@ -78,7 +81,7 @@ func (config *Config) InstallFlags() {
config.InsecureRegistries = append(config.InsecureRegistries, "127.0.0.0/8")
}
func GetDefaultNetworkMtu() int {
func getDefaultNetworkMtu() int {
if iface, err := networkdriver.GetDefaultRouteIface(); err == nil {
return iface.MTU
}

View File

@@ -17,6 +17,7 @@ import (
"github.com/docker/libcontainer/devices"
"github.com/docker/libcontainer/label"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/engine"
"github.com/docker/docker/image"
@@ -25,7 +26,6 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/networkfs/etchosts"
"github.com/docker/docker/pkg/networkfs/resolvconf"
"github.com/docker/docker/pkg/promise"
@@ -102,13 +102,17 @@ func (container *Container) FromDisk() error {
return err
}
data, err := ioutil.ReadFile(pth)
jsonSource, err := os.Open(pth)
if err != nil {
return err
}
defer jsonSource.Close()
dec := json.NewDecoder(jsonSource)
// Load container settings
// udp broke compat of docker.PortMapping, but it's not used when loading a container, we can skip it
if err := json.Unmarshal(data, container); err != nil && !strings.Contains(err.Error(), "docker.PortMapping") {
if err := dec.Decode(container); err != nil && !strings.Contains(err.Error(), "docker.PortMapping") {
return err
}
@@ -229,6 +233,18 @@ func populateCommand(c *Container, env []string) error {
return fmt.Errorf("invalid network mode: %s", c.hostConfig.NetworkMode)
}
ipc := &execdriver.Ipc{}
if c.hostConfig.IpcMode.IsContainer() {
ic, err := c.getIpcContainer()
if err != nil {
return err
}
ipc.ContainerID = ic.ID
} else {
ipc.HostIpc = c.hostConfig.IpcMode.IsHost()
}
// Build lists of devices allowed and created within the container.
userSpecifiedDevices := make([]*devices.Device, len(c.hostConfig.Devices))
for i, deviceMapping := range c.hostConfig.Devices {
@@ -244,7 +260,10 @@ func populateCommand(c *Container, env []string) error {
autoCreatedDevices := append(devices.DefaultAutoCreatedDevices, userSpecifiedDevices...)
// TODO: this can be removed after lxc-conf is fully deprecated
lxcConfig := mergeLxcConfIntoOptions(c.hostConfig)
lxcConfig, err := mergeLxcConfIntoOptions(c.hostConfig)
if err != nil {
return err
}
resources := &execdriver.Resources{
Memory: c.Config.Memory,
@@ -270,6 +289,7 @@ func populateCommand(c *Container, env []string) error {
InitPath: "/.dockerinit",
WorkingDir: c.Config.WorkingDir,
Network: en,
Ipc: ipc,
Resources: resources,
AllowedDevices: allowedDevices,
AutoCreatedDevices: autoCreatedDevices,
@@ -297,6 +317,12 @@ func (container *Container) Start() (err error) {
// setup has been cleaned up properly
defer func() {
if err != nil {
container.setError(err)
// if no one else has set it, make sure we don't leave it at zero
if container.ExitCode == 0 {
container.ExitCode = 128
}
container.toDisk()
container.cleanup()
}
}()
@@ -414,7 +440,7 @@ func (container *Container) buildHostsFiles(IP string) error {
}
container.HostsPath = hostsPath
extraContent := make(map[string]string)
var extraContent []etchosts.Record
children, err := container.daemon.Children(container.Name)
if err != nil {
@@ -423,15 +449,15 @@ func (container *Container) buildHostsFiles(IP string) error {
for linkAlias, child := range children {
_, alias := path.Split(linkAlias)
extraContent[alias] = child.NetworkSettings.IPAddress
extraContent = append(extraContent, etchosts.Record{Hosts: alias, IP: child.NetworkSettings.IPAddress})
}
for _, extraHost := range container.hostConfig.ExtraHosts {
parts := strings.Split(extraHost, ":")
extraContent[parts[0]] = parts[1]
extraContent = append(extraContent, etchosts.Record{Hosts: parts[0], IP: parts[1]})
}
return etchosts.Build(container.HostsPath, IP, container.Config.Hostname, container.Config.Domainname, &extraContent)
return etchosts.Build(container.HostsPath, IP, container.Config.Hostname, container.Config.Domainname, extraContent)
}
func (container *Container) buildHostnameAndHostsFiles(IP string) error {
@@ -455,6 +481,7 @@ func (container *Container) AllocateNetwork() error {
)
job := eng.Job("allocate_interface", container.ID)
job.Setenv("RequestedMac", container.Config.MacAddress)
if env, err = job.Stdout.AddEnv(); err != nil {
return err
}
@@ -525,7 +552,9 @@ func (container *Container) ReleaseNetwork() {
}
eng := container.daemon.eng
eng.Job("release_interface", container.ID).Run()
job := eng.Job("release_interface", container.ID)
job.SetenvBool("overrideShutdown", true)
job.Run()
container.NetworkSettings = &NetworkSettings{}
}
@@ -576,6 +605,10 @@ func (container *Container) cleanup() {
if err := container.Unmount(); err != nil {
log.Errorf("%v: Failed to umount filesystem: %v", container.ID, err)
}
for _, eConfig := range container.execCommands.s {
container.daemon.unregisterExecCommand(eConfig)
}
}
func (container *Container) KillSig(sig int) error {
@@ -691,6 +724,9 @@ func (container *Container) Restart(seconds int) error {
}
func (container *Container) Resize(h, w int) error {
if !container.IsRunning() {
return fmt.Errorf("Cannot resize container %s, container is not running", container.ID)
}
return container.command.ProcessConfig.Terminal.Resize(h, w)
}
@@ -826,19 +862,25 @@ func (container *Container) Copy(resource string) (io.ReadCloser, error) {
return nil, err
}
var filter []string
basePath, err := container.getResourcePath(resource)
if err != nil {
container.Unmount()
return nil, err
}
// Check if this is actually in a volume
for _, mnt := range container.VolumeMounts() {
if len(mnt.MountToPath) > 0 && strings.HasPrefix(resource, mnt.MountToPath[1:]) {
return mnt.Export(resource)
}
}
stat, err := os.Stat(basePath)
if err != nil {
container.Unmount()
return nil, err
}
var filter []string
if !stat.IsDir() {
d, f := path.Split(basePath)
basePath = d
@@ -965,7 +1007,7 @@ func (container *Container) updateParentsHosts() error {
c := container.daemon.Get(cid)
if c != nil && !container.daemon.config.DisableNetwork && container.hostConfig.NetworkMode.IsPrivate() {
if err := etchosts.Update(c.HostsPath, container.NetworkSettings.IPAddress, container.Name[1:]); err != nil {
return fmt.Errorf("Failed to update /etc/hosts in parent container: %v", err)
log.Errorf("Failed to update /etc/hosts in parent container: %v", err)
}
}
}
@@ -1228,10 +1270,25 @@ func (container *Container) GetMountLabel() string {
return container.MountLabel
}
func (container *Container) getIpcContainer() (*Container, error) {
containerID := container.hostConfig.IpcMode.Container()
c := container.daemon.Get(containerID)
if c == nil {
return nil, fmt.Errorf("no such container to join IPC: %s", containerID)
}
if !c.IsRunning() {
return nil, fmt.Errorf("cannot join IPC of a non running container: %s", containerID)
}
return c, nil
}
func (container *Container) getNetworkedContainer() (*Container, error) {
parts := strings.SplitN(string(container.hostConfig.NetworkMode), ":", 2)
switch parts[0] {
case "container":
if len(parts) != 2 {
return nil, fmt.Errorf("no container specified to join network")
}
nc := container.daemon.Get(parts[1])
if nc == nil {
return nil, fmt.Errorf("no such container to join network: %s", parts[1])

View File

@@ -1,10 +1,13 @@
package daemon
import (
"fmt"
"github.com/docker/docker/engine"
"github.com/docker/docker/graph"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/runconfig"
"github.com/docker/libcontainer/label"
)
func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
@@ -50,12 +53,9 @@ func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
job.Errorf("IPv4 forwarding is disabled.\n")
}
container.LogEvent("create")
// FIXME: this is necessary because daemon.Create might return a nil container
// with a non-nil error. This should not happen! Once it's fixed we
// can remove this workaround.
if container != nil {
job.Printf("%s\n", container.ID)
}
job.Printf("%s\n", container.ID)
for _, warning := range buildWarnings {
job.Errorf("%s\n", warning)
}
@@ -80,6 +80,12 @@ func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.Hos
if warnings, err = daemon.mergeAndVerifyConfig(config, img); err != nil {
return nil, nil, err
}
if hostConfig != nil && hostConfig.SecurityOpt == nil {
hostConfig.SecurityOpt, err = daemon.GenerateSecurityOpt(hostConfig.IpcMode)
if err != nil {
return nil, nil, err
}
}
if container, err = daemon.newContainer(name, config, img); err != nil {
return nil, nil, err
}
@@ -94,8 +100,33 @@ func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.Hos
return nil, nil, err
}
}
if err := container.Mount(); err != nil {
return nil, nil, err
}
defer container.Unmount()
if err := container.prepareVolumes(); err != nil {
return nil, nil, err
}
if err := container.ToDisk(); err != nil {
return nil, nil, err
}
return container, warnings, nil
}
func (daemon *Daemon) GenerateSecurityOpt(ipcMode runconfig.IpcMode) ([]string, error) {
if ipcMode.IsHost() {
return label.DisableSecOpt(), nil
}
if ipcContainer := ipcMode.Container(); ipcContainer != "" {
c := daemon.Get(ipcContainer)
if c == nil {
return nil, fmt.Errorf("no such container to join IPC: %s", ipcContainer)
}
if !c.IsRunning() {
return nil, fmt.Errorf("cannot join IPC of a non running container: %s", ipcContainer)
}
return label.DupSecOpt(c.ProcessLabel), nil
}
return nil, nil
}

View File

@@ -14,6 +14,8 @@ import (
"github.com/docker/libcontainer/label"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/execdrivers"
"github.com/docker/docker/daemon/execdriver/lxc"
@@ -29,7 +31,6 @@ import (
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/graphdb"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/namesgenerator"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
@@ -83,6 +84,7 @@ func (c *contStore) List() []*Container {
}
type Daemon struct {
ID string
repository string
sysInitPath string
containers *contStore
@@ -128,6 +130,7 @@ func (daemon *Daemon) Install(eng *engine.Engine) error {
"execCreate": daemon.ContainerExecCreate,
"execStart": daemon.ContainerExecStart,
"execResize": daemon.ContainerExecResize,
"execInspect": daemon.ContainerExecInspect,
} {
if err := eng.Register(name, method); err != nil {
return err
@@ -231,7 +234,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err
log.Debugf("killing old running container %s", container.ID)
existingPid := container.Pid
container.SetStopped(0)
container.SetStopped(&execdriver.ExitStatus{0, false})
// We only have to handle this for lxc because the other drivers will ensure that
// no processes are left when docker dies
@@ -263,7 +266,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err
log.Debugf("Marking as stopped")
container.SetStopped(-127)
container.SetStopped(&execdriver.ExitStatus{-127, false})
if err := container.ToDisk(); err != nil {
return err
}
@@ -304,7 +307,7 @@ func (daemon *Daemon) restore() error {
)
if !debug {
log.Infof("Loading containers: ")
log.Infof("Loading containers: start.")
}
dir, err := ioutil.ReadDir(daemon.repository)
if err != nil {
@@ -392,7 +395,8 @@ func (daemon *Daemon) restore() error {
}
if !debug {
log.Infof(": done.")
fmt.Println()
log.Infof("Loading containers: done.")
}
return nil
@@ -692,6 +696,9 @@ func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.
if child == nil {
return fmt.Errorf("Could not get container for %s", parts["name"])
}
if child.hostConfig.NetworkMode.IsHost() {
return runconfig.ErrConflictHostNetworkAndLinks
}
if err := daemon.RegisterLink(container, child, parts["alias"]); err != nil {
return err
}
@@ -717,10 +724,8 @@ func NewDaemon(config *Config, eng *engine.Engine) (*Daemon, error) {
}
func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) {
// Apply configuration defaults
if config.Mtu == 0 {
// FIXME: GetDefaultNetwork Mtu doesn't need to be public anymore
config.Mtu = GetDefaultNetworkMtu()
config.Mtu = getDefaultNetworkMtu()
}
// Check for mutually incompatible config options
if config.BridgeIface != "" && config.BridgeIP != "" {
@@ -893,7 +898,13 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
return nil, err
}
trustKey, err := api.LoadOrCreateTrustKey(config.TrustKeyPath)
if err != nil {
return nil, err
}
daemon := &Daemon{
ID: trustKey.PublicKey().KeyID(),
repository: daemonRepo,
containers: &contStore{s: make(map[string]*Container)},
execCommands: newExecStore(),
@@ -918,7 +929,6 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
eng.OnShutdown(func() {
// FIXME: if these cleanup steps can be called concurrently, register
// them as separate handlers to speed up total shutdown time
// FIXME: use engine logging instead of log.Errorf
if err := daemon.shutdown(); err != nil {
log.Errorf("daemon.shutdown(): %s", err)
}
@@ -968,6 +978,7 @@ func (daemon *Daemon) Mount(container *Container) error {
if container.basefs == "" {
container.basefs = dir
} else if container.basefs != dir {
daemon.driver.Put(container.ID)
return fmt.Errorf("Error: driver %s is returning inconsistent paths for container %s ('%s' then '%s')",
daemon.driver, container.ID, container.basefs, dir)
}
@@ -989,7 +1000,7 @@ func (daemon *Daemon) Diff(container *Container) (archive.Archive, error) {
return daemon.driver.Diff(container.ID, initID)
}
func (daemon *Daemon) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
func (daemon *Daemon) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error) {
return daemon.execDriver.Run(c.command, pipes, startCallback)
}

View File

@@ -3,10 +3,10 @@
package daemon
import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/daemon/graphdriver/aufs"
"github.com/docker/docker/graph"
"github.com/docker/docker/pkg/log"
)
// Given the graphdriver ad, if it is aufs, then migrate it.

7
daemon/daemon_overlay.go Normal file
View File

@@ -0,0 +1,7 @@
// +build !exclude_graphdriver_overlay
package daemon
import (
_ "github.com/docker/docker/daemon/graphdriver/overlay"
)

View File

@@ -5,8 +5,8 @@ import (
"os"
"path"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
)
func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status {

View File

@@ -9,12 +9,12 @@ import (
"strings"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/lxc"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
@@ -24,6 +24,7 @@ type execConfig struct {
sync.Mutex
ID string
Running bool
ExitCode int
ProcessConfig execdriver.ProcessConfig
StreamConfig
OpenStdin bool
@@ -97,7 +98,9 @@ func (d *Daemon) getActiveContainer(name string) (*Container, error) {
if !container.IsRunning() {
return nil, fmt.Errorf("Container %s is not running", name)
}
if container.IsPaused() {
return nil, fmt.Errorf("Container %s is paused, unpause the container before exec", name)
}
return container, nil
}
@@ -117,13 +120,14 @@ func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status {
return job.Error(err)
}
config := runconfig.ExecConfigFromJob(job)
config, err := runconfig.ExecConfigFromJob(job)
if err != nil {
return job.Error(err)
}
entrypoint, args := d.getEntrypointAndArgs(nil, config.Cmd)
processConfig := execdriver.ProcessConfig{
Privileged: config.Privileged,
User: config.User,
Tty: config.Tty,
Entrypoint: entrypoint,
Arguments: args,
@@ -155,7 +159,6 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
var (
cStdin io.ReadCloser
cStdout, cStderr io.Writer
cStdinCloser io.Closer
execName = job.Args[0]
)
@@ -183,10 +186,10 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
r, w := io.Pipe()
go func() {
defer w.Close()
defer log.Debugf("Closing buffered stdin pipe")
io.Copy(w, job.Stdin)
}()
cStdin = r
cStdinCloser = job.Stdin
}
if execConfig.OpenStdout {
cStdout = job.Stdout
@@ -204,12 +207,13 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
execConfig.StreamConfig.stdinPipe = ioutils.NopWriteCloser(ioutil.Discard) // Silently drop stdin
}
attachErr := d.Attach(&execConfig.StreamConfig, execConfig.OpenStdin, false, execConfig.ProcessConfig.Tty, cStdin, cStdinCloser, cStdout, cStderr)
attachErr := d.attach(&execConfig.StreamConfig, execConfig.OpenStdin, true, execConfig.ProcessConfig.Tty, cStdin, cStdout, cStderr)
execErr := make(chan error)
// Remove exec from daemon and container.
defer d.unregisterExecCommand(execConfig)
// Note, the execConfig data will be removed when the container
// itself is deleted. This allows us to query it (for things like
// the exitStatus) even after the cmd is done running.
go func() {
err := container.Exec(execConfig)
@@ -232,7 +236,17 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
}
func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
return d.execDriver.Exec(c.command, &execConfig.ProcessConfig, pipes, startCallback)
exitStatus, err := d.execDriver.Exec(c.command, &execConfig.ProcessConfig, pipes, startCallback)
// On err, make sure we don't leave ExitCode at zero
if err != nil && exitStatus == 0 {
exitStatus = 128
}
execConfig.ExitCode = exitStatus
execConfig.Running = false
return exitStatus, err
}
func (container *Container) Exec(execConfig *execConfig) error {

View File

@@ -40,8 +40,17 @@ type TtyTerminal interface {
Master() *os.File
}
// ExitStatus provides exit reasons for a container.
type ExitStatus struct {
// The exit code with which the container exited.
ExitCode int
// Whether the container encountered an OOM.
OOMKilled bool
}
type Driver interface {
Run(c *Command, pipes *Pipes, startCallback StartCallback) (int, error) // Run executes the process and blocks until the process exits and returns the exit code
Run(c *Command, pipes *Pipes, startCallback StartCallback) (ExitStatus, error) // Run executes the process and blocks until the process exits and returns the exit code
// Exec executes the process in an existing container, blocks until the process exits and returns the exit code
Exec(c *Command, processConfig *ProcessConfig, pipes *Pipes, startCallback StartCallback) (int, error)
Kill(c *Command, sig int) error
@@ -62,6 +71,12 @@ type Network struct {
HostNetworking bool `json:"host_networking"`
}
// IPC settings of the container
type Ipc struct {
ContainerID string `json:"container_id"` // id of the container to join ipc.
HostIpc bool `json:"host_ipc"`
}
type NetworkInterface struct {
Gateway string `json:"gateway"`
IPAddress string `json:"ip"`
@@ -106,6 +121,7 @@ type Command struct {
WorkingDir string `json:"working_dir"`
ConfigPath string `json:"config_path"` // this should be able to be removed when the lxc template is moved into the driver
Network *Network `json:"network"`
Ipc *Ipc `json:"ipc"`
Resources *Resources `json:"resources"`
Mounts []Mount `json:"mounts"`
AllowedDevices []*devices.Device `json:"allowed_devices"`

View File

@@ -1 +1,2 @@
# the LXC exec driver needs more maintainers and contributions
Dinesh Subhraveti <dineshs@altiscale.com> (@dineshs-altiscale)

View File

@@ -17,8 +17,8 @@ import (
"github.com/kr/pty"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/utils"
"github.com/docker/libcontainer/cgroups"
@@ -55,7 +55,7 @@ func (d *driver) Name() string {
return fmt.Sprintf("%s-%s", DriverName, version)
}
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error) {
var (
term execdriver.Terminal
err error
@@ -76,20 +76,27 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
})
if err := d.generateEnvConfig(c); err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
configPath, err := d.generateLXCConfig(c)
if err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
params := []string{
"lxc-start",
"-n", c.ID,
"-f", configPath,
"--",
c.InitPath,
}
if c.Network.ContainerID != "" {
params = append(params,
"--share-net", c.Network.ContainerID,
)
}
params = append(params,
"--",
c.InitPath,
)
if c.Network.Interface != nil {
params = append(params,
"-g", c.Network.Interface.Gateway,
@@ -116,14 +123,6 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
params = append(params, "-w", c.WorkingDir)
}
if len(c.CapAdd) > 0 {
params = append(params, fmt.Sprintf("-cap-add=%s", strings.Join(c.CapAdd, ":")))
}
if len(c.CapDrop) > 0 {
params = append(params, fmt.Sprintf("-cap-drop=%s", strings.Join(c.CapDrop, ":")))
}
params = append(params, "--", c.ProcessConfig.Entrypoint)
params = append(params, c.ProcessConfig.Arguments...)
@@ -155,11 +154,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
c.ProcessConfig.Args = append([]string{name}, arg...)
if err := nodes.CreateDeviceNodes(c.Rootfs, c.AutoCreatedDevices); err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
if err := c.ProcessConfig.Start(); err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
var (
@@ -183,7 +182,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
c.ProcessConfig.Process.Kill()
c.ProcessConfig.Wait()
}
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
c.ContainerPid = pid
@@ -194,7 +193,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
<-waitLock
return getExitCode(c), waitErr
return execdriver.ExitStatus{getExitCode(c), false}, waitErr
}
/// Return the exit code of the process

View File

@@ -6,7 +6,6 @@ import (
"fmt"
"io/ioutil"
"log"
"net"
"os"
"os/exec"
"runtime"
@@ -14,7 +13,6 @@ import (
"syscall"
"github.com/docker/docker/pkg/reexec"
"github.com/docker/libcontainer/netlink"
)
// Args provided to the init function for a driver
@@ -59,12 +57,7 @@ func setupNamespace(args *InitArgs) error {
if err := setupEnv(args); err != nil {
return err
}
if err := setupHostname(args); err != nil {
return err
}
if err := setupNetworking(args); err != nil {
return err
}
if err := finalizeNamespace(args); err != nil {
return err
}
@@ -138,59 +131,6 @@ func setupEnv(args *InitArgs) error {
return nil
}
func setupHostname(args *InitArgs) error {
hostname := getEnv(args, "HOSTNAME")
if hostname == "" {
return nil
}
return setHostname(hostname)
}
// Setup networking
func setupNetworking(args *InitArgs) error {
if args.Ip != "" {
// eth0
iface, err := net.InterfaceByName("eth0")
if err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
ip, ipNet, err := net.ParseCIDR(args.Ip)
if err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
if err := netlink.NetworkLinkAddIp(iface, ip, ipNet); err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
if err := netlink.NetworkSetMTU(iface, args.Mtu); err != nil {
return fmt.Errorf("Unable to set MTU: %v", err)
}
if err := netlink.NetworkLinkUp(iface); err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
// loopback
iface, err = net.InterfaceByName("lo")
if err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
if err := netlink.NetworkLinkUp(iface); err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
}
if args.Gateway != "" {
gw := net.ParseIP(args.Gateway)
if gw == nil {
return fmt.Errorf("Unable to set up networking, %s is not a valid gateway IP", args.Gateway)
}
if err := netlink.AddDefaultGw(gw.String(), "eth0"); err != nil {
return fmt.Errorf("Unable to set up networking: %v", err)
}
}
return nil
}
// Setup working directory
func setupWorkingDirectory(args *InitArgs) error {
if args.WorkDir == "" {

View File

@@ -2,74 +2,19 @@ package lxc
import (
"fmt"
"strings"
"syscall"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/native/template"
"github.com/docker/libcontainer/namespaces"
"github.com/docker/libcontainer/security/capabilities"
"github.com/docker/libcontainer/system"
"github.com/docker/libcontainer/utils"
)
func setHostname(hostname string) error {
return syscall.Sethostname([]byte(hostname))
}
func finalizeNamespace(args *InitArgs) error {
if err := utils.CloseExecFrom(3); err != nil {
return err
}
// We use the native drivers default template so that things like caps are consistent
// across both drivers
container := template.New()
if !args.Privileged {
// drop capabilities in bounding set before changing user
if err := capabilities.DropBoundingSet(container.Capabilities); err != nil {
return fmt.Errorf("drop bounding set %s", err)
}
// preserve existing capabilities while we change users
if err := system.SetKeepCaps(); err != nil {
return fmt.Errorf("set keep caps %s", err)
}
}
if err := namespaces.SetupUser(args.User); err != nil {
return fmt.Errorf("setup user %s", err)
}
if !args.Privileged {
if err := system.ClearKeepCaps(); err != nil {
return fmt.Errorf("clear keep caps %s", err)
}
var (
adds []string
drops []string
)
if args.CapAdd != "" {
adds = strings.Split(args.CapAdd, ":")
}
if args.CapDrop != "" {
drops = strings.Split(args.CapDrop, ":")
}
caps, err := execdriver.TweakCapabilities(container.Capabilities, adds, drops)
if err != nil {
return err
}
// drop all other capabilities
if err := capabilities.DropCapabilities(caps); err != nil {
return fmt.Errorf("drop capabilities %s", err)
}
}
if err := setupWorkingDirectory(args); err != nil {
return err
}

View File

@@ -2,12 +2,6 @@
package lxc
import "github.com/docker/docker/daemon/execdriver"
func setHostname(hostname string) error {
panic("Not supported on darwin")
}
func finalizeNamespace(args *execdriver.InitArgs) error {
func finalizeNamespace(args *InitArgs) error {
panic("Not supported on darwin")
}

View File

@@ -1,11 +1,12 @@
package lxc
import (
"github.com/docker/docker/daemon/execdriver"
nativeTemplate "github.com/docker/docker/daemon/execdriver/native/template"
"github.com/docker/libcontainer/label"
"os"
"strings"
"text/template"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/libcontainer/label"
)
const LxcTemplate = `
@@ -15,6 +16,13 @@ lxc.network.type = veth
lxc.network.link = {{.Network.Interface.Bridge}}
lxc.network.name = eth0
lxc.network.mtu = {{.Network.Mtu}}
{{if .Network.Interface.IPAddress}}
lxc.network.ipv4 = {{.Network.Interface.IPAddress}}/{{.Network.Interface.IPPrefixLen}}
{{end}}
{{if .Network.Interface.Gateway}}
lxc.network.ipv4.gateway = {{.Network.Interface.Gateway}}
{{end}}
lxc.network.flags = up
{{else if .Network.HostNetworking}}
lxc.network.type = none
{{else}}
@@ -70,10 +78,23 @@ lxc.mount.entry = devpts {{escapeFstabSpaces $ROOTFS}}/dev/pts devpts {{formatMo
lxc.mount.entry = shm {{escapeFstabSpaces $ROOTFS}}/dev/shm tmpfs {{formatMountLabel "size=65536k,nosuid,nodev,noexec" ""}} 0 0
{{range $value := .Mounts}}
{{$createVal := isDirectory $value.Source}}
{{if $value.Writable}}
lxc.mount.entry = {{$value.Source}} {{escapeFstabSpaces $ROOTFS}}/{{escapeFstabSpaces $value.Destination}} none rbind,rw 0 0
lxc.mount.entry = {{$value.Source}} {{escapeFstabSpaces $ROOTFS}}/{{escapeFstabSpaces $value.Destination}} none rbind,rw,create={{$createVal}} 0 0
{{else}}
lxc.mount.entry = {{$value.Source}} {{escapeFstabSpaces $ROOTFS}}/{{escapeFstabSpaces $value.Destination}} none rbind,ro 0 0
lxc.mount.entry = {{$value.Source}} {{escapeFstabSpaces $ROOTFS}}/{{escapeFstabSpaces $value.Destination}} none rbind,ro,create={{$createVal}} 0 0
{{end}}
{{end}}
{{if .ProcessConfig.Env}}
lxc.utsname = {{getHostname .ProcessConfig.Env}}
{{end}}
{{if .ProcessConfig.Privileged}}
# No cap values are needed, as lxc is starting in privileged mode
{{else}}
{{range $value := keepCapabilities .CapAdd .CapDrop}}
lxc.cap.keep = {{$value}}
{{end}}
{{end}}
@@ -117,6 +138,33 @@ func escapeFstabSpaces(field string) string {
return strings.Replace(field, " ", "\\040", -1)
}
func keepCapabilities(adds []string, drops []string) []string {
container := nativeTemplate.New()
caps, err := execdriver.TweakCapabilities(container.Capabilities, adds, drops)
var newCaps []string
for _, cap := range caps {
newCaps = append(newCaps, strings.ToLower(cap))
}
if err != nil {
return []string{}
}
return newCaps
}
func isDirectory(source string) string {
f, err := os.Stat(source)
if err != nil {
if os.IsNotExist(err) {
return "dir"
}
return ""
}
if f.IsDir() {
return "dir"
}
return "file"
}
func getMemorySwap(v *execdriver.Resources) int64 {
// By default, MemorySwap is set to twice the size of RAM.
// If you want to omit MemorySwap, set it to `-1'.
@@ -137,12 +185,25 @@ func getLabel(c map[string][]string, name string) string {
return ""
}
func getHostname(env []string) string {
for _, kv := range env {
parts := strings.SplitN(kv, "=", 2)
if parts[0] == "HOSTNAME" && len(parts) == 2 {
return parts[1]
}
}
return ""
}
func init() {
var err error
funcMap := template.FuncMap{
"getMemorySwap": getMemorySwap,
"escapeFstabSpaces": escapeFstabSpaces,
"formatMountLabel": label.FormatMountLabel,
"isDirectory": isDirectory,
"keepCapabilities": keepCapabilities,
"getHostname": getHostname,
}
LxcTemplateCompiled, err = template.New("lxc").Funcs(funcMap).Parse(LxcTemplate)
if err != nil {

View File

@@ -14,6 +14,7 @@ import (
"time"
"github.com/docker/docker/daemon/execdriver"
nativeTemplate "github.com/docker/docker/daemon/execdriver/native/template"
"github.com/docker/libcontainer/devices"
)
@@ -104,6 +105,10 @@ func TestCustomLxcConfig(t *testing.T) {
}
func grepFile(t *testing.T, path string, pattern string) {
grepFileWithReverse(t, path, pattern, false)
}
func grepFileWithReverse(t *testing.T, path string, pattern string, inverseGrep bool) {
f, err := os.Open(path)
if err != nil {
t.Fatal(err)
@@ -117,9 +122,15 @@ func grepFile(t *testing.T, path string, pattern string) {
for err == nil {
line, err = r.ReadString('\n')
if strings.Contains(line, pattern) == true {
if inverseGrep {
t.Fatalf("grepFile: pattern \"%s\" found in \"%s\"", pattern, path)
}
return
}
}
if inverseGrep {
return
}
t.Fatalf("grepFile: pattern \"%s\" not found in \"%s\"", pattern, path)
}
@@ -140,3 +151,152 @@ func TestEscapeFstabSpaces(t *testing.T) {
}
}
}
func TestIsDirectory(t *testing.T) {
tempDir, err := ioutil.TempDir("", "TestIsDir")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tempDir)
tempFile, err := ioutil.TempFile(tempDir, "TestIsDirFile")
if err != nil {
t.Fatal(err)
}
if isDirectory(tempDir) != "dir" {
t.Logf("Could not identify %s as a directory", tempDir)
t.Fail()
}
if isDirectory(tempFile.Name()) != "file" {
t.Logf("Could not identify %s as a file", tempFile.Name())
t.Fail()
}
}
func TestCustomLxcConfigMounts(t *testing.T) {
root, err := ioutil.TempDir("", "TestCustomLxcConfig")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
tempDir, err := ioutil.TempDir("", "TestIsDir")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tempDir)
tempFile, err := ioutil.TempFile(tempDir, "TestIsDirFile")
if err != nil {
t.Fatal(err)
}
os.MkdirAll(path.Join(root, "containers", "1"), 0777)
driver, err := NewDriver(root, "", false)
if err != nil {
t.Fatal(err)
}
processConfig := execdriver.ProcessConfig{
Privileged: false,
}
mounts := []execdriver.Mount{
{
Source: tempDir,
Destination: tempDir,
Writable: false,
Private: true,
},
{
Source: tempFile.Name(),
Destination: tempFile.Name(),
Writable: true,
Private: true,
},
}
command := &execdriver.Command{
ID: "1",
LxcConfig: []string{
"lxc.utsname = docker",
"lxc.cgroup.cpuset.cpus = 0,1",
},
Network: &execdriver.Network{
Mtu: 1500,
Interface: nil,
},
Mounts: mounts,
ProcessConfig: processConfig,
}
p, err := driver.generateLXCConfig(command)
if err != nil {
t.Fatal(err)
}
grepFile(t, p, "lxc.utsname = docker")
grepFile(t, p, "lxc.cgroup.cpuset.cpus = 0,1")
grepFile(t, p, fmt.Sprintf("lxc.mount.entry = %s %s none rbind,ro,create=%s 0 0", tempDir, "/"+tempDir, "dir"))
grepFile(t, p, fmt.Sprintf("lxc.mount.entry = %s %s none rbind,rw,create=%s 0 0", tempFile.Name(), "/"+tempFile.Name(), "file"))
}
func TestCustomLxcConfigMisc(t *testing.T) {
root, err := ioutil.TempDir("", "TestCustomLxcConfig")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
os.MkdirAll(path.Join(root, "containers", "1"), 0777)
driver, err := NewDriver(root, "", false)
if err != nil {
t.Fatal(err)
}
processConfig := execdriver.ProcessConfig{
Privileged: false,
}
processConfig.Env = []string{"HOSTNAME=testhost"}
command := &execdriver.Command{
ID: "1",
LxcConfig: []string{
"lxc.cgroup.cpuset.cpus = 0,1",
},
Network: &execdriver.Network{
Mtu: 1500,
Interface: &execdriver.NetworkInterface{
Gateway: "10.10.10.1",
IPAddress: "10.10.10.10",
IPPrefixLen: 24,
Bridge: "docker0",
},
},
ProcessConfig: processConfig,
CapAdd: []string{"net_admin", "syslog"},
CapDrop: []string{"kill", "mknod"},
}
p, err := driver.generateLXCConfig(command)
if err != nil {
t.Fatal(err)
}
// network
grepFile(t, p, "lxc.network.type = veth")
grepFile(t, p, "lxc.network.link = docker0")
grepFile(t, p, "lxc.network.name = eth0")
grepFile(t, p, "lxc.network.ipv4 = 10.10.10.10/24")
grepFile(t, p, "lxc.network.ipv4.gateway = 10.10.10.1")
grepFile(t, p, "lxc.network.flags = up")
// hostname
grepFile(t, p, "lxc.utsname = testhost")
grepFile(t, p, "lxc.cgroup.cpuset.cpus = 0,1")
container := nativeTemplate.New()
for _, cap := range container.Capabilities {
cap = strings.ToLower(cap)
if cap != "mknod" && cap != "kill" {
grepFile(t, p, fmt.Sprintf("lxc.cap.keep = %s", cap))
}
}
grepFileWithReverse(t, p, fmt.Sprintf("lxc.cap.keep = kill"), true)
grepFileWithReverse(t, p, fmt.Sprintf("lxc.cap.keep = mknod"), true)
}

View File

@@ -36,6 +36,10 @@ func (d *driver) createContainer(c *execdriver.Command) (*libcontainer.Config, e
container.MountConfig.NoPivotRoot = os.Getenv("DOCKER_RAMDISK") != ""
container.RestrictSys = true
if err := d.createIpc(container, c); err != nil {
return nil, err
}
if err := d.createNetwork(container, c); err != nil {
return nil, err
}
@@ -124,6 +128,28 @@ func (d *driver) createNetwork(container *libcontainer.Config, c *execdriver.Com
return nil
}
func (d *driver) createIpc(container *libcontainer.Config, c *execdriver.Command) error {
if c.Ipc.HostIpc {
container.Namespaces["NEWIPC"] = false
return nil
}
if c.Ipc.ContainerID != "" {
d.Lock()
active := d.activeContainers[c.Ipc.ContainerID]
d.Unlock()
if active == nil || active.cmd.Process == nil {
return fmt.Errorf("%s is not a valid running container to join", c.Ipc.ContainerID)
}
cmd := active.cmd
container.IpcNsPath = filepath.Join("/proc", fmt.Sprint(cmd.Process.Pid), "ns", "ipc")
}
return nil
}
func (d *driver) setPrivileged(container *libcontainer.Config) (err error) {
container.Capabilities = capabilities.GetAllCapabilities()
container.Cgroups.AllowAllDevices = true

View File

@@ -14,6 +14,7 @@ import (
"sync"
"syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/term"
"github.com/docker/libcontainer"
@@ -60,11 +61,20 @@ func NewDriver(root, initPath string) (*driver, error) {
}, nil
}
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
func (d *driver) notifyOnOOM(config *libcontainer.Config) (<-chan struct{}, error) {
return fs.NotifyOnOOM(config.Cgroups)
}
type execOutput struct {
exitCode int
err error
}
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error) {
// take the Command and populate the libcontainer.Config from it
container, err := d.createContainer(c)
if err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
var term execdriver.Terminal
@@ -75,7 +85,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
term, err = execdriver.NewStdConsole(&c.ProcessConfig, pipes)
}
if err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
c.ProcessConfig.Terminal = term
@@ -92,40 +102,66 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
)
if err := d.createContainerRoot(c.ID); err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
defer d.cleanContainer(c.ID)
if err := d.writeContainerFile(container, c.ID); err != nil {
return -1, err
return execdriver.ExitStatus{-1, false}, err
}
return namespaces.Exec(container, c.ProcessConfig.Stdin, c.ProcessConfig.Stdout, c.ProcessConfig.Stderr, c.ProcessConfig.Console, dataPath, args, func(container *libcontainer.Config, console, dataPath, init string, child *os.File, args []string) *exec.Cmd {
c.ProcessConfig.Path = d.initPath
c.ProcessConfig.Args = append([]string{
DriverName,
"-console", console,
"-pipe", "3",
"-root", filepath.Join(d.root, c.ID),
"--",
}, args...)
execOutputChan := make(chan execOutput, 1)
waitForStart := make(chan struct{})
// set this to nil so that when we set the clone flags anything else is reset
c.ProcessConfig.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: uintptr(namespaces.GetNamespaceFlags(container.Namespaces)),
}
c.ProcessConfig.ExtraFiles = []*os.File{child}
go func() {
exitCode, err := namespaces.Exec(container, c.ProcessConfig.Stdin, c.ProcessConfig.Stdout, c.ProcessConfig.Stderr, c.ProcessConfig.Console, dataPath, args, func(container *libcontainer.Config, console, dataPath, init string, child *os.File, args []string) *exec.Cmd {
c.ProcessConfig.Path = d.initPath
c.ProcessConfig.Args = append([]string{
DriverName,
"-console", console,
"-pipe", "3",
"-root", filepath.Join(d.root, c.ID),
"--",
}, args...)
c.ProcessConfig.Env = container.Env
c.ProcessConfig.Dir = container.RootFs
// set this to nil so that when we set the clone flags anything else is reset
c.ProcessConfig.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: uintptr(namespaces.GetNamespaceFlags(container.Namespaces)),
}
c.ProcessConfig.ExtraFiles = []*os.File{child}
return &c.ProcessConfig.Cmd
}, func() {
if startCallback != nil {
c.ContainerPid = c.ProcessConfig.Process.Pid
startCallback(&c.ProcessConfig, c.ContainerPid)
}
})
c.ProcessConfig.Env = container.Env
c.ProcessConfig.Dir = container.RootFs
return &c.ProcessConfig.Cmd
}, func() {
close(waitForStart)
if startCallback != nil {
c.ContainerPid = c.ProcessConfig.Process.Pid
startCallback(&c.ProcessConfig, c.ContainerPid)
}
})
execOutputChan <- execOutput{exitCode, err}
}()
select {
case execOutput := <-execOutputChan:
return execdriver.ExitStatus{execOutput.exitCode, false}, execOutput.err
case <-waitForStart:
break
}
oomKill := false
oomKillNotification, err := d.notifyOnOOM(container)
if err == nil {
_, oomKill = <-oomKillNotification
} else {
log.Warnf("WARNING: Your kernel does not support OOM notifications: %s", err)
}
// wait for the container to exit.
execOutput := <-execOutputChan
return execdriver.ExitStatus{execOutput.exitCode, oomKill}, execOutput.err
}
func (d *driver) Kill(p *execdriver.Command, sig int) error {

View File

@@ -13,7 +13,6 @@ import (
"github.com/docker/docker/pkg/reexec"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/namespaces"
"github.com/docker/libcontainer/syncpipe"
)
func init() {
@@ -48,12 +47,7 @@ func initializer() {
writeError(err)
}
syncPipe, err := syncpipe.NewSyncPipeFromFd(0, uintptr(*pipe))
if err != nil {
writeError(err)
}
if err := namespaces.Init(container, rootfs, *console, syncPipe, flag.Args()); err != nil {
if err := namespaces.Init(container, rootfs, *console, os.NewFile(uintptr(*pipe), "child"), flag.Args()); err != nil {
writeError(err)
}

View File

@@ -3,10 +3,10 @@
package native
import (
"encoding/json"
"os"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/syncpipe"
)
func findUserArgs() []string {
@@ -21,15 +21,9 @@ func findUserArgs() []string {
// loadConfigFromFd loads a container's config from the sync pipe that is provided by
// fd 3 when running a process
func loadConfigFromFd() (*libcontainer.Config, error) {
syncPipe, err := syncpipe.NewSyncPipeFromFd(0, 3)
if err != nil {
return nil, err
}
var config *libcontainer.Config
if err := syncPipe.ReadFromParent(&config); err != nil {
if err := json.NewDecoder(os.NewFile(3, "child")).Decode(&config); err != nil {
return nil, err
}
return config, nil
}

View File

@@ -30,10 +30,10 @@ import (
"sync"
"syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/log"
mountpk "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/utils"
"github.com/docker/libcontainer/label"
@@ -99,7 +99,7 @@ func Init(root string, options []string) (graphdriver.Driver, error) {
return nil, err
}
if err := graphdriver.MakePrivate(root); err != nil {
if err := mountpk.MakePrivate(root); err != nil {
return nil, err
}
@@ -301,6 +301,7 @@ func (a *Driver) Diff(id, parent string) (archive.Archive, error) {
// AUFS doesn't need the parent layer to produce a diff.
return archive.TarWithOptions(path.Join(a.rootPath(), "diff", id), &archive.TarOptions{
Compression: archive.Uncompressed,
Excludes: []string{".wh..wh.*"},
})
}
@@ -412,39 +413,44 @@ func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err erro
}
}()
if err = a.tryMount(ro, rw, target, mountLabel); err != nil {
if err = a.mountRw(rw, target, mountLabel); err != nil {
return
}
// Mount options are clipped to page size(4096 bytes). If there are more
// layers then these are remounted individually using append.
for _, layer := range ro {
data := label.FormatMountLabel(fmt.Sprintf("append:%s=ro+wh", layer), mountLabel)
if err = mount("none", target, "aufs", MsRemount, data); err != nil {
return
b := make([]byte, syscall.Getpagesize()-len(mountLabel)-50) // room for xino & mountLabel
bp := copy(b, fmt.Sprintf("br:%s=rw", rw))
firstMount := true
i := 0
for {
for ; i < len(ro); i++ {
layer := fmt.Sprintf(":%s=ro+wh", ro[i])
if firstMount {
if bp+len(layer) > len(b) {
break
}
bp += copy(b[bp:], layer)
} else {
data := label.FormatMountLabel(fmt.Sprintf("append%s", layer), mountLabel)
if err = mount("none", target, "aufs", MsRemount, data); err != nil {
return
}
}
}
if firstMount {
data := label.FormatMountLabel(fmt.Sprintf("%s,xino=/dev/shm/aufs.xino", string(b[:bp])), mountLabel)
if err = mount("none", target, "aufs", 0, data); err != nil {
return
}
firstMount = false
}
if i == len(ro) {
break
}
}
return
}
// Try to mount using the aufs fast path, if this fails then
// append ro layers.
func (a *Driver) tryMount(ro []string, rw, target, mountLabel string) (err error) {
var (
rwBranch = fmt.Sprintf("%s=rw", rw)
roBranches = fmt.Sprintf("%s=ro+wh:", strings.Join(ro, "=ro+wh:"))
data = label.FormatMountLabel(fmt.Sprintf("br:%v:%v,xino=/dev/shm/aufs.xino", rwBranch, roBranches), mountLabel)
)
return mount("none", target, "aufs", 0, data)
}
func (a *Driver) mountRw(rw, target, mountLabel string) error {
data := label.FormatMountLabel(fmt.Sprintf("br:%s,xino=/dev/shm/aufs.xino", rw), mountLabel)
return mount("none", target, "aufs", 0, data)
}
func rollbackMount(target string, err error) {
if err != nil {
Unmount(target)
}
}

View File

@@ -15,7 +15,8 @@ import (
)
var (
tmp = path.Join(os.TempDir(), "aufs-tests", "aufs")
tmpOuter = path.Join(os.TempDir(), "aufs-tests")
tmp = path.Join(tmpOuter, "aufs")
)
func init() {
@@ -641,9 +642,13 @@ func hash(c string) string {
return hex.EncodeToString(h.Sum(nil))
}
func TestMountMoreThan42Layers(t *testing.T) {
d := newDriver(t)
defer os.RemoveAll(tmp)
func testMountMoreThan42Layers(t *testing.T, mountPath string) {
if err := os.MkdirAll(mountPath, 0755); err != nil {
t.Fatal(err)
}
defer os.RemoveAll(mountPath)
d := testInit(mountPath, t).(*Driver)
defer d.Cleanup()
var last string
var expected int
@@ -664,24 +669,24 @@ func TestMountMoreThan42Layers(t *testing.T) {
if err := d.Create(current, parent); err != nil {
t.Logf("Current layer %d", i)
t.Fatal(err)
t.Error(err)
}
point, err := d.Get(current, "")
if err != nil {
t.Logf("Current layer %d", i)
t.Fatal(err)
t.Error(err)
}
f, err := os.Create(path.Join(point, current))
if err != nil {
t.Logf("Current layer %d", i)
t.Fatal(err)
t.Error(err)
}
f.Close()
if i%10 == 0 {
if err := os.Remove(path.Join(point, parent)); err != nil {
t.Logf("Current layer %d", i)
t.Fatal(err)
t.Error(err)
}
expected--
}
@@ -691,13 +696,37 @@ func TestMountMoreThan42Layers(t *testing.T) {
// Perform the actual mount for the top most image
point, err := d.Get(last, "")
if err != nil {
t.Fatal(err)
t.Error(err)
}
files, err := ioutil.ReadDir(point)
if err != nil {
t.Fatal(err)
t.Error(err)
}
if len(files) != expected {
t.Fatalf("Expected %d got %d", expected, len(files))
t.Errorf("Expected %d got %d", expected, len(files))
}
}
func TestMountMoreThan42Layers(t *testing.T) {
os.RemoveAll(tmpOuter)
testMountMoreThan42Layers(t, tmp)
}
func TestMountMoreThan42LayersMatchingPathLength(t *testing.T) {
defer os.RemoveAll(tmpOuter)
zeroes := "0"
for {
// This finds a mount path so that when combined into aufs mount options
// 4096 byte boundary would be in between the paths or in permission
// section. For '/tmp' it will use '/tmp/aufs-tests/00000000/aufs'
mountPath := path.Join(tmpOuter, zeroes, "aufs")
pathLength := 77 + len(mountPath)
if mod := 4095 % pathLength; mod == 0 || mod > pathLength-2 {
t.Logf("Using path: %s", mountPath)
testMountMoreThan42Layers(t, mountPath)
return
}
zeroes += "0"
}
}

View File

@@ -4,7 +4,7 @@ import (
"os/exec"
"syscall"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
)
func Unmount(target string) error {

View File

@@ -40,7 +40,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
return nil, err
}
if err := graphdriver.MakePrivate(home); err != nil {
if err := mount.MakePrivate(home); err != nil {
return nil, err
}
@@ -60,7 +60,14 @@ func (d *Driver) String() string {
}
func (d *Driver) Status() [][2]string {
return nil
status := [][2]string{}
if bv := BtrfsBuildVersion(); bv != "-" {
status = append(status, [2]string{"Build Version", bv})
}
if lv := BtrfsLibVersion(); lv != -1 {
status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)})
}
return status
}
func (d *Driver) Cleanup() error {

View File

@@ -0,0 +1,24 @@
// +build linux,!btrfs_noversion
package btrfs
/*
#include <btrfs/version.h>
// because around version 3.16, they did not define lib version yet
int my_btrfs_lib_version() {
#ifdef BTRFS_LIB_VERSION
return BTRFS_LIB_VERSION;
#else
return -1;
#endif
}
*/
import "C"
func BtrfsBuildVersion() string {
return string(C.BTRFS_BUILD_VERSION)
}
func BtrfsLibVersion() int {
return int(C.BTRFS_LIB_VERSION)
}

View File

@@ -0,0 +1,13 @@
// +build linux,btrfs_noversion
package btrfs
// TODO(vbatts) remove this work-around once supported linux distros are on
// btrfs utililties of >= 3.16.1
func BtrfsBuildVersion() string {
return "-"
}
func BtrfsLibVersion() int {
return -1
}

View File

@@ -0,0 +1,13 @@
// +build linux
package btrfs
import (
"testing"
)
func TestBuildVersion(t *testing.T) {
if len(BtrfsBuildVersion()) == 0 {
t.Errorf("expected output from btrfs build version, but got empty string")
}
}

View File

@@ -1 +1,2 @@
Alexander Larsson <alexl@redhat.com> (@alexlarsson)
Vincent Batts <vbatts@redhat.com> (@vbatts)

View File

@@ -100,6 +100,25 @@ Here is the list of supported options:
``docker -d --storage-opt dm.mountopt=nodiscard``
* `dm.thinpooldev`
Specifies a custom blockdevice to use for the thin pool.
If using a block device for device mapper storage, ideally lvm2
would be used to create/manage the thin-pool volume that is then
handed to docker to exclusively create/manage the thin and thin
snapshot volumes needed for it's containers. Managing the thin-pool
outside of docker makes for the most feature-rich method of having
docker utilize device mapper thin provisioning as the backing
storage for docker's containers. lvm2-based thin-pool management
feature highlights include: automatic or interactive thin-pool
resize support, dynamically change thin-pool features, automatic
thinp metadata checking when lvm2 activates the thin-pool, etc.
Example use:
``docker -d --storage-opt dm.thinpooldev=/dev/mapper/thin-pool``
* `dm.datadev`
Specifies a custom blockdevice to use for data for the thin pool.

View File

@@ -18,8 +18,9 @@ import (
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/units"
"github.com/docker/libcontainer/label"
@@ -29,9 +30,20 @@ var (
DefaultDataLoopbackSize int64 = 100 * 1024 * 1024 * 1024
DefaultMetaDataLoopbackSize int64 = 2 * 1024 * 1024 * 1024
DefaultBaseFsSize uint64 = 10 * 1024 * 1024 * 1024
DefaultThinpBlockSize uint32 = 128 // 64K = 128 512b sectors
DefaultThinpBlockSize uint32 = 128 // 64K = 128 512b sectors
MaxDeviceId int = 0xffffff // 24 bit, pool limit
DeviceIdMapSz int = (MaxDeviceId + 1) / 8
)
const deviceSetMetaFile string = "deviceset-metadata"
const transactionMetaFile string = "transaction-metadata"
type Transaction struct {
OpenTransactionId uint64 `json:"open_transaction_id"`
DeviceIdHash string `json:"device_hash"`
DeviceId int `json:"device_id"`
}
type DevInfo struct {
Hash string `json:"-"`
DeviceId int `json:"device_id"`
@@ -62,13 +74,13 @@ type MetaData struct {
}
type DeviceSet struct {
MetaData
sync.Mutex // Protects Devices map and serializes calls into libdevmapper
root string
devicePrefix string
TransactionId uint64
NewTransactionId uint64
nextDeviceId int
MetaData `json:"-"`
sync.Mutex `json:"-"` // Protects Devices map and serializes calls into libdevmapper
root string
devicePrefix string
TransactionId uint64 `json:"-"`
NextDeviceId int `json:"next_device_id"`
deviceIdMap []byte
// Options
dataLoopbackSize int64
@@ -81,6 +93,8 @@ type DeviceSet struct {
metadataDevice string
doBlkDiscard bool
thinpBlockSize uint32
thinPoolDevice string
Transaction `json:"-"`
}
type DiskUsage struct {
@@ -138,12 +152,23 @@ func (devices *DeviceSet) metadataFile(info *DevInfo) string {
return path.Join(devices.metadataDir(), file)
}
func (devices *DeviceSet) transactionMetaFile() string {
return path.Join(devices.metadataDir(), transactionMetaFile)
}
func (devices *DeviceSet) deviceSetMetaFile() string {
return path.Join(devices.metadataDir(), deviceSetMetaFile)
}
func (devices *DeviceSet) oldMetadataFile() string {
return path.Join(devices.loopbackDir(), "json")
}
func (devices *DeviceSet) getPoolName() string {
return devices.devicePrefix + "-pool"
if devices.thinPoolDevice == "" {
return devices.devicePrefix + "-pool"
}
return devices.thinPoolDevice
}
func (devices *DeviceSet) getPoolDevName() string {
@@ -189,8 +214,16 @@ func (devices *DeviceSet) ensureImage(name string, size int64) (string, error) {
}
func (devices *DeviceSet) allocateTransactionId() uint64 {
devices.NewTransactionId = devices.NewTransactionId + 1
return devices.NewTransactionId
devices.OpenTransactionId = devices.TransactionId + 1
return devices.OpenTransactionId
}
func (devices *DeviceSet) updatePoolTransactionId() error {
if err := devicemapper.SetTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.OpenTransactionId); err != nil {
return fmt.Errorf("Error setting devmapper transaction ID: %s", err)
}
devices.TransactionId = devices.OpenTransactionId
return nil
}
func (devices *DeviceSet) removeMetadata(info *DevInfo) error {
@@ -200,11 +233,8 @@ func (devices *DeviceSet) removeMetadata(info *DevInfo) error {
return nil
}
func (devices *DeviceSet) saveMetadata(info *DevInfo) error {
jsonData, err := json.Marshal(info)
if err != nil {
return fmt.Errorf("Error encoding metadata to json: %s", err)
}
// Given json data and file path, write it to disk
func (devices *DeviceSet) writeMetaFile(jsonData []byte, filePath string) error {
tmpFile, err := ioutil.TempFile(devices.metadataDir(), ".tmp")
if err != nil {
return fmt.Errorf("Error creating metadata file: %s", err)
@@ -223,19 +253,48 @@ func (devices *DeviceSet) saveMetadata(info *DevInfo) error {
if err := tmpFile.Close(); err != nil {
return fmt.Errorf("Error closing metadata file %s: %s", tmpFile.Name(), err)
}
if err := os.Rename(tmpFile.Name(), devices.metadataFile(info)); err != nil {
if err := os.Rename(tmpFile.Name(), filePath); err != nil {
return fmt.Errorf("Error committing metadata file %s: %s", tmpFile.Name(), err)
}
if devices.NewTransactionId != devices.TransactionId {
if err = setTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.NewTransactionId); err != nil {
return fmt.Errorf("Error setting devmapper transition ID: %s", err)
}
devices.TransactionId = devices.NewTransactionId
return nil
}
func (devices *DeviceSet) saveMetadata(info *DevInfo) error {
jsonData, err := json.Marshal(info)
if err != nil {
return fmt.Errorf("Error encoding metadata to json: %s", err)
}
if err := devices.writeMetaFile(jsonData, devices.metadataFile(info)); err != nil {
return err
}
return nil
}
func (devices *DeviceSet) markDeviceIdUsed(deviceId int) {
var mask byte
i := deviceId % 8
mask = 1 << uint(i)
devices.deviceIdMap[deviceId/8] = devices.deviceIdMap[deviceId/8] | mask
}
func (devices *DeviceSet) markDeviceIdFree(deviceId int) {
var mask byte
i := deviceId % 8
mask = ^(1 << uint(i))
devices.deviceIdMap[deviceId/8] = devices.deviceIdMap[deviceId/8] & mask
}
func (devices *DeviceSet) isDeviceIdFree(deviceId int) bool {
var mask byte
i := deviceId % 8
mask = (1 << uint(i))
if (devices.deviceIdMap[deviceId/8] & mask) != 0 {
return false
}
return true
}
func (devices *DeviceSet) lookupDevice(hash string) (*DevInfo, error) {
devices.devicesLock.Lock()
defer devices.devicesLock.Unlock()
@@ -251,13 +310,91 @@ func (devices *DeviceSet) lookupDevice(hash string) (*DevInfo, error) {
return info, nil
}
func (devices *DeviceSet) registerDevice(id int, hash string, size uint64) (*DevInfo, error) {
func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo) error {
// Skip some of the meta files which are not device files.
if strings.HasSuffix(finfo.Name(), ".migrated") {
log.Debugf("Skipping file %s", path)
return nil
}
if finfo.Name() == deviceSetMetaFile {
log.Debugf("Skipping file %s", path)
return nil
}
log.Debugf("Loading data for file %s", path)
hash := finfo.Name()
if hash == "base" {
hash = ""
}
dinfo := devices.loadMetadata(hash)
if dinfo == nil {
return fmt.Errorf("Error loading device metadata file %s", hash)
}
if dinfo.DeviceId > MaxDeviceId {
log.Errorf("Warning: Ignoring Invalid DeviceId=%d", dinfo.DeviceId)
return nil
}
devices.Lock()
devices.markDeviceIdUsed(dinfo.DeviceId)
devices.Unlock()
log.Debugf("Added deviceId=%d to DeviceIdMap", dinfo.DeviceId)
return nil
}
func (devices *DeviceSet) constructDeviceIdMap() error {
log.Debugf("[deviceset] constructDeviceIdMap()")
defer log.Debugf("[deviceset] constructDeviceIdMap() END")
var scan = func(path string, info os.FileInfo, err error) error {
if err != nil {
log.Debugf("Can't walk the file %s", path)
return nil
}
// Skip any directories
if info.IsDir() {
return nil
}
return devices.deviceFileWalkFunction(path, info)
}
return filepath.Walk(devices.metadataDir(), scan)
}
func (devices *DeviceSet) unregisterDevice(id int, hash string) error {
log.Debugf("unregisterDevice(%v, %v)", id, hash)
info := &DevInfo{
Hash: hash,
DeviceId: id,
}
devices.devicesLock.Lock()
delete(devices.Devices, hash)
devices.devicesLock.Unlock()
if err := devices.removeMetadata(info); err != nil {
log.Debugf("Error removing meta data: %s", err)
return err
}
return nil
}
func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, transactionId uint64) (*DevInfo, error) {
log.Debugf("registerDevice(%v, %v)", id, hash)
info := &DevInfo{
Hash: hash,
DeviceId: id,
Size: size,
TransactionId: devices.allocateTransactionId(),
TransactionId: transactionId,
Initialized: false,
devices: devices,
}
@@ -280,11 +417,11 @@ func (devices *DeviceSet) registerDevice(id int, hash string, size uint64) (*Dev
func (devices *DeviceSet) activateDeviceIfNeeded(info *DevInfo) error {
log.Debugf("activateDeviceIfNeeded(%v)", info.Hash)
if devinfo, _ := getInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 {
if devinfo, _ := devicemapper.GetInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 {
return nil
}
return activateDevice(devices.getPoolDevName(), info.Name(), info.DeviceId, info.Size)
return devicemapper.ActivateDevice(devices.getPoolDevName(), info.Name(), info.DeviceId, info.Size)
}
func (devices *DeviceSet) createFilesystem(info *DevInfo) error {
@@ -320,19 +457,8 @@ func (devices *DeviceSet) createFilesystem(info *DevInfo) error {
return nil
}
func (devices *DeviceSet) initMetaData() error {
_, _, _, params, err := getStatus(devices.getPoolName())
if err != nil {
return err
}
if _, err := fmt.Sscanf(params, "%d", &devices.TransactionId); err != nil {
return err
}
devices.NewTransactionId = devices.TransactionId
func (devices *DeviceSet) migrateOldMetaData() error {
// Migrate old metadatafile
jsonData, err := ioutil.ReadFile(devices.oldMetadataFile())
if err != nil && !os.IsNotExist(err) {
return err
@@ -347,11 +473,7 @@ func (devices *DeviceSet) initMetaData() error {
for hash, info := range m.Devices {
info.Hash = hash
// If the transaction id is larger than the actual one we lost the device due to some crash
if info.TransactionId <= devices.TransactionId {
devices.saveMetadata(info)
}
devices.saveMetadata(info)
}
if err := os.Rename(devices.oldMetadataFile(), devices.oldMetadataFile()+".migrated"); err != nil {
return err
@@ -362,6 +484,149 @@ func (devices *DeviceSet) initMetaData() error {
return nil
}
func (devices *DeviceSet) initMetaData() error {
if err := devices.migrateOldMetaData(); err != nil {
return err
}
_, transactionId, _, _, _, _, err := devices.poolStatus()
if err != nil {
return err
}
devices.TransactionId = transactionId
if err := devices.constructDeviceIdMap(); err != nil {
return err
}
if err := devices.processPendingTransaction(); err != nil {
return err
}
return nil
}
func (devices *DeviceSet) incNextDeviceId() {
// Ids are 24bit, so wrap around
devices.NextDeviceId = (devices.NextDeviceId + 1) & MaxDeviceId
}
func (devices *DeviceSet) getNextFreeDeviceId() (int, error) {
devices.incNextDeviceId()
for i := 0; i <= MaxDeviceId; i++ {
if devices.isDeviceIdFree(devices.NextDeviceId) {
devices.markDeviceIdUsed(devices.NextDeviceId)
return devices.NextDeviceId, nil
}
devices.incNextDeviceId()
}
return 0, fmt.Errorf("Unable to find a free device Id")
}
func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
deviceId, err := devices.getNextFreeDeviceId()
if err != nil {
return nil, err
}
if err := devices.openTransaction(hash, deviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId)
devices.markDeviceIdFree(deviceId)
return nil, err
}
for {
if err := devicemapper.CreateDevice(devices.getPoolDevName(), deviceId); err != nil {
if devicemapper.DeviceIdExists(err) {
// Device Id already exists. This should not
// happen. Now we have a mechianism to find
// a free device Id. So something is not right.
// Give a warning and continue.
log.Errorf("Warning: Device Id %d exists in pool but it is supposed to be unused", deviceId)
deviceId, err = devices.getNextFreeDeviceId()
if err != nil {
return nil, err
}
// Save new device id into transaction
devices.refreshTransaction(deviceId)
continue
}
log.Debugf("Error creating device: %s", err)
devices.markDeviceIdFree(deviceId)
return nil, err
}
break
}
log.Debugf("Registering device (id %v) with FS size %v", deviceId, devices.baseFsSize)
info, err := devices.registerDevice(deviceId, hash, devices.baseFsSize, devices.OpenTransactionId)
if err != nil {
_ = devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
devices.markDeviceIdFree(deviceId)
return nil, err
}
if err := devices.closeTransaction(); err != nil {
devices.unregisterDevice(deviceId, hash)
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
devices.markDeviceIdFree(deviceId)
return nil, err
}
return info, nil
}
func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInfo) error {
deviceId, err := devices.getNextFreeDeviceId()
if err != nil {
return err
}
if err := devices.openTransaction(hash, deviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId)
devices.markDeviceIdFree(deviceId)
return err
}
for {
if err := devicemapper.CreateSnapDevice(devices.getPoolDevName(), deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
if devicemapper.DeviceIdExists(err) {
// Device Id already exists. This should not
// happen. Now we have a mechianism to find
// a free device Id. So something is not right.
// Give a warning and continue.
log.Errorf("Warning: Device Id %d exists in pool but it is supposed to be unused", deviceId)
deviceId, err = devices.getNextFreeDeviceId()
if err != nil {
return err
}
// Save new device id into transaction
devices.refreshTransaction(deviceId)
continue
}
log.Debugf("Error creating snap device: %s", err)
devices.markDeviceIdFree(deviceId)
return err
}
break
}
if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size, devices.OpenTransactionId); err != nil {
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
devices.markDeviceIdFree(deviceId)
log.Debugf("Error registering device: %s", err)
return err
}
if err := devices.closeTransaction(); err != nil {
devices.unregisterDevice(deviceId, hash)
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
devices.markDeviceIdFree(deviceId)
return err
}
return nil
}
func (devices *DeviceSet) loadMetadata(hash string) *DevInfo {
info := &DevInfo{Hash: hash, devices: devices}
@@ -374,11 +639,6 @@ func (devices *DeviceSet) loadMetadata(hash string) *DevInfo {
return nil
}
// If the transaction id is larger than the actual one we lost the device due to some crash
if info.TransactionId > devices.TransactionId {
return nil
}
return info
}
@@ -390,31 +650,35 @@ func (devices *DeviceSet) setupBaseImage() error {
if oldInfo != nil && !oldInfo.Initialized {
log.Debugf("Removing uninitialized base image")
if err := devices.deleteDevice(oldInfo); err != nil {
if err := devices.DeleteDevice(""); err != nil {
return err
}
}
log.Debugf("Initializing base device-manager snapshot")
if devices.thinPoolDevice != "" && oldInfo == nil {
_, transactionId, dataUsed, _, _, _, err := devices.poolStatus()
if err != nil {
return err
}
if dataUsed != 0 {
return fmt.Errorf("Unable to take ownership of thin-pool (%s) that already has used data blocks",
devices.thinPoolDevice)
}
if transactionId != 0 {
return fmt.Errorf("Unable to take ownership of thin-pool (%s) with non-zero transaction Id",
devices.thinPoolDevice)
}
}
id := devices.nextDeviceId
log.Debugf("Initializing base device-mapper thin volume")
// Create initial device
if err := createDevice(devices.getPoolDevName(), &id); err != nil {
return err
}
// Ids are 24bit, so wrap around
devices.nextDeviceId = (id + 1) & 0xffffff
log.Debugf("Registering base device (id %v) with FS size %v", id, devices.baseFsSize)
info, err := devices.registerDevice(id, "", devices.baseFsSize)
info, err := devices.createRegisterDevice("")
if err != nil {
_ = deleteDevice(devices.getPoolDevName(), id)
return err
}
log.Debugf("Creating filesystem on base device-manager snapshot")
log.Debugf("Creating filesystem on base device-mapper thin volume")
if err = devices.activateDeviceIfNeeded(info); err != nil {
return err
@@ -447,11 +711,12 @@ func setCloseOnExec(name string) {
}
}
func (devices *DeviceSet) log(level int, file string, line int, dmError int, message string) {
func (devices *DeviceSet) DMLog(level int, file string, line int, dmError int, message string) {
if level >= 7 {
return // Ignore _LOG_DEBUG
}
// FIXME(vbatts) push this back into ./pkg/devicemapper/
log.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
}
@@ -489,7 +754,7 @@ func (devices *DeviceSet) ResizePool(size int64) error {
return fmt.Errorf("Can't shrink file")
}
dataloopback := FindLoopDeviceFor(datafile)
dataloopback := devicemapper.FindLoopDeviceFor(datafile)
if dataloopback == nil {
return fmt.Errorf("Unable to find loopback mount for: %s", datafilename)
}
@@ -501,7 +766,7 @@ func (devices *DeviceSet) ResizePool(size int64) error {
}
defer metadatafile.Close()
metadataloopback := FindLoopDeviceFor(metadatafile)
metadataloopback := devicemapper.FindLoopDeviceFor(metadatafile)
if metadataloopback == nil {
return fmt.Errorf("Unable to find loopback mount for: %s", metadatafilename)
}
@@ -513,32 +778,166 @@ func (devices *DeviceSet) ResizePool(size int64) error {
}
// Reload size for loopback device
if err := LoopbackSetCapacity(dataloopback); err != nil {
if err := devicemapper.LoopbackSetCapacity(dataloopback); err != nil {
return fmt.Errorf("Unable to update loopback capacity: %s", err)
}
// Suspend the pool
if err := suspendDevice(devices.getPoolName()); err != nil {
if err := devicemapper.SuspendDevice(devices.getPoolName()); err != nil {
return fmt.Errorf("Unable to suspend pool: %s", err)
}
// Reload with the new block sizes
if err := reloadPool(devices.getPoolName(), dataloopback, metadataloopback, devices.thinpBlockSize); err != nil {
if err := devicemapper.ReloadPool(devices.getPoolName(), dataloopback, metadataloopback, devices.thinpBlockSize); err != nil {
return fmt.Errorf("Unable to reload pool: %s", err)
}
// Resume the pool
if err := resumeDevice(devices.getPoolName()); err != nil {
if err := devicemapper.ResumeDevice(devices.getPoolName()); err != nil {
return fmt.Errorf("Unable to resume pool: %s", err)
}
return nil
}
func (devices *DeviceSet) initDevmapper(doInit bool) error {
logInit(devices)
func (devices *DeviceSet) loadTransactionMetaData() error {
jsonData, err := ioutil.ReadFile(devices.transactionMetaFile())
if err != nil {
// There is no active transaction. This will be the case
// during upgrade.
if os.IsNotExist(err) {
devices.OpenTransactionId = devices.TransactionId
return nil
}
return err
}
_, err := getDriverVersion()
json.Unmarshal(jsonData, &devices.Transaction)
return nil
}
func (devices *DeviceSet) saveTransactionMetaData() error {
jsonData, err := json.Marshal(&devices.Transaction)
if err != nil {
return fmt.Errorf("Error encoding metadata to json: %s", err)
}
return devices.writeMetaFile(jsonData, devices.transactionMetaFile())
}
func (devices *DeviceSet) removeTransactionMetaData() error {
if err := os.RemoveAll(devices.transactionMetaFile()); err != nil {
return err
}
return nil
}
func (devices *DeviceSet) rollbackTransaction() error {
log.Debugf("Rolling back open transaction: TransactionId=%d hash=%s device_id=%d", devices.OpenTransactionId, devices.DeviceIdHash, devices.DeviceId)
// A device id might have already been deleted before transaction
// closed. In that case this call will fail. Just leave a message
// in case of failure.
if err := devicemapper.DeleteDevice(devices.getPoolDevName(), devices.DeviceId); err != nil {
log.Errorf("Warning: Unable to delete device: %s", err)
}
dinfo := &DevInfo{Hash: devices.DeviceIdHash}
if err := devices.removeMetadata(dinfo); err != nil {
log.Errorf("Warning: Unable to remove meta data: %s", err)
} else {
devices.markDeviceIdFree(devices.DeviceId)
}
if err := devices.removeTransactionMetaData(); err != nil {
log.Errorf("Warning: Unable to remove transaction meta file %s: %s", devices.transactionMetaFile(), err)
}
return nil
}
func (devices *DeviceSet) processPendingTransaction() error {
if err := devices.loadTransactionMetaData(); err != nil {
return err
}
// If there was open transaction but pool transaction Id is same
// as open transaction Id, nothing to roll back.
if devices.TransactionId == devices.OpenTransactionId {
return nil
}
// If open transaction Id is less than pool transaction Id, something
// is wrong. Bail out.
if devices.OpenTransactionId < devices.TransactionId {
log.Errorf("Warning: Open Transaction id %d is less than pool transaction id %d", devices.OpenTransactionId, devices.TransactionId)
return nil
}
// Pool transaction Id is not same as open transaction. There is
// a transaction which was not completed.
if err := devices.rollbackTransaction(); err != nil {
return fmt.Errorf("Rolling back open transaction failed: %s", err)
}
devices.OpenTransactionId = devices.TransactionId
return nil
}
func (devices *DeviceSet) loadDeviceSetMetaData() error {
jsonData, err := ioutil.ReadFile(devices.deviceSetMetaFile())
if err != nil {
// For backward compatibility return success if file does
// not exist.
if os.IsNotExist(err) {
return nil
}
return err
}
return json.Unmarshal(jsonData, devices)
}
func (devices *DeviceSet) saveDeviceSetMetaData() error {
jsonData, err := json.Marshal(devices)
if err != nil {
return fmt.Errorf("Error encoding metadata to json: %s", err)
}
return devices.writeMetaFile(jsonData, devices.deviceSetMetaFile())
}
func (devices *DeviceSet) openTransaction(hash string, DeviceId int) error {
devices.allocateTransactionId()
devices.DeviceIdHash = hash
devices.DeviceId = DeviceId
if err := devices.saveTransactionMetaData(); err != nil {
return fmt.Errorf("Error saving transaction meta data: %s", err)
}
return nil
}
func (devices *DeviceSet) refreshTransaction(DeviceId int) error {
devices.DeviceId = DeviceId
if err := devices.saveTransactionMetaData(); err != nil {
return fmt.Errorf("Error saving transaction meta data: %s", err)
}
return nil
}
func (devices *DeviceSet) closeTransaction() error {
if err := devices.updatePoolTransactionId(); err != nil {
log.Debugf("Failed to close Transaction")
return err
}
return nil
}
func (devices *DeviceSet) initDevmapper(doInit bool) error {
// give ourselves to libdm as a log handler
devicemapper.LogInit(devices)
_, err := devicemapper.GetDriverVersion()
if err != nil {
// Can't even get driver version, assume not supported
return graphdriver.ErrNotSupported
@@ -564,11 +963,11 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(sysSt.Dev), minor(sysSt.Dev), sysSt.Ino)
log.Debugf("Generated prefix: %s", devices.devicePrefix)
// Check for the existence of the device <prefix>-pool
// Check for the existence of the thin-pool device
log.Debugf("Checking for existence of the pool '%s'", devices.getPoolName())
info, err := getInfo(devices.getPoolName())
info, err := devicemapper.GetInfo(devices.getPoolName())
if info == nil {
log.Debugf("Error device getInfo: %s", err)
log.Debugf("Error device devicemapper.GetInfo: %s", err)
return err
}
@@ -583,7 +982,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
createdLoopback := false
// If the pool doesn't exist, create it
if info.Exists == 0 {
if info.Exists == 0 && devices.thinPoolDevice == "" {
log.Debugf("Pool doesn't exist. Creating it.")
var (
@@ -610,7 +1009,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
return err
}
dataFile, err = attachLoopDevice(data)
dataFile, err = devicemapper.AttachLoopDevice(data)
if err != nil {
return err
}
@@ -641,7 +1040,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
return err
}
metadataFile, err = attachLoopDevice(metadata)
metadataFile, err = devicemapper.AttachLoopDevice(metadata)
if err != nil {
return err
}
@@ -653,7 +1052,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
}
defer metadataFile.Close()
if err := createPool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
if err := devicemapper.CreatePool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
return err
}
}
@@ -666,6 +1065,12 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
}
}
// Right now this loads only NextDeviceId. If there is more metatadata
// down the line, we might have to move it earlier.
if err = devices.loadDeviceSetMetaData(); err != nil {
return err
}
// Setup the base image
if doInit {
if err := devices.setupBaseImage(); err != nil {
@@ -678,6 +1083,9 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
}
func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
log.Debugf("[deviceset] AddDevice() hash=%s basehash=%s", hash, baseHash)
defer log.Debugf("[deviceset] AddDevice END")
baseInfo, err := devices.lookupDevice(baseHash)
if err != nil {
return err
@@ -693,21 +1101,10 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
return fmt.Errorf("device %s already exists", hash)
}
deviceId := devices.nextDeviceId
if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
log.Debugf("Error creating snap device: %s", err)
if err := devices.createRegisterSnapDevice(hash, baseInfo); err != nil {
return err
}
// Ids are 24bit, so wrap around
devices.nextDeviceId = (deviceId + 1) & 0xffffff
if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil {
deleteDevice(devices.getPoolDevName(), deviceId)
log.Debugf("Error registering device: %s", err)
return err
}
return nil
}
@@ -717,13 +1114,13 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
// on the thin pool when we remove a thinp device, so we do it
// manually
if err := devices.activateDeviceIfNeeded(info); err == nil {
if err := BlockDeviceDiscard(info.DevName()); err != nil {
if err := devicemapper.BlockDeviceDiscard(info.DevName()); err != nil {
log.Debugf("Error discarding block on device: %s (ignoring)", err)
}
}
}
devinfo, _ := getInfo(info.Name())
devinfo, _ := devicemapper.GetInfo(info.Name())
if devinfo != nil && devinfo.Exists != 0 {
if err := devices.removeDeviceAndWait(info.Name()); err != nil {
log.Debugf("Error removing device: %s", err)
@@ -731,24 +1128,26 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
}
}
if err := deleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
if err := devices.openTransaction(info.Hash, info.DeviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", "", info.DeviceId)
return err
}
if err := devicemapper.DeleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
log.Debugf("Error deleting device: %s", err)
return err
}
devices.allocateTransactionId()
devices.devicesLock.Lock()
delete(devices.Devices, info.Hash)
devices.devicesLock.Unlock()
if err := devices.removeMetadata(info); err != nil {
devices.devicesLock.Lock()
devices.Devices[info.Hash] = info
devices.devicesLock.Unlock()
log.Debugf("Error removing meta data: %s", err)
if err := devices.unregisterDevice(info.DeviceId, info.Hash); err != nil {
return err
}
if err := devices.closeTransaction(); err != nil {
return err
}
devices.markDeviceIdFree(info.DeviceId)
return nil
}
@@ -771,12 +1170,17 @@ func (devices *DeviceSet) deactivatePool() error {
log.Debugf("[devmapper] deactivatePool()")
defer log.Debugf("[devmapper] deactivatePool END")
devname := devices.getPoolDevName()
devinfo, err := getInfo(devname)
devinfo, err := devicemapper.GetInfo(devname)
if err != nil {
return err
}
if d, err := devicemapper.GetDeps(devname); err == nil {
// Access to more Debug output
log.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d)
}
if devinfo.Exists != 0 {
return removeDevice(devname)
return devicemapper.RemoveDevice(devname)
}
return nil
@@ -792,7 +1196,7 @@ func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
log.Errorf("Warning: error waiting for device %s to close: %s", info.Hash, err)
}
devinfo, err := getInfo(info.Name())
devinfo, err := devicemapper.GetInfo(info.Name())
if err != nil {
return err
}
@@ -811,11 +1215,11 @@ func (devices *DeviceSet) removeDeviceAndWait(devname string) error {
var err error
for i := 0; i < 1000; i++ {
err = removeDevice(devname)
err = devicemapper.RemoveDevice(devname)
if err == nil {
break
}
if err != ErrBusy {
if err != devicemapper.ErrBusy {
return err
}
@@ -843,7 +1247,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
defer log.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
i := 0
for ; i < 1000; i++ {
devinfo, err := getInfo(devname)
devinfo, err := devicemapper.GetInfo(devname)
if err != nil {
// If there is an error we assume the device doesn't exist.
// The error might actually be something else, but we can't differentiate.
@@ -872,7 +1276,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
func (devices *DeviceSet) waitClose(info *DevInfo) error {
i := 0
for ; i < 1000; i++ {
devinfo, err := getInfo(info.Name())
devinfo, err := devicemapper.GetInfo(info.Name())
if err != nil {
return err
}
@@ -893,7 +1297,6 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
}
func (devices *DeviceSet) Shutdown() error {
log.Debugf("[deviceset %s] shutdown()", devices.devicePrefix)
log.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
defer log.Debugf("[deviceset %s] shutdown END", devices.devicePrefix)
@@ -937,9 +1340,13 @@ func (devices *DeviceSet) Shutdown() error {
}
devices.Lock()
if err := devices.deactivatePool(); err != nil {
log.Debugf("Shutdown deactivate pool , error: %s", err)
if devices.thinPoolDevice == "" {
if err := devices.deactivatePool(); err != nil {
log.Debugf("Shutdown deactivate pool , error: %s", err)
}
}
devices.saveDeviceSetMetaData()
devices.Unlock()
return nil
@@ -1060,7 +1467,7 @@ func (devices *DeviceSet) HasActivatedDevice(hash string) bool {
devices.Lock()
defer devices.Unlock()
devinfo, _ := getInfo(info.Name())
devinfo, _ := devicemapper.GetInfo(info.Name())
return devinfo != nil && devinfo.Exists != 0
}
@@ -1082,7 +1489,7 @@ func (devices *DeviceSet) List() []string {
func (devices *DeviceSet) deviceStatus(devName string) (sizeInSectors, mappedSectors, highestMappedSector uint64, err error) {
var params string
_, sizeInSectors, _, params, err = getStatus(devName)
_, sizeInSectors, _, params, err = devicemapper.GetStatus(devName)
if err != nil {
return
}
@@ -1127,7 +1534,7 @@ func (devices *DeviceSet) GetDeviceStatus(hash string) (*DevStatus, error) {
func (devices *DeviceSet) poolStatus() (totalSizeInSectors, transactionId, dataUsed, dataTotal, metadataUsed, metadataTotal uint64, err error) {
var params string
if _, totalSizeInSectors, _, params, err = getStatus(devices.getPoolName()); err == nil {
if _, totalSizeInSectors, _, params, err = devicemapper.GetStatus(devices.getPoolName()); err == nil {
_, err = fmt.Sscanf(params, "%d %d/%d %d/%d", &transactionId, &metadataUsed, &metadataTotal, &dataUsed, &dataTotal)
}
return
@@ -1170,7 +1577,7 @@ func (devices *DeviceSet) Status() *Status {
}
func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error) {
SetDevDir("/dev")
devicemapper.SetDevDir("/dev")
devices := &DeviceSet{
root: root,
@@ -1181,6 +1588,7 @@ func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error
filesystem: "ext4",
doBlkDiscard: true,
thinpBlockSize: DefaultThinpBlockSize,
deviceIdMap: make([]byte, DeviceIdMapSz),
}
foundBlkDiscard := false
@@ -1222,6 +1630,8 @@ func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error
devices.metadataDevice = val
case "dm.datadev":
devices.dataDevice = val
case "dm.thinpooldev":
devices.thinPoolDevice = strings.TrimPrefix(val, "/dev/mapper/")
case "dm.blkdiscard":
foundBlkDiscard = true
devices.doBlkDiscard, err = strconv.ParseBool(val)
@@ -1241,7 +1651,7 @@ func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error
}
// By default, don't do blk discard hack on raw devices, its rarely useful and is expensive
if !foundBlkDiscard && devices.dataDevice != "" {
if !foundBlkDiscard && (devices.dataDevice != "" || devices.thinPoolDevice != "") {
devices.doBlkDiscard = false
}

View File

@@ -3,8 +3,9 @@
package devmapper
import (
"github.com/docker/docker/daemon/graphdriver/graphtest"
"testing"
"github.com/docker/docker/daemon/graphdriver/graphtest"
)
func init() {
@@ -12,6 +13,9 @@ func init() {
DefaultDataLoopbackSize = 300 * 1024 * 1024
DefaultMetaDataLoopbackSize = 200 * 1024 * 1024
DefaultBaseFsSize = 300 * 1024 * 1024
if err := graphtest.InitLoopbacks(); err != nil {
panic(err)
}
}
// This avoids creating a new driver for each test if all tests are run

View File

@@ -8,8 +8,9 @@ import (
"os"
"path"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/units"
)
@@ -34,7 +35,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
return nil, err
}
if err := graphdriver.MakePrivate(home); err != nil {
if err := mount.MakePrivate(home); err != nil {
return nil, err
}
@@ -63,7 +64,7 @@ func (d *Driver) Status() [][2]string {
{"Metadata Space Used", fmt.Sprintf("%s", units.HumanSize(int64(s.Metadata.Used)))},
{"Metadata Space Total", fmt.Sprintf("%s", units.HumanSize(int64(s.Metadata.Total)))},
}
if vStr, err := GetLibraryVersion(); err == nil {
if vStr, err := devicemapper.GetLibraryVersion(); err == nil {
status = append(status, [2]string{"Library Version", vStr})
}
return status

View File

@@ -7,7 +7,6 @@ import (
"path"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/mount"
)
type FsMagic uint64
@@ -81,6 +80,8 @@ var (
"btrfs",
"devicemapper",
"vfs",
// experimental, has to be enabled manually for now
"overlay",
}
ErrNotSupported = errors.New("driver not supported")
@@ -139,18 +140,3 @@ func New(root string, options []string) (driver Driver, err error) {
}
return nil, fmt.Errorf("No supported storage backend found")
}
func MakePrivate(mountPoint string) error {
mounted, err := mount.Mounted(mountPoint)
if err != nil {
return err
}
if !mounted {
if err := mount.Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
return err
}
}
return mount.ForceMount("", mountPoint, "none", "private")
}

View File

@@ -1,13 +1,15 @@
// +build daemon
package graphdriver
import (
"fmt"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/utils"
)

View File

@@ -1,6 +1,7 @@
package graphtest
import (
"fmt"
"io/ioutil"
"os"
"path"
@@ -20,6 +21,46 @@ type Driver struct {
refCount int
}
// InitLoopbacks ensures that the loopback devices are properly created within
// the system running the device mapper tests.
func InitLoopbacks() error {
stat_t, err := getBaseLoopStats()
if err != nil {
return err
}
// create atleast 8 loopback files, ya, that is a good number
for i := 0; i < 8; i++ {
loopPath := fmt.Sprintf("/dev/loop%d", i)
// only create new loopback files if they don't exist
if _, err := os.Stat(loopPath); err != nil {
if mkerr := syscall.Mknod(loopPath,
uint32(stat_t.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil {
return mkerr
}
os.Chown(loopPath, int(stat_t.Uid), int(stat_t.Gid))
}
}
return nil
}
// getBaseLoopStats inspects /dev/loop0 to collect uid,gid, and mode for the
// loop0 device on the system. If it does not exist we assume 0,0,0660 for the
// stat data
func getBaseLoopStats() (*syscall.Stat_t, error) {
loop0, err := os.Stat("/dev/loop0")
if err != nil {
if os.IsNotExist(err) {
return &syscall.Stat_t{
Uid: 0,
Gid: 0,
Mode: 0660,
}, nil
}
return nil, err
}
return loop0.Sys().(*syscall.Stat_t), nil
}
func newDriver(t *testing.T, name string) *Driver {
root, err := ioutil.TempDir("/var/tmp", "docker-graphtest-")
if err != nil {
@@ -33,7 +74,7 @@ func newDriver(t *testing.T, name string) *Driver {
d, err := graphdriver.GetDriver(name, root, nil)
if err != nil {
if err == graphdriver.ErrNotSupported || err == graphdriver.ErrPrerequisites {
t.Skip("Driver %s not supported", name)
t.Skipf("Driver %s not supported", name)
}
t.Fatal(err)
}

View File

@@ -0,0 +1,157 @@
// +build linux
package overlay
import (
"fmt"
"io"
"os"
"path/filepath"
"syscall"
"github.com/docker/docker/pkg/system"
)
type CopyFlags int
const (
CopyHardlink CopyFlags = 1 << iota
)
func copyRegular(srcPath, dstPath string, mode os.FileMode) error {
srcFile, err := os.Open(srcPath)
if err != nil {
return err
}
defer srcFile.Close()
dstFile, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE, mode)
if err != nil {
return err
}
defer dstFile.Close()
_, err = io.Copy(dstFile, srcFile)
return err
}
func copyXattr(srcPath, dstPath, attr string) error {
data, err := system.Lgetxattr(srcPath, attr)
if err != nil {
return err
}
if data != nil {
if err := system.Lsetxattr(dstPath, attr, data, 0); err != nil {
return err
}
}
return nil
}
func copyDir(srcDir, dstDir string, flags CopyFlags) error {
err := filepath.Walk(srcDir, func(srcPath string, f os.FileInfo, err error) error {
if err != nil {
return err
}
// Rebase path
relPath, err := filepath.Rel(srcDir, srcPath)
if err != nil {
return err
}
dstPath := filepath.Join(dstDir, relPath)
if err != nil {
return err
}
stat, ok := f.Sys().(*syscall.Stat_t)
if !ok {
return fmt.Errorf("Unable to get raw syscall.Stat_t data for %s", srcPath)
}
switch f.Mode() & os.ModeType {
case 0: // Regular file
if flags&CopyHardlink != 0 {
if err := os.Link(srcPath, dstPath); err != nil {
return err
}
} else {
if err := copyRegular(srcPath, dstPath, f.Mode()); err != nil {
return err
}
}
case os.ModeDir:
if err := os.Mkdir(dstPath, f.Mode()); err != nil && !os.IsExist(err) {
return err
}
case os.ModeSymlink:
link, err := os.Readlink(srcPath)
if err != nil {
return err
}
if err := os.Symlink(link, dstPath); err != nil {
return err
}
case os.ModeNamedPipe:
fallthrough
case os.ModeSocket:
if err := syscall.Mkfifo(dstPath, stat.Mode); err != nil {
return err
}
case os.ModeDevice:
if err := syscall.Mknod(dstPath, stat.Mode, int(stat.Rdev)); err != nil {
return err
}
default:
return fmt.Errorf("Unknown file type for %s\n", srcPath)
}
if err := os.Lchown(dstPath, int(stat.Uid), int(stat.Gid)); err != nil {
return err
}
if err := copyXattr(srcPath, dstPath, "security.capability"); err != nil {
return err
}
// We need to copy this attribute if it appears in an overlay upper layer, as
// this function is used to copy those. It is set by overlay if a directory
// is removed and then re-created and should not inherit anything from the
// same dir in the lower dir.
if err := copyXattr(srcPath, dstPath, "trusted.overlay.opaque"); err != nil {
return err
}
isSymlink := f.Mode()&os.ModeSymlink != 0
// There is no LChmod, so ignore mode for symlink. Also, this
// must happen after chown, as that can modify the file mode
if !isSymlink {
if err := os.Chmod(dstPath, f.Mode()); err != nil {
return err
}
}
ts := []syscall.Timespec{stat.Atim, stat.Mtim}
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
if !isSymlink {
if err := system.UtimesNano(dstPath, ts); err != nil {
return err
}
} else {
if err := system.LUtimesNano(dstPath, ts); err != nil {
return err
}
}
return nil
})
return err
}

View File

@@ -0,0 +1,370 @@
// +build linux
package overlay
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"sync"
"syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/libcontainer/label"
)
// This is a small wrapper over the NaiveDiffWriter that lets us have a custom
// implementation of ApplyDiff()
var (
ErrApplyDiffFallback = fmt.Errorf("Fall back to normal ApplyDiff")
)
type ApplyDiffProtoDriver interface {
graphdriver.ProtoDriver
ApplyDiff(id, parent string, diff archive.ArchiveReader) (bytes int64, err error)
}
type naiveDiffDriverWithApply struct {
graphdriver.Driver
applyDiff ApplyDiffProtoDriver
}
func NaiveDiffDriverWithApply(driver ApplyDiffProtoDriver) graphdriver.Driver {
return &naiveDiffDriverWithApply{
Driver: graphdriver.NaiveDiffDriver(driver),
applyDiff: driver,
}
}
func (d *naiveDiffDriverWithApply) ApplyDiff(id, parent string, diff archive.ArchiveReader) (int64, error) {
b, err := d.applyDiff.ApplyDiff(id, parent, diff)
if err == ErrApplyDiffFallback {
return d.Driver.ApplyDiff(id, parent, diff)
}
return b, err
}
// This backend uses the overlay union filesystem for containers
// plus hard link file sharing for images.
// Each container/image can have a "root" subdirectory which is a plain
// filesystem hierarchy, or they can use overlay.
// If they use overlay there is a "upper" directory and a "lower-id"
// file, as well as "merged" and "work" directories. The "upper"
// directory has the upper layer of the overlay, and "lower-id" contains
// the id of the parent whose "root" directory shall be used as the lower
// layer in the overlay. The overlay itself is mounted in the "merged"
// directory, and the "work" dir is needed for overlay to work.
// When a overlay layer is created there are two cases, either the
// parent has a "root" dir, then we start out with a empty "upper"
// directory overlaid on the parents root. This is typically the
// case with the init layer of a container which is based on an image.
// If there is no "root" in the parent, we inherit the lower-id from
// the parent and start by making a copy if the parents "upper" dir.
// This is typically the case for a container layer which copies
// its parent -init upper layer.
// Additionally we also have a custom implementation of ApplyLayer
// which makes a recursive copy of the parent "root" layer using
// hardlinks to share file data, and then applies the layer on top
// of that. This means all child images share file (but not directory)
// data with the parent.
type ActiveMount struct {
count int
path string
mounted bool
}
type Driver struct {
home string
sync.Mutex // Protects concurrent modification to active
active map[string]*ActiveMount
}
func init() {
graphdriver.Register("overlay", Init)
}
func Init(home string, options []string) (graphdriver.Driver, error) {
if err := supportsOverlay(); err != nil {
return nil, graphdriver.ErrNotSupported
}
// Create the driver home dir
if err := os.MkdirAll(home, 0755); err != nil && !os.IsExist(err) {
return nil, err
}
d := &Driver{
home: home,
active: make(map[string]*ActiveMount),
}
return NaiveDiffDriverWithApply(d), nil
}
func supportsOverlay() error {
// We can try to modprobe overlay first before looking at
// proc/filesystems for when overlay is supported
exec.Command("modprobe", "overlay").Run()
f, err := os.Open("/proc/filesystems")
if err != nil {
return err
}
defer f.Close()
s := bufio.NewScanner(f)
for s.Scan() {
if s.Text() == "nodev\toverlay" {
return nil
}
}
log.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.")
return graphdriver.ErrNotSupported
}
func (d *Driver) String() string {
return "overlay"
}
func (d *Driver) Status() [][2]string {
return nil
}
func (d *Driver) Cleanup() error {
return nil
}
func (d *Driver) Create(id string, parent string) (retErr error) {
dir := d.dir(id)
if err := os.MkdirAll(path.Dir(dir), 0700); err != nil {
return err
}
if err := os.Mkdir(dir, 0700); err != nil {
return err
}
defer func() {
// Clean up on failure
if retErr != nil {
os.RemoveAll(dir)
}
}()
// Toplevel images are just a "root" dir
if parent == "" {
if err := os.Mkdir(path.Join(dir, "root"), 0755); err != nil {
return err
}
return nil
}
parentDir := d.dir(parent)
// Ensure parent exists
if _, err := os.Lstat(parentDir); err != nil {
return err
}
// If parent has a root, just do a overlay to it
parentRoot := path.Join(parentDir, "root")
if s, err := os.Lstat(parentRoot); err == nil {
if err := os.Mkdir(path.Join(dir, "upper"), s.Mode()); err != nil {
return err
}
if err := os.Mkdir(path.Join(dir, "work"), 0700); err != nil {
return err
}
if err := os.Mkdir(path.Join(dir, "merged"), 0700); err != nil {
return err
}
if err := ioutil.WriteFile(path.Join(dir, "lower-id"), []byte(parent), 0666); err != nil {
return err
}
return nil
}
// Otherwise, copy the upper and the lower-id from the parent
lowerId, err := ioutil.ReadFile(path.Join(parentDir, "lower-id"))
if err != nil {
return err
}
if err := ioutil.WriteFile(path.Join(dir, "lower-id"), lowerId, 0666); err != nil {
return err
}
parentUpperDir := path.Join(parentDir, "upper")
s, err := os.Lstat(parentUpperDir)
if err != nil {
return err
}
upperDir := path.Join(dir, "upper")
if err := os.Mkdir(upperDir, s.Mode()); err != nil {
return err
}
if err := os.Mkdir(path.Join(dir, "work"), 0700); err != nil {
return err
}
if err := os.Mkdir(path.Join(dir, "merged"), 0700); err != nil {
return err
}
return copyDir(parentUpperDir, upperDir, 0)
}
func (d *Driver) dir(id string) string {
return path.Join(d.home, id)
}
func (d *Driver) Remove(id string) error {
dir := d.dir(id)
if _, err := os.Stat(dir); err != nil {
return err
}
return os.RemoveAll(dir)
}
func (d *Driver) Get(id string, mountLabel string) (string, error) {
// Protect the d.active from concurrent access
d.Lock()
defer d.Unlock()
mount := d.active[id]
if mount != nil {
mount.count++
return mount.path, nil
} else {
mount = &ActiveMount{count: 1}
}
dir := d.dir(id)
if _, err := os.Stat(dir); err != nil {
return "", err
}
// If id has a root, just return it
rootDir := path.Join(dir, "root")
if _, err := os.Stat(rootDir); err == nil {
mount.path = rootDir
d.active[id] = mount
return mount.path, nil
}
lowerId, err := ioutil.ReadFile(path.Join(dir, "lower-id"))
if err != nil {
return "", err
}
lowerDir := path.Join(d.dir(string(lowerId)), "root")
upperDir := path.Join(dir, "upper")
workDir := path.Join(dir, "work")
mergedDir := path.Join(dir, "merged")
opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", lowerDir, upperDir, workDir)
if err := syscall.Mount("overlay", mergedDir, "overlay", 0, label.FormatMountLabel(opts, mountLabel)); err != nil {
return "", err
}
mount.path = mergedDir
mount.mounted = true
d.active[id] = mount
return mount.path, nil
}
func (d *Driver) Put(id string) {
// Protect the d.active from concurrent access
d.Lock()
defer d.Unlock()
mount := d.active[id]
if mount == nil {
log.Debugf("Put on a non-mounted device %s", id)
return
}
mount.count--
if mount.count > 0 {
return
}
if mount.mounted {
if err := syscall.Unmount(mount.path, 0); err != nil {
log.Debugf("Failed to unmount %s overlay: %v", id, err)
}
}
delete(d.active, id)
}
func (d *Driver) ApplyDiff(id string, parent string, diff archive.ArchiveReader) (bytes int64, err error) {
dir := d.dir(id)
if parent == "" {
return 0, ErrApplyDiffFallback
}
parentRootDir := path.Join(d.dir(parent), "root")
if _, err := os.Stat(parentRootDir); err != nil {
return 0, ErrApplyDiffFallback
}
// We now know there is a parent, and it has a "root" directory containing
// the full root filesystem. We can just hardlink it and apply the
// layer. This relies on two things:
// 1) ApplyDiff is only run once on a clean (no writes to upper layer) container
// 2) ApplyDiff doesn't do any in-place writes to files (would break hardlinks)
// These are all currently true and are not expected to break
tmpRootDir, err := ioutil.TempDir(dir, "tmproot")
if err != nil {
return 0, err
}
defer func() {
if err != nil {
os.RemoveAll(tmpRootDir)
} else {
os.RemoveAll(path.Join(dir, "upper"))
os.RemoveAll(path.Join(dir, "work"))
os.RemoveAll(path.Join(dir, "merged"))
os.RemoveAll(path.Join(dir, "lower-id"))
}
}()
if err = copyDir(parentRootDir, tmpRootDir, CopyHardlink); err != nil {
return 0, err
}
if err := chrootarchive.ApplyLayer(tmpRootDir, diff); err != nil {
return 0, err
}
rootDir := path.Join(dir, "root")
if err := os.Rename(tmpRootDir, rootDir); err != nil {
return 0, err
}
changes, err := archive.ChangesDirs(rootDir, parentRootDir)
if err != nil {
return 0, err
}
return archive.ChangesSize(rootDir, changes), nil
}
func (d *Driver) Exists(id string) bool {
_, err := os.Stat(d.dir(id))
return err == nil
}

View File

@@ -0,0 +1,28 @@
package overlay
import (
"github.com/docker/docker/daemon/graphdriver/graphtest"
"testing"
)
// This avoids creating a new driver for each test if all tests are run
// Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown
func TestOverlaySetup(t *testing.T) {
graphtest.GetDriver(t, "overlay")
}
func TestOverlayCreateEmpty(t *testing.T) {
graphtest.DriverTestCreateEmpty(t, "overlay")
}
func TestOverlayCreateBase(t *testing.T) {
graphtest.DriverTestCreateBase(t, "overlay")
}
func TestOverlayCreateSnap(t *testing.T) {
graphtest.DriverTestCreateSnap(t, "overlay")
}
func TestOverlayTeardown(t *testing.T) {
graphtest.PutDriver(t)
}

View File

@@ -133,6 +133,9 @@ func (daemon *Daemon) canDeleteImage(imgID string, force bool) error {
for _, container := range daemon.List() {
parent, err := daemon.Repositories().LookupImage(container.Image)
if err != nil {
if daemon.Graph().IsNotExist(err) {
return nil
}
return err
}

View File

@@ -4,11 +4,12 @@ import (
"os"
"runtime"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/registry"
"github.com/docker/docker/utils"
)
@@ -37,6 +38,11 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
operatingSystem += " (containerized)"
}
meminfo, err := system.ReadMemInfo()
if err != nil {
log.Errorf("Could not read system memory info: %v", err)
}
// if we still have the original dockerinit binary from before we copied it locally, let's return the path to that, since that's more intuitive (the copied path is trivial to derive by hand given VERSION)
initPath := utils.DockerInitPath("")
if initPath == "" {
@@ -50,6 +56,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
return job.Error(err)
}
v := &engine.Env{}
v.Set("ID", daemon.ID)
v.SetInt("Containers", len(daemon.List()))
v.SetInt("Images", imgcount)
v.Set("Driver", daemon.GraphDriver().String())
@@ -67,6 +74,13 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
v.Set("IndexServerAddress", registry.IndexServerAddress())
v.Set("InitSha1", dockerversion.INITSHA1)
v.Set("InitPath", initPath)
v.SetInt("NCPU", runtime.NumCPU())
v.SetInt64("MemTotal", meminfo.MemTotal)
v.Set("DockerRootDir", daemon.Config().Root)
if hostname, err := os.Hostname(); err == nil {
v.Set("Name", hostname)
}
v.SetList("Labels", daemon.Config().Labels)
if _, err := v.WriteTo(job.Stdout); err != nil {
return job.Error(err)
}

View File

@@ -65,3 +65,21 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
}
return job.Errorf("No such container: %s", name)
}
func (daemon *Daemon) ContainerExecInspect(job *engine.Job) engine.Status {
if len(job.Args) != 1 {
return job.Errorf("usage: %s ID", job.Name)
}
id := job.Args[0]
eConfig, err := daemon.getExecConfig(id)
if err != nil {
return job.Error(err)
}
b, err := json.Marshal(*eConfig)
if err != nil {
return job.Error(err)
}
job.Stdout.Write(b)
return engine.StatusOK
}

View File

@@ -28,7 +28,6 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status {
size = job.GetenvBool("size")
psFilters filters.Args
filt_exited []int
filt_status []string
)
outs := engine.NewTable("Created", 0)
@@ -46,8 +45,6 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status {
}
}
filt_status, _ = psFilters["status"]
names := map[string][]string{}
daemon.ContainerGraph().Walk("/", func(p string, e *graphdb.Entity) error {
names[e.ID()] = append(names[e.ID()], p)
@@ -76,6 +73,15 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status {
if !container.Running && !all && n <= 0 && since == "" && before == "" {
return nil
}
if !psFilters.Match("name", container.Name) {
return nil
}
if !psFilters.Match("id", container.ID) {
return nil
}
if before != "" && !foundBefore {
if container.ID == beforeCont.ID {
foundBefore = true
@@ -102,10 +108,9 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status {
return nil
}
}
for _, status := range filt_status {
if container.State.StateString() != strings.ToLower(status) {
return nil
}
if !psFilters.Match("status", container.State.StateString()) {
return nil
}
displayed++
out := &engine.Env{}

View File

@@ -7,10 +7,11 @@ import (
"io"
"os"
"strconv"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/tailfile"
"github.com/docker/docker/pkg/timeutils"
)
@@ -112,24 +113,36 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) engine.Status {
}
if follow && container.IsRunning() {
errors := make(chan error, 2)
wg := sync.WaitGroup{}
if stdout {
wg.Add(1)
stdoutPipe := container.StdoutLogPipe()
defer stdoutPipe.Close()
go func() {
errors <- jsonlog.WriteLog(stdoutPipe, job.Stdout, format)
wg.Done()
}()
}
if stderr {
wg.Add(1)
stderrPipe := container.StderrLogPipe()
defer stderrPipe.Close()
go func() {
errors <- jsonlog.WriteLog(stderrPipe, job.Stderr, format)
wg.Done()
}()
}
err := <-errors
if err != nil {
log.Errorf("%s", err)
wg.Wait()
close(errors)
for err := range errors {
if err != nil {
log.Errorf("%s", err)
}
}
}
return engine.StatusOK
}

View File

@@ -6,8 +6,8 @@ import (
"sync"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/runconfig"
)
@@ -100,7 +100,7 @@ func (m *containerMonitor) Close() error {
func (m *containerMonitor) Start() error {
var (
err error
exitStatus int
exitStatus execdriver.ExitStatus
// this variable indicates where we in execution flow:
// before Run or after
afterRun bool
@@ -110,7 +110,7 @@ func (m *containerMonitor) Start() error {
defer func() {
if afterRun {
m.container.Lock()
m.container.setStopped(exitStatus)
m.container.setStopped(&exitStatus)
defer m.container.Unlock()
}
m.Close()
@@ -138,6 +138,7 @@ func (m *containerMonitor) Start() error {
// if we receive an internal error from the initial start of a container then lets
// return it instead of entering the restart loop
if m.container.RestartCount == 0 {
m.container.ExitCode = -1
m.resetContainer(false)
return err
@@ -149,10 +150,10 @@ func (m *containerMonitor) Start() error {
// here container.Lock is already lost
afterRun = true
m.resetMonitor(err == nil && exitStatus == 0)
m.resetMonitor(err == nil && exitStatus.ExitCode == 0)
if m.shouldRestart(exitStatus) {
m.container.SetRestarting(exitStatus)
if m.shouldRestart(exitStatus.ExitCode) {
m.container.SetRestarting(&exitStatus)
m.container.LogEvent("die")
m.resetContainer(true)
@@ -163,10 +164,12 @@ func (m *containerMonitor) Start() error {
// we need to check this before reentering the loop because the waitForNextRestart could have
// been terminated by a request from a user
if m.shouldStop {
m.container.ExitCode = exitStatus.ExitCode
return err
}
continue
}
m.container.ExitCode = exitStatus.ExitCode
m.container.LogEvent("die")
m.resetContainer(true)
return err
@@ -206,7 +209,7 @@ func (m *containerMonitor) waitForNextRestart() {
// shouldRestart checks the restart policy and applies the rules to determine if
// the container's process should be restarted
func (m *containerMonitor) shouldRestart(exitStatus int) bool {
func (m *containerMonitor) shouldRestart(exitCode int) bool {
m.mux.Lock()
defer m.mux.Unlock()
@@ -225,7 +228,7 @@ func (m *containerMonitor) shouldRestart(exitStatus int) bool {
return false
}
return exitStatus != 0
return exitCode != 0
}
return false

View File

@@ -4,16 +4,17 @@ import (
"fmt"
"io/ioutil"
"net"
"strings"
"os"
"strconv"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver"
"github.com/docker/docker/daemon/networkdriver/ipallocator"
"github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/daemon/networkdriver/portmapper"
"github.com/docker/docker/engine"
"github.com/docker/docker/nat"
"github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/networkfs/resolvconf"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/libcontainer/netlink"
@@ -104,8 +105,8 @@ func InitDriver(job *engine.Job) engine.Status {
if !usingDefaultBridge {
return job.Error(err)
}
// If the iface is not found, try to create it
if err := createBridge(bridgeIP); err != nil {
// If the bridge interface is not found (or has no address), try to create it and/or add an address
if err := configureBridge(bridgeIP); err != nil {
return job.Error(err)
}
@@ -193,7 +194,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
if output, err := iptables.Raw(append([]string{"-I"}, natArgs...)...); err != nil {
return fmt.Errorf("Unable to enable network bridge NAT: %s", err)
} else if len(output) != 0 {
return fmt.Errorf("Error iptables postrouting: %s", output)
return &iptables.ChainError{Chain: "POSTROUTING", Output: output}
}
}
}
@@ -234,7 +235,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
if output, err := iptables.Raw(append([]string{"-I"}, outgoingArgs...)...); err != nil {
return fmt.Errorf("Unable to allow outgoing packets: %s", err)
} else if len(output) != 0 {
return fmt.Errorf("Error iptables allow outgoing: %s", output)
return &iptables.ChainError{Chain: "FORWARD outgoing", Output: output}
}
}
@@ -245,16 +246,18 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
if output, err := iptables.Raw(append([]string{"-I"}, existingArgs...)...); err != nil {
return fmt.Errorf("Unable to allow incoming packets: %s", err)
} else if len(output) != 0 {
return fmt.Errorf("Error iptables allow incoming: %s", output)
return &iptables.ChainError{Chain: "FORWARD incoming", Output: output}
}
}
return nil
}
// CreateBridgeIface creates a network bridge interface on the host system with the name `ifaceName`,
// and attempts to configure it with an address which doesn't conflict with any other interface on the host.
// If it can't find an address which doesn't conflict, it will return an error.
func createBridge(bridgeIP string) error {
// configureBridge attempts to create and configure a network bridge interface named `bridgeIface` on the host
// If bridgeIP is empty, it will try to find a non-conflicting IP from the Docker-specified private ranges
// If the bridge `bridgeIface` already exists, it will only perform the IP address association with the existing
// bridge (fixes issue #8444)
// If an address which doesn't conflict with existing interfaces can't be found, an error is returned.
func configureBridge(bridgeIP string) error {
nameservers := []string{}
resolvConf, _ := resolvconf.Get()
// we don't check for an error here, because we don't really care
@@ -295,7 +298,10 @@ func createBridge(bridgeIP string) error {
log.Debugf("Creating bridge %s with network %s", bridgeIface, ifaceAddr)
if err := createBridgeIface(bridgeIface); err != nil {
return err
// the bridge may already exist, therefore we can ignore an "exists" error
if !os.IsExist(err) {
return err
}
}
iface, err := net.InterfaceByName(bridgeIface)
@@ -461,22 +467,13 @@ func AllocatePort(job *engine.Job) engine.Status {
if host, err = portmapper.Map(container, ip, hostPort); err == nil {
break
}
if allocerr, ok := err.(portallocator.ErrPortAlreadyAllocated); ok {
// There is no point in immediately retrying to map an explicitly
// chosen port.
if hostPort != 0 {
job.Logf("Failed to bind %s for container address %s: %s", allocerr.IPPort(), container.String(), allocerr.Error())
break
}
// Automatically chosen 'free' port failed to bind: move on the next.
job.Logf("Failed to bind %s for container address %s. Trying another port.", allocerr.IPPort(), container.String())
} else {
// some other error during mapping
job.Logf("Received an unexpected error during port allocation: %s", err.Error())
// There is no point in immediately retrying to map an explicitly
// chosen port.
if hostPort != 0 {
job.Logf("Failed to allocate and map port %d: %s", hostPort, err)
break
}
job.Logf("Failed to allocate and map port: %s, retry: %d", err, i+1)
}
if err != nil {
@@ -509,18 +506,13 @@ func LinkContainers(job *engine.Job) engine.Status {
ignoreErrors = job.GetenvBool("IgnoreErrors")
ports = job.GetenvList("Ports")
)
split := func(p string) (string, string) {
parts := strings.Split(p, "/")
return parts[0], parts[1]
}
for _, p := range ports {
port, proto := split(p)
for _, value := range ports {
port := nat.Port(value)
if output, err := iptables.Raw(action, "FORWARD",
"-i", bridgeIface, "-o", bridgeIface,
"-p", proto,
"-p", port.Proto(),
"-s", parentIP,
"--dport", port,
"--dport", strconv.Itoa(port.Int()),
"-d", childIP,
"-j", "ACCEPT"); !ignoreErrors && err != nil {
return job.Error(err)
@@ -530,9 +522,9 @@ func LinkContainers(job *engine.Job) engine.Status {
if output, err := iptables.Raw(action, "FORWARD",
"-i", bridgeIface, "-o", bridgeIface,
"-p", proto,
"-p", port.Proto(),
"-s", childIP,
"--sport", port,
"--sport", strconv.Itoa(port.Int()),
"-d", parentIP,
"-j", "ACCEPT"); !ignoreErrors && err != nil {
return job.Error(err)

View File

@@ -1,31 +1,38 @@
package ipallocator
import (
"encoding/binary"
"errors"
"math/big"
"net"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver"
)
// allocatedMap is thread-unsafe set of allocated IP
type allocatedMap struct {
p map[uint32]struct{}
last uint32
begin uint32
end uint32
p map[string]struct{}
last *big.Int
begin *big.Int
end *big.Int
}
func newAllocatedMap(network *net.IPNet) *allocatedMap {
firstIP, lastIP := networkdriver.NetworkRange(network)
begin := ipToInt(firstIP) + 2
end := ipToInt(lastIP) - 1
begin := big.NewInt(0).Add(ipToBigInt(firstIP), big.NewInt(1))
end := big.NewInt(0).Sub(ipToBigInt(lastIP), big.NewInt(1))
// if IPv4 network, then allocation range starts at begin + 1 because begin is bridge IP
if len(firstIP) == 4 {
begin = begin.Add(begin, big.NewInt(1))
}
return &allocatedMap{
p: make(map[uint32]struct{}),
p: make(map[string]struct{}),
begin: begin,
end: end,
last: begin - 1, // so first allocated will be begin
last: big.NewInt(0).Sub(begin, big.NewInt(1)), // so first allocated will be begin
}
}
@@ -56,13 +63,16 @@ func RegisterSubnet(network *net.IPNet, subnet *net.IPNet) error {
}
n := newAllocatedMap(network)
beginIP, endIP := networkdriver.NetworkRange(subnet)
begin, end := ipToInt(beginIP)+1, ipToInt(endIP)-1
if !(begin >= n.begin && end <= n.end && begin < end) {
begin := big.NewInt(0).Add(ipToBigInt(beginIP), big.NewInt(1))
end := big.NewInt(0).Sub(ipToBigInt(endIP), big.NewInt(1))
// Check that subnet is within network
if !(begin.Cmp(n.begin) >= 0 && end.Cmp(n.end) <= 0 && begin.Cmp(end) == -1) {
return ErrBadSubnet
}
n.begin = begin
n.end = end
n.last = begin - 1
n.begin.Set(begin)
n.end.Set(end)
n.last.Sub(begin, big.NewInt(1))
allocatedIPs[key] = n
return nil
}
@@ -93,28 +103,25 @@ func ReleaseIP(network *net.IPNet, ip net.IP) error {
lock.Lock()
defer lock.Unlock()
if allocated, exists := allocatedIPs[network.String()]; exists {
pos := ipToInt(ip)
delete(allocated.p, pos)
delete(allocated.p, ip.String())
}
return nil
}
func (allocated *allocatedMap) checkIP(ip net.IP) (net.IP, error) {
pos := ipToInt(ip)
// Verify that the IP address has not been already allocated.
if _, ok := allocated.p[pos]; ok {
if _, ok := allocated.p[ip.String()]; ok {
return nil, ErrIPAlreadyAllocated
}
pos := ipToBigInt(ip)
// Verify that the IP address is within our network range.
if pos < allocated.begin || pos > allocated.end {
if pos.Cmp(allocated.begin) == -1 || pos.Cmp(allocated.end) == 1 {
return nil, ErrIPOutOfRange
}
// Register the IP.
allocated.p[pos] = struct{}{}
allocated.last = pos
allocated.p[ip.String()] = struct{}{}
allocated.last.Set(pos)
return ip, nil
}
@@ -122,29 +129,38 @@ func (allocated *allocatedMap) checkIP(ip net.IP) (net.IP, error) {
// return an available ip if one is currently available. If not,
// return the next available ip for the nextwork
func (allocated *allocatedMap) getNextIP() (net.IP, error) {
for pos := allocated.last + 1; pos != allocated.last; pos++ {
if pos > allocated.end {
pos = allocated.begin
pos := big.NewInt(0).Set(allocated.last)
allRange := big.NewInt(0).Sub(allocated.end, allocated.begin)
for i := big.NewInt(0); i.Cmp(allRange) <= 0; i.Add(i, big.NewInt(1)) {
pos.Add(pos, big.NewInt(1))
if pos.Cmp(allocated.end) == 1 {
pos.Set(allocated.begin)
}
if _, ok := allocated.p[pos]; ok {
if _, ok := allocated.p[bigIntToIP(pos).String()]; ok {
continue
}
allocated.p[pos] = struct{}{}
allocated.last = pos
return intToIP(pos), nil
allocated.p[bigIntToIP(pos).String()] = struct{}{}
allocated.last.Set(pos)
return bigIntToIP(pos), nil
}
return nil, ErrNoAvailableIPs
}
// Converts a 4 bytes IP into a 32 bit integer
func ipToInt(ip net.IP) uint32 {
return binary.BigEndian.Uint32(ip.To4())
// Converts a 4 bytes IP into a 128 bit integer
func ipToBigInt(ip net.IP) *big.Int {
x := big.NewInt(0)
if ip4 := ip.To4(); ip4 != nil {
return x.SetBytes(ip4)
}
if ip6 := ip.To16(); ip6 != nil {
return x.SetBytes(ip6)
}
log.Errorf("ipToBigInt: Wrong IP length! %s", ip)
return nil
}
// Converts 32 bit integer into a 4 bytes IP address
func intToIP(n uint32) net.IP {
b := make([]byte, 4)
binary.BigEndian.PutUint32(b, n)
ip := net.IP(b)
return ip
// Converts 128 bit integer into a 4 bytes IP address
func bigIntToIP(v *big.Int) net.IP {
return net.IP(v.Bytes())
}

View File

@@ -2,6 +2,7 @@ package ipallocator
import (
"fmt"
"math/big"
"net"
"testing"
)
@@ -10,6 +11,46 @@ func reset() {
allocatedIPs = networkSet{}
}
func TestConversion(t *testing.T) {
ip := net.ParseIP("127.0.0.1")
i := ipToBigInt(ip)
if i.Cmp(big.NewInt(0x7f000001)) != 0 {
t.Fatal("incorrect conversion")
}
conv := bigIntToIP(i)
if !ip.Equal(conv) {
t.Error(conv.String())
}
}
func TestConversionIPv6(t *testing.T) {
ip := net.ParseIP("2a00:1450::1")
ip2 := net.ParseIP("2a00:1450::2")
ip3 := net.ParseIP("2a00:1450::1:1")
i := ipToBigInt(ip)
val, success := big.NewInt(0).SetString("2a001450000000000000000000000001", 16)
if !success {
t.Fatal("Hex-String to BigInt conversion failed.")
}
if i.Cmp(val) != 0 {
t.Fatal("incorrent conversion")
}
conv := bigIntToIP(i)
conv2 := bigIntToIP(big.NewInt(0).Add(i, big.NewInt(1)))
conv3 := bigIntToIP(big.NewInt(0).Add(i, big.NewInt(0x10000)))
if !ip.Equal(conv) {
t.Error("2a00:1450::1 should be equal to " + conv.String())
}
if !ip2.Equal(conv2) {
t.Error("2a00:1450::2 should be equal to " + conv2.String())
}
if !ip3.Equal(conv3) {
t.Error("2a00:1450::1:1 should be equal to " + conv3.String())
}
}
func TestRequestNewIps(t *testing.T) {
defer reset()
network := &net.IPNet{
@@ -19,6 +60,7 @@ func TestRequestNewIps(t *testing.T) {
var ip net.IP
var err error
for i := 2; i < 10; i++ {
ip, err = RequestIP(network, nil)
if err != nil {
@@ -29,7 +71,39 @@ func TestRequestNewIps(t *testing.T) {
t.Fatalf("Expected ip %s got %s", expected, ip.String())
}
}
value := intToIP(ipToInt(ip) + 1).String()
value := bigIntToIP(big.NewInt(0).Add(ipToBigInt(ip), big.NewInt(1))).String()
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
ip, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
if ip.String() != value {
t.Fatalf("Expected to receive the next ip %s got %s", value, ip.String())
}
}
func TestRequestNewIpV6(t *testing.T) {
defer reset()
network := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x14, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}, // /64 netmask
}
var ip net.IP
var err error
for i := 1; i < 10; i++ {
ip, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
if expected := fmt.Sprintf("2a00:1450::%d", i); ip.String() != expected {
t.Fatalf("Expected ip %s got %s", expected, ip.String())
}
}
value := bigIntToIP(big.NewInt(0).Add(ipToBigInt(ip), big.NewInt(1))).String()
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
@@ -59,6 +133,23 @@ func TestReleaseIp(t *testing.T) {
}
}
func TestReleaseIpV6(t *testing.T) {
defer reset()
network := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x14, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}, // /64 netmask
}
ip, err := RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
}
func TestGetReleasedIp(t *testing.T) {
defer reset()
network := &net.IPNet{
@@ -97,6 +188,44 @@ func TestGetReleasedIp(t *testing.T) {
}
}
func TestGetReleasedIpV6(t *testing.T) {
defer reset()
network := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x14, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0},
}
ip, err := RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
value := ip.String()
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
for i := 0; i < 253; i++ {
_, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
err = ReleaseIP(network, ip)
if err != nil {
t.Fatal(err)
}
}
ip, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
if ip.String() != value {
t.Fatalf("Expected to receive same ip %s got %s", value, ip.String())
}
}
func TestRequestSpecificIp(t *testing.T) {
defer reset()
network := &net.IPNet{
@@ -122,15 +251,28 @@ func TestRequestSpecificIp(t *testing.T) {
}
}
func TestConversion(t *testing.T) {
ip := net.ParseIP("127.0.0.1")
i := ipToInt(ip)
if i == 0 {
t.Fatal("converted to zero")
func TestRequestSpecificIpV6(t *testing.T) {
defer reset()
network := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x14, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}, // /64 netmask
}
conv := intToIP(i)
if !ip.Equal(conv) {
t.Error(conv.String())
ip := net.ParseIP("2a00:1450::5")
// Request a "good" IP.
if _, err := RequestIP(network, ip); err != nil {
t.Fatal(err)
}
// Request the same IP again.
if _, err := RequestIP(network, ip); err != ErrIPAlreadyAllocated {
t.Fatalf("Got the same IP twice: %#v", err)
}
// Request an out of range IP.
if _, err := RequestIP(network, net.ParseIP("2a00:1500::1")); err != ErrIPOutOfRange {
t.Fatalf("Got an out of range IP: %#v", err)
}
}
@@ -144,6 +286,7 @@ func TestIPAllocator(t *testing.T) {
}
gwIP, n, _ := net.ParseCIDR("127.0.0.1/29")
network := &net.IPNet{IP: gwIP, Mask: n.Mask}
// Pool after initialisation (f = free, u = used)
// 2(f) - 3(f) - 4(f) - 5(f) - 6(f)
@@ -237,13 +380,13 @@ func TestAllocateFirstIP(t *testing.T) {
}
firstIP := network.IP.To4().Mask(network.Mask)
first := ipToInt(firstIP) + 1
first := big.NewInt(0).Add(ipToBigInt(firstIP), big.NewInt(1))
ip, err := RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
allocated := ipToInt(ip)
allocated := ipToBigInt(ip)
if allocated == first {
t.Fatalf("allocated ip should not equal first ip: %d == %d", first, allocated)
@@ -289,6 +432,65 @@ func TestAllocateAllIps(t *testing.T) {
}
assertIPEquals(t, first, again)
// ensure that alloc.last == alloc.begin won't result in dead loop
if _, err := RequestIP(network, nil); err != ErrNoAvailableIPs {
t.Fatal(err)
}
// Test by making alloc.last the only free ip and ensure we get it back
// #1. first of the range, (alloc.last == ipToInt(first) already)
if err := ReleaseIP(network, first); err != nil {
t.Fatal(err)
}
ret, err := RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
assertIPEquals(t, first, ret)
// #2. last of the range, note that current is the last one
last := net.IPv4(192, 168, 0, 254)
setLastTo(t, network, last)
ret, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
assertIPEquals(t, last, ret)
// #3. middle of the range
mid := net.IPv4(192, 168, 0, 7)
setLastTo(t, network, mid)
ret, err = RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
assertIPEquals(t, mid, ret)
}
// make sure the pool is full when calling setLastTo.
// we don't cheat here
func setLastTo(t *testing.T, network *net.IPNet, ip net.IP) {
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
ret, err := RequestIP(network, nil)
if err != nil {
t.Fatal(err)
}
assertIPEquals(t, ip, ret)
if err := ReleaseIP(network, ip); err != nil {
t.Fatal(err)
}
}
func TestAllocateDifferentSubnets(t *testing.T) {
@@ -301,11 +503,24 @@ func TestAllocateDifferentSubnets(t *testing.T) {
IP: []byte{127, 0, 0, 1},
Mask: []byte{255, 255, 255, 0},
}
network3 := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x14, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}, // /64 netmask
}
network4 := &net.IPNet{
IP: []byte{0x2a, 0x00, 0x16, 0x32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
Mask: []byte{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}, // /64 netmask
}
expectedIPs := []net.IP{
0: net.IPv4(192, 168, 0, 2),
1: net.IPv4(192, 168, 0, 3),
2: net.IPv4(127, 0, 0, 2),
3: net.IPv4(127, 0, 0, 3),
4: net.ParseIP("2a00:1450::1"),
5: net.ParseIP("2a00:1450::2"),
6: net.ParseIP("2a00:1450::3"),
7: net.ParseIP("2a00:1632::1"),
8: net.ParseIP("2a00:1632::2"),
}
ip11, err := RequestIP(network1, nil)
@@ -324,11 +539,37 @@ func TestAllocateDifferentSubnets(t *testing.T) {
if err != nil {
t.Fatal(err)
}
ip31, err := RequestIP(network3, nil)
if err != nil {
t.Fatal(err)
}
ip32, err := RequestIP(network3, nil)
if err != nil {
t.Fatal(err)
}
ip33, err := RequestIP(network3, nil)
if err != nil {
t.Fatal(err)
}
ip41, err := RequestIP(network4, nil)
if err != nil {
t.Fatal(err)
}
ip42, err := RequestIP(network4, nil)
if err != nil {
t.Fatal(err)
}
assertIPEquals(t, expectedIPs[0], ip11)
assertIPEquals(t, expectedIPs[1], ip12)
assertIPEquals(t, expectedIPs[2], ip21)
assertIPEquals(t, expectedIPs[3], ip22)
assertIPEquals(t, expectedIPs[4], ip31)
assertIPEquals(t, expectedIPs[5], ip32)
assertIPEquals(t, expectedIPs[6], ip33)
assertIPEquals(t, expectedIPs[7], ip41)
assertIPEquals(t, expectedIPs[8], ip42)
}
func TestRegisterBadTwice(t *testing.T) {
defer reset()
network := &net.IPNet{
@@ -378,6 +619,7 @@ func TestAllocateFromRange(t *testing.T) {
IP: []byte{192, 168, 0, 8},
Mask: []byte{255, 255, 255, 248},
}
if err := RegisterSubnet(network, subnet); err != nil {
t.Fatal(err)
}

View File

@@ -122,9 +122,6 @@ func TestNetworkRange(t *testing.T) {
if !last.Equal(net.ParseIP("192.168.0.255")) {
t.Error(last.String())
}
if size := NetworkSize(network.Mask); size != 256 {
t.Error(size)
}
// Class A test
_, network, _ = net.ParseCIDR("10.0.0.1/8")
@@ -135,9 +132,6 @@ func TestNetworkRange(t *testing.T) {
if !last.Equal(net.ParseIP("10.255.255.255")) {
t.Error(last.String())
}
if size := NetworkSize(network.Mask); size != 16777216 {
t.Error(size)
}
// Class A, random IP address
_, network, _ = net.ParseCIDR("10.1.2.3/8")
@@ -158,9 +152,6 @@ func TestNetworkRange(t *testing.T) {
if !last.Equal(net.ParseIP("10.1.2.3")) {
t.Error(last.String())
}
if size := NetworkSize(network.Mask); size != 1 {
t.Error(size)
}
// 31bit mask
_, network, _ = net.ParseCIDR("10.1.2.3/31")
@@ -171,9 +162,6 @@ func TestNetworkRange(t *testing.T) {
if !last.Equal(net.ParseIP("10.1.2.3")) {
t.Error(last.String())
}
if size := NetworkSize(network.Mask); size != 2 {
t.Error(size)
}
// 26bit mask
_, network, _ = net.ParseCIDR("10.1.2.3/26")
@@ -184,7 +172,4 @@ func TestNetworkRange(t *testing.T) {
if !last.Equal(net.ParseIP("10.1.2.63")) {
t.Error(last.String())
}
if size := NetworkSize(network.Mask); size != 64 {
t.Error(size)
}
}

View File

@@ -14,7 +14,8 @@ type portMap struct {
func newPortMap() *portMap {
return &portMap{
p: map[int]struct{}{},
p: map[int]struct{}{},
last: EndPortRange,
}
}
@@ -135,13 +136,9 @@ func ReleaseAll() error {
}
func (pm *portMap) findPort() (int, error) {
if pm.last == 0 {
pm.p[BeginPortRange] = struct{}{}
pm.last = BeginPortRange
return BeginPortRange, nil
}
for port := pm.last + 1; port != pm.last; port++ {
port := pm.last
for i := 0; i <= EndPortRange-BeginPortRange; i++ {
port++
if port > EndPortRange {
port = BeginPortRange
}

View File

@@ -134,6 +134,19 @@ func TestAllocateAllPorts(t *testing.T) {
if newPort != port {
t.Fatalf("Expected port %d got %d", port, newPort)
}
// now pm.last == newPort, release it so that it's the only free port of
// the range, and ensure we get it back
if err := ReleasePort(defaultIP, "tcp", newPort); err != nil {
t.Fatal(err)
}
port, err = RequestPort(defaultIP, "tcp", 0)
if err != nil {
t.Fatal(err)
}
if newPort != port {
t.Fatalf("Expected port %d got %d", newPort, port)
}
}
func BenchmarkAllocatePorts(b *testing.B) {
@@ -214,3 +227,19 @@ func TestPortAllocation(t *testing.T) {
t.Fatal("Requesting a dynamic port should never allocate a used port")
}
}
func TestNoDuplicateBPR(t *testing.T) {
defer reset()
if port, err := RequestPort(defaultIP, "tcp", BeginPortRange); err != nil {
t.Fatal(err)
} else if port != BeginPortRange {
t.Fatalf("Expected port %d got %d", BeginPortRange, port)
}
if port, err := RequestPort(defaultIP, "tcp", 0); err != nil {
t.Fatal(err)
} else if port == BeginPortRange {
t.Fatalf("Acquire(0) allocated the same port twice: %d", port)
}
}

View File

@@ -6,9 +6,9 @@ import (
"net"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/log"
)
type mapping struct {

View File

@@ -130,7 +130,12 @@ func (p *proxyCommand) Start() error {
r.Read(buf)
if string(buf) != "0\n" {
errStr, _ := ioutil.ReadAll(r)
errStr, err := ioutil.ReadAll(r)
if err != nil {
errchan <- fmt.Errorf("Error reading exit status from userland proxy: %v", err)
return
}
errchan <- fmt.Errorf("Error starting userland proxy: %s", errStr)
return
}
@@ -140,7 +145,7 @@ func (p *proxyCommand) Start() error {
select {
case err := <-errchan:
return err
case <-time.After(1 * time.Second):
case <-time.After(16 * time.Second):
return fmt.Errorf("Timed out proxy starting the userland proxy")
}
}

View File

@@ -1,7 +1,6 @@
package networkdriver
import (
"encoding/binary"
"errors"
"fmt"
"net"
@@ -56,25 +55,21 @@ func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool {
// Calculates the first and last IP addresses in an IPNet
func NetworkRange(network *net.IPNet) (net.IP, net.IP) {
var (
netIP = network.IP.To4()
firstIP = netIP.Mask(network.Mask)
lastIP = net.IPv4(0, 0, 0, 0).To4()
)
var netIP net.IP
if network.IP.To4() != nil {
netIP = network.IP.To4()
} else if network.IP.To16() != nil {
netIP = network.IP.To16()
} else {
return nil, nil
}
for i := 0; i < len(lastIP); i++ {
lastIP := make([]byte, len(netIP), len(netIP))
for i := 0; i < len(netIP); i++ {
lastIP[i] = netIP[i] | ^network.Mask[i]
}
return firstIP, lastIP
}
// Given a netmask, calculates the number of available hosts
func NetworkSize(mask net.IPMask) int32 {
m := net.IPv4Mask(0, 0, 0, 0)
for i := 0; i < net.IPv4len; i++ {
m[i] = ^mask[i]
}
return int32(binary.BigEndian.Uint32(m)) + 1
return netIP.Mask(network.Mask), net.IP(lastIP)
}
// Return the IPv4 address of a network interface
@@ -90,7 +85,7 @@ func GetIfaceAddr(name string) (net.Addr, error) {
var addrs4 []net.Addr
for _, addr := range addrs {
ip := (addr.(*net.IPNet)).IP
if ip4 := ip.To4(); len(ip4) == net.IPv4len {
if ip4 := ip.To4(); ip4 != nil {
addrs4 = append(addrs4, addr)
}
}

View File

@@ -5,6 +5,7 @@ import (
"sync"
"time"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/units"
)
@@ -13,8 +14,10 @@ type State struct {
Running bool
Paused bool
Restarting bool
OOMKilled bool
Pid int
ExitCode int
Error string // contains last known error when starting the container
StartedAt time.Time
FinishedAt time.Time
waitChan chan struct{}
@@ -137,6 +140,7 @@ func (s *State) SetRunning(pid int) {
}
func (s *State) setRunning(pid int) {
s.Error = ""
s.Running = true
s.Paused = false
s.Restarting = false
@@ -147,25 +151,26 @@ func (s *State) setRunning(pid int) {
s.waitChan = make(chan struct{})
}
func (s *State) SetStopped(exitCode int) {
func (s *State) SetStopped(exitStatus *execdriver.ExitStatus) {
s.Lock()
s.setStopped(exitCode)
s.setStopped(exitStatus)
s.Unlock()
}
func (s *State) setStopped(exitCode int) {
func (s *State) setStopped(exitStatus *execdriver.ExitStatus) {
s.Running = false
s.Restarting = false
s.Pid = 0
s.FinishedAt = time.Now().UTC()
s.ExitCode = exitCode
s.ExitCode = exitStatus.ExitCode
s.OOMKilled = exitStatus.OOMKilled
close(s.waitChan) // fire waiters for stop
s.waitChan = make(chan struct{})
}
// SetRestarting is when docker hanldes the auto restart of containers when they are
// in the middle of a stop and being restarted again
func (s *State) SetRestarting(exitCode int) {
func (s *State) SetRestarting(exitStatus *execdriver.ExitStatus) {
s.Lock()
// we should consider the container running when it is restarting because of
// all the checks in docker around rm/stop/etc
@@ -173,12 +178,20 @@ func (s *State) SetRestarting(exitCode int) {
s.Restarting = true
s.Pid = 0
s.FinishedAt = time.Now().UTC()
s.ExitCode = exitCode
s.ExitCode = exitStatus.ExitCode
s.OOMKilled = exitStatus.OOMKilled
close(s.waitChan) // fire waiters for stop
s.waitChan = make(chan struct{})
s.Unlock()
}
// setError sets the container's error state. This is useful when we want to
// know the error that occurred when container transits to another state
// when inspecting it
func (s *State) setError(err error) {
s.Error = err.Error()
}
func (s *State) IsRestarting() bool {
s.Lock()
res := s.Restarting

View File

@@ -4,6 +4,8 @@ import (
"sync/atomic"
"testing"
"time"
"github.com/docker/docker/daemon/execdriver"
)
func TestStateRunStop(t *testing.T) {
@@ -47,7 +49,7 @@ func TestStateRunStop(t *testing.T) {
atomic.StoreInt64(&exit, int64(exitCode))
close(stopped)
}()
s.SetStopped(i)
s.SetStopped(&execdriver.ExitStatus{i, false})
if s.IsRunning() {
t.Fatal("State is running")
}

View File

@@ -1,6 +1,7 @@
package daemon
import (
"errors"
"fmt"
"strings"
@@ -32,9 +33,9 @@ func migratePortMappings(config *runconfig.Config, hostConfig *runconfig.HostCon
return nil
}
func mergeLxcConfIntoOptions(hostConfig *runconfig.HostConfig) []string {
func mergeLxcConfIntoOptions(hostConfig *runconfig.HostConfig) ([]string, error) {
if hostConfig == nil {
return nil
return nil, nil
}
out := []string{}
@@ -44,10 +45,13 @@ func mergeLxcConfIntoOptions(hostConfig *runconfig.HostConfig) []string {
for _, pair := range lxcConf {
// because lxc conf gets the driver name lxc.XXXX we need to trim it off
// and let the lxc driver add it back later if needed
if !strings.Contains(pair.Key, ".") {
return nil, errors.New("Illegal Key passed into LXC Configurations")
}
parts := strings.SplitN(pair.Key, ".", 2)
out = append(out, fmt.Sprintf("%s=%s", parts[1], pair.Value))
}
}
return out
return out, nil
}

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