mirror of
https://github.com/clearlinux/docker.git
synced 2026-08-20 12:45:50 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 867b2a90c2 | |||
| 3600720a36 | |||
| 8e681c34af | |||
| b60e316b67 | |||
| a2fc45e627 | |||
| 3f47f23fec | |||
| e5974ae0ff | |||
| ce002bf8da | |||
| 9cad4c2a1b | |||
| 6056cce265 | |||
| cec512ccbb | |||
| d1e027291b | |||
| fda2934b6d | |||
| 6fe06c6cc8 | |||
| 63596f8c5d | |||
| 3c9e23c297 | |||
| 6908e0ba1e | |||
| 816d55342d | |||
| 2463be4dea | |||
| 9e98ba72e1 | |||
| d1f7ebda16 | |||
| 899f06bf79 | |||
| f020f1d31e | |||
| b9a0e886fc | |||
| bcab23bbdc | |||
| 7c35bfd78e | |||
| 78d66068a5 | |||
| ab5b715964 | |||
| d8448f27c6 | |||
| 463cf28788 | |||
| 6ce9daea0e | |||
| 39dbaa08dc | |||
| d70e20cddd | |||
| 2741b82cf3 | |||
| 70ec7c6355 | |||
| 0225a37951 | |||
| 4bb1950089 |
@@ -23,6 +23,3 @@ bundles/
|
||||
vendor/pkg/
|
||||
pyenv
|
||||
Vagrantfile
|
||||
docs/AWS_S3_BUCKET
|
||||
docs/GIT_BRANCH
|
||||
docs/VERSION
|
||||
|
||||
+14
-2
@@ -10,9 +10,21 @@ install: true
|
||||
|
||||
before_script:
|
||||
- env | sort
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq python-yaml
|
||||
- git remote add upstream git://github.com/dotcloud/docker.git
|
||||
- upstream=master;
|
||||
if [ "$TRAVIS_PULL_REQUEST" != false ]; then
|
||||
upstream=$TRAVIS_BRANCH;
|
||||
fi;
|
||||
git fetch --append --no-tags upstream refs/heads/$upstream:refs/remotes/upstream/$upstream
|
||||
# sometimes we have upstream master already as origin/master (PRs), but other times we don't, so let's just make sure we have a completely unambiguous way to specify "upstream master" from here out
|
||||
# but if it's a PR against non-master, we need that upstream branch instead :)
|
||||
- sudo pip install -r docs/requirements.txt
|
||||
|
||||
script:
|
||||
- hack/make.sh validate-dco
|
||||
- hack/make.sh validate-gofmt
|
||||
- hack/travis/dco.py
|
||||
- hack/travis/gofmt.py
|
||||
- make -sC docs SPHINXOPTS=-q docs man
|
||||
|
||||
# vim:set sw=2 ts=2:
|
||||
|
||||
@@ -20,7 +20,6 @@ Andrew Munsell <andrew@wizardapps.net>
|
||||
Andrews Medina <andrewsmedina@gmail.com>
|
||||
Andy Chambers <anchambers@paypal.com>
|
||||
andy diller <dillera@gmail.com>
|
||||
Andy Goldstein <agoldste@redhat.com>
|
||||
Andy Rothfusz <github@metaliveblog.com>
|
||||
Andy Smith <github@anarkystic.com>
|
||||
Anthony Bishopric <git@anthonybishopric.com>
|
||||
@@ -45,7 +44,6 @@ Brian Olsen <brian@maven-group.org>
|
||||
Brian Shumate <brian@couchbase.com>
|
||||
Briehan Lombaard <briehan.lombaard@gmail.com>
|
||||
Bruno Bigras <bigras.bruno@gmail.com>
|
||||
Bryan Matsuo <bryan.matsuo@gmail.com>
|
||||
Caleb Spare <cespare@gmail.com>
|
||||
Calen Pennington <cale@edx.org>
|
||||
Carl X. Su <bcbcarl@gmail.com>
|
||||
@@ -179,7 +177,6 @@ Keli Hu <dev@keli.hu>
|
||||
Ken Cochrane <kencochrane@gmail.com>
|
||||
Kevin Clark <kevin.clark@gmail.com>
|
||||
Kevin J. Lynagh <kevin@keminglabs.com>
|
||||
Kevin Wallace <kevin@pentabarf.net>
|
||||
Keyvan Fatehi <keyvanfatehi@gmail.com>
|
||||
kim0 <email.ahmedkamal@googlemail.com>
|
||||
Kim BKC Carlbacker <kim.carlbacker@gmail.com>
|
||||
|
||||
-154
@@ -1,159 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.11.1 (2014-05-07)
|
||||
|
||||
#### Registry
|
||||
- Fix push and pull to private registry
|
||||
|
||||
## 0.11.0 (2014-05-07)
|
||||
|
||||
#### Notable features since 0.10.0
|
||||
|
||||
* SELinux support for mount and process labels
|
||||
* Linked containers can be accessed by hostname
|
||||
* Use the net `--net` flag to allow advanced network configuration such as host networking so that containers can use the host's network interfaces
|
||||
* Add a ping endpoint to the Remote API to do healthchecks of your docker daemon
|
||||
* Logs can now be returned with an optional timestamp
|
||||
* Docker now works with registries that support SHA-512
|
||||
* Multiple registry endpoints are supported to allow registry mirrors
|
||||
|
||||
## 0.10.0 (2014-04-08)
|
||||
|
||||
#### Builder
|
||||
- Fix printing multiple messages on a single line. Fixes broken output during builds.
|
||||
- Follow symlinks inside container's root for ADD build instructions.
|
||||
- Fix EXPOSE caching.
|
||||
|
||||
#### Documentation
|
||||
- Add the new options of `docker ps` to the documentation.
|
||||
- Add the options of `docker restart` to the documentation.
|
||||
- Update daemon docs and help messages for --iptables and --ip-forward.
|
||||
- Updated apt-cacher-ng docs example.
|
||||
- Remove duplicate description of --mtu from docs.
|
||||
- Add missing -t and -v for `docker images` to the docs.
|
||||
- Add fixes to the cli docs.
|
||||
- Update libcontainer docs.
|
||||
- Update images in docs to remove references to AUFS and LXC.
|
||||
- Update the nodejs_web_app in the docs to use the new epel RPM address.
|
||||
- Fix external link on security of containers.
|
||||
- Update remote API docs.
|
||||
- Add image size to history docs.
|
||||
- Be explicit about binding to all interfaces in redis example.
|
||||
- Document DisableNetwork flag in the 1.10 remote api.
|
||||
- Document that `--lxc-conf` is lxc only.
|
||||
- Add chef usage documentation.
|
||||
- Add example for an image with multiple for `docker load`.
|
||||
- Explain what `docker run -a` does in the docs.
|
||||
|
||||
#### Contrib
|
||||
- Add variable for DOCKER_LOGFILE to sysvinit and use append instead of overwrite in opening the logfile.
|
||||
- Fix init script cgroup mounting workarounds to be more similar to cgroupfs-mount and thus work properly.
|
||||
- Remove inotifywait hack from the upstart host-integration example because it's not necessary any more.
|
||||
- Add check-config script to contrib.
|
||||
- Fix fish shell completion.
|
||||
|
||||
#### Hack
|
||||
* Clean up "go test" output from "make test" to be much more readable/scannable.
|
||||
* Excluse more "definitely not unit tested Go source code" directories from hack/make/test.
|
||||
+ Generate md5 and sha256 hashes when building, and upload them via hack/release.sh.
|
||||
- Include contributed completions in Ubuntu PPA.
|
||||
+ Add cli integration tests.
|
||||
* Add tweaks to the hack scripts to make them simpler.
|
||||
|
||||
#### Remote API
|
||||
+ Add TLS auth support for API.
|
||||
* Move git clone from daemon to client.
|
||||
- Fix content-type detection in docker cp.
|
||||
* Split API into 2 go packages.
|
||||
|
||||
#### Runtime
|
||||
* Support hairpin NAT without going through Docker server.
|
||||
- devicemapper: succeed immediately when removing non-existing devices.
|
||||
- devicemapper: improve handling of devicemapper devices (add per device lock, increase sleep time and unlock while sleeping).
|
||||
- devicemapper: increase timeout in waitClose to 10 seconds.
|
||||
- devicemapper: ensure we shut down thin pool cleanly.
|
||||
- devicemapper: pass info, rather than hash to activateDeviceIfNeeded, deactivateDevice, setInitialized, deleteDevice.
|
||||
- devicemapper: avoid AB-BA deadlock.
|
||||
- devicemapper: make shutdown better/faster.
|
||||
- improve alpha sorting in mflag.
|
||||
- Remove manual http cookie management because the cookiejar is being used.
|
||||
- Use BSD raw mode on Darwin. Fixes nano, tmux and others.
|
||||
- Add FreeBSD support for the client.
|
||||
- Merge auth package into registry.
|
||||
- Add deprecation warning for -t on `docker pull`.
|
||||
- Remove goroutine leak on error.
|
||||
- Update parseLxcInfo to comply with new lxc1.0 format.
|
||||
- Fix attach exit on darwin.
|
||||
- Improve deprecation message.
|
||||
- Retry to retrieve the layer metadata up to 5 times for `docker pull`.
|
||||
- Only unshare the mount namespace for execin.
|
||||
- Merge existing config when committing.
|
||||
- Disable daemon startup timeout.
|
||||
- Fix issue #4681: add loopback interface when networking is disabled.
|
||||
- Add failing test case for issue #4681.
|
||||
- Send SIGTERM to child, instead of SIGKILL.
|
||||
- Show the driver and the kernel version in `docker info` even when not in debug mode.
|
||||
- Always symlink /dev/ptmx for libcontainer. This fixes console related problems.
|
||||
- Fix issue caused by the absence of /etc/apparmor.d.
|
||||
- Don't leave empty cidFile behind when failing to create the container.
|
||||
- Mount cgroups automatically if they're not mounted already.
|
||||
- Use mock for search tests.
|
||||
- Update to double-dash everywhere.
|
||||
- Move .dockerenv parsing to lxc driver.
|
||||
- Move all bind-mounts in the container inside the namespace.
|
||||
- Don't use separate bind mount for container.
|
||||
- Always symlink /dev/ptmx for libcontainer.
|
||||
- Don't kill by pid for other drivers.
|
||||
- Add initial logging to libcontainer.
|
||||
* Sort by port in `docker ps`.
|
||||
- Move networking drivers into runtime top level package.
|
||||
+ Add --no-prune to `docker rmi`.
|
||||
+ Add time since exit in `docker ps`.
|
||||
- graphdriver: add build tags.
|
||||
- Prevent allocation of previously allocated ports & prevent improve port allocation.
|
||||
* Add support for --since/--before in `docker ps`.
|
||||
- Clean up container stop.
|
||||
+ Add support for configurable dns search domains.
|
||||
- Add support for relative WORKDIR instructions.
|
||||
- Add --output flag for docker save.
|
||||
- Remove duplication of DNS entries in config merging.
|
||||
- Add cpuset.cpus to cgroups and native driver options.
|
||||
- Remove docker-ci.
|
||||
- Promote btrfs. btrfs is no longer considered experimental.
|
||||
- Add --input flag to `docker load`.
|
||||
- Return error when existing bridge doesn't match IP address.
|
||||
- Strip comments before parsing line continuations to avoid interpreting instructions as comments.
|
||||
- Fix TestOnlyLoopbackExistsWhenUsingDisableNetworkOption to ignore "DOWN" interfaces.
|
||||
- Add systemd implementation of cgroups and make containers show up as systemd units.
|
||||
- Fix commit and import when no repository is specified.
|
||||
- Remount /var/lib/docker as --private to fix scaling issue.
|
||||
- Use the environment's proxy when pinging the remote registry.
|
||||
- Reduce error level from harmless errors.
|
||||
* Allow --volumes-from to be individual files.
|
||||
- Fix expanding buffer in StdCopy.
|
||||
- Set error regardless of attach or stdin. This fixes #3364.
|
||||
- Add support for --env-file to load environment variables from files.
|
||||
- Symlink /etc/mtab and /proc/mounts.
|
||||
- Allow pushing a single tag.
|
||||
- Shut down containers cleanly at shutdown and wait forever for the containers to shut down. This makes container shutdown on daemon shutdown work properly via SIGTERM.
|
||||
- Don't throw error when starting an already running container.
|
||||
- Fix dynamic port allocation limit.
|
||||
- remove setupDev from libcontainer.
|
||||
- Add API version to `docker version`.
|
||||
- Return correct exit code when receiving signal and make SIGQUIT quit without cleanup.
|
||||
- Fix --volumes-from mount failure.
|
||||
- Allow non-privileged containers to create device nodes.
|
||||
- Skip login tests because of external dependency on a hosted service.
|
||||
- Deprecate `docker images --tree` and `docker images --viz`.
|
||||
- Deprecate `docker insert`.
|
||||
- Include base abstraction for apparmor. This fixes some apparmor related problems on Ubuntu 14.04.
|
||||
- Add specific error message when hitting 401 over HTTP on push.
|
||||
- Fix absolute volume check.
|
||||
- Remove volumes-from from the config.
|
||||
- Move DNS options to hostconfig.
|
||||
- Update the apparmor profile for libcontainer.
|
||||
- Add deprecation notice for `docker commit -run`.
|
||||
|
||||
## 0.9.1 (2014-03-24)
|
||||
|
||||
#### Builder
|
||||
|
||||
+21
-38
@@ -82,7 +82,7 @@ editors have plugins that do this automatically, and there's also a git
|
||||
pre-commit hook:
|
||||
|
||||
```
|
||||
curl -o .git/hooks/pre-commit https://raw.githubusercontent.com/edsrzf/gofmt-git-hook/master/fmt-check && chmod +x .git/hooks/pre-commit
|
||||
curl -o .git/hooks/pre-commit https://raw.github.com/edsrzf/gofmt-git-hook/master/fmt-check && chmod +x .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
Pull requests descriptions should be as clear as possible and include a
|
||||
@@ -90,10 +90,6 @@ reference to all the issues that they address.
|
||||
|
||||
Pull requests must not contain commits from other users or branches.
|
||||
|
||||
Commit messages must start with a capitalized and short summary (max. 50
|
||||
chars) written in the imperative, followed by an optional, more detailed
|
||||
explanatory text which is separated from the summary by an empty line.
|
||||
|
||||
Code review comments may be added to your pull request. Discuss, then make the
|
||||
suggested modifications and push additional commits to your feature branch. Be
|
||||
sure to post a comment after pushing. The new commits will show up in the pull
|
||||
@@ -130,46 +126,33 @@ For more details see [MAINTAINERS.md](hack/MAINTAINERS.md)
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right to
|
||||
pass it on as an open-source patch. The rules are pretty simple: if you
|
||||
can certify the below (from
|
||||
[developercertificate.org](http://developercertificate.org/)):
|
||||
can certify the below:
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
Docker Developer Certificate of Origin 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
By making a contribution to the Docker Project ("Project"), I represent and
|
||||
warrant that:
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
a. The contribution was created in whole or in part by me and I have the right
|
||||
to submit the contribution on my own behalf or on behalf of a third party who
|
||||
has authorized me to submit this contribution to the Project; or
|
||||
|
||||
b. The contribution is based upon previous work that, to the best of my
|
||||
knowledge, is covered under an appropriate open source license and I have the
|
||||
right and authorization to submit that work with modifications, whether
|
||||
created in whole or in part by me, under the same open source license (unless
|
||||
I am permitted to submit under a different license) that I have identified in
|
||||
the contribution; or
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
c. The contribution was provided directly to me by some other person who
|
||||
represented and warranted (a) or (b) and I have not modified it.
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
d. I understand and agree that this Project and the contribution are publicly
|
||||
known and that a record of the contribution (including all personal
|
||||
information I submit with it, including my sign-off record) is maintained
|
||||
indefinitely and may be redistributed consistent with this Project or the open
|
||||
source license(s) involved.
|
||||
```
|
||||
|
||||
then you just add a line to every git commit message:
|
||||
|
||||
+5
-12
@@ -6,13 +6,13 @@
|
||||
# docker build -t docker .
|
||||
#
|
||||
# # Mount your source in an interactive container for quick testing:
|
||||
# docker run -v `pwd`:/go/src/github.com/dotcloud/docker --privileged -i -t docker bash
|
||||
# docker run -v `pwd`:/go/src/github.com/dotcloud/docker -privileged -i -t docker bash
|
||||
#
|
||||
# # Run the test suite:
|
||||
# docker run --privileged docker hack/make.sh test
|
||||
# docker run -privileged docker hack/make.sh test
|
||||
#
|
||||
# # Publish a release:
|
||||
# docker run --privileged \
|
||||
# docker run -privileged \
|
||||
# -e AWS_S3_BUCKET=baz \
|
||||
# -e AWS_ACCESS_KEY=foo \
|
||||
# -e AWS_SECRET_KEY=bar \
|
||||
@@ -42,7 +42,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \
|
||||
libcap-dev \
|
||||
libsqlite3-dev \
|
||||
mercurial \
|
||||
pandoc \
|
||||
reprepro \
|
||||
ruby1.9.1 \
|
||||
ruby1.9.1-dev \
|
||||
@@ -69,10 +68,7 @@ ENV GOPATH /go:/go/src/github.com/dotcloud/docker/vendor
|
||||
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
|
||||
|
||||
# Compile Go for cross compilation
|
||||
ENV DOCKER_CROSSPLATFORMS \
|
||||
linux/386 linux/arm \
|
||||
darwin/amd64 darwin/386 \
|
||||
freebsd/amd64 freebsd/386 freebsd/arm
|
||||
ENV DOCKER_CROSSPLATFORMS linux/386 linux/arm darwin/amd64 darwin/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'
|
||||
@@ -83,9 +79,6 @@ RUN go get code.google.com/p/go.tools/cmd/cover
|
||||
# TODO replace FPM with some very minimal debhelper stuff
|
||||
RUN gem install --no-rdoc --no-ri fpm --version 1.0.2
|
||||
|
||||
# Get the "busybox" image source so we can build locally instead of pulling
|
||||
RUN git clone https://github.com/jpetazzo/docker-busybox.git /docker-busybox
|
||||
|
||||
# Setup s3cmd config
|
||||
RUN /bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY' > /.s3cfg
|
||||
|
||||
@@ -94,7 +87,7 @@ RUN git config --global user.email 'docker-dummy@example.com'
|
||||
|
||||
VOLUME /var/lib/docker
|
||||
WORKDIR /go/src/github.com/dotcloud/docker
|
||||
ENV DOCKER_BUILDTAGS apparmor selinux
|
||||
ENV DOCKER_BUILDTAGS apparmor
|
||||
|
||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||
ENTRYPOINT ["hack/dind"]
|
||||
|
||||
@@ -176,7 +176,18 @@
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2014 Docker, Inc.
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
Solomon Hykes <solomon@docker.com> (@shykes)
|
||||
Guillaume J. Charmes <guillaume@docker.com> (@creack)
|
||||
Solomon Hykes <solomon@dotcloud.com> (@shykes)
|
||||
Guillaume Charmes <guillaume@dotcloud.com> (@creack)
|
||||
Victor Vieux <vieux@docker.com> (@vieux)
|
||||
Michael Crosby <michael@crosbymichael.com> (@crosbymichael)
|
||||
.travis.yml: Tianon Gravi <admwiggin@gmail.com> (@tianon)
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
.PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli validate
|
||||
.PHONY: all binary build cross default docs docs-build docs-shell shell test test-integration
|
||||
|
||||
# to allow `make BINDDIR=. shell` or `make BINDDIR= test`
|
||||
BINDDIR := bundles
|
||||
# to allow `make DOCSPORT=9000 docs`
|
||||
DOCSPORT := 8000
|
||||
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref 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/dotcloud/docker/$(BINDDIR)")
|
||||
|
||||
DOCKER_RUN_DOCKER := docker run --rm -it --privileged -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
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
DOCKER_IMAGE := docker:$(GIT_BRANCH)
|
||||
DOCKER_DOCS_IMAGE := docker-docs:$(GIT_BRANCH)
|
||||
DOCKER_RUN_DOCKER := docker run --rm -i -t --privileged -e TESTFLAGS -v "$(CURDIR)/bundles:/go/src/github.com/dotcloud/docker/bundles" "$(DOCKER_IMAGE)"
|
||||
|
||||
default: binary
|
||||
|
||||
@@ -26,29 +17,17 @@ cross: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross
|
||||
|
||||
docs: docs-build
|
||||
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve
|
||||
docker run --rm -i -t -p 8000:8000 "$(DOCKER_DOCS_IMAGE)"
|
||||
|
||||
docs-shell: docs-build
|
||||
$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
|
||||
|
||||
docs-release: docs-build
|
||||
$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./release.sh
|
||||
docker run --rm -i -t -p 8000:8000 "$(DOCKER_DOCS_IMAGE)" bash
|
||||
|
||||
test: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-unit test-integration test-integration-cli
|
||||
|
||||
test-unit: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh test test-integration
|
||||
|
||||
test-integration: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh test-integration
|
||||
|
||||
test-integration-cli: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-integration-cli
|
||||
|
||||
validate: build
|
||||
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco
|
||||
|
||||
shell: build
|
||||
$(DOCKER_RUN_DOCKER) bash
|
||||
|
||||
@@ -56,9 +35,6 @@ build: bundles
|
||||
docker build -t "$(DOCKER_IMAGE)" .
|
||||
|
||||
docs-build:
|
||||
cp ./VERSION docs/VERSION
|
||||
echo "$(GIT_BRANCH)" > docs/GIT_BRANCH
|
||||
echo "$(AWS_S3_BUCKET)" > docs/AWS_S3_BUCKET
|
||||
docker build -t "$(DOCKER_DOCS_IMAGE)" docs
|
||||
|
||||
bundles:
|
||||
|
||||
@@ -18,7 +18,7 @@ It benefits directly from the experience accumulated over several years
|
||||
of large-scale operation and support of hundreds of thousands of
|
||||
applications and databases.
|
||||
|
||||

|
||||

|
||||
|
||||
## Better than VMs
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -17,3 +20,46 @@ func TestJsonContentType(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetBoolParam(t *testing.T) {
|
||||
if ret, err := getBoolParam("true"); err != nil || !ret {
|
||||
t.Fatalf("true -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("True"); err != nil || !ret {
|
||||
t.Fatalf("True -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("1"); err != nil || !ret {
|
||||
t.Fatalf("1 -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam(""); err != nil || ret {
|
||||
t.Fatalf("\"\" -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("false"); err != nil || ret {
|
||||
t.Fatalf("false -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("0"); err != nil || ret {
|
||||
t.Fatalf("0 -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("faux"); err == nil || ret {
|
||||
t.Fatalf("faux -> false, err | got %t %s", ret, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TesthttpError(t *testing.T) {
|
||||
r := httptest.NewRecorder()
|
||||
|
||||
httpError(r, fmt.Errorf("No such method"))
|
||||
if r.Code != http.StatusNotFound {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusNotFound, r.Code)
|
||||
}
|
||||
|
||||
httpError(r, fmt.Errorf("This accound hasn't been activated"))
|
||||
if r.Code != http.StatusForbidden {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusForbidden, r.Code)
|
||||
}
|
||||
|
||||
httpError(r, fmt.Errorf("Some error"))
|
||||
if r.Code != http.StatusInternalServerError {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusInternalServerError, r.Code)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,109 +0,0 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
flag "github.com/dotcloud/docker/pkg/mflag"
|
||||
"github.com/dotcloud/docker/pkg/term"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
)
|
||||
|
||||
var funcMap = template.FuncMap{
|
||||
"json": func(v interface{}) string {
|
||||
a, _ := json.Marshal(v)
|
||||
return string(a)
|
||||
},
|
||||
}
|
||||
|
||||
func (cli *DockerCli) getMethod(name string) (func(...string) error, bool) {
|
||||
methodName := "Cmd" + strings.ToUpper(name[:1]) + strings.ToLower(name[1:])
|
||||
method := reflect.ValueOf(cli).MethodByName(methodName)
|
||||
if !method.IsValid() {
|
||||
return nil, false
|
||||
}
|
||||
return method.Interface().(func(...string) error), true
|
||||
}
|
||||
|
||||
func (cli *DockerCli) ParseCommands(args ...string) error {
|
||||
if len(args) > 0 {
|
||||
method, exists := cli.getMethod(args[0])
|
||||
if !exists {
|
||||
fmt.Println("Error: Command not found:", args[0])
|
||||
return cli.CmdHelp(args[1:]...)
|
||||
}
|
||||
return method(args[1:]...)
|
||||
}
|
||||
return cli.CmdHelp(args...)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) Subcmd(name, signature, description string) *flag.FlagSet {
|
||||
flags := flag.NewFlagSet(name, flag.ContinueOnError)
|
||||
flags.Usage = func() {
|
||||
fmt.Fprintf(cli.err, "\nUsage: docker %s %s\n\n%s\n\n", name, signature, description)
|
||||
flags.PrintDefaults()
|
||||
os.Exit(2)
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
||||
func (cli *DockerCli) LoadConfigFile() (err error) {
|
||||
cli.configFile, err = registry.LoadConfig(os.Getenv("HOME"))
|
||||
if err != nil {
|
||||
fmt.Fprintf(cli.err, "WARNING: %s\n", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func NewDockerCli(in io.ReadCloser, out, err io.Writer, proto, addr string, tlsConfig *tls.Config) *DockerCli {
|
||||
var (
|
||||
isTerminal = false
|
||||
terminalFd uintptr
|
||||
scheme = "http"
|
||||
)
|
||||
|
||||
if tlsConfig != nil {
|
||||
scheme = "https"
|
||||
}
|
||||
|
||||
if in != nil {
|
||||
if file, ok := in.(*os.File); ok {
|
||||
terminalFd = file.Fd()
|
||||
isTerminal = term.IsTerminal(terminalFd)
|
||||
}
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
err = out
|
||||
}
|
||||
return &DockerCli{
|
||||
proto: proto,
|
||||
addr: addr,
|
||||
in: in,
|
||||
out: out,
|
||||
err: err,
|
||||
isTerminal: isTerminal,
|
||||
terminalFd: terminalFd,
|
||||
tlsConfig: tlsConfig,
|
||||
scheme: scheme,
|
||||
}
|
||||
}
|
||||
|
||||
type DockerCli struct {
|
||||
proto string
|
||||
addr string
|
||||
configFile *registry.ConfigFile
|
||||
in io.ReadCloser
|
||||
out io.Writer
|
||||
err io.Writer
|
||||
isTerminal bool
|
||||
terminalFd uintptr
|
||||
tlsConfig *tls.Config
|
||||
scheme string
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/dockerversion"
|
||||
"github.com/dotcloud/docker/pkg/term"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
)
|
||||
|
||||
func (cli *DockerCli) dial() (net.Conn, error) {
|
||||
if cli.tlsConfig != nil && cli.proto != "unix" {
|
||||
return tls.Dial(cli.proto, cli.addr, cli.tlsConfig)
|
||||
}
|
||||
return net.Dial(cli.proto, cli.addr)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.ReadCloser, stdout, stderr io.Writer, started chan io.Closer) error {
|
||||
defer func() {
|
||||
if started != nil {
|
||||
close(started)
|
||||
}
|
||||
}()
|
||||
|
||||
req, err := http.NewRequest(method, fmt.Sprintf("/v%s%s", api.APIVERSION, path), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION)
|
||||
req.Header.Set("Content-Type", "plain/text")
|
||||
req.Host = cli.addr
|
||||
|
||||
dial, err := cli.dial()
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "connection refused") {
|
||||
return fmt.Errorf("Cannot connect to the Docker daemon. Is 'docker -d' running on this host?")
|
||||
}
|
||||
return err
|
||||
}
|
||||
clientconn := httputil.NewClientConn(dial, nil)
|
||||
defer clientconn.Close()
|
||||
|
||||
// Server hijacks the connection, error 'connection closed' expected
|
||||
clientconn.Do(req)
|
||||
|
||||
rwc, br := clientconn.Hijack()
|
||||
defer rwc.Close()
|
||||
|
||||
if started != nil {
|
||||
started <- rwc
|
||||
}
|
||||
|
||||
var receiveStdout chan error
|
||||
|
||||
var oldState *term.State
|
||||
|
||||
if in != nil && setRawTerminal && cli.isTerminal && os.Getenv("NORAW") == "" {
|
||||
oldState, err = term.SetRawTerminal(cli.terminalFd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer term.RestoreTerminal(cli.terminalFd, oldState)
|
||||
}
|
||||
|
||||
if stdout != nil || stderr != nil {
|
||||
receiveStdout = utils.Go(func() (err error) {
|
||||
defer func() {
|
||||
if in != nil {
|
||||
if setRawTerminal && cli.isTerminal {
|
||||
term.RestoreTerminal(cli.terminalFd, oldState)
|
||||
}
|
||||
// For some reason this Close call blocks on darwin..
|
||||
// As the client exists right after, simply discard the close
|
||||
// until we find a better solution.
|
||||
if runtime.GOOS != "darwin" {
|
||||
in.Close()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// When TTY is ON, use regular copy
|
||||
if setRawTerminal {
|
||||
_, err = io.Copy(stdout, br)
|
||||
} else {
|
||||
_, err = utils.StdCopy(stdout, stderr, br)
|
||||
}
|
||||
utils.Debugf("[hijack] End of stdout")
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
sendStdin := utils.Go(func() error {
|
||||
if in != nil {
|
||||
io.Copy(rwc, in)
|
||||
utils.Debugf("[hijack] End of stdin")
|
||||
}
|
||||
if tcpc, ok := rwc.(*net.TCPConn); ok {
|
||||
if err := tcpc.CloseWrite(); err != nil {
|
||||
utils.Debugf("Couldn't send EOF: %s\n", err)
|
||||
}
|
||||
} else if unixc, ok := rwc.(*net.UnixConn); ok {
|
||||
if err := unixc.CloseWrite(); err != nil {
|
||||
utils.Debugf("Couldn't send EOF: %s\n", err)
|
||||
}
|
||||
}
|
||||
// Discard errors due to pipe interruption
|
||||
return nil
|
||||
})
|
||||
|
||||
if stdout != nil || stderr != nil {
|
||||
if err := <-receiveStdout; err != nil {
|
||||
utils.Debugf("Error receiveStdout: %s", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if !cli.isTerminal {
|
||||
if err := <-sendStdin; err != nil {
|
||||
utils.Debugf("Error sendStdin: %s", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
gosignal "os/signal"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/dockerversion"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/pkg/term"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrConnectionRefused = errors.New("Cannot connect to the Docker daemon. Is 'docker -d' running on this host?")
|
||||
)
|
||||
|
||||
func (cli *DockerCli) HTTPClient() *http.Client {
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: cli.tlsConfig,
|
||||
Dial: func(network, addr string) (net.Conn, error) {
|
||||
return net.Dial(cli.proto, cli.addr)
|
||||
},
|
||||
}
|
||||
return &http.Client{Transport: tr}
|
||||
}
|
||||
|
||||
func (cli *DockerCli) call(method, path string, data interface{}, passAuthInfo bool) (io.ReadCloser, int, error) {
|
||||
params := bytes.NewBuffer(nil)
|
||||
if data != nil {
|
||||
if env, ok := data.(engine.Env); ok {
|
||||
if err := env.Encode(params); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
} else {
|
||||
buf, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
if _, err := params.Write(buf); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(method, fmt.Sprintf("/v%s%s", api.APIVERSION, path), params)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
if passAuthInfo {
|
||||
cli.LoadConfigFile()
|
||||
// Resolve the Auth config relevant for this server
|
||||
authConfig := cli.configFile.ResolveAuthConfig(registry.IndexServerAddress())
|
||||
getHeaders := func(authConfig registry.AuthConfig) (map[string][]string, error) {
|
||||
buf, err := json.Marshal(authConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
registryAuthHeader := []string{
|
||||
base64.URLEncoding.EncodeToString(buf),
|
||||
}
|
||||
return map[string][]string{"X-Registry-Auth": registryAuthHeader}, nil
|
||||
}
|
||||
if headers, err := getHeaders(authConfig); err == nil && headers != nil {
|
||||
for k, v := range headers {
|
||||
req.Header[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION)
|
||||
req.URL.Host = cli.addr
|
||||
req.URL.Scheme = cli.scheme
|
||||
if data != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
} else if method == "POST" {
|
||||
req.Header.Set("Content-Type", "plain/text")
|
||||
}
|
||||
resp, err := cli.HTTPClient().Do(req)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "connection refused") {
|
||||
return nil, -1, ErrConnectionRefused
|
||||
}
|
||||
return nil, -1, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 400 {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
if len(body) == 0 {
|
||||
return nil, resp.StatusCode, fmt.Errorf("Error: request returned %s for API route and version %s, check if the server supports the requested API version", http.StatusText(resp.StatusCode), req.URL)
|
||||
}
|
||||
return nil, resp.StatusCode, fmt.Errorf("Error: %s", bytes.TrimSpace(body))
|
||||
}
|
||||
return resp.Body, resp.StatusCode, nil
|
||||
}
|
||||
|
||||
func (cli *DockerCli) stream(method, path string, in io.Reader, out io.Writer, headers map[string][]string) error {
|
||||
return cli.streamHelper(method, path, true, in, out, nil, headers)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) streamHelper(method, path string, setRawTerminal bool, in io.Reader, stdout, stderr io.Writer, headers map[string][]string) error {
|
||||
if (method == "POST" || method == "PUT") && in == nil {
|
||||
in = bytes.NewReader([]byte{})
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(method, fmt.Sprintf("http://v%s%s", api.APIVERSION, path), in)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION)
|
||||
req.URL.Host = cli.addr
|
||||
req.URL.Scheme = cli.scheme
|
||||
if method == "POST" {
|
||||
req.Header.Set("Content-Type", "plain/text")
|
||||
}
|
||||
|
||||
if headers != nil {
|
||||
for k, v := range headers {
|
||||
req.Header[k] = v
|
||||
}
|
||||
}
|
||||
resp, err := cli.HTTPClient().Do(req)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "connection refused") {
|
||||
return fmt.Errorf("Cannot connect to the Docker daemon. Is 'docker -d' running on this host?")
|
||||
}
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 400 {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(body) == 0 {
|
||||
return fmt.Errorf("Error :%s", http.StatusText(resp.StatusCode))
|
||||
}
|
||||
return fmt.Errorf("Error: %s", bytes.TrimSpace(body))
|
||||
}
|
||||
|
||||
if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") {
|
||||
return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.terminalFd, cli.isTerminal)
|
||||
}
|
||||
if stdout != nil || stderr != nil {
|
||||
// When TTY is ON, use regular copy
|
||||
if setRawTerminal {
|
||||
_, err = io.Copy(stdout, resp.Body)
|
||||
} else {
|
||||
_, err = utils.StdCopy(stdout, stderr, resp.Body)
|
||||
}
|
||||
utils.Debugf("[stream] End of stdout")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cli *DockerCli) resizeTty(id string) {
|
||||
height, width := cli.getTtySize()
|
||||
if height == 0 && width == 0 {
|
||||
return
|
||||
}
|
||||
v := url.Values{}
|
||||
v.Set("h", strconv.Itoa(height))
|
||||
v.Set("w", strconv.Itoa(width))
|
||||
if _, _, err := readBody(cli.call("POST", "/containers/"+id+"/resize?"+v.Encode(), nil, false)); err != nil {
|
||||
utils.Debugf("Error resize: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func waitForExit(cli *DockerCli, containerId string) (int, error) {
|
||||
stream, _, err := cli.call("POST", "/containers/"+containerId+"/wait", nil, false)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
var out engine.Env
|
||||
if err := out.Decode(stream); err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return out.GetInt("StatusCode"), nil
|
||||
}
|
||||
|
||||
// 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) {
|
||||
body, _, err := readBody(cli.call("GET", "/containers/"+containerId+"/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
|
||||
}
|
||||
c := &api.Container{}
|
||||
if err := json.Unmarshal(body, c); err != nil {
|
||||
return false, -1, err
|
||||
}
|
||||
return c.State.Running, c.State.ExitCode, nil
|
||||
}
|
||||
|
||||
func (cli *DockerCli) monitorTtySize(id string) error {
|
||||
cli.resizeTty(id)
|
||||
|
||||
sigchan := make(chan os.Signal, 1)
|
||||
gosignal.Notify(sigchan, syscall.SIGWINCH)
|
||||
go func() {
|
||||
for _ = range sigchan {
|
||||
cli.resizeTty(id)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cli *DockerCli) getTtySize() (int, int) {
|
||||
if !cli.isTerminal {
|
||||
return 0, 0
|
||||
}
|
||||
ws, err := term.GetWinsize(cli.terminalFd)
|
||||
if err != nil {
|
||||
utils.Debugf("Error getting size: %s", err)
|
||||
if ws == nil {
|
||||
return 0, 0
|
||||
}
|
||||
}
|
||||
return int(ws.Height), int(ws.Width)
|
||||
}
|
||||
|
||||
func readBody(stream io.ReadCloser, statusCode int, err error) ([]byte, int, error) {
|
||||
if stream != nil {
|
||||
defer stream.Close()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, statusCode, err
|
||||
}
|
||||
body, err := ioutil.ReadAll(stream)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
return body, statusCode, nil
|
||||
}
|
||||
+4
-7
@@ -3,16 +3,15 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/pkg/version"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
"mime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
APIVERSION version.Version = "1.11"
|
||||
DEFAULTHTTPHOST = "127.0.0.1"
|
||||
DEFAULTUNIXSOCKET = "/var/run/docker.sock"
|
||||
APIVERSION = "1.10"
|
||||
DEFAULTHTTPHOST = "127.0.0.1"
|
||||
DEFAULTUNIXSOCKET = "/var/run/docker.sock"
|
||||
)
|
||||
|
||||
func ValidateHost(val string) (string, error) {
|
||||
@@ -24,10 +23,8 @@ func ValidateHost(val string) (string, error) {
|
||||
}
|
||||
|
||||
//TODO remove, used on < 1.5 in getContainersJSON
|
||||
func DisplayablePorts(ports *engine.Table) string {
|
||||
func displayablePorts(ports *engine.Table) string {
|
||||
result := []string{}
|
||||
ports.SetKey("PublicPort")
|
||||
ports.Sort()
|
||||
for _, port := range ports.Data {
|
||||
if port.Get("IP") == "" {
|
||||
result = append(result, fmt.Sprintf("%d/%s", port.GetInt("PublicPort"), port.Get("Type")))
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package server
|
||||
package api
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"code.google.com/p/go.net/websocket"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"expvar"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/auth"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/pkg/listenbuffer"
|
||||
"github.com/dotcloud/docker/pkg/systemd"
|
||||
"github.com/dotcloud/docker/pkg/user"
|
||||
"github.com/dotcloud/docker/pkg/version"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
"github.com/gorilla/mux"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@@ -19,18 +26,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"code.google.com/p/go.net/websocket"
|
||||
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/pkg/listenbuffer"
|
||||
"github.com/dotcloud/docker/pkg/systemd"
|
||||
"github.com/dotcloud/docker/pkg/user"
|
||||
"github.com/dotcloud/docker/pkg/version"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -247,7 +242,6 @@ func getEvents(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
||||
var job = eng.Job("events", r.RemoteAddr)
|
||||
streamJSON(job, w, true)
|
||||
job.Setenv("since", r.Form.Get("since"))
|
||||
job.Setenv("until", r.Form.Get("until"))
|
||||
return job.Run()
|
||||
}
|
||||
|
||||
@@ -319,7 +313,7 @@ func getContainersJSON(eng *engine.Engine, version version.Version, w http.Respo
|
||||
for _, out := range outs.Data {
|
||||
ports := engine.NewTable("", 0)
|
||||
ports.ReadListFrom([]byte(out.Get("Ports")))
|
||||
out.Set("Ports", api.DisplayablePorts(ports))
|
||||
out.Set("Ports", displayablePorts(ports))
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if _, err = outs.WriteListTo(w); err != nil {
|
||||
@@ -329,48 +323,6 @@ func getContainersJSON(eng *engine.Engine, version version.Version, w http.Respo
|
||||
return nil
|
||||
}
|
||||
|
||||
func getContainersLogs(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
}
|
||||
if vars == nil {
|
||||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
|
||||
var (
|
||||
job = eng.Job("inspect", vars["name"], "container")
|
||||
c, err = job.Stdout.AddEnv()
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = job.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var outStream, errStream io.Writer
|
||||
outStream = utils.NewWriteFlusher(w)
|
||||
|
||||
if c.GetSubEnv("Config") != nil && !c.GetSubEnv("Config").GetBool("Tty") && version.GreaterThanOrEqualTo("1.6") {
|
||||
errStream = utils.NewStdWriter(outStream, utils.Stderr)
|
||||
outStream = utils.NewStdWriter(outStream, utils.Stdout)
|
||||
} else {
|
||||
errStream = outStream
|
||||
}
|
||||
|
||||
job = eng.Job("logs", vars["name"])
|
||||
job.Setenv("follow", r.Form.Get("follow"))
|
||||
job.Setenv("stdout", r.Form.Get("stdout"))
|
||||
job.Setenv("stderr", r.Form.Get("stderr"))
|
||||
job.Setenv("timestamps", r.Form.Get("timestamps"))
|
||||
job.Stdout.Add(outStream)
|
||||
job.Stderr.Set(errStream)
|
||||
if err := job.Run(); err != nil {
|
||||
fmt.Fprintf(outStream, "Error: %s\n", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func postImagesTag(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
@@ -428,13 +380,13 @@ func postImagesCreate(eng *engine.Engine, version version.Version, w http.Respon
|
||||
job *engine.Job
|
||||
)
|
||||
authEncoded := r.Header.Get("X-Registry-Auth")
|
||||
authConfig := ®istry.AuthConfig{}
|
||||
authConfig := &auth.AuthConfig{}
|
||||
if authEncoded != "" {
|
||||
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
||||
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
||||
// for a pull it is not an error if no auth was given
|
||||
// to increase compatibility with the existing api it is defaulting to be empty
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
}
|
||||
}
|
||||
if image != "" { //pull
|
||||
@@ -476,7 +428,7 @@ func getImagesSearch(eng *engine.Engine, version version.Version, w http.Respons
|
||||
}
|
||||
var (
|
||||
authEncoded = r.Header.Get("X-Registry-Auth")
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
metaHeaders = map[string][]string{}
|
||||
)
|
||||
|
||||
@@ -485,7 +437,7 @@ func getImagesSearch(eng *engine.Engine, version version.Version, w http.Respons
|
||||
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
||||
// for a search it is not an error if no auth was given
|
||||
// to increase compatibility with the existing api it is defaulting to be empty
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
}
|
||||
}
|
||||
for k, v := range r.Header {
|
||||
@@ -502,7 +454,6 @@ func getImagesSearch(eng *engine.Engine, version version.Version, w http.Respons
|
||||
return job.Run()
|
||||
}
|
||||
|
||||
// FIXME: 'insert' is deprecated as of 0.10, and should be removed in a future version.
|
||||
func postImagesInsert(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
@@ -542,7 +493,7 @@ func postImagesPush(eng *engine.Engine, version version.Version, w http.Response
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
}
|
||||
authConfig := ®istry.AuthConfig{}
|
||||
authConfig := &auth.AuthConfig{}
|
||||
|
||||
authEncoded := r.Header.Get("X-Registry-Auth")
|
||||
if authEncoded != "" {
|
||||
@@ -550,7 +501,7 @@ func postImagesPush(eng *engine.Engine, version version.Version, w http.Response
|
||||
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
||||
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
||||
// to increase compatibility to existing api it is defaulting to be empty
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
}
|
||||
} else {
|
||||
// the old format is supported for compatibility if there was no authConfig header
|
||||
@@ -562,7 +513,6 @@ func postImagesPush(eng *engine.Engine, version version.Version, w http.Response
|
||||
job := eng.Job("push", vars["name"])
|
||||
job.SetenvJson("metaHeaders", metaHeaders)
|
||||
job.SetenvJson("authConfig", authConfig)
|
||||
job.Setenv("tag", r.Form.Get("tag"))
|
||||
if version.GreaterThan("1.0") {
|
||||
job.SetenvBool("json", true)
|
||||
streamJSON(job, w, true)
|
||||
@@ -673,7 +623,6 @@ func deleteImages(eng *engine.Engine, version version.Version, w http.ResponseWr
|
||||
var job = eng.Job("image_delete", vars["name"])
|
||||
streamJSON(job, w, false)
|
||||
job.Setenv("force", r.Form.Get("force"))
|
||||
job.Setenv("noprune", r.Form.Get("noprune"))
|
||||
|
||||
return job.Run()
|
||||
}
|
||||
@@ -686,7 +635,7 @@ func postContainersStart(eng *engine.Engine, version version.Version, w http.Res
|
||||
job := eng.Job("start", name)
|
||||
// allow a nil body for backwards compatibility
|
||||
if r.Body != nil {
|
||||
if api.MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
||||
if MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
||||
if err := job.DecodeEnv(r.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -873,9 +822,9 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
||||
}
|
||||
var (
|
||||
authEncoded = r.Header.Get("X-Registry-Auth")
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
configFileEncoded = r.Header.Get("X-Registry-Config")
|
||||
configFile = ®istry.ConfigFile{}
|
||||
configFile = &auth.ConfigFile{}
|
||||
job = eng.Job("build")
|
||||
)
|
||||
|
||||
@@ -888,7 +837,7 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
||||
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
||||
// for a pull it is not an error if no auth was given
|
||||
// to increase compatibility with the existing api it is defaulting to be empty
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
authConfig = &auth.AuthConfig{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,7 +846,7 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
||||
if err := json.NewDecoder(configFileJson).Decode(configFile); err != nil {
|
||||
// for a pull it is not an error if no auth was given
|
||||
// to increase compatibility with the existing api it is defaulting to be empty
|
||||
configFile = ®istry.ConfigFile{}
|
||||
configFile = &auth.ConfigFile{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -933,7 +882,7 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp
|
||||
|
||||
var copyData engine.Env
|
||||
|
||||
if contentType := r.Header.Get("Content-Type"); api.MatchesContentType(contentType, "application/json") {
|
||||
if contentType := r.Header.Get("Content-Type"); MatchesContentType(contentType, "application/json") {
|
||||
if err := copyData.Decode(r.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -944,9 +893,6 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp
|
||||
if copyData.Get("Resource") == "" {
|
||||
return fmt.Errorf("Path cannot be empty")
|
||||
}
|
||||
|
||||
origResource := copyData.Get("Resource")
|
||||
|
||||
if copyData.Get("Resource")[0] == '/' {
|
||||
copyData.Set("Resource", copyData.Get("Resource")[1:])
|
||||
}
|
||||
@@ -957,8 +903,6 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp
|
||||
utils.Errorf("%s", err.Error())
|
||||
if strings.Contains(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"])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -974,11 +918,6 @@ func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
||||
}
|
||||
|
||||
func ping(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
_, err := w.Write([]byte{'O', 'K'})
|
||||
return err
|
||||
}
|
||||
|
||||
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, enableCors bool, dockerVersion version.Version) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// log the request
|
||||
@@ -990,20 +929,20 @@ func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, local
|
||||
|
||||
if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") {
|
||||
userAgent := strings.Split(r.Header.Get("User-Agent"), "/")
|
||||
if len(userAgent) == 2 && !dockerVersion.Equal(version.Version(userAgent[1])) {
|
||||
if len(userAgent) == 2 && !dockerVersion.Equal(userAgent[1]) {
|
||||
utils.Debugf("Warning: client and server don't have the same version (client: %s, server: %s)", userAgent[1], dockerVersion)
|
||||
}
|
||||
}
|
||||
version := version.Version(mux.Vars(r)["version"])
|
||||
if version == "" {
|
||||
version = api.APIVERSION
|
||||
version = APIVERSION
|
||||
}
|
||||
if enableCors {
|
||||
writeCorsHeaders(w, r)
|
||||
}
|
||||
|
||||
if version.GreaterThan(api.APIVERSION) {
|
||||
http.Error(w, fmt.Errorf("client and server don't have same version (client : %s, server: %s)", version, api.APIVERSION).Error(), http.StatusNotFound)
|
||||
if version.GreaterThan(APIVERSION) {
|
||||
http.Error(w, fmt.Errorf("client and server don't have same version (client : %s, server: %s)", version, APIVERSION).Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1047,7 +986,6 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
|
||||
}
|
||||
m := map[string]map[string]HttpApiFunc{
|
||||
"GET": {
|
||||
"/_ping": ping,
|
||||
"/events": getEvents,
|
||||
"/info": getInfo,
|
||||
"/version": getVersion,
|
||||
@@ -1063,7 +1001,6 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
|
||||
"/containers/{name:.*}/changes": getContainersChanges,
|
||||
"/containers/{name:.*}/json": getContainersByName,
|
||||
"/containers/{name:.*}/top": getContainersTop,
|
||||
"/containers/{name:.*}/logs": getContainersLogs,
|
||||
"/containers/{name:.*}/attach/ws": wsContainersAttach,
|
||||
},
|
||||
"POST": {
|
||||
@@ -1192,8 +1129,9 @@ func changeGroup(addr string, nameOrGid string) error {
|
||||
|
||||
// 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 {
|
||||
r, err := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"))
|
||||
func ListenAndServe(proto, addr string, eng *engine.Engine, logging, enableCors bool, dockerVersion, socketGroup string) error {
|
||||
r, err := createRouter(eng, logging, enableCors, dockerVersion)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1213,43 +1151,17 @@ func ListenAndServe(proto, addr string, job *engine.Job) error {
|
||||
return 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},
|
||||
}
|
||||
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
|
||||
}
|
||||
l = tls.NewListener(l, tlsConfig)
|
||||
}
|
||||
|
||||
// Basic error and sanity checking
|
||||
switch proto {
|
||||
case "tcp":
|
||||
if !strings.HasPrefix(addr, "127.0.0.1") && !job.GetenvBool("TlsVerify") {
|
||||
if !strings.HasPrefix(addr, "127.0.0.1") {
|
||||
log.Println("/!\\ DON'T BIND ON ANOTHER IP ADDRESS THAN 127.0.0.1 IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
|
||||
}
|
||||
case "unix":
|
||||
if err := os.Chmod(addr, 0660); err != nil {
|
||||
return err
|
||||
}
|
||||
socketGroup := job.Getenv("SocketGroup")
|
||||
|
||||
if socketGroup != "" {
|
||||
if err := changeGroup(addr, socketGroup); err != nil {
|
||||
if socketGroup == "docker" {
|
||||
@@ -1271,9 +1183,6 @@ func ListenAndServe(proto, addr string, job *engine.Job) error {
|
||||
// ServeApi loops through all of the protocols sent in to docker and spawns
|
||||
// off a go routine to setup a serving http.Server for each.
|
||||
func ServeApi(job *engine.Job) engine.Status {
|
||||
if len(job.Args) == 0 {
|
||||
return job.Errorf("usage: %s PROTO://ADDR [PROTO://ADDR ...]", job.Name)
|
||||
}
|
||||
var (
|
||||
protoAddrs = job.Args
|
||||
chErrors = make(chan error, len(protoAddrs))
|
||||
@@ -1286,12 +1195,9 @@ func ServeApi(job *engine.Job) engine.Status {
|
||||
|
||||
for _, protoAddr := range protoAddrs {
|
||||
protoAddrParts := strings.SplitN(protoAddr, "://", 2)
|
||||
if len(protoAddrParts) != 2 {
|
||||
return job.Errorf("usage: %s PROTO://ADDR [PROTO://ADDR ...]", job.Name)
|
||||
}
|
||||
go func() {
|
||||
log.Printf("Listening for HTTP on %s (%s)\n", protoAddrParts[0], protoAddrParts[1])
|
||||
chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], job)
|
||||
chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"), job.Getenv("SocketGroup"))
|
||||
}()
|
||||
}
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetBoolParam(t *testing.T) {
|
||||
if ret, err := getBoolParam("true"); err != nil || !ret {
|
||||
t.Fatalf("true -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("True"); err != nil || !ret {
|
||||
t.Fatalf("True -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("1"); err != nil || !ret {
|
||||
t.Fatalf("1 -> true, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam(""); err != nil || ret {
|
||||
t.Fatalf("\"\" -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("false"); err != nil || ret {
|
||||
t.Fatalf("false -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("0"); err != nil || ret {
|
||||
t.Fatalf("0 -> false, nil | got %t %s", ret, err)
|
||||
}
|
||||
if ret, err := getBoolParam("faux"); err == nil || ret {
|
||||
t.Fatalf("faux -> false, err | got %t %s", ret, err)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TesthttpError(t *testing.T) {
|
||||
r := httptest.NewRecorder()
|
||||
|
||||
httpError(r, fmt.Errorf("No such method"))
|
||||
if r.Code != http.StatusNotFound {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusNotFound, r.Code)
|
||||
}
|
||||
|
||||
httpError(r, fmt.Errorf("This accound hasn't been activated"))
|
||||
if r.Code != http.StatusForbidden {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusForbidden, r.Code)
|
||||
}
|
||||
|
||||
httpError(r, fmt.Errorf("Some error"))
|
||||
if r.Code != http.StatusInternalServerError {
|
||||
t.Fatalf("Expected %d, got %d", http.StatusInternalServerError, r.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetVersion(t *testing.T) {
|
||||
eng := engine.New()
|
||||
var called bool
|
||||
eng.Register("version", func(job *engine.Job) engine.Status {
|
||||
called = true
|
||||
v := &engine.Env{}
|
||||
v.SetJson("Version", "42.1")
|
||||
v.Set("ApiVersion", "1.1.1.1.1")
|
||||
v.Set("GoVersion", "2.42")
|
||||
v.Set("Os", "Linux")
|
||||
v.Set("Arch", "x86_64")
|
||||
if _, err := v.WriteTo(job.Stdout); err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
return engine.StatusOK
|
||||
})
|
||||
r := serveRequest("GET", "/version", nil, eng, t)
|
||||
if !called {
|
||||
t.Fatalf("handler was not called")
|
||||
}
|
||||
v := readEnv(r.Body, t)
|
||||
if v.Get("Version") != "42.1" {
|
||||
t.Fatalf("%#v\n", v)
|
||||
}
|
||||
if r.HeaderMap.Get("Content-Type") != "application/json" {
|
||||
t.Fatalf("%#v\n", r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetInfo(t *testing.T) {
|
||||
eng := engine.New()
|
||||
var called bool
|
||||
eng.Register("info", func(job *engine.Job) engine.Status {
|
||||
called = true
|
||||
v := &engine.Env{}
|
||||
v.SetInt("Containers", 1)
|
||||
v.SetInt("Images", 42000)
|
||||
if _, err := v.WriteTo(job.Stdout); err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
return engine.StatusOK
|
||||
})
|
||||
r := serveRequest("GET", "/info", nil, eng, t)
|
||||
if !called {
|
||||
t.Fatalf("handler was not called")
|
||||
}
|
||||
v := readEnv(r.Body, t)
|
||||
if v.GetInt("Images") != 42000 {
|
||||
t.Fatalf("%#v\n", v)
|
||||
}
|
||||
if v.GetInt("Containers") != 1 {
|
||||
t.Fatalf("%#v\n", v)
|
||||
}
|
||||
if r.HeaderMap.Get("Content-Type") != "application/json" {
|
||||
t.Fatalf("%#v\n", r)
|
||||
}
|
||||
}
|
||||
|
||||
func serveRequest(method, target string, body io.Reader, eng *engine.Engine, t *testing.T) *httptest.ResponseRecorder {
|
||||
r := httptest.NewRecorder()
|
||||
req, err := http.NewRequest(method, target, body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func readEnv(src io.Reader, t *testing.T) *engine.Env {
|
||||
out := engine.NewOutput()
|
||||
v, err := out.AddEnv()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := io.Copy(out, src); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out.Close()
|
||||
return v
|
||||
}
|
||||
|
||||
func toJson(data interface{}, t *testing.T) io.Reader {
|
||||
var buf bytes.Buffer
|
||||
if err := json.NewEncoder(&buf).Encode(data); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return &buf
|
||||
}
|
||||
+1
-4
@@ -404,7 +404,7 @@ func Untar(archive io.Reader, dest string, options *TarOptions) error {
|
||||
parent := filepath.Dir(hdr.Name)
|
||||
parentPath := filepath.Join(dest, parent)
|
||||
if _, err := os.Lstat(parentPath); err != nil && os.IsNotExist(err) {
|
||||
err = os.MkdirAll(parentPath, 0777)
|
||||
err = os.MkdirAll(parentPath, 600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -617,9 +617,6 @@ func NewTempArchive(src Archive, dir string) (*TempArchive, error) {
|
||||
if _, err := io.Copy(f, src); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = f.Sync(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := f.Seek(0, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func mutateSampleDir(t *testing.T, root string) {
|
||||
}
|
||||
|
||||
// Rewrite a file
|
||||
if err := ioutil.WriteFile(path.Join(root, "file2"), []byte("fileNN\n"), 0777); err != nil {
|
||||
if err := ioutil.WriteFile(path.Join(root, "file2"), []byte("fileN\n"), 0777); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -146,12 +146,12 @@ func mutateSampleDir(t *testing.T, root string) {
|
||||
if err := os.RemoveAll(path.Join(root, "file3")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := ioutil.WriteFile(path.Join(root, "file3"), []byte("fileMM\n"), 0404); err != nil {
|
||||
if err := ioutil.WriteFile(path.Join(root, "file3"), []byte("fileM\n"), 0404); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Touch file
|
||||
if err := os.Chtimes(path.Join(root, "file4"), time.Now().Add(time.Second), time.Now().Add(time.Second)); err != nil {
|
||||
if err := os.Chtimes(path.Join(root, "file4"), time.Now(), time.Now()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ func mutateSampleDir(t *testing.T, root string) {
|
||||
}
|
||||
|
||||
// Touch dir
|
||||
if err := os.Chtimes(path.Join(root, "dir3"), time.Now().Add(time.Second), time.Now().Add(time.Second)); err != nil {
|
||||
if err := os.Chtimes(path.Join(root, "dir3"), time.Now(), time.Now()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ func ApplyLayer(dest string, layer ArchiveReader) error {
|
||||
parent := filepath.Dir(hdr.Name)
|
||||
parentPath := filepath.Join(dest, parent)
|
||||
if _, err := os.Lstat(parentPath); err != nil && os.IsNotExist(err) {
|
||||
err = os.MkdirAll(parentPath, 0600)
|
||||
err = os.MkdirAll(parentPath, 600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Sam Alba <sam@dotcloud.com> (@samalba)
|
||||
Joffrey Fuhrer <joffrey@dotcloud.com> (@shin-)
|
||||
Ken Cochrane <ken@dotcloud.com> (@kencochrane)
|
||||
@@ -1,4 +1,4 @@
|
||||
package registry
|
||||
package auth
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
@@ -1,4 +1,4 @@
|
||||
package registry
|
||||
package auth
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
@@ -1,4 +1,4 @@
|
||||
package server
|
||||
package docker
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
@@ -6,6 +6,11 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/archive"
|
||||
"github.com/dotcloud/docker/auth"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"github.com/dotcloud/docker/runconfig"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
@@ -16,13 +21,6 @@ import (
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/dotcloud/docker/archive"
|
||||
"github.com/dotcloud/docker/daemon"
|
||||
"github.com/dotcloud/docker/nat"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"github.com/dotcloud/docker/runconfig"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -36,8 +34,8 @@ type BuildFile interface {
|
||||
}
|
||||
|
||||
type buildFile struct {
|
||||
daemon *daemon.Daemon
|
||||
srv *Server
|
||||
runtime *Runtime
|
||||
srv *Server
|
||||
|
||||
image string
|
||||
maintainer string
|
||||
@@ -50,8 +48,8 @@ type buildFile struct {
|
||||
utilizeCache bool
|
||||
rm bool
|
||||
|
||||
authConfig *registry.AuthConfig
|
||||
configFile *registry.ConfigFile
|
||||
authConfig *auth.AuthConfig
|
||||
configFile *auth.ConfigFile
|
||||
|
||||
tmpContainers map[string]struct{}
|
||||
tmpImages map[string]struct{}
|
||||
@@ -66,20 +64,19 @@ type buildFile struct {
|
||||
|
||||
func (b *buildFile) clearTmp(containers map[string]struct{}) {
|
||||
for c := range containers {
|
||||
tmp := b.daemon.Get(c)
|
||||
if err := b.daemon.Destroy(tmp); err != nil {
|
||||
tmp := b.runtime.Get(c)
|
||||
if err := b.runtime.Destroy(tmp); err != nil {
|
||||
fmt.Fprintf(b.outStream, "Error removing intermediate container %s: %s\n", utils.TruncateID(c), err.Error())
|
||||
} else {
|
||||
delete(containers, c)
|
||||
fmt.Fprintf(b.outStream, "Removing intermediate container %s\n", utils.TruncateID(c))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *buildFile) CmdFrom(name string) error {
|
||||
image, err := b.daemon.Repositories().LookupImage(name)
|
||||
image, err := b.runtime.repositories.LookupImage(name)
|
||||
if err != nil {
|
||||
if b.daemon.Graph().IsNotExist(err) {
|
||||
if b.runtime.graph.IsNotExist(err) {
|
||||
remote, tag := utils.ParseRepositoryTag(name)
|
||||
pullRegistryAuth := b.authConfig
|
||||
if len(b.configFile.Configs) > 0 {
|
||||
@@ -99,7 +96,7 @@ func (b *buildFile) CmdFrom(name string) error {
|
||||
if err := job.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
image, err = b.daemon.Repositories().LookupImage(name)
|
||||
image, err = b.runtime.repositories.LookupImage(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -113,7 +110,7 @@ func (b *buildFile) CmdFrom(name string) error {
|
||||
b.config = image.Config
|
||||
}
|
||||
if b.config.Env == nil || len(b.config.Env) == 0 {
|
||||
b.config.Env = append(b.config.Env, "HOME=/", "PATH="+daemon.DefaultPathEnv)
|
||||
b.config.Env = append(b.config.Env, "HOME=/", "PATH="+defaultPathEnv)
|
||||
}
|
||||
// Process ONBUILD triggers if they exist
|
||||
if nTriggers := len(b.config.OnBuild); nTriggers != 0 {
|
||||
@@ -307,22 +304,8 @@ func (b *buildFile) CmdEntrypoint(args string) error {
|
||||
}
|
||||
|
||||
func (b *buildFile) CmdExpose(args string) error {
|
||||
portsTab := strings.Split(args, " ")
|
||||
|
||||
if b.config.ExposedPorts == nil {
|
||||
b.config.ExposedPorts = make(nat.PortSet)
|
||||
}
|
||||
ports, _, err := nat.ParsePortSpecs(append(portsTab, b.config.PortSpecs...))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for port := range ports {
|
||||
if _, exists := b.config.ExposedPorts[port]; !exists {
|
||||
b.config.ExposedPorts[port] = struct{}{}
|
||||
}
|
||||
}
|
||||
b.config.PortSpecs = nil
|
||||
|
||||
ports := strings.Split(args, " ")
|
||||
b.config.PortSpecs = append(ports, b.config.PortSpecs...)
|
||||
return b.commit("", b.config.Cmd, fmt.Sprintf("EXPOSE %v", ports))
|
||||
}
|
||||
|
||||
@@ -340,14 +323,7 @@ func (b *buildFile) CmdCopy(args string) error {
|
||||
}
|
||||
|
||||
func (b *buildFile) CmdWorkdir(workdir string) error {
|
||||
if workdir[0] == '/' {
|
||||
b.config.WorkingDir = workdir
|
||||
} else {
|
||||
if b.config.WorkingDir == "" {
|
||||
b.config.WorkingDir = "/"
|
||||
}
|
||||
b.config.WorkingDir = filepath.Join(b.config.WorkingDir, workdir)
|
||||
}
|
||||
b.config.WorkingDir = workdir
|
||||
return b.commit("", b.config.Cmd, fmt.Sprintf("WORKDIR %v", workdir))
|
||||
}
|
||||
|
||||
@@ -395,20 +371,11 @@ func (b *buildFile) checkPathForAddition(orig string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *buildFile) addContext(container *daemon.Container, orig, dest string, remote bool) error {
|
||||
func (b *buildFile) addContext(container *Container, orig, dest string, remote bool) error {
|
||||
var (
|
||||
err error
|
||||
origPath = path.Join(b.contextPath, orig)
|
||||
destPath = path.Join(container.RootfsPath(), dest)
|
||||
destPath = path.Join(container.BasefsPath(), dest)
|
||||
)
|
||||
|
||||
if destPath != container.RootfsPath() {
|
||||
destPath, err = utils.FollowSymlinkInScope(destPath, container.RootfsPath())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve the trailing '/'
|
||||
if strings.HasSuffix(dest, "/") {
|
||||
destPath = destPath + "/"
|
||||
@@ -421,22 +388,10 @@ func (b *buildFile) addContext(container *daemon.Container, orig, dest string, r
|
||||
return err
|
||||
}
|
||||
|
||||
chownR := func(destPath string, uid, gid int) error {
|
||||
return filepath.Walk(destPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err := os.Lchown(path, uid, gid); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
if err := archive.CopyWithTar(origPath, destPath); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := chownR(destPath, 0, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -466,10 +421,6 @@ func (b *buildFile) addContext(container *daemon.Container, orig, dest string, r
|
||||
if err := archive.CopyWithTar(origPath, destPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := chownR(destPath, 0, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -504,35 +455,27 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||
)
|
||||
|
||||
if utils.IsURL(orig) {
|
||||
// Initiate the download
|
||||
isRemote = true
|
||||
resp, err := utils.Download(orig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create a tmp dir
|
||||
tmpDirName, err := ioutil.TempDir(b.contextPath, "docker-remote")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create a tmp file within our tmp dir
|
||||
tmpFileName := path.Join(tmpDirName, "tmp")
|
||||
tmpFile, err := os.OpenFile(tmpFileName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(tmpDirName)
|
||||
|
||||
// Download and dump result to tmp file
|
||||
if _, err := io.Copy(tmpFile, resp.Body); err != nil {
|
||||
if _, err = io.Copy(tmpFile, resp.Body); err != nil {
|
||||
tmpFile.Close()
|
||||
return err
|
||||
}
|
||||
tmpFile.Close()
|
||||
|
||||
origPath = path.Join(filepath.Base(tmpDirName), filepath.Base(tmpFileName))
|
||||
tmpFile.Close()
|
||||
|
||||
// Process the checksum
|
||||
r, err := archive.Tar(tmpFileName, archive.Uncompressed)
|
||||
@@ -611,7 +554,7 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||
}
|
||||
|
||||
// Create the container and start it
|
||||
container, _, err := b.daemon.Create(b.config, "")
|
||||
container, _, err := b.runtime.Create(b.config, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -633,14 +576,42 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *buildFile) create() (*daemon.Container, error) {
|
||||
type StdoutFormater struct {
|
||||
io.Writer
|
||||
*utils.StreamFormatter
|
||||
}
|
||||
|
||||
func (sf *StdoutFormater) Write(buf []byte) (int, error) {
|
||||
formattedBuf := sf.StreamFormatter.FormatStream(string(buf))
|
||||
n, err := sf.Writer.Write(formattedBuf)
|
||||
if n != len(formattedBuf) {
|
||||
return n, io.ErrShortWrite
|
||||
}
|
||||
return len(buf), err
|
||||
}
|
||||
|
||||
type StderrFormater struct {
|
||||
io.Writer
|
||||
*utils.StreamFormatter
|
||||
}
|
||||
|
||||
func (sf *StderrFormater) Write(buf []byte) (int, error) {
|
||||
formattedBuf := sf.StreamFormatter.FormatStream("\033[91m" + string(buf) + "\033[0m")
|
||||
n, err := sf.Writer.Write(formattedBuf)
|
||||
if n != len(formattedBuf) {
|
||||
return n, io.ErrShortWrite
|
||||
}
|
||||
return len(buf), err
|
||||
}
|
||||
|
||||
func (b *buildFile) create() (*Container, error) {
|
||||
if b.image == "" {
|
||||
return nil, fmt.Errorf("Please provide a source image with `from` prior to run")
|
||||
}
|
||||
b.config.Image = b.image
|
||||
|
||||
// Create the container and start it
|
||||
c, _, err := b.daemon.Create(b.config, "")
|
||||
c, _, err := b.runtime.Create(b.config, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -654,11 +625,12 @@ func (b *buildFile) create() (*daemon.Container, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (b *buildFile) run(c *daemon.Container) error {
|
||||
func (b *buildFile) run(c *Container) error {
|
||||
var errCh chan error
|
||||
|
||||
if b.verbose {
|
||||
errCh = utils.Go(func() error {
|
||||
return <-b.daemon.Attach(c, nil, nil, b.outStream, b.errStream)
|
||||
return <-c.Attach(nil, nil, b.outStream, b.errStream)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -704,7 +676,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
container, warnings, err := b.daemon.Create(b.config, "")
|
||||
container, warnings, err := b.runtime.Create(b.config, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -714,13 +686,13 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
||||
b.tmpContainers[container.ID] = struct{}{}
|
||||
fmt.Fprintf(b.outStream, " ---> Running in %s\n", utils.TruncateID(container.ID))
|
||||
id = container.ID
|
||||
|
||||
if err := container.Mount(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer container.Unmount()
|
||||
}
|
||||
container := b.daemon.Get(id)
|
||||
|
||||
container := b.runtime.Get(id)
|
||||
if container == nil {
|
||||
return fmt.Errorf("An error occured while creating the container")
|
||||
}
|
||||
@@ -729,7 +701,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
||||
autoConfig := *b.config
|
||||
autoConfig.Cmd = autoCmd
|
||||
// Commit the container
|
||||
image, err := b.daemon.Commit(container, "", "", "", b.maintainer, &autoConfig)
|
||||
image, err := b.runtime.Commit(container, "", "", "", b.maintainer, &autoConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -770,24 +742,26 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
||||
if len(fileBytes) == 0 {
|
||||
return "", ErrDockerfileEmpty
|
||||
}
|
||||
var (
|
||||
dockerfile = lineContinuation.ReplaceAllString(stripComments(fileBytes), "")
|
||||
stepN = 0
|
||||
)
|
||||
dockerfile := string(fileBytes)
|
||||
dockerfile = lineContinuation.ReplaceAllString(dockerfile, "")
|
||||
stepN := 0
|
||||
for _, line := range strings.Split(dockerfile, "\n") {
|
||||
line = strings.Trim(strings.Replace(line, "\t", " ", -1), " \t\r\n")
|
||||
if len(line) == 0 {
|
||||
// Skip comments and empty line
|
||||
if len(line) == 0 || line[0] == '#' {
|
||||
continue
|
||||
}
|
||||
if err := b.BuildStep(fmt.Sprintf("%d", stepN), line); err != nil {
|
||||
return "", err
|
||||
} else if b.rm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
}
|
||||
stepN += 1
|
||||
|
||||
}
|
||||
if b.image != "" {
|
||||
fmt.Fprintf(b.outStream, "Successfully built %s\n", utils.TruncateID(b.image))
|
||||
if b.rm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
}
|
||||
return b.image, nil
|
||||
}
|
||||
return "", fmt.Errorf("No image was generated. This may be because the Dockerfile does not, like, do anything.\n")
|
||||
@@ -818,23 +792,9 @@ func (b *buildFile) BuildStep(name, expression string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func stripComments(raw []byte) string {
|
||||
var (
|
||||
out []string
|
||||
lines = strings.Split(string(raw), "\n")
|
||||
)
|
||||
for _, l := range lines {
|
||||
if len(l) == 0 || l[0] == '#' {
|
||||
continue
|
||||
}
|
||||
out = append(out, l)
|
||||
}
|
||||
return strings.Join(out, "\n")
|
||||
}
|
||||
|
||||
func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *registry.AuthConfig, authConfigFile *registry.ConfigFile) BuildFile {
|
||||
func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *auth.AuthConfig, authConfigFile *auth.ConfigFile) BuildFile {
|
||||
return &buildFile{
|
||||
daemon: srv.daemon,
|
||||
runtime: srv.runtime,
|
||||
srv: srv,
|
||||
config: &runconfig.Config{},
|
||||
outStream: outStream,
|
||||
+13
-19
@@ -1,26 +1,21 @@
|
||||
package builtins
|
||||
|
||||
import (
|
||||
api "github.com/dotcloud/docker/api/server"
|
||||
"github.com/dotcloud/docker/daemon/networkdriver/bridge"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"github.com/dotcloud/docker/server"
|
||||
|
||||
"github.com/dotcloud/docker"
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/networkdriver/lxc"
|
||||
)
|
||||
|
||||
func Register(eng *engine.Engine) error {
|
||||
if err := daemon(eng); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := remote(eng); err != nil {
|
||||
return err
|
||||
}
|
||||
return registry.NewService().Install(eng)
|
||||
func Register(eng *engine.Engine) {
|
||||
daemon(eng)
|
||||
remote(eng)
|
||||
}
|
||||
|
||||
// remote: a RESTful api for cross-docker communication
|
||||
func remote(eng *engine.Engine) error {
|
||||
return eng.Register("serveapi", api.ServeApi)
|
||||
func remote(eng *engine.Engine) {
|
||||
eng.Register("serveapi", api.ServeApi)
|
||||
}
|
||||
|
||||
// daemon: a default execution and storage backend for Docker on Linux,
|
||||
@@ -38,9 +33,8 @@ func remote(eng *engine.Engine) error {
|
||||
//
|
||||
// These components should be broken off into plugins of their own.
|
||||
//
|
||||
func daemon(eng *engine.Engine) error {
|
||||
if err := eng.Register("initserver", server.InitServer); err != nil {
|
||||
return err
|
||||
}
|
||||
return eng.Register("init_networkdriver", bridge.InitDriver)
|
||||
func daemon(eng *engine.Engine) {
|
||||
eng.Register("initserver", docker.InitServer)
|
||||
eng.Register("init_networkdriver", lxc.InitDriver)
|
||||
eng.Register("version", docker.GetVersion)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"github.com/dotcloud/docker/runconfig"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func parse(t *testing.T, args string) (*runconfig.Config, *runconfig.HostConfig, error) {
|
||||
config, hostConfig, _, err := runconfig.Parse(strings.Split(args+" ubuntu bash", " "), nil)
|
||||
return config, hostConfig, err
|
||||
}
|
||||
|
||||
func mustParse(t *testing.T, args string) (*runconfig.Config, *runconfig.HostConfig) {
|
||||
config, hostConfig, err := parse(t, args)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return config, hostConfig
|
||||
}
|
||||
|
||||
func TestParseRunLinks(t *testing.T) {
|
||||
if _, hostConfig := mustParse(t, "-link a:b"); len(hostConfig.Links) == 0 || hostConfig.Links[0] != "a:b" {
|
||||
t.Fatalf("Error parsing links. Expected []string{\"a:b\"}, received: %v", hostConfig.Links)
|
||||
}
|
||||
if _, hostConfig := mustParse(t, "-link a:b -link c:d"); len(hostConfig.Links) < 2 || hostConfig.Links[0] != "a:b" || hostConfig.Links[1] != "c:d" {
|
||||
t.Fatalf("Error parsing links. Expected []string{\"a:b\", \"c:d\"}, received: %v", hostConfig.Links)
|
||||
}
|
||||
if _, hostConfig := mustParse(t, ""); len(hostConfig.Links) != 0 {
|
||||
t.Fatalf("Error parsing links. No link expected, received: %v", hostConfig.Links)
|
||||
}
|
||||
|
||||
if _, _, err := parse(t, "-link a"); err == nil {
|
||||
t.Fatalf("Error parsing links. `-link a` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-link"); err == nil {
|
||||
t.Fatalf("Error parsing links. `-link` should be an error but is not")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRunAttach(t *testing.T) {
|
||||
if config, _ := mustParse(t, "-a stdin"); !config.AttachStdin || config.AttachStdout || config.AttachStderr {
|
||||
t.Fatalf("Error parsing attach flags. Expect only Stdin enabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
|
||||
}
|
||||
if config, _ := mustParse(t, "-a stdin -a stdout"); !config.AttachStdin || !config.AttachStdout || config.AttachStderr {
|
||||
t.Fatalf("Error parsing attach flags. Expect only Stdin and Stdout enabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
|
||||
}
|
||||
if config, _ := mustParse(t, "-a stdin -a stdout -a stderr"); !config.AttachStdin || !config.AttachStdout || !config.AttachStderr {
|
||||
t.Fatalf("Error parsing attach flags. Expect all attach enabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
|
||||
}
|
||||
if config, _ := mustParse(t, ""); config.AttachStdin || !config.AttachStdout || !config.AttachStderr {
|
||||
t.Fatalf("Error parsing attach flags. Expect Stdin disabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
|
||||
}
|
||||
|
||||
if _, _, err := parse(t, "-a"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a invalid"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a invalid` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a invalid -a stdout"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a stdout -a stderr -d"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a stdin -d"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a stdin -d` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a stdout -d"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a stdout -d` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-a stderr -d"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-a stderr -d` should be an error but is not")
|
||||
}
|
||||
if _, _, err := parse(t, "-d -rm"); err == nil {
|
||||
t.Fatalf("Error parsing attach flags, `-d -rm` should be an error but is not")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRunVolumes(t *testing.T) {
|
||||
if config, hostConfig := mustParse(t, "-v /tmp"); hostConfig.Binds != nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp` should not mount-bind anything. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/tmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, "-v /tmp -v /var"); hostConfig.Binds != nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp -v /var` should not mount-bind anything. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/tmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp` is missing from volumes. Recevied %v", config.Volumes)
|
||||
} else if _, exists := config.Volumes["/var"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /var` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, "-v /hostTmp:/containerTmp"); hostConfig.Binds == nil || hostConfig.Binds[0] != "/hostTmp:/containerTmp" {
|
||||
t.Fatalf("Error parsing volume flags, `-v /hostTmp:/containerTmp` should mount-bind /hostTmp into /containeTmp. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/containerTmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, "-v /hostTmp:/containerTmp -v /hostVar:/containerVar"); hostConfig.Binds == nil || hostConfig.Binds[0] != "/hostTmp:/containerTmp" || hostConfig.Binds[1] != "/hostVar:/containerVar" {
|
||||
t.Fatalf("Error parsing volume flags, `-v /hostTmp:/containerTmp -v /hostVar:/containerVar` should mount-bind /hostTmp into /containeTmp and /hostVar into /hostContainer. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/containerTmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerTmp` is missing from volumes. Received %v", config.Volumes)
|
||||
} else if _, exists := config.Volumes["/containerVar"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerVar` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, "-v /hostTmp:/containerTmp:ro -v /hostVar:/containerVar:rw"); hostConfig.Binds == nil || hostConfig.Binds[0] != "/hostTmp:/containerTmp:ro" || hostConfig.Binds[1] != "/hostVar:/containerVar:rw" {
|
||||
t.Fatalf("Error parsing volume flags, `-v /hostTmp:/containerTmp:ro -v /hostVar:/containerVar:rw` should mount-bind /hostTmp into /containeTmp and /hostVar into /hostContainer. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/containerTmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerTmp` is missing from volumes. Received %v", config.Volumes)
|
||||
} else if _, exists := config.Volumes["/containerVar"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerVar` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, "-v /hostTmp:/containerTmp -v /containerVar"); hostConfig.Binds == nil || len(hostConfig.Binds) > 1 || hostConfig.Binds[0] != "/hostTmp:/containerTmp" {
|
||||
t.Fatalf("Error parsing volume flags, `-v /hostTmp:/containerTmp -v /containerVar` should mount-bind only /hostTmp into /containeTmp. Received %v", hostConfig.Binds)
|
||||
} else if _, exists := config.Volumes["/containerTmp"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerTmp` is missing from volumes. Received %v", config.Volumes)
|
||||
} else if _, exists := config.Volumes["/containerVar"]; !exists {
|
||||
t.Fatalf("Error parsing volume flags, `-v /containerVar` is missing from volumes. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if config, hostConfig := mustParse(t, ""); hostConfig.Binds != nil {
|
||||
t.Fatalf("Error parsing volume flags, without volume, nothing should be mount-binded. Received %v", hostConfig.Binds)
|
||||
} else if len(config.Volumes) != 0 {
|
||||
t.Fatalf("Error parsing volume flags, without volume, no volume should be present. Received %v", config.Volumes)
|
||||
}
|
||||
|
||||
if _, _, err := parse(t, "-v /"); err == nil {
|
||||
t.Fatalf("Expected error, but got none")
|
||||
}
|
||||
|
||||
if _, _, err := parse(t, "-v /:/"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /:/` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v /tmp:"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp:` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v /tmp:ro"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp:ro` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v /tmp::"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp::` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v :"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v :` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v ::"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v ::` should fail but didn't")
|
||||
}
|
||||
if _, _, err := parse(t, "-v /tmp:/tmp:/tmp:/tmp"); err == nil {
|
||||
t.Fatalf("Error parsing volume flags, `-v /tmp:/tmp:/tmp:/tmp` should fail but didn't")
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package daemonconfig
|
||||
package docker
|
||||
|
||||
import (
|
||||
"github.com/dotcloud/docker/daemon/networkdriver"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"net"
|
||||
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/networkdriver"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -12,12 +13,11 @@ const (
|
||||
)
|
||||
|
||||
// FIXME: separate runtime configuration from http api configuration
|
||||
type Config struct {
|
||||
type DaemonConfig struct {
|
||||
Pidfile string
|
||||
Root string
|
||||
AutoRestart bool
|
||||
Dns []string
|
||||
DnsSearch []string
|
||||
EnableIptables bool
|
||||
EnableIpForward bool
|
||||
DefaultIp net.IP
|
||||
@@ -28,14 +28,12 @@ type Config struct {
|
||||
ExecDriver string
|
||||
Mtu int
|
||||
DisableNetwork bool
|
||||
EnableSelinuxSupport bool
|
||||
Context map[string][]string
|
||||
}
|
||||
|
||||
// ConfigFromJob creates and returns a new DaemonConfig object
|
||||
// by parsing the contents of a job's environment.
|
||||
func ConfigFromJob(job *engine.Job) *Config {
|
||||
config := &Config{
|
||||
func DaemonConfigFromJob(job *engine.Job) *DaemonConfig {
|
||||
config := &DaemonConfig{
|
||||
Pidfile: job.Getenv("Pidfile"),
|
||||
Root: job.Getenv("Root"),
|
||||
AutoRestart: job.GetenvBool("AutoRestart"),
|
||||
@@ -47,14 +45,10 @@ func ConfigFromJob(job *engine.Job) *Config {
|
||||
InterContainerCommunication: job.GetenvBool("InterContainerCommunication"),
|
||||
GraphDriver: job.Getenv("GraphDriver"),
|
||||
ExecDriver: job.Getenv("ExecDriver"),
|
||||
EnableSelinuxSupport: job.GetenvBool("EnableSelinuxSupport"),
|
||||
}
|
||||
if dns := job.GetenvList("Dns"); dns != nil {
|
||||
config.Dns = dns
|
||||
}
|
||||
if dnsSearch := job.GetenvList("DnsSearch"); dnsSearch != nil {
|
||||
config.DnsSearch = dnsSearch
|
||||
}
|
||||
if mtu := job.GetenvInt("Mtu"); mtu != 0 {
|
||||
config.Mtu = mtu
|
||||
} else {
|
||||
+520
-480
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
package daemon
|
||||
package docker
|
||||
|
||||
import (
|
||||
"github.com/dotcloud/docker/nat"
|
||||
@@ -132,14 +132,14 @@ func TestParseNetworkOptsUdp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFullName(t *testing.T) {
|
||||
name, err := GetFullContainerName("testing")
|
||||
name, err := getFullName("testing")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if name != "/testing" {
|
||||
t.Fatalf("Expected /testing got %s", name)
|
||||
}
|
||||
if _, err := GetFullContainerName(""); err == nil {
|
||||
if _, err := getFullName(""); err == nil {
|
||||
t.Fatal("Error should not be nil")
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# bits of this were adapted from lxc-checkconfig
|
||||
# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in
|
||||
|
||||
possibleConfigs=(
|
||||
'/proc/config.gz'
|
||||
"/boot/config-$(uname -r)"
|
||||
"/usr/src/linux-$(uname -r)/.config"
|
||||
'/usr/src/linux/.config'
|
||||
)
|
||||
: ${CONFIG:="${possibleConfigs[0]}"}
|
||||
|
||||
if ! command -v zgrep &> /dev/null; then
|
||||
zgrep() {
|
||||
zcat "$2" | grep "$1"
|
||||
}
|
||||
fi
|
||||
|
||||
is_set() {
|
||||
zgrep "CONFIG_$1=[y|m]" "$CONFIG" > /dev/null
|
||||
}
|
||||
|
||||
# see http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
||||
declare -A colors=(
|
||||
[black]=30
|
||||
[red]=31
|
||||
[green]=32
|
||||
[yellow]=33
|
||||
[blue]=34
|
||||
[magenta]=35
|
||||
[cyan]=36
|
||||
[white]=37
|
||||
)
|
||||
color() {
|
||||
color=()
|
||||
if [ "$1" = 'bold' ]; then
|
||||
color+=( '1' )
|
||||
shift
|
||||
fi
|
||||
if [ $# -gt 0 ] && [ "${colors[$1]}" ]; then
|
||||
color+=( "${colors[$1]}" )
|
||||
fi
|
||||
local IFS=';'
|
||||
echo -en '\033['"${color[*]}"m
|
||||
}
|
||||
wrap_color() {
|
||||
text="$1"
|
||||
shift
|
||||
color "$@"
|
||||
echo -n "$text"
|
||||
color reset
|
||||
echo
|
||||
}
|
||||
|
||||
wrap_good() {
|
||||
echo "$(wrap_color "$1" white): $(wrap_color "$2" green)"
|
||||
}
|
||||
wrap_bad() {
|
||||
echo "$(wrap_color "$1" bold): $(wrap_color "$2" bold red)"
|
||||
}
|
||||
wrap_warning() {
|
||||
wrap_color >&2 "$*" red
|
||||
}
|
||||
|
||||
check_flag() {
|
||||
if is_set "$1"; then
|
||||
wrap_good "CONFIG_$1" 'enabled'
|
||||
else
|
||||
wrap_bad "CONFIG_$1" 'missing'
|
||||
fi
|
||||
}
|
||||
|
||||
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..."
|
||||
for tryConfig in "${possibleConfigs[@]}"; do
|
||||
if [ -e "$tryConfig" ]; then
|
||||
CONFIG="$tryConfig"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -e "$CONFIG" ]; then
|
||||
wrap_warning "error: cannot find kernel config"
|
||||
wrap_warning " try running this script again, specifying the kernel config:"
|
||||
wrap_warning " CONFIG=/path/to/kernel/.config $0"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
wrap_color "info: reading kernel config from $CONFIG ..." white
|
||||
echo
|
||||
|
||||
echo 'Generally Necessary:'
|
||||
|
||||
echo -n '- '
|
||||
cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)([, ]|$)/ && $8 == "cgroup" { print $5 }' /proc/$$/mountinfo | head -n1)"
|
||||
cgroupDir="$(dirname "$cgroupSubsystemDir")"
|
||||
if [ -d "$cgroupDir/cpu" -o -d "$cgroupDir/cpuacct" -o -d "$cgroupDir/cpuset" -o -d "$cgroupDir/devices" -o -d "$cgroupDir/freezer" -o -d "$cgroupDir/memory" ]; then
|
||||
echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]"
|
||||
else
|
||||
if [ "$cgroupSubsystemDir" ]; then
|
||||
echo "$(wrap_bad 'cgroup hierarchy' 'single mountpoint!') [$cgroupSubsystemDir]"
|
||||
else
|
||||
echo "$(wrap_bad 'cgroup hierarchy' 'nonexistent??')"
|
||||
fi
|
||||
echo " $(wrap_color '(see https://github.com/tianon/cgroupfs-mount)' yellow)"
|
||||
fi
|
||||
|
||||
flags=(
|
||||
NAMESPACES {NET,PID,IPC,UTS}_NS
|
||||
DEVPTS_MULTIPLE_INSTANCES
|
||||
CGROUPS CGROUP_DEVICE
|
||||
MACVLAN VETH BRIDGE
|
||||
NF_NAT_IPV4 IP_NF_TARGET_MASQUERADE
|
||||
NETFILTER_XT_MATCH_{ADDRTYPE,CONNTRACK}
|
||||
NF_NAT NF_NAT_NEEDED
|
||||
)
|
||||
check_flags "${flags[@]}"
|
||||
echo
|
||||
|
||||
echo 'Optional Features:'
|
||||
flags=(
|
||||
MEMCG_SWAP
|
||||
RESOURCE_COUNTERS
|
||||
)
|
||||
check_flags "${flags[@]}"
|
||||
|
||||
echo '- Storage Drivers:'
|
||||
{
|
||||
echo '- "'$(wrap_color 'aufs' blue)'":'
|
||||
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
|
||||
|
||||
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 | sed 's/^/ /'
|
||||
} | sed 's/^/ /'
|
||||
echo
|
||||
|
||||
#echo 'Potential Future Features:'
|
||||
#check_flags USER_NS
|
||||
#echo
|
||||
@@ -392,8 +392,11 @@ _docker_port()
|
||||
_docker_ps()
|
||||
{
|
||||
case "$prev" in
|
||||
--since|--before)
|
||||
__docker_containers_all
|
||||
--since-id|--before-id)
|
||||
COMPREPLY=( $( compgen -W "$( __docker_q ps -a -q )" -- "$cur" ) )
|
||||
# TODO replace this with __docker_containers_all
|
||||
# see https://github.com/dotcloud/docker/issues/3565
|
||||
return
|
||||
;;
|
||||
-n)
|
||||
return
|
||||
@@ -404,7 +407,7 @@ _docker_ps()
|
||||
|
||||
case "$cur" in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W "-q --quiet -s --size -a --all --no-trunc -l --latest --since --before -n" -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W "-q --quiet -s --size -a --all --no-trunc -l --latest --since-id --before-id -n" -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
||||
@@ -26,38 +26,36 @@ end
|
||||
function __fish_print_docker_containers --description 'Print a list of docker containers' -a select
|
||||
switch $select
|
||||
case running
|
||||
docker ps -a --no-trunc | command awk 'NR>1' | command awk 'BEGIN {FS=" +"}; $5 ~ "^Up" {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
docker ps -a --no-trunc | awk 'NR>1' | awk 'BEGIN {FS=" +"}; $5 ~ "^Up" {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
case stopped
|
||||
docker ps -a --no-trunc | command awk 'NR>1' | command awk 'BEGIN {FS=" +"}; $5 ~ "^Exit" {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
docker ps -a --no-trunc | awk 'NR>1' | awk 'BEGIN {FS=" +"}; $5 ~ "^Exit" {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
case all
|
||||
docker ps -a --no-trunc | command awk 'NR>1' | command awk 'BEGIN {FS=" +"}; {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
docker ps -a --no-trunc | awk 'NR>1' | awk 'BEGIN {FS=" +"}; {print $1 "\n" $(NF-1)}' | tr ',' '\n'
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_print_docker_images --description 'Print a list of docker images'
|
||||
docker images | command awk 'NR>1' | command grep -v '<none>' | command awk '{print $1":"$2}'
|
||||
docker images | awk 'NR>1' | grep -v '<none>' | awk '{print $1":"$2}'
|
||||
end
|
||||
|
||||
function __fish_print_docker_repositories --description 'Print a list of docker repositories'
|
||||
docker images | command awk 'NR>1' | command grep -v '<none>' | command awk '{print $1}' | command sort | command uniq
|
||||
docker images | awk 'NR>1' | grep -v '<none>' | awk '{print $1}' | sort | uniq
|
||||
end
|
||||
|
||||
# common options
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s D -l debug -d 'Enable debug mode'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s G -l group -d "Group to assign the unix socket specified by -H when running in daemon mode; use '' (the empty string) to disable setting of a group"
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s H -l host -d 'tcp://host:port, unix://path/to/socket, fd://* or fd://socketfd to use in daemon mode. Multiple sockets can be specified'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -l api-enable-cors -d 'Enable CORS headers in the remote API'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s b -l bridge -d "Attach containers to a pre-existing network bridge; use 'none' to disable container networking"
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -l bip -d "Use this CIDR notation address for the network bridge's IP, not compatible with -b"
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s d -l daemon -d 'Enable daemon mode'
|
||||
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 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"
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -l mtu -d 'Set the containers network MTU; if no value is provided: default to the default route MTU or 1500 if no default route is available'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -l mtu -d 'Set the containers network MTU; if no value is provided: default to the default route MTU or 1500 if not default route is available'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s p -l pidfile -d 'Path to use for daemon PID file'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s r -l restart -d 'Restart previously running containers'
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -s s -l storage-driver -d 'Force the docker runtime to use a specific storage driver'
|
||||
@@ -73,7 +71,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from attach' -a '(__fish_pri
|
||||
# build
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a build -d 'Build a container from a Dockerfile'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from build' -l no-cache -d 'Do not use cache when building the image'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from build' -s q -l quiet -d 'Suppress the verbose output generated by the containers'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from build' -s q -l quiet -d 'Suppress verbose build output'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from build' -l rm -d 'Remove intermediate containers after a successful build'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from build' -s t -l tag -d 'Repository name (and optionally a tag) to be applied to the resulting image in case of success'
|
||||
|
||||
@@ -102,16 +100,16 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from export' -a '(__fish_pri
|
||||
# history
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a history -d 'Show the history of an image'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from history' -l no-trunc -d "Don't truncate output"
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from history' -s q -l quiet -d 'Only show numeric IDs'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from history' -s q -l quiet -d 'only show numeric IDs'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from history' -a '(__fish_print_docker_images)' -d "Image"
|
||||
|
||||
# images
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a images -d 'List images'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s a -l all -d 'Show all images (by default filter out the intermediate image layers)'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s a -l all -d 'show all images (by default filter out the intermediate images used to build)'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -l no-trunc -d "Don't truncate output"
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s q -l quiet -d 'Only show numeric IDs'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s t -l tree -d 'Output graph in tree format'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s v -l viz -d 'Output graph in graphviz format'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s q -l quiet -d 'only show numeric IDs'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s t -l tree -d 'output graph in tree format'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -s v -l viz -d 'output graph in graphviz format'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from images' -a '(__fish_print_docker_repositories)' -d "Repository"
|
||||
|
||||
# import
|
||||
@@ -128,7 +126,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from insert' -a '(__fish_pri
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a inspect -d 'Return low-level information on a container'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -s f -l format -d 'Format the output using the given go template.'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_images)' -d "Image"
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_containers all)' -d "Container"
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_containers running)' -d "Container"
|
||||
|
||||
# kill
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a kill -d 'Kill a running container'
|
||||
@@ -140,9 +138,9 @@ complete -c docker -f -n '__fish_docker_no_subcommand' -a load -d 'Load an image
|
||||
|
||||
# login
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a login -d 'Register or Login to the docker registry server'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s e -l email -d 'Email'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s p -l password -d 'Password'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s u -l username -d 'Username'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s e -l email -d 'email'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s p -l password -d 'password'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s u -l username -d 'username'
|
||||
|
||||
# logs
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a logs -d 'Fetch the logs of a container'
|
||||
@@ -156,13 +154,13 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from port' -a '(__fish_print
|
||||
# ps
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a ps -d 'List containers'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s a -l all -d 'Show all containers. Only running containers are shown by default.'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -l before -d 'Show only container created before Id or Name, include non-running ones.'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -l before-id -d 'Show only container created before Id, include non-running ones.'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -s l -l latest -d 'Show only the latest created container, include non-running ones.'
|
||||
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' -l since -d 'Show only containers created since Id or Name, include non-running ones.'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from ps' -l since-id -d 'Show only containers created since Id, include non-running ones.'
|
||||
|
||||
# pull
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a pull -d 'Pull an image or a repository from the docker registry server'
|
||||
@@ -182,14 +180,12 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from restart' -a '(__fish_pr
|
||||
|
||||
# rm
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a rm -d 'Remove one or more containers'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rm' -s f -l force -d 'Force removal of running container'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rm' -s l -l link -d 'Remove the specified link and not the underlying container'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rm' -s v -l volumes -d 'Remove the volumes associated to the container'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rm' -a '(__fish_print_docker_containers stopped)' -d "Container"
|
||||
|
||||
# rmi
|
||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a rmi -d 'Remove one or more images'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rmi' -s f -l force -d 'Force'
|
||||
complete -c docker -A -f -n '__fish_seen_subcommand_from rmi' -a '(__fish_print_docker_images)' -d "Image"
|
||||
|
||||
# run
|
||||
|
||||
@@ -174,7 +174,7 @@ __docker_subcommand () {
|
||||
(ps)
|
||||
_arguments '-a[Show all containers. Only running containers are shown by default]' \
|
||||
'-h[Show help]' \
|
||||
'--before-id=-[Show only container created before Id, include non-running one]:containers:__docker_containers' \
|
||||
'-before-id=-[Show only container created before Id, include non-running one]:containers:__docker_containers' \
|
||||
'-n=-[Show n last created containers, include non-running one]:n:(1 5 10 25 50)'
|
||||
;;
|
||||
(tag)
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
# wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/data/Dockerfile
|
||||
#
|
||||
# # Build data image
|
||||
# docker build -t data .
|
||||
# docker build -t data -rm .
|
||||
#
|
||||
# # Create a data container. (eg: iceweasel-data)
|
||||
# docker run --name iceweasel-data data true
|
||||
# docker run -name iceweasel-data data true
|
||||
#
|
||||
# # List data from it
|
||||
# docker run --volumes-from iceweasel-data busybox ls -al /data
|
||||
# docker run -volumes-from iceweasel-data busybox ls -al /data
|
||||
|
||||
docker-version 0.6.5
|
||||
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
# wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/iceweasel/Dockerfile
|
||||
#
|
||||
# # Build iceweasel image
|
||||
# docker build -t iceweasel .
|
||||
# docker build -t iceweasel -rm .
|
||||
#
|
||||
# # Run stateful data-on-host iceweasel. For ephemeral, remove -v /data/iceweasel:/data
|
||||
# docker run -v /data/iceweasel:/data -v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
# -v /dev/snd:/dev/snd --lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
|
||||
# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
|
||||
# -e DISPLAY=unix$DISPLAY iceweasel
|
||||
#
|
||||
# # To run stateful dockerized data containers
|
||||
# docker run --volumes-from iceweasel-data -v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
# -v /dev/snd:/dev/snd --lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
|
||||
# docker run -volumes-from iceweasel-data -v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||
# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
|
||||
# -e DISPLAY=unix$DISPLAY iceweasel
|
||||
|
||||
docker-version 0.6.5
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/daemon/graphdriver/devmapper"
|
||||
"github.com/dotcloud/docker/graphdriver/devmapper"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
FROM ubuntu:12.10
|
||||
MAINTAINER Guillaume J. Charmes <guillaume@docker.com>
|
||||
MAINTAINER Guillaume J. Charmes <guillaume@dotcloud.com>
|
||||
|
||||
RUN apt-get update && apt-get install -y wget git mercurial
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM busybox
|
||||
MAINTAINER Guillaume J. Charmes <guillaume@docker.com>
|
||||
MAINTAINER Guillaume J. Charmes <guillaume@dotcloud.com>
|
||||
ADD manager /usr/bin/
|
||||
ENTRYPOINT ["/usr/bin/manager"]
|
||||
|
||||
@@ -70,7 +70,7 @@ func main() {
|
||||
bufErr := bytes.NewBuffer(nil)
|
||||
|
||||
// Instanciate the Docker CLI
|
||||
cli := docker.NewDockerCli(nil, bufOut, bufErr, "unix", "/var/run/docker.sock", false, nil)
|
||||
cli := docker.NewDockerCli(nil, bufOut, bufErr, "unix", "/var/run/docker.sock")
|
||||
// Retrieve the container info
|
||||
if err := cli.CmdInspect(flag.Arg(0)); err != nil {
|
||||
// As of docker v0.6.3, CmdInspect always returns nil
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#DOCKER="/usr/local/bin/docker"
|
||||
|
||||
# Use DOCKER_OPTS to modify the daemon startup options.
|
||||
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
|
||||
#DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4"
|
||||
|
||||
# If you need Docker to use an HTTP proxy, it can also be specified here.
|
||||
#export http_proxy="http://127.0.0.1:3128/"
|
||||
|
||||
@@ -2,8 +2,6 @@ description "Docker daemon"
|
||||
|
||||
start on filesystem
|
||||
stop on runlevel [!2345]
|
||||
limit nofile 524288 1048576
|
||||
limit nproc 524288 1048576
|
||||
|
||||
respawn
|
||||
|
||||
@@ -37,5 +35,5 @@ script
|
||||
if [ -f /etc/default/$UPSTART_JOB ]; then
|
||||
. /etc/default/$UPSTART_JOB
|
||||
fi
|
||||
exec "$DOCKER" -d $DOCKER_OPTS
|
||||
"$DOCKER" -d $DOCKER_OPTS
|
||||
end script
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# these are generated by the md/md2man-all.sh script
|
||||
man*
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM fedora:20
|
||||
MAINTAINER ipbabble <emailwhenry@redhat.com>
|
||||
# Update and install pandoc
|
||||
RUN yum -y update; yum clean all;
|
||||
RUN yum -y install pandoc;
|
||||
@@ -1,71 +0,0 @@
|
||||
Docker Documentation
|
||||
====================
|
||||
|
||||
This directory contains the Docker user manual in the Markdown format.
|
||||
Do *not* edit the man pages in the man1 directory. Instead, amend the
|
||||
Markdown (*.md) files.
|
||||
|
||||
# File List
|
||||
|
||||
docker.md
|
||||
docker-attach.md
|
||||
docker-build.md
|
||||
docker-commit.md
|
||||
docker-cp.md
|
||||
docker-diff.md
|
||||
docker-events.md
|
||||
docker-export.md
|
||||
docker-history.md
|
||||
docker-images.md
|
||||
docker-import.md
|
||||
docker-info.md
|
||||
docker-inspect.md
|
||||
docker-kill.md
|
||||
docker-load.md
|
||||
docker-login.md
|
||||
docker-logs.md
|
||||
docker-port.md
|
||||
docker-ps.md
|
||||
docker-pull.md
|
||||
docker-push.md
|
||||
docker-restart.md
|
||||
docker-rmi.md
|
||||
docker-rm.md
|
||||
docker-run.md
|
||||
docker-save.md
|
||||
docker-search.md
|
||||
docker-start.md
|
||||
docker-stop.md
|
||||
docker-tag.md
|
||||
docker-top.md
|
||||
docker-wait.md
|
||||
Dockerfile
|
||||
md2man-all.sh
|
||||
|
||||
# Generating man pages from the Markdown files
|
||||
|
||||
The recommended approach for generating the man pages is via a Docker
|
||||
container. Using the supplied Dockerfile, Docker will create a Fedora based
|
||||
container and isolate the Pandoc installation. This is a seamless process,
|
||||
saving you from dealing with Pandoc and dependencies on your own computer.
|
||||
|
||||
## Building the Fedora / Pandoc image
|
||||
|
||||
There is a Dockerfile provided in the `docker/contrib/man/md` directory.
|
||||
|
||||
Using this Dockerfile, create a Docker image tagged `fedora/pandoc`:
|
||||
|
||||
docker build -t fedora/pandoc .
|
||||
|
||||
## Utilizing the Fedora / Pandoc image
|
||||
|
||||
Once the image is built, run a container using the image with *volumes*:
|
||||
|
||||
docker run -v /<path-to-git-dir>/docker/contrib/man:/pandoc:rw \
|
||||
-w /pandoc -i fedora/pandoc /pandoc/md/md2man-all.sh
|
||||
|
||||
The Pandoc Docker container will process the Markdown files and generate
|
||||
the man pages inside the `docker/contrib/man/man1` directory using
|
||||
Docker volumes. For more information on Docker volumes see the man page for
|
||||
`docker run` and also look at the article [Sharing Directories via Volumes]
|
||||
(http://docs.docker.io/use/working_with_volumes/).
|
||||
@@ -1,57 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-attach - Attach to a running container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker attach** **--no-stdin**[=*false*] **--sig-proxy**[=*true*] CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
If you **docker run** a container in detached mode (**-d**), you can reattach to
|
||||
the detached container with **docker attach** using the container's ID or name.
|
||||
|
||||
You can detach from the container again (and leave it running) with `CTRL-c` (for
|
||||
a quiet exit) or `CTRL-\` to get a stacktrace of the Docker client when it quits.
|
||||
When you detach from a container the exit code will be returned to
|
||||
the client.
|
||||
|
||||
# OPTIONS
|
||||
**--no-stdin**=*true*|*false*
|
||||
When set to true, do not attach to stdin. The default is *false*.
|
||||
|
||||
**--sig-proxy**=*true*|*false*:
|
||||
When set to true, proxify all received signal to the process (even in non-tty
|
||||
mode). The default is *true*.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Attaching to a container
|
||||
|
||||
In this example the top command is run inside a container, from an image called
|
||||
fedora, in detached mode. The ID from the container is passed into the **docker
|
||||
attach** command:
|
||||
|
||||
# ID=$(sudo docker run -d fedora /usr/bin/top -b)
|
||||
# sudo docker attach $ID
|
||||
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
|
||||
Swap: 786428k total, 0k used, 786428k free, 221740k cached
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
|
||||
|
||||
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
|
||||
Swap: 786428k total, 0k used, 786428k free, 221776k cached
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,82 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-build - Build a container image from a Dockerfile source at PATH
|
||||
|
||||
# SYNOPSIS
|
||||
**docker build** [**--no-cache**[=*false*]] [**-q**|**--quiet**[=*false*]]
|
||||
[**--rm**] [**-t**|**--tag**=TAG] PATH | URL | -
|
||||
|
||||
# DESCRIPTION
|
||||
This will read the Dockerfile from the directory specified in **PATH**.
|
||||
It also sends any other files and directories found in the current
|
||||
directory to the Docker daemon. The contents of this directory would
|
||||
be used by **ADD** commands found within the Dockerfile.
|
||||
|
||||
Warning, this will send a lot of data to the Docker daemon depending
|
||||
on the contents of the current directory. The build is run by the Docker
|
||||
daemon, not by the CLI, so the whole context must be transferred to the daemon.
|
||||
The Docker CLI reports "Uploading context" when the context is sent to
|
||||
the daemon.
|
||||
|
||||
When a single Dockerfile is given as the URL, then no context is set.
|
||||
When a Git repository is set as the **URL**, the repository is used
|
||||
as context.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-q**, **--quiet**=*true*|*false*
|
||||
When set to true, suppress verbose build output. Default is *false*.
|
||||
|
||||
**--rm**=*true*|*false*
|
||||
When true, remove intermediate containers that are created during the
|
||||
build process. The default is true.
|
||||
|
||||
**-t**, **--tag**=*tag*
|
||||
Tag to be applied to the resulting image on successful completion of
|
||||
the build.
|
||||
|
||||
**--no-cache**=*true*|*false*
|
||||
When set to true, do not use a cache when building the image. The
|
||||
default is *false*.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Building an image using a Dockefile located inside the current directory
|
||||
|
||||
Docker images can be built using the build command and a Dockerfile:
|
||||
|
||||
docker build .
|
||||
|
||||
During the build process Docker creates intermediate images. In order to
|
||||
keep them, you must explicitly set `--rm=false`.
|
||||
|
||||
docker build --rm=false .
|
||||
|
||||
A good practice is to make a sub-directory with a related name and create
|
||||
the Dockerfile in that directory. For example, a directory called mongo may
|
||||
contain a Dockerfile to create a Docker MongoDB image. Likewise, another
|
||||
directory called httpd may be used to store Dockerfiles for Apache web
|
||||
server images.
|
||||
|
||||
It is also a good practice to add the files required for the image to the
|
||||
sub-directory. These files will then be specified with the `ADD` instruction
|
||||
in the Dockerfile. Note: If you include a tar file (a good practice!), then
|
||||
Docker will automatically extract the contents of the tar file
|
||||
specified within the `ADD` instruction into the specified target.
|
||||
|
||||
## Building an image using a URL
|
||||
|
||||
This will clone the specified Github repository from the URL and use it
|
||||
as context. The Dockerfile at the root of the repository is used as
|
||||
Dockerfile. This only works if the Github repository is a dedicated
|
||||
repository.
|
||||
|
||||
docker build github.com/scollier/Fedora-Dockerfiles/tree/master/apache
|
||||
|
||||
Note: You can set an arbitrary Git repository via the `git://` schema.
|
||||
|
||||
# HISTORY
|
||||
March 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,34 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-commit - Create a new image from the changes to an existing
|
||||
container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker commit** **-a**|**--author**[=""] **-m**|**--message**[=""]
|
||||
CONTAINER [REPOSITORY[:TAG]]
|
||||
|
||||
# DESCRIPTION
|
||||
Using an existing container's name or ID you can create a new image.
|
||||
|
||||
# OPTIONS
|
||||
**-a, --author**=""
|
||||
Author name. (eg. "John Hannibal Smith <hannibal@a-team.com>"
|
||||
|
||||
**-m, --message**=""
|
||||
Commit message
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Creating a new image from an existing container
|
||||
An existing Fedora based container has had Apache installed while running
|
||||
in interactive mode with the bash shell. Apache is also running. To
|
||||
create a new image run docker ps to find the container's ID and then run:
|
||||
|
||||
# docker commit -me= "Added Apache to Fedora base image" \
|
||||
--a="A D Ministrator" 98bd7fc99854 fedora/fedora_httpd:20
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and in
|
||||
@@ -1,24 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-cp - Copy files/folders from the PATH to the HOSTPATH
|
||||
|
||||
# SYNOPSIS
|
||||
**docker cp** CONTAINER:PATH HOSTPATH
|
||||
|
||||
# DESCRIPTION
|
||||
Copy files/folders from the containers filesystem to the host
|
||||
path. Paths are relative to the root of the filesystem. Files
|
||||
can be copied from a running or stopped container.
|
||||
|
||||
# EXAMPLE
|
||||
An important shell script file, created in a bash shell, is copied from
|
||||
the exited container to the current dir on the host:
|
||||
|
||||
# docker cp c071f3c3ee81:setup.sh .
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-diff - Inspect changes on a container's filesystem
|
||||
|
||||
# SYNOPSIS
|
||||
**docker diff** CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
Inspect changes on a container's filesystem. You can use the full or
|
||||
shortened container ID or the container name set using
|
||||
**docker run --name** option.
|
||||
|
||||
# EXAMPLE
|
||||
Inspect the changes to on a nginx container:
|
||||
|
||||
# docker diff 1fdfd1f54c1b
|
||||
C /dev
|
||||
C /dev/console
|
||||
C /dev/core
|
||||
C /dev/stdout
|
||||
C /dev/fd
|
||||
C /dev/ptmx
|
||||
C /dev/stderr
|
||||
C /dev/stdin
|
||||
C /run
|
||||
A /run/nginx.pid
|
||||
C /var/lib/nginx/tmp
|
||||
A /var/lib/nginx/tmp/client_body
|
||||
A /var/lib/nginx/tmp/fastcgi
|
||||
A /var/lib/nginx/tmp/proxy
|
||||
A /var/lib/nginx/tmp/scgi
|
||||
A /var/lib/nginx/tmp/uwsgi
|
||||
C /var/log/nginx
|
||||
A /var/log/nginx/access.log
|
||||
A /var/log/nginx/error.log
|
||||
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-events - Get real time events from the server
|
||||
|
||||
**docker events** **--since**=""|*epoch-time*
|
||||
|
||||
# DESCRIPTION
|
||||
Get event information from the Docker daemon. Information can include historical
|
||||
information and real-time information.
|
||||
|
||||
# OPTIONS
|
||||
**--since**=""
|
||||
Show previously created events and then stream. This can be in either
|
||||
seconds since epoch, or date string.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Listening for Docker events
|
||||
|
||||
After running docker events a container 786d698004576 is started and stopped
|
||||
(The container name has been shortened in the ouput below):
|
||||
|
||||
# docker events
|
||||
[2014-04-12 18:23:04 -0400 EDT] 786d69800457: (from whenry/testimage:latest) start
|
||||
[2014-04-12 18:23:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) die
|
||||
[2014-04-12 18:23:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) stop
|
||||
|
||||
## Listening for events since a given date
|
||||
Again the output container IDs have been shortened for the purposes of this document:
|
||||
|
||||
# docker events --since '2014-04-12'
|
||||
[2014-04-12 18:11:28 -0400 EDT] c655dbf640dc: (from whenry/testimage:latest) create
|
||||
[2014-04-12 18:11:28 -0400 EDT] c655dbf640dc: (from whenry/testimage:latest) start
|
||||
[2014-04-12 18:14:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) create
|
||||
[2014-04-12 18:14:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) start
|
||||
[2014-04-12 18:22:44 -0400 EDT] 786d69800457: (from whenry/testimage:latest) die
|
||||
[2014-04-12 18:22:44 -0400 EDT] 786d69800457: (from whenry/testimage:latest) stop
|
||||
[2014-04-12 18:23:04 -0400 EDT] 786d69800457: (from whenry/testimage:latest) start
|
||||
[2014-04-12 18:23:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) die
|
||||
[2014-04-12 18:23:13 -0400 EDT] 786d69800457: (from whenry/testimage:latest) stop
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,26 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-export - Export the contents of a filesystem as a tar archive to
|
||||
STDOUT.
|
||||
|
||||
# SYNOPSIS
|
||||
**docker export** CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
Export the contents of a container's filesystem using the full or shortened
|
||||
container ID or container name. The output is exported to STDOUT and can be
|
||||
redirected to a tar file.
|
||||
|
||||
# EXAMPLE
|
||||
Export the contents of the container called angry_bell to a tar file
|
||||
called test.tar:
|
||||
|
||||
# docker export angry_bell > test.tar
|
||||
# ls *.tar
|
||||
test.tar
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,32 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-history - Show the history of an image
|
||||
|
||||
# SYNOPSIS
|
||||
**docker history** **--no-trunc**[=*false*] [**-q**|**--quiet**[=*false*]]
|
||||
IMAGE
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Show the history of when and how an image was created.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
When true don't truncate output. Default is false
|
||||
|
||||
**-q**, **--quiet=*true*|*false*
|
||||
When true only show numeric IDs. Default is false.
|
||||
|
||||
# EXAMPLE
|
||||
$ sudo docker history fedora
|
||||
IMAGE CREATED CREATED BY SIZE
|
||||
105182bb5e8b 5 days ago /bin/sh -c #(nop) ADD file:71356d2ad59aa3119d 372.7 MB
|
||||
73bd853d2ea5 13 days ago /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar 0 B
|
||||
511136ea3c5a 10 months ago 0 B
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,99 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-images - List the images in the local repository
|
||||
|
||||
# SYNOPSIS
|
||||
**docker images**
|
||||
[**-a**|**--all**=*false*]
|
||||
[**--no-trunc**[=*false*]
|
||||
[**-q**|**--quiet**[=*false*]
|
||||
[**-t**|**--tree**=*false*]
|
||||
[**-v**|**--viz**=*false*]
|
||||
[NAME]
|
||||
|
||||
# DESCRIPTION
|
||||
This command lists the images stored in the local Docker repository.
|
||||
|
||||
By default, intermediate images, used during builds, are not listed. Some of the
|
||||
output, e.g. image ID, is truncated, for space reasons. However the truncated
|
||||
image ID, and often the first few characters, are enough to be used in other
|
||||
Docker commands that use the image ID. The output includes repository, tag, image
|
||||
ID, date created and the virtual size.
|
||||
|
||||
The title REPOSITORY for the first title may seem confusing. It is essentially
|
||||
the image name. However, because you can tag a specific image, and multiple tags
|
||||
(image instances) can be associated with a single name, the name is really a
|
||||
repository for all tagged images of the same name. For example consider an image
|
||||
called fedora. It may be tagged with 18, 19, or 20, etc. to manage different
|
||||
versions.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-a**, **--all**=*true*|*false*
|
||||
When set to true, also include all intermediate images in the list. The
|
||||
default is false.
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
When set to true, list the full image ID and not the truncated ID. The
|
||||
default is false.
|
||||
|
||||
**-q**, **--quiet**=*true*|*false*
|
||||
When set to true, list the complete image ID as part of the output. The
|
||||
default is false.
|
||||
|
||||
**-t**, **--tree**=*true*|*false*
|
||||
When set to true, list the images in a tree dependency tree (hierarchy)
|
||||
format. The default is false.
|
||||
|
||||
**-v**, **--viz**=*true*|*false*
|
||||
When set to true, list the graph in graphviz format. The default is
|
||||
*false*.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Listing the images
|
||||
|
||||
To list the images in a local repository (not the registry) run:
|
||||
|
||||
docker images
|
||||
|
||||
The list will contain the image repository name, a tag for the image, and an
|
||||
image ID, when it was created and its virtual size. Columns: REPOSITORY, TAG,
|
||||
IMAGE ID, CREATED, and VIRTUAL SIZE.
|
||||
|
||||
To get a verbose list of images which contains all the intermediate images
|
||||
used in builds use **-a**:
|
||||
|
||||
docker images -a
|
||||
|
||||
## List images dependency tree hierarchy
|
||||
|
||||
To list the images in the local repository (not the registry) in a dependency
|
||||
tree format, use the **-t** option.
|
||||
|
||||
docker images -t
|
||||
|
||||
This displays a staggered hierarchy tree where the less indented image is
|
||||
the oldest with dependent image layers branching inward (to the right) on
|
||||
subsequent lines. The newest or top level image layer is listed last in
|
||||
any tree branch.
|
||||
|
||||
## List images in GraphViz format
|
||||
|
||||
To display the list in a format consumable by a GraphViz tools run with
|
||||
**-v**. For example to produce a .png graph file of the hierarchy use:
|
||||
|
||||
docker images --viz | dot -Tpng -o docker.png
|
||||
|
||||
## Listing only the shortened image IDs
|
||||
|
||||
Listing just the shortened image IDs. This can be useful for some automated
|
||||
tools.
|
||||
|
||||
docker images -q
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,39 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-import - Create an empty filesystem image and import the contents
|
||||
of the tarball into it.
|
||||
|
||||
# SYNOPSIS
|
||||
**docker import** URL|- [REPOSITORY[:TAG]]
|
||||
|
||||
# DESCRIPTION
|
||||
Create a new filesystem image from the contents of a tarball (.tar,
|
||||
.tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Import from a remote location
|
||||
|
||||
# docker import http://example.com/exampleimage.tgz example/imagerepo
|
||||
|
||||
## Import from a local file
|
||||
|
||||
Import to docker via pipe and stdin:
|
||||
|
||||
# cat exampleimage.tgz | docker import - example/imagelocal
|
||||
|
||||
## Import from a local file and tag
|
||||
|
||||
Import to docker via pipe and stdin:
|
||||
|
||||
# cat exampleimageV2.tgz | docker import - example/imagelocal:V-2.0
|
||||
|
||||
## Import from a local directory
|
||||
|
||||
# tar -c . | docker import - exampleimagedir
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,46 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-info - Display system wide information
|
||||
|
||||
# SYNOPSIS
|
||||
**docker info**
|
||||
|
||||
# DESCRIPTION
|
||||
This command displays system wide information regarding the Docker installation.
|
||||
Information displayed includes the number of containers and images, pool name,
|
||||
data file, metadata file, data space used, total data space, metadata space used
|
||||
, total metadata space, execution driver, and the kernel version.
|
||||
|
||||
The data file is where the images are stored and the metadata file is where the
|
||||
meta data regarding those images are stored. When run for the first time Docker
|
||||
allocates a certain amount of data space and meta data space from the space
|
||||
available on the volume where `/var/lib/docker` is mounted.
|
||||
|
||||
# OPTIONS
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Display Docker system information
|
||||
|
||||
Here is a sample output:
|
||||
|
||||
# docker info
|
||||
Containers: 18
|
||||
Images: 95
|
||||
Storage Driver: devicemapper
|
||||
Pool Name: docker-8:1-170408448-pool
|
||||
Data file: /var/lib/docker/devicemapper/devicemapper/data
|
||||
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
|
||||
Data Space Used: 9946.3 Mb
|
||||
Data Space Total: 102400.0 Mb
|
||||
Metadata Space Used: 9.9 Mb
|
||||
Metadata Space Total: 2048.0 Mb
|
||||
Execution Driver: native-0.1
|
||||
Kernel Version: 3.10.0-116.el7.x86_64
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,229 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-inspect - Return low-level information on a container/image
|
||||
|
||||
# SYNOPSIS
|
||||
**docker inspect** [**-f**|**--format**="" CONTAINER|IMAGE
|
||||
[CONTAINER|IMAGE...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This displays all the information available in Docker for a given
|
||||
container or image. By default, this will render all results in a JSON
|
||||
array. If a format is specified, the given template will be executed for
|
||||
each result.
|
||||
|
||||
# OPTIONS
|
||||
**-f**, **--format**=""
|
||||
The text/template package of Go describes all the details of the
|
||||
format. See examples section
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Getting information on a container
|
||||
|
||||
To get information on a container use it's ID or instance name:
|
||||
|
||||
#docker inspect 1eb5fabf5a03
|
||||
[{
|
||||
"ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
|
||||
"Created": "2014-04-04T21:33:52.02361335Z",
|
||||
"Path": "/usr/sbin/nginx",
|
||||
"Args": [],
|
||||
"Config": {
|
||||
"Hostname": "1eb5fabf5a03",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": {
|
||||
"80/tcp": {}
|
||||
},
|
||||
"Tty": true,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": [
|
||||
"/usr/sbin/nginx"
|
||||
],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "summit/nginx",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": {
|
||||
"mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650",
|
||||
"process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650"
|
||||
}
|
||||
},
|
||||
"State": {
|
||||
"Running": true,
|
||||
"Pid": 858,
|
||||
"ExitCode": 0,
|
||||
"StartedAt": "2014-04-04T21:33:54.16259207Z",
|
||||
"FinishedAt": "0001-01-01T00:00:00Z",
|
||||
"Ghost": false
|
||||
},
|
||||
"Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
|
||||
"NetworkSettings": {
|
||||
"IPAddress": "172.17.0.2",
|
||||
"IPPrefixLen": 16,
|
||||
"Gateway": "172.17.42.1",
|
||||
"Bridge": "docker0",
|
||||
"PortMapping": null,
|
||||
"Ports": {
|
||||
"80/tcp": [
|
||||
{
|
||||
"HostIp": "0.0.0.0",
|
||||
"HostPort": "80"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ResolvConfPath": "/etc/resolv.conf",
|
||||
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
|
||||
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
|
||||
"Name": "/ecstatic_ptolemy",
|
||||
"Driver": "devicemapper",
|
||||
"ExecDriver": "native-0.1",
|
||||
"Volumes": {},
|
||||
"VolumesRW": {},
|
||||
"HostConfig": {
|
||||
"Binds": null,
|
||||
"ContainerIDFile": "",
|
||||
"LxcConf": [],
|
||||
"Privileged": false,
|
||||
"PortBindings": {
|
||||
"80/tcp": [
|
||||
{
|
||||
"HostIp": "0.0.0.0",
|
||||
"HostPort": "80"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Links": null,
|
||||
"PublishAllPorts": false,
|
||||
"DriverOptions": {
|
||||
"lxc": null
|
||||
},
|
||||
"CliAddress": ""
|
||||
}
|
||||
|
||||
## Getting the IP address of a container instance
|
||||
|
||||
To get the IP address of a container use:
|
||||
|
||||
# docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
|
||||
172.17.0.2
|
||||
|
||||
## Listing all port bindings
|
||||
|
||||
One can loop over arrays and maps in the results to produce simple text
|
||||
output:
|
||||
|
||||
# docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
|
||||
{{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
|
||||
|
||||
80/tcp -> 80
|
||||
|
||||
## Getting information on an image
|
||||
|
||||
Use an image's ID or name (e.g. repository/name[:tag]) to get information
|
||||
on it.
|
||||
|
||||
# docker inspect 58394af37342
|
||||
[{
|
||||
"id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9",
|
||||
"parent": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"created": "2014-02-03T16:10:40.500814677Z",
|
||||
"container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5",
|
||||
"container_config": {
|
||||
"Hostname": "88807319f25e",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": null,
|
||||
"Tty": false,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": [
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"#(nop) ADD fedora-20-dummy.tar.xz in /"
|
||||
],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": null
|
||||
},
|
||||
"docker_version": "0.6.3",
|
||||
"author": "I P Babble \u003clsm5@ipbabble.com\u003e - ./buildcontainers.sh",
|
||||
"config": {
|
||||
"Hostname": "88807319f25e",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": null,
|
||||
"Tty": false,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": null,
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": null
|
||||
},
|
||||
"architecture": "x86_64",
|
||||
"Size": 385520098
|
||||
}]
|
||||
|
||||
# HISTORY
|
||||
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,21 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-kill - Kill a running container (send SIGKILL, or specified signal)
|
||||
|
||||
# SYNOPSIS
|
||||
**docker kill** **--signal**[=*"KILL"*] CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The main process inside each container specified will be sent SIGKILL,
|
||||
or any signal specified with option --signal.
|
||||
|
||||
# OPTIONS
|
||||
**-s**, **--signal**=*"KILL"*
|
||||
Signal to send to the container
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,36 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-load - Load an image from a tar archive on STDIN
|
||||
|
||||
# SYNOPSIS
|
||||
**docker load** **--input**=""
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Loads a tarred repository from a file or the standard input stream.
|
||||
Restores both images and tags.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-i**, **--input**=""
|
||||
Read from a tar archive file, instead of STDIN
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
$ sudo docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
||||
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
||||
$ sudo docker load --input fedora.tar
|
||||
$ sudo docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
||||
busybox latest 769b9341d937 7 weeks ago 2.489 MB
|
||||
fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
|
||||
fedora 20 58394af37342 7 weeks ago 385.5 MB
|
||||
fedora heisenbug 58394af37342 7 weeks ago 385.5 MB
|
||||
fedora latest 58394af37342 7 weeks ago 385.5 MB
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,35 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-login - Register or Login to a docker registry server.
|
||||
|
||||
# SYNOPSIS
|
||||
**docker login** [**-e**|**-email**=""] [**-p**|**--password**=""]
|
||||
[**-u**|**--username**=""] [SERVER]
|
||||
|
||||
# DESCRIPTION
|
||||
Register or Login to a docker registry server, if no server is
|
||||
specified "https://index.docker.io/v1/" is the default. If you want to
|
||||
login to a private registry you can specify this by adding the server name.
|
||||
|
||||
# OPTIONS
|
||||
**-e**, **--email**=""
|
||||
Email address
|
||||
|
||||
**-p**, **--password**=""
|
||||
Password
|
||||
|
||||
**-u**, **--username**=""
|
||||
Username
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
## Login to a local registry
|
||||
|
||||
# docker login localhost:8080
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-logs - Fetch the logs of a container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker logs** **--follow**[=*false*] CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
The **docker logs** command batch-retrieves whatever logs are present for
|
||||
a container at the time of execution. This does not guarantee execution
|
||||
order when combined with a docker run (i.e. your run may not have generated
|
||||
any logs at the time you execute docker logs).
|
||||
|
||||
The **docker logs --follow** command combines commands **docker logs** and
|
||||
**docker attach**. It will first return all logs from the beginning and
|
||||
then continue streaming new output from the container’s stdout and stderr.
|
||||
|
||||
# OPTIONS
|
||||
**-f, --follow**=*true*|*false*
|
||||
When *true*, follow log output. The default is false.
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,15 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-port - Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
|
||||
|
||||
# SYNOPSIS
|
||||
**docker port** CONTAINER PRIVATE_PORT
|
||||
|
||||
# DESCRIPTION
|
||||
Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,68 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-ps - List containers
|
||||
|
||||
# SYNOPSIS
|
||||
**docker ps** [**-a**|**--all**=*false*] [**--before**=""]
|
||||
[**-l**|**--latest**=*false*] [**-n**=*-1*] [**--no-trunc**=*false*]
|
||||
[**-q**|**--quiet**=*false*] [**-s**|**--size**=*false*]
|
||||
[**--since**=""]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
List the containers in the local repository. By default this show only
|
||||
the running containers.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-a**, **--all**=*true*|*false*
|
||||
When true show all containers. Only running containers are shown by
|
||||
default. Default is false.
|
||||
|
||||
**--before**=""
|
||||
Show only container created before Id or Name, include non-running
|
||||
ones.
|
||||
|
||||
**-l**, **--latest**=*true*|*false*
|
||||
When true show only the latest created container, include non-running
|
||||
ones. The default is false.
|
||||
|
||||
**-n**=NUM
|
||||
Show NUM (integer) last created containers, include non-running ones.
|
||||
The default is -1 (none)
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
When true truncate output. Default is false.
|
||||
|
||||
**-q**, **--quiet**=*true*|*false*
|
||||
When false only display numeric IDs. Default is false.
|
||||
|
||||
**-s**, **--size**=*true*|*false*
|
||||
When true display container sizes. Default is false.
|
||||
|
||||
**--since**=""
|
||||
Show only containers created since Id or Name, include non-running ones.
|
||||
|
||||
# EXAMPLE
|
||||
# Display all containers, including non-running
|
||||
|
||||
# docker ps -a
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain
|
||||
01946d9d34d8 vpavlin/rhel7:latest /bin/sh -c #(nop) MA 33 minutes ago Exit 0 thirsty_bell
|
||||
c1d3b0166030 acffc0358b9e /bin/sh -c yum -y up 2 weeks ago Exit 1 determined_torvalds
|
||||
41d50ecd2f57 fedora:20 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike
|
||||
|
||||
# Display only IDs of all containers, including non-running
|
||||
|
||||
# docker ps -a -q
|
||||
a87ecb4f327c
|
||||
01946d9d34d8
|
||||
c1d3b0166030
|
||||
41d50ecd2f57
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,37 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-pull - Pull an image or a repository from the registry
|
||||
|
||||
# SYNOPSIS
|
||||
**docker pull** NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This command pulls down an image or a repository from the registry. If
|
||||
there is more than one image for a repository (e.g. fedora) then all
|
||||
images for that repository name are pulled down including any tags.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
# Pull a reposiotry with multiple images
|
||||
|
||||
$ sudo docker pull fedora
|
||||
Pulling repository fedora
|
||||
ad57ef8d78d7: Download complete
|
||||
105182bb5e8b: Download complete
|
||||
511136ea3c5a: Download complete
|
||||
73bd853d2ea5: Download complete
|
||||
|
||||
$ sudo docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
||||
fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
|
||||
fedora 20 105182bb5e8b 5 days ago 372.7 MB
|
||||
fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
|
||||
fedora latest 105182bb5e8b 5 days ago 372.7 MB
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-push - Push an image or a repository to the registry
|
||||
|
||||
# SYNOPSIS
|
||||
**docker push** NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
Push an image or a repository to a registry. The default registry is the Docker
|
||||
Index located at [index.docker.io](https://index.docker.io/v1/). However the
|
||||
image can be pushed to another, perhaps private, registry as demonstrated in
|
||||
the example below.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
# Pushing a new image to a registry
|
||||
|
||||
First save the new image by finding the container ID (using **docker ps**)
|
||||
and then committing it to a new image name:
|
||||
|
||||
# docker commit c16378f943fe rhel-httpd
|
||||
|
||||
Now push the image to the registry using the image ID. In this example
|
||||
the registry is on host named registry-host and listening on port 5000.
|
||||
Default Docker commands will push to the default `index.docker.io`
|
||||
registry. Instead, push to the local registry, which is on a host called
|
||||
registry-host*. To do this, tag the image with the host name or IP
|
||||
address, and the port of the registry:
|
||||
|
||||
# docker tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
|
||||
# docker push registry-host:5000/myadmin/rhel-httpd
|
||||
|
||||
Check that this worked by running:
|
||||
|
||||
# docker images
|
||||
|
||||
You should see both `rhel-httpd` and `registry-host:5000/myadmin/rhel-httpd`
|
||||
listed.
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,21 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-restart - Restart a running container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker restart** [**-t**|**--time**[=*10*]] CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
Restart each container listed.
|
||||
|
||||
# OPTIONS
|
||||
**-t**, **--time**=NUM
|
||||
Number of seconds to try to stop for before killing the container. Once
|
||||
killed it will then be restarted. Default=10
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
|
||||
# NAME
|
||||
|
||||
docker-rm - Remove one or more containers.
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
**docker rm** [**-f**|**--force**[=*false*] [**-l**|**--link**[=*false*] [**-v**|
|
||||
**--volumes**[=*false*]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
**docker rm** will remove one or more containers from the host node. The
|
||||
container name or ID can be used. This does not remove images. You cannot
|
||||
remove a running container unless you use the \fB-f\fR option. To see all
|
||||
containers on a host use the **docker ps -a** command.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-f**, **--force**=*true*|*false*
|
||||
When set to true, force the removal of the container. The default is
|
||||
*false*.
|
||||
|
||||
**-l**, **--link**=*true*|*false*
|
||||
When set to true, remove the specified link and not the underlying
|
||||
container. The default is *false*.
|
||||
|
||||
**-v**, **--volumes**=*true*|*false*
|
||||
When set to true, remove the volumes associated to the container. The
|
||||
default is *false*.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
##Removing a container using its ID##
|
||||
|
||||
To remove a container using its ID, find either from a **docker ps -a**
|
||||
command, or use the ID returned from the **docker run** command, or retrieve
|
||||
it from a file used to store it using the **docker run --cidfile**:
|
||||
|
||||
docker rm abebf7571666
|
||||
|
||||
##Removing a container using the container name##
|
||||
|
||||
The name of the container can be found using the **docker ps -a**
|
||||
command. The use that name as follows:
|
||||
|
||||
docker rm hopeful_morse
|
||||
|
||||
# HISTORY
|
||||
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,35 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-rmi \- Remove one or more images.
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
**docker rmi** [**-f**|**--force**[=*false*] IMAGE [IMAGE...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This will remove one or more images from the host node. This does not
|
||||
remove images from a registry. You cannot remove an image of a running
|
||||
container unless you use the **-f** option. To see all images on a host
|
||||
use the **docker images** command.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-f**, **--force**=*true*|*false*
|
||||
When set to true, force the removal of the image. The default is
|
||||
*false*.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Removing an image
|
||||
|
||||
Here is an example of removing and image:
|
||||
|
||||
docker rmi fedora/httpd
|
||||
|
||||
# HISTORY
|
||||
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,343 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-run - Run a process in an isolated container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker run**
|
||||
[**-a**|**--attach**[=]] [**-c**|**--cpu-shares**[=0]
|
||||
[**-m**|**--memory**=*memory-limit*]
|
||||
[**--cidfile**=*file*] [**-d**|**--detach**[=*false*]] [**--dns**=*IP-address*]
|
||||
[**--name**=*name*] [**-u**|**--user**=*username*|*uid*]
|
||||
[**--link**=*name*:*alias*]
|
||||
[**-e**|**--env**=*environment*] [**--entrypoint**=*command*]
|
||||
[**--expose**=*port*] [**-P**|**--publish-all**[=*false*]]
|
||||
[**-p**|**--publish**=*port-mappping*] [**-h**|**--hostname**=*hostname*]
|
||||
[**--rm**[=*false*]] [**--priviledged**[=*false*]
|
||||
[**-i**|**--interactive**[=*false*]
|
||||
[**-t**|**--tty**[=*false*]] [**--lxc-conf**=*options*]
|
||||
[**-n**|**--networking**[=*true*]]
|
||||
[**-v**|**--volume**=*volume*] [**--volumes-from**=*container-id*]
|
||||
[**-w**|**--workdir**=*directory*] [**--sig-proxy**[=*true*]]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Run a process in a new container. **docker run** starts a process with its own
|
||||
file system, its own networking, and its own isolated process tree. The IMAGE
|
||||
which starts the process may define defaults related to the process that will be
|
||||
run in the container, the networking to expose, and more, but **docker run**
|
||||
gives final control to the operator or administrator who starts the container
|
||||
from the image. For that reason **docker run** has more options than any other
|
||||
Docker command.
|
||||
|
||||
If the IMAGE is not already loaded then **docker run** will pull the IMAGE, and
|
||||
all image dependencies, from the repository in the same way running **docker
|
||||
pull** IMAGE, before it starts the container from that image.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
**-a**, **--attach**=*stdin*|*stdout*|*stderr*
|
||||
Attach to stdin, stdout or stderr. In foreground mode (the default when
|
||||
**-d** is not specified), **docker run** can start the process in the container
|
||||
and attach the console to the process’s standard input, output, and standard
|
||||
error. It can even pretend to be a TTY (this is what most commandline
|
||||
executables expect) and pass along signals. The **-a** option can be set for
|
||||
each of stdin, stdout, and stderr.
|
||||
|
||||
**-c**, **--cpu-shares**=0
|
||||
CPU shares in relative weight. You can increase the priority of a container
|
||||
with the -c option. By default, all containers run at the same priority and get
|
||||
the same proportion of CPU cycles, but you can tell the kernel to give more
|
||||
shares of CPU time to one or more containers when you start them via **docker
|
||||
run**.
|
||||
|
||||
**--cidfile**=*file*
|
||||
Write the container ID to the file specified.
|
||||
|
||||
|
||||
**-d**, **-detach**=*true*|*false*
|
||||
Detached mode. This runs the container in the background. It outputs the new
|
||||
container's ID and any error messages. At any time you can run **docker ps** in
|
||||
the other shell to view a list of the running containers. You can reattach to a
|
||||
detached container with **docker attach**. If you choose to run a container in
|
||||
the detached mode, then you cannot use the **-rm** option.
|
||||
|
||||
|
||||
**--dns**=*IP-address*
|
||||
Set custom DNS servers. This option can be used to override the DNS
|
||||
configuration passed to the container. Typically this is necessary when the
|
||||
host DNS configuration is invalid for the container (eg. 127.0.0.1). When this
|
||||
is the case the **-dns** flags is necessary for every run.
|
||||
|
||||
|
||||
**-e**, **-env**=*environment*
|
||||
Set environment variables. This option allows you to specify arbitrary
|
||||
environment variables that are available for the process that will be launched
|
||||
inside of the container.
|
||||
|
||||
|
||||
**--entrypoint**=*command*
|
||||
This option allows you to overwrite the default entrypoint of the image that
|
||||
is set in the Dockerfile. The ENTRYPOINT of an image is similar to a COMMAND
|
||||
because it specifies what executable to run when the container starts, but it is
|
||||
(purposely) more difficult to override. The ENTRYPOINT gives a container its
|
||||
default nature or behavior, so that when you set an ENTRYPOINT you can run the
|
||||
container as if it were that binary, complete with default options, and you can
|
||||
pass in more options via the COMMAND. But, sometimes an operator may want to run
|
||||
something else inside the container, so you can override the default ENTRYPOINT
|
||||
at runtime by using a **--entrypoint** and a string to specify the new
|
||||
ENTRYPOINT.
|
||||
|
||||
**--expose**=*port*
|
||||
Expose a port from the container without publishing it to your host. A
|
||||
containers port can be exposed to other containers in three ways: 1) The
|
||||
developer can expose the port using the EXPOSE parameter of the Dockerfile, 2)
|
||||
the operator can use the **--expose** option with **docker run**, or 3) the
|
||||
container can be started with the **--link**.
|
||||
|
||||
**-m**, **-memory**=*memory-limit*
|
||||
Allows you to constrain the memory available to a container. If the host
|
||||
supports swap memory, then the -m memory setting can be larger than physical
|
||||
RAM. The memory limit format: <number><optional unit>, where unit = b, k, m or
|
||||
g.
|
||||
|
||||
**-P**, **-publish-all**=*true*|*false*
|
||||
When set to true publish all exposed ports to the host interfaces. The
|
||||
default is false. If the operator uses -P (or -p) then Docker will make the
|
||||
exposed port accessible on the host and the ports will be available to any
|
||||
client that can reach the host. To find the map between the host ports and the
|
||||
exposed ports, use **docker port**.
|
||||
|
||||
|
||||
**-p**, **-publish**=[]
|
||||
Publish a container's port to the host (format: ip:hostPort:containerPort |
|
||||
ip::containerPort | hostPort:containerPort) (use **docker port** to see the
|
||||
actual mapping)
|
||||
|
||||
|
||||
**-h**, **-hostname**=*hostname*
|
||||
Sets the container host name that is available inside the container.
|
||||
|
||||
|
||||
**-i**, **-interactive**=*true*|*false*
|
||||
When set to true, keep stdin open even if not attached. The default is false.
|
||||
|
||||
|
||||
**--link**=*name*:*alias*
|
||||
Add link to another container. The format is name:alias. If the operator
|
||||
uses **--link** when starting the new client container, then the client
|
||||
container can access the exposed port via a private networking interface. Docker
|
||||
will set some environment variables in the client container to help indicate
|
||||
which interface and port to use.
|
||||
|
||||
|
||||
**-n**, **-networking**=*true*|*false*
|
||||
By default, all containers have networking enabled (true) and can make
|
||||
outgoing connections. The operator can disable networking with **--networking**
|
||||
to false. This disables all incoming and outgoing networking. In cases like this
|
||||
, I/O can only be performed through files or by using STDIN/STDOUT.
|
||||
|
||||
Also by default, the container will use the same DNS servers as the host. The
|
||||
operator may override this with **-dns**.
|
||||
|
||||
|
||||
**--name**=*name*
|
||||
Assign a name to the container. The operator can identify a container in
|
||||
three ways:
|
||||
|
||||
UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
|
||||
UUID short identifier (“f78375b1c487”)
|
||||
Name (“jonah”)
|
||||
|
||||
The UUID identifiers come from the Docker daemon, and if a name is not assigned
|
||||
to the container with **--name** then the daemon will also generate a random
|
||||
string name. The name is useful when defining links (see **--link**) (or any
|
||||
other place you need to identify a container). This works for both background
|
||||
and foreground Docker containers.
|
||||
|
||||
|
||||
**--privileged**=*true*|*false*
|
||||
Give extended privileges to this container. By default, Docker containers are
|
||||
“unprivileged” (=false) and cannot, for example, run a Docker daemon inside the
|
||||
Docker container. This is because by default a container is not allowed to
|
||||
access any devices. A “privileged” container is given access to all devices.
|
||||
|
||||
When the operator executes **docker run -privileged**, Docker will enable access
|
||||
to all devices on the host as well as set some configuration in AppArmor to
|
||||
allow the container nearly all the same access to the host as processes running
|
||||
outside of a container on the host.
|
||||
|
||||
|
||||
**--rm**=*true*|*false*
|
||||
If set to *true* the container is automatically removed when it exits. The
|
||||
default is *false*. This option is incompatible with **-d**.
|
||||
|
||||
|
||||
**--sig-proxy**=*true*|*false*
|
||||
When set to true, proxify all received signals to the process (even in
|
||||
non-tty mode). The default is true.
|
||||
|
||||
|
||||
**-t**, **-tty**=*true*|*false*
|
||||
When set to true Docker can allocate a pseudo-tty and attach to the standard
|
||||
input of any container. This can be used, for example, to run a throwaway
|
||||
interactive shell. The default is value is false.
|
||||
|
||||
|
||||
**-u**, **-user**=*username*,*uid*
|
||||
Set a username or UID for the container.
|
||||
|
||||
|
||||
**-v**, **-volume**=*volume*
|
||||
Bind mount a volume to the container. The **-v** option can be used one or
|
||||
more times to add one or more mounts to a container. These mounts can then be
|
||||
used in other containers using the **--volumes-from** option. See examples.
|
||||
|
||||
|
||||
**--volumes-from**=*container-id*
|
||||
Will mount volumes from the specified container identified by container-id.
|
||||
Once a volume is mounted in a one container it can be shared with other
|
||||
containers using the **--volumes-from** option when running those other
|
||||
containers. The volumes can be shared even if the original container with the
|
||||
mount is not running.
|
||||
|
||||
|
||||
**-w**, **-workdir**=*directory*
|
||||
Working directory inside the container. The default working directory for
|
||||
running binaries within a container is the root directory (/). The developer can
|
||||
set a different default with the Dockerfile WORKDIR instruction. The operator
|
||||
can override the working directory by using the **-w** option.
|
||||
|
||||
|
||||
**IMAGE**
|
||||
The image name or ID.
|
||||
|
||||
|
||||
**COMMAND**
|
||||
The command or program to run inside the image.
|
||||
|
||||
|
||||
**ARG**
|
||||
The arguments for the command to be run in the container.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Exposing log messages from the container to the host's log
|
||||
|
||||
If you want messages that are logged in your container to show up in the host's
|
||||
syslog/journal then you should bind mount the /var/log directory as follows.
|
||||
|
||||
# docker run -v /dev/log:/dev/log -i -t fedora /bin/bash
|
||||
|
||||
From inside the container you can test this by sending a message to the log.
|
||||
|
||||
(bash)# logger "Hello from my container"
|
||||
|
||||
Then exit and check the journal.
|
||||
|
||||
# exit
|
||||
|
||||
# journalctl -b | grep Hello
|
||||
|
||||
This should list the message sent to logger.
|
||||
|
||||
## Attaching to one or more from STDIN, STDOUT, STDERR
|
||||
|
||||
If you do not specify -a then Docker will attach everything (stdin,stdout,stderr)
|
||||
. You can specify to which of the three standard streams (stdin, stdout, stderr)
|
||||
you’d like to connect instead, as in:
|
||||
|
||||
# docker run -a stdin -a stdout -i -t fedora /bin/bash
|
||||
|
||||
## Linking Containers
|
||||
|
||||
The link feature allows multiple containers to communicate with each other. For
|
||||
example, a container whose Dockerfile has exposed port 80 can be run and named
|
||||
as follows:
|
||||
|
||||
# docker run --name=link-test -d -i -t fedora/httpd
|
||||
|
||||
A second container, in this case called linker, can communicate with the httpd
|
||||
container, named link-test, by running with the **--link=<name>:<alias>**
|
||||
|
||||
# docker run -t -i --link=link-test:lt --name=linker fedora /bin/bash
|
||||
|
||||
Now the container linker is linked to container link-test with the alias lt.
|
||||
Running the **env** command in the linker container shows environment variables
|
||||
with the LT (alias) context (**LT_**)
|
||||
|
||||
# env
|
||||
HOSTNAME=668231cb0978
|
||||
TERM=xterm
|
||||
LT_PORT_80_TCP=tcp://172.17.0.3:80
|
||||
LT_PORT_80_TCP_PORT=80
|
||||
LT_PORT_80_TCP_PROTO=tcp
|
||||
LT_PORT=tcp://172.17.0.3:80
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
PWD=/
|
||||
LT_NAME=/linker/lt
|
||||
SHLVL=1
|
||||
HOME=/
|
||||
LT_PORT_80_TCP_ADDR=172.17.0.3
|
||||
_=/usr/bin/env
|
||||
|
||||
When linking two containers Docker will use the exposed ports of the container
|
||||
to create a secure tunnel for the parent to access.
|
||||
|
||||
|
||||
## Mapping Ports for External Usage
|
||||
|
||||
The exposed port of an application can be mapped to a host port using the **-p**
|
||||
flag. For example a httpd port 80 can be mapped to the host port 8080 using the
|
||||
following:
|
||||
|
||||
# docker run -p 8080:80 -d -i -t fedora/httpd
|
||||
|
||||
## Creating and Mounting a Data Volume Container
|
||||
|
||||
Many applications require the sharing of persistent data across several
|
||||
containers. Docker allows you to create a Data Volume Container that other
|
||||
containers can mount from. For example, create a named container that contains
|
||||
directories /var/volume1 and /tmp/volume2. The image will need to contain these
|
||||
directories so a couple of RUN mkdir instructions might be required for you
|
||||
fedora-data image:
|
||||
|
||||
# docker run --name=data -v /var/volume1 -v /tmp/volume2 -i -t fedora-data true
|
||||
# docker run --volumes-from=data --name=fedora-container1 -i -t fedora bash
|
||||
|
||||
Multiple -volumes-from parameters will bring together multiple data volumes from
|
||||
multiple containers. And it's possible to mount the volumes that came from the
|
||||
DATA container in yet another container via the fedora-container1 intermidiery
|
||||
container, allowing to abstract the actual data source from users of that data:
|
||||
|
||||
# docker run --volumes-from=fedora-container1 --name=fedora-container2 -i -t fedora bash
|
||||
|
||||
## Mounting External Volumes
|
||||
|
||||
To mount a host directory as a container volume, specify the absolute path to
|
||||
the directory and the absolute path for the container directory separated by a
|
||||
colon:
|
||||
|
||||
# docker run -v /var/db:/data1 -i -t fedora bash
|
||||
|
||||
When using SELinux, be aware that the host has no knowledge of container SELinux
|
||||
policy. Therefore, in the above example, if SELinux policy is enforced, the
|
||||
`/var/db` directory is not writable to the container. A "Permission Denied"
|
||||
message will occur and an avc: message in the host's syslog.
|
||||
|
||||
|
||||
To work around this, at time of writing this man page, the following command
|
||||
needs to be run in order for the proper SELinux policy type label to be attached
|
||||
to the host directory:
|
||||
|
||||
# chcon -Rt svirt_sandbox_file_t /var/db
|
||||
|
||||
|
||||
Now, writing to the /data1 volume in the container will be allowed and the
|
||||
changes will also be reflected on the host in /var/db.
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,35 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-save - Save an image to a tar archive (streamed to STDOUT by default)
|
||||
|
||||
# SYNOPSIS
|
||||
**docker save** [**-o**|**--output**=""] IMAGE
|
||||
|
||||
# DESCRIPTION
|
||||
Produces a tarred repository to the standard output stream. Contains all
|
||||
parent layers, and all tags + versions, or specified repo:tag.
|
||||
|
||||
Stream to a file instead of STDOUT by using **-o**.
|
||||
|
||||
# OPTIONS
|
||||
**-o**, **--output**=""
|
||||
Write to an file, instead of STDOUT
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
Save all fedora repository images to a fedora-all.tar and save the latest
|
||||
fedora image to a fedora-latest.tar:
|
||||
|
||||
$ sudo docker save fedora > fedora-all.tar
|
||||
$ sudo docker save --output=fedora-latest.tar fedora:latest
|
||||
$ ls -sh fedora-all.tar
|
||||
721M fedora-all.tar
|
||||
$ ls -sh fedora-latest.tar
|
||||
367M fedora-latest.tar
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-search - Search the docker index for images
|
||||
|
||||
# SYNOPSIS
|
||||
**docker search** **--no-trunc**[=*false*] **-t**|**--trusted**[=*false*]
|
||||
**-s**|**--stars**[=*0*] TERM
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Search an index for an image with that matches the term TERM. The table
|
||||
of images returned displays the name, description (truncated by default),
|
||||
number of stars awarded, whether the image is official, and whether it
|
||||
is trusted.
|
||||
|
||||
# OPTIONS
|
||||
**--no-trunc**=*true*|*false*
|
||||
When true display the complete description. The default is false.
|
||||
|
||||
**-s**, **--stars**=NUM
|
||||
Only displays with at least NUM (integer) stars. I.e. only those images
|
||||
ranked >=NUM.
|
||||
|
||||
**-t**, **--trusted**=*true*|*false*
|
||||
When true only show trusted builds. The default is false.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
## Search the registry for ranked images
|
||||
|
||||
Search the registry for the term 'fedora' and only display those images
|
||||
ranked 3 or higher:
|
||||
|
||||
$ sudo docker search -s 3 fedora
|
||||
NAME DESCRIPTION STARS OFFICIAL TRUSTED
|
||||
mattdm/fedora A basic Fedora image corresponding roughly... 50
|
||||
fedora (Semi) Official Fedora base image. 38
|
||||
mattdm/fedora-small A small Fedora image on which to build. Co... 8
|
||||
goldmann/wildfly A WildFly application server running on a ... 3 [OK]
|
||||
|
||||
## Search the registry for trusted images
|
||||
|
||||
Search the registry for the term 'fedora' and only display trusted images
|
||||
ranked 1 or higher:
|
||||
|
||||
$ sudo docker search -s 1 -t fedora
|
||||
NAME DESCRIPTION STARS OFFICIAL TRUSTED
|
||||
goldmann/wildfly A WildFly application server running on a ... 3 [OK]
|
||||
tutum/fedora-20 Fedora 20 image with SSH access. For the r... 1 [OK]
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,25 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-start - Restart a stopped container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker start** [**a**|**--attach**[=*false*]] [**-i**|**--interactive**
|
||||
[=*true*] CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Start a stopped container.
|
||||
|
||||
# OPTION
|
||||
**-a**, **--attach**=*true*|*false*
|
||||
When true attach to container's stdout/stderr and forward all signals to
|
||||
the process
|
||||
|
||||
**-i**, **--interactive**=*true*|*false*
|
||||
When true attach to container's stdin
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,22 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-stop - Stop a running container
|
||||
grace period)
|
||||
|
||||
# SYNOPSIS
|
||||
**docker stop** [**-t**|**--time**[=*10*]] CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
Stop a running container (Send SIGTERM, and then SIGKILL after
|
||||
grace period)
|
||||
|
||||
# OPTIONS
|
||||
**-t**, **--time**=NUM
|
||||
Wait NUM number of seconds for the container to stop before killing it.
|
||||
The default is 10 seconds.
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,48 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-tag - Tag an image in the repository
|
||||
|
||||
# SYNOPSIS
|
||||
**docker tag** [**-f**|**--force**[=*false*]
|
||||
IMAGE [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
This will tag an image in the repository.
|
||||
|
||||
# "OPTIONS"
|
||||
**-f**, **--force**=*true*|*false*
|
||||
When set to true, force the tag name. The default is *false*.
|
||||
|
||||
**REGISTRYHOST**
|
||||
The hostname of the registry if required. This may also include the port
|
||||
separated by a ':'
|
||||
|
||||
**USERNAME**
|
||||
The username or other qualifying identifier for the image.
|
||||
|
||||
**NAME**
|
||||
The image name.
|
||||
|
||||
**TAG**
|
||||
The tag you are assigning to the image.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Tagging an image
|
||||
|
||||
Here is an example of tagging an image with the tag version1.0 :
|
||||
|
||||
docker tag 0e5574283393 fedora/httpd:version1.0
|
||||
|
||||
## Tagging an image for a private repository
|
||||
|
||||
To push an image to an private registry and not the central Docker
|
||||
registry you must tag it with the registry hostname and port (if needed).
|
||||
|
||||
docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
@@ -1,27 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-top - Lookup the running processes of a container
|
||||
|
||||
# SYNOPSIS
|
||||
**docker top** CONTAINER [ps-OPTION]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Look up the running process of the container. ps-OPTION can be any of the
|
||||
options you would pass to a Linux ps command.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
Run **docker top** with the ps option of -x:
|
||||
|
||||
$ sudo docker top 8601afda2b -x
|
||||
PID TTY STAT TIME COMMAND
|
||||
16623 ? Ss 0:00 sleep 99999
|
||||
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker-wait - Block until a container stops, then print its exit code.
|
||||
|
||||
# SYNOPSIS
|
||||
**docker wait** CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
Block until a container stops, then print its exit code.
|
||||
|
||||
#EXAMPLE
|
||||
|
||||
$ sudo docker run -d fedora sleep 99
|
||||
079b83f558a2bc52ecad6b2a5de13622d584e6bb1aea058c11b36511e85e7622
|
||||
$ sudo docker wait 079b83f558a2bc
|
||||
0
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.io source material and internal work.
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
% DOCKER(1) Docker User Manuals
|
||||
% William Henry
|
||||
% APRIL 2014
|
||||
# NAME
|
||||
docker \- Docker image and container command line interface
|
||||
|
||||
# SYNOPSIS
|
||||
**docker** [OPTIONS] COMMAND [arg...]
|
||||
|
||||
# DESCRIPTION
|
||||
**docker** has two distinct functions. It is used for starting the Docker
|
||||
daemon and to run the CLI (i.e., to command the daemon to manage images,
|
||||
containers etc.) So **docker** is both a server, as a deamon, and a client
|
||||
to the daemon, through the CLI.
|
||||
|
||||
To run the Docker deamon you do not specify any of the commands listed below but
|
||||
must specify the **-d** option. The other options listed below are for the
|
||||
daemon only.
|
||||
|
||||
The Docker CLI has over 30 commands. The commands are listed below and each has
|
||||
its own man page which explain usage and arguements.
|
||||
|
||||
To see the man page for a command run **man docker <command>**.
|
||||
|
||||
# OPTIONS
|
||||
**-D**=*true*|*false*
|
||||
Enable debug mode. Default is false.
|
||||
|
||||
**-H**, **--host**=[unix:///var/run/docker.sock]: tcp://[host[:port]] to bind or
|
||||
unix://[/path/to/socket] to use.
|
||||
Enable both the socket support and TCP on localhost. When host=[0.0.0.0],
|
||||
port=[4243] or path =[/var/run/docker.sock] is omitted, default values are used.
|
||||
|
||||
**--api-enable-cors**=*true*|*false*
|
||||
Enable CORS headers in the remote API. Default is false.
|
||||
|
||||
**-b**=""
|
||||
Attach containers to a pre\-existing network bridge; use 'none' to disable container networking
|
||||
|
||||
**--bip**=""
|
||||
Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b
|
||||
|
||||
**-d**=*true*|*false*
|
||||
Enable daemon mode. Default is false.
|
||||
|
||||
**--dns**=""
|
||||
Force Docker to use specific DNS servers
|
||||
|
||||
**-g**=""
|
||||
Path to use as the root of the Docker runtime. Default is `/var/lib/docker`.
|
||||
|
||||
**--icc**=*true*|*false*
|
||||
Enable inter\-container communication. Default is true.
|
||||
|
||||
**--ip**=""
|
||||
Default IP address to use when binding container ports. Default is `0.0.0.0`.
|
||||
|
||||
**--iptables**=*true*|*false*
|
||||
Disable Docker's addition of iptables rules. Default is true.
|
||||
|
||||
**--mtu**=VALUE
|
||||
Set the containers network mtu. Default is `1500`.
|
||||
|
||||
**-p**=""
|
||||
Path to use for daemon PID file. Default is `/var/run/docker.pid`
|
||||
|
||||
**-r**=*true*|*false*
|
||||
Restart previously running containers. Default is true.
|
||||
|
||||
**-s**=""
|
||||
Force the Docker runtime to use a specific storage driver.
|
||||
|
||||
**-v**=*true*|*false*
|
||||
Print version information and quit. Default is false.
|
||||
|
||||
**--selinux-enabled=*true*|*false*
|
||||
Enable selinux support. Default is false.
|
||||
|
||||
# COMMANDS
|
||||
**docker-attach(1)**
|
||||
Attach to a running container
|
||||
|
||||
**docker-build(1)**
|
||||
Build a container from a Dockerfile
|
||||
|
||||
**docker-commit(1)**
|
||||
Create a new image from a container's changes
|
||||
|
||||
**docker-cp(1)**
|
||||
Copy files/folders from the containers filesystem to the host at path
|
||||
|
||||
**docker-diff(1)**
|
||||
Inspect changes on a container's filesystem
|
||||
|
||||
|
||||
**docker-events(1)**
|
||||
Get real time events from the server
|
||||
|
||||
**docker-export(1)**
|
||||
Stream the contents of a container as a tar archive
|
||||
|
||||
**docker-history(1)**
|
||||
Show the history of an image
|
||||
|
||||
**docker-images(1)**
|
||||
List images
|
||||
|
||||
**docker-import(1)**
|
||||
Create a new filesystem image from the contents of a tarball
|
||||
|
||||
**docker-info(1)**
|
||||
Display system-wide information
|
||||
|
||||
**docker-inspect(1)**
|
||||
Return low-level information on a container
|
||||
|
||||
**docker-kill(1)**
|
||||
Kill a running container (which includes the wrapper process and everything
|
||||
inside it)
|
||||
|
||||
**docker-load(1)**
|
||||
Load an image from a tar archive
|
||||
|
||||
**docker-login(1)**
|
||||
Register or Login to a Docker registry server
|
||||
|
||||
**docker-logs(1)**
|
||||
Fetch the logs of a container
|
||||
|
||||
**docker-port(1)**
|
||||
Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
|
||||
|
||||
**docker-ps(1)**
|
||||
List containers
|
||||
|
||||
**docker-pull(1)**
|
||||
Pull an image or a repository from a Docker registry server
|
||||
|
||||
**docker-push(1)**
|
||||
Push an image or a repository to a Docker registry server
|
||||
|
||||
**docker-restart(1)**
|
||||
Restart a running container
|
||||
|
||||
**docker-rm(1)**
|
||||
Remove one or more containers
|
||||
|
||||
**docker-rmi(1)**
|
||||
Remove one or more images
|
||||
|
||||
**docker-run(1)**
|
||||
Run a command in a new container
|
||||
|
||||
**docker-save(1)**
|
||||
Save an image to a tar archive
|
||||
|
||||
**docker-search(1)**
|
||||
Search for an image in the Docker index
|
||||
|
||||
**docker-start(1)**
|
||||
Start a stopped container
|
||||
|
||||
**docker-stop(1)**
|
||||
Stop a running container
|
||||
|
||||
**docker-tag(1)**
|
||||
Tag an image into a repository
|
||||
|
||||
**docker-top(1)**
|
||||
Lookup the running processes of a container
|
||||
|
||||
**version**
|
||||
Show the Docker version information
|
||||
|
||||
**docker-wait(1)**
|
||||
Block until a container stops, then print its exit code
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
For specific examples please see the man page for the specific Docker command.
|
||||
For example:
|
||||
|
||||
man docker run
|
||||
|
||||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based
|
||||
on docker.io source material and internal work.
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# get into this script's directory
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
|
||||
[ "$1" = '-q' ] || {
|
||||
set -x
|
||||
pwd
|
||||
}
|
||||
|
||||
for FILE in *.md; do
|
||||
base="$(basename "$FILE")"
|
||||
name="${base%.md}"
|
||||
num="${name##*.}"
|
||||
if [ -z "$num" -o "$base" = "$num" ]; then
|
||||
# skip files that aren't of the format xxxx.N.md (like README.md)
|
||||
continue
|
||||
fi
|
||||
mkdir -p "../man${num}"
|
||||
pandoc -s -t man "$FILE" -o "../man${num}/${name}"
|
||||
done
|
||||
@@ -1,56 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-attach.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "APRIL 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-attach \- Attach to a running container
|
||||
.SH SYNOPSIS
|
||||
.B docker attach
|
||||
\fB--no-stdin\fR[=\fIfalse\fR]
|
||||
\fB--sig-proxy\fR[=\fItrue\fR]
|
||||
container
|
||||
.SH DESCRIPTION
|
||||
If you \fBdocker run\fR a container in detached mode (\fB-d\fR), you can reattach to the detached container with \fBdocker attach\fR using the container's ID or name.
|
||||
.sp
|
||||
You can detach from the container again (and leave it running) with CTRL-c (for a quiet exit) or CTRL-\ to get a stacktrace of the Docker client when it quits. When you detach from the container the exit code will be returned to the client.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B --no-stdin=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, do not attach to stdin. The default is \fIfalse\fR.
|
||||
.TP
|
||||
.B --sig-proxy=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, proxify all received signal to the process (even in non-tty mode). The default is \fItrue\fR.
|
||||
.sp
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.PP
|
||||
.B Attaching to a container
|
||||
.TP
|
||||
In this example the top command is run inside a container, from an image called fedora, in detached mode. The ID from the container is passed into the \fBdocker attach\fR command:
|
||||
.sp
|
||||
.nf
|
||||
.RS
|
||||
# ID=$(sudo docker run -d fedora /usr/bin/top -b)
|
||||
# sudo docker attach $ID
|
||||
top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||
Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
|
||||
Swap: 786428k total, 0k used, 786428k free, 221740k cached
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
|
||||
|
||||
top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
|
||||
Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
|
||||
Swap: 786428k total, 0k used, 786428k free, 221776k cached
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
|
||||
.RE
|
||||
.fi
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,65 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-build.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "MARCH 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-build \- Build a container image from a Dockerfile source at PATH
|
||||
.SH SYNOPSIS
|
||||
.B docker build
|
||||
[\fB--no-cache\fR[=\fIfalse\fR]
|
||||
[\fB-q\fR|\fB--quiet\fR[=\fIfalse\fR]
|
||||
[\fB--rm\fR[=\fitrue\fR]]
|
||||
[\fB-t\fR|\fB--tag\fR=\fItag\fR]
|
||||
PATH | URL | -
|
||||
.SH DESCRIPTION
|
||||
This will read the Dockerfile from the directory specified in \fBPATH\fR. It also sends any other files and directories found in the current directory to the Docker daemon. The contents of this directory would be used by ADD command found within the Dockerfile.
|
||||
Warning, this will send a lot of data to the Docker daemon if the current directory contains a lot of data.
|
||||
If the absolute path is provided instead of ‘.’, only the files and directories required by the ADD commands from the Dockerfile will be added to the context and transferred to the Docker daemon.
|
||||
.sp
|
||||
When a single Dockerfile is given as URL, then no context is set. When a Git repository is set as URL, the repository is used as context.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -q, --quiet=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, suppress verbose build output. Default is \fIfalse\fR.
|
||||
.TP
|
||||
.B --rm=\fItrue\fr|\fIfalse\fR:
|
||||
When true, remove intermediate containers that are created during the build process. The default is true.
|
||||
.TP
|
||||
.B -t, --tag=\fItag\fR:
|
||||
Tag to be applied to the resulting image on successful completion of the build.
|
||||
.TP
|
||||
.B --no-cache=\fItrue\fR|\fIfalse\fR
|
||||
When set to true, do not use a cache when building the image. The default is \fIfalse\fR.
|
||||
.sp
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.sp
|
||||
.B Building an image from current directory
|
||||
.TP
|
||||
USing a Dockerfile, Docker images are built using the build command:
|
||||
.sp
|
||||
.RS
|
||||
docker build .
|
||||
.RE
|
||||
.sp
|
||||
If, for some reasone, you do not what to remove the intermediate containers created during the build you must set--rm=false.
|
||||
.sp
|
||||
.RS
|
||||
docker build --rm=false .
|
||||
.sp
|
||||
.RE
|
||||
.sp
|
||||
A good practice is to make a subdirectory with a related name and create the Dockerfile in that directory. E.g. a directory called mongo may contain a Dockerfile for a MongoDB image, or a directory called httpd may contain an Dockerfile for an Apache web server.
|
||||
.sp
|
||||
It is also good practice to add the files required for the image to the subdirectory. These files will be then specified with the `ADD` instruction in the Dockerfile. Note: if you include a tar file, which is good practice, then Docker will automatically extract the contents of the tar file specified in the `ADD` instruction into the specified target.
|
||||
.sp
|
||||
.B Building an image container using a URL
|
||||
.TP
|
||||
This will clone the Github repository and use it as context. The Dockerfile at the root of the repository is used as Dockerfile. This only works if the Github repository is a dedicated repository. Note that you can specify an arbitrary Git repository by using the ‘git://’ schema.
|
||||
.sp
|
||||
.RS
|
||||
docker build github.com/scollier/Fedora-Dockerfiles/tree/master/apache
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
March 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,84 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-images.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "April 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-images \- List the images in the local repository
|
||||
.SH SYNOPSIS
|
||||
.B docker images
|
||||
[\fB-a\fR|\fB--all\fR=\fIfalse\fR]
|
||||
[\fB--no-trunc\fR[=\fIfalse\fR]
|
||||
[\fB-q\fR|\fB--quiet\fR[=\fIfalse\fR]
|
||||
[\fB-t\fR|\fB--tree\fR=\fIfalse\fR]
|
||||
[\fB-v\fR|\fB--viz\fR=\fIfalse\fR]
|
||||
[NAME]
|
||||
.SH DESCRIPTION
|
||||
This command lists the images stored in the local Docker repository.
|
||||
.sp
|
||||
By default, intermediate images, used during builds, are not listed. Some of the output, e.g. image ID, is truncated, for space reasons. However the truncated image ID, and often the first few characters, are enough to be used in other Docker commands that use the image ID. The output includes repository, tag, image ID, date created and the virtual size.
|
||||
.sp
|
||||
The title REPOSITORY for the first title may seem confusing. It is essentially the image name. However, because you can tag a specific image, and multiple tags (image instances) can be associated with a single name, the name is really a repository for all tagged images of the same name.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -a, --all=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, also include all intermediate images in the list. The default is false.
|
||||
.TP
|
||||
.B --no-trunc=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, list the full image ID and not the truncated ID. The default is false.
|
||||
.TP
|
||||
.B -q, --quiet=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, list the complete image ID as part of the output. The default is false.
|
||||
.TP
|
||||
.B -t, --tree=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, list the images in a tree dependency tree (hierarchy) format. The default is false.
|
||||
.TP
|
||||
.B -v, --viz=\fItrue\fR|\fIfalse\fR
|
||||
When set to true, list the graph in graphviz format. The default is \fIfalse\fR.
|
||||
.sp
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.B Listing the images
|
||||
.TP
|
||||
To list the images in a local repository (not the registry) run:
|
||||
.sp
|
||||
.RS
|
||||
docker images
|
||||
.RE
|
||||
.sp
|
||||
The list will contain the image repository name, a tag for the image, and an image ID, when it was created and its virtual size. Columns: REPOSITORY, TAG, IMAGE ID, CREATED, and VIRTUAL SIZE.
|
||||
.sp
|
||||
To get a verbose list of images which contains all the intermediate images used in builds use \fB-a\fR:
|
||||
.sp
|
||||
.RS
|
||||
docker images -a
|
||||
.RE
|
||||
.sp
|
||||
.B List images dependency tree hierarchy
|
||||
.TP
|
||||
To list the images in the local repository (not the registry) in a dependency tree format then use the \fB-t\fR|\fB--tree=true\fR option.
|
||||
.sp
|
||||
.RS
|
||||
docker images -t
|
||||
.RE
|
||||
.sp
|
||||
This displays a staggered hierarchy tree where the less indented image is the oldest with dependent image layers branching inward (to the right) on subsequent lines. The newest or top level image layer is listed last in any tree branch.
|
||||
.sp
|
||||
.B List images in GraphViz format
|
||||
.TP
|
||||
To display the list in a format consumable by a GraphViz tools run with \fB-v\fR|\fB--viz=true\fR. For example to produce a .png graph file of the hierarchy use:
|
||||
.sp
|
||||
.RS
|
||||
docker images --viz | dot -Tpng -o docker.png
|
||||
.sp
|
||||
.RE
|
||||
.sp
|
||||
.B Listing only the shortened image IDs
|
||||
.TP
|
||||
Listing just the shortened image IDs. This can be useful for some automated tools.
|
||||
.sp
|
||||
.RS
|
||||
docker images -q
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,39 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-info.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "APRIL 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-info \- Display system wide information
|
||||
.SH SYNOPSIS
|
||||
.B docker info
|
||||
.SH DESCRIPTION
|
||||
This command displays system wide information regarding the Docker installation. Information displayed includes the number of containers and images, pool name, data file, metadata file, data space used, total data space, metadata space used, total metadata space, execution driver, and the kernel version.
|
||||
.sp
|
||||
The data file is where the images are stored and the metadata file is where the meta data regarding those images are stored. When run for the first time Docker allocates a certain amount of data space and meta data space from the space available on the volume where /var/lib/docker is mounted.
|
||||
.SH "OPTIONS"
|
||||
There are no available options.
|
||||
.sp
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.B Display Docker system information
|
||||
.TP
|
||||
Here is a sample output:
|
||||
.sp
|
||||
.RS
|
||||
# docker info
|
||||
Containers: 18
|
||||
Images: 95
|
||||
Storage Driver: devicemapper
|
||||
Pool Name: docker-8:1-170408448-pool
|
||||
Data file: /var/lib/docker/devicemapper/devicemapper/data
|
||||
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
|
||||
Data Space Used: 9946.3 Mb
|
||||
Data Space Total: 102400.0 Mb
|
||||
Metadata Space Used: 9.9 Mb
|
||||
Metadata Space Total: 2048.0 Mb
|
||||
Execution Driver: native-0.1
|
||||
Kernel Version: 3.10.0-116.el7.x86_64
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,237 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-inspect.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "APRIL 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-inspect \- Return low-level information on a container/image
|
||||
.SH SYNOPSIS
|
||||
.B docker inspect
|
||||
[\fB-f\fR|\fB--format\fR=""
|
||||
CONTAINER|IMAGE [CONTAINER|IMAGE...]
|
||||
.SH DESCRIPTION
|
||||
This displays all the information available in Docker for a given container or image. By default, this will render all results in a JSON array. If a format is specified, the given template will be executed for each result.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -f, --format="":
|
||||
The text/template package of Go describes all the details of the format. See examples section
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.PP
|
||||
.B Getting information on a container
|
||||
.TP
|
||||
To get information on a container use it's ID or instance name
|
||||
.sp
|
||||
.fi
|
||||
.RS
|
||||
#docker inspect 1eb5fabf5a03
|
||||
|
||||
[{
|
||||
"ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
|
||||
"Created": "2014-04-04T21:33:52.02361335Z",
|
||||
"Path": "/usr/sbin/nginx",
|
||||
"Args": [],
|
||||
"Config": {
|
||||
"Hostname": "1eb5fabf5a03",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": {
|
||||
"80/tcp": {}
|
||||
},
|
||||
"Tty": true,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": [
|
||||
"/usr/sbin/nginx"
|
||||
],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "summit/nginx",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": {
|
||||
"mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650",
|
||||
"process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650"
|
||||
}
|
||||
},
|
||||
"State": {
|
||||
"Running": true,
|
||||
"Pid": 858,
|
||||
"ExitCode": 0,
|
||||
"StartedAt": "2014-04-04T21:33:54.16259207Z",
|
||||
"FinishedAt": "0001-01-01T00:00:00Z",
|
||||
"Ghost": false
|
||||
},
|
||||
"Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
|
||||
"NetworkSettings": {
|
||||
"IPAddress": "172.17.0.2",
|
||||
"IPPrefixLen": 16,
|
||||
"Gateway": "172.17.42.1",
|
||||
"Bridge": "docker0",
|
||||
"PortMapping": null,
|
||||
"Ports": {
|
||||
"80/tcp": [
|
||||
{
|
||||
"HostIp": "0.0.0.0",
|
||||
"HostPort": "80"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ResolvConfPath": "/etc/resolv.conf",
|
||||
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
|
||||
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
|
||||
"Name": "/ecstatic_ptolemy",
|
||||
"Driver": "devicemapper",
|
||||
"ExecDriver": "native-0.1",
|
||||
"Volumes": {},
|
||||
"VolumesRW": {},
|
||||
"HostConfig": {
|
||||
"Binds": null,
|
||||
"ContainerIDFile": "",
|
||||
"LxcConf": [],
|
||||
"Privileged": false,
|
||||
"PortBindings": {
|
||||
"80/tcp": [
|
||||
{
|
||||
"HostIp": "0.0.0.0",
|
||||
"HostPort": "80"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Links": null,
|
||||
"PublishAllPorts": false,
|
||||
"DriverOptions": {
|
||||
"lxc": null
|
||||
},
|
||||
"CliAddress": ""
|
||||
}
|
||||
.RE
|
||||
.nf
|
||||
.sp
|
||||
.B Getting the IP address of a container instance
|
||||
.TP
|
||||
To get the IP address of a container use:
|
||||
.sp
|
||||
.fi
|
||||
.RS
|
||||
# docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
|
||||
|
||||
172.17.0.2
|
||||
.RE
|
||||
.nf
|
||||
.sp
|
||||
.B Listing all port bindings
|
||||
.TP
|
||||
One can loop over arrays and maps in the results to produce simple text output:
|
||||
.sp
|
||||
.fi
|
||||
.RS
|
||||
# docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
|
||||
|
||||
80/tcp -> 80
|
||||
.RE
|
||||
.nf
|
||||
.sp
|
||||
.B Getting information on an image
|
||||
.TP
|
||||
Use an image's ID or name (e.g. repository/name[:tag]) to get information on it.
|
||||
.sp
|
||||
.fi
|
||||
.RS
|
||||
docker inspect 58394af37342
|
||||
[{
|
||||
"id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9",
|
||||
"parent": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"created": "2014-02-03T16:10:40.500814677Z",
|
||||
"container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5",
|
||||
"container_config": {
|
||||
"Hostname": "88807319f25e",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": null,
|
||||
"Tty": false,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": [
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"#(nop) ADD fedora-20-medium.tar.xz in /"
|
||||
],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": null
|
||||
},
|
||||
"docker_version": "0.6.3",
|
||||
"author": "Lokesh Mandvekar \u003clsm5@redhat.com\u003e - ./buildcontainers.sh",
|
||||
"config": {
|
||||
"Hostname": "88807319f25e",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
"PortSpecs": null,
|
||||
"ExposedPorts": null,
|
||||
"Tty": false,
|
||||
"OpenStdin": false,
|
||||
"StdinOnce": false,
|
||||
"Env": [
|
||||
"HOME=/",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Cmd": null,
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
"Image": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
||||
"Volumes": null,
|
||||
"VolumesFrom": "",
|
||||
"WorkingDir": "",
|
||||
"Entrypoint": null,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"Context": null
|
||||
},
|
||||
"architecture": "x86_64",
|
||||
"Size": 385520098
|
||||
}]
|
||||
.RE
|
||||
.nf
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,45 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-rm.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "MARCH 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-rm \- Remove one or more containers.
|
||||
.SH SYNOPSIS
|
||||
.B docker rm
|
||||
[\fB-f\fR|\fB--force\fR[=\fIfalse\fR]
|
||||
[\fB-l\fR|\fB--link\fR[=\fIfalse\fR]
|
||||
[\fB-v\fR|\fB--volumes\fR[=\fIfalse\fR]
|
||||
CONTAINER [CONTAINER...]
|
||||
.SH DESCRIPTION
|
||||
This will remove one or more containers from the host node. The container name or ID can be used. This does not remove images. You cannot remove a running container unless you use the \fB-f\fR option. To see all containers on a host use the \fBdocker ps -a\fR command.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -f, --force=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, force the removal of the container. The default is \fIfalse\fR.
|
||||
.TP
|
||||
.B -l, --link=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, remove the specified link and not the underlying container. The default is \fIfalse\fR.
|
||||
.TP
|
||||
.B -v, --volumes=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, remove the volumes associated to the container. The default is \fIfalse\fR.
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.PP
|
||||
.B Removing a container using its ID
|
||||
.TP
|
||||
To remove a container using its ID, find either from a \fBdocker ps -a\fR command, or use the ID returned from the \fBdocker run\fR command, or retrieve it from a file used to store it using the \fBdocker run --cidfile\fR:
|
||||
.sp
|
||||
.RS
|
||||
docker rm abebf7571666
|
||||
.RE
|
||||
.sp
|
||||
.B Removing a container using the container name:
|
||||
.TP
|
||||
The name of the container can be found using the \fBdocker ps -a\fR command. The use that name as follows:
|
||||
.sp
|
||||
.RS
|
||||
docker rm hopeful_morse
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
March 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,50 +0,0 @@
|
||||
DOCKER "1" "APRIL 2014" "0.1" "Docker"
|
||||
=======================================
|
||||
|
||||
NAME
|
||||
----
|
||||
|
||||
docker-rm - Remove one or more containers.
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
`docker rm` [`-f`|`--force`[=*false*] [`-l`|`--link`[=*false*] [`-v`|`--volumes`[=*false*]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
`docker rm` will remove one or more containers from the host node. The container name or ID can be used. This does not remove images. You cannot remove a running container unless you use the \fB-f\fR option. To see all containers on a host use the `docker ps -a` command.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
`-f`, `--force`=*true*|*false*:
|
||||
When set to true, force the removal of the container. The default is *false*.
|
||||
|
||||
`-l`, `--link`=*true*|*false*:
|
||||
When set to true, remove the specified link and not the underlying container. The default is *false*.
|
||||
|
||||
`-v`, `--volumes`=*true*|*false*:
|
||||
When set to true, remove the volumes associated to the container. The default is *false*.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
##Removing a container using its ID##
|
||||
|
||||
To remove a container using its ID, find either from a `docker ps -a` command, or use the ID returned from the `docker run` command, or retrieve it from a file used to store it using the `docker run --cidfile`:
|
||||
|
||||
docker rm abebf7571666
|
||||
|
||||
##Removing a container using the container name##
|
||||
|
||||
The name of the container can be found using the \fBdocker ps -a\fR command. The use that name as follows:
|
||||
|
||||
docker rm hopeful_morse
|
||||
|
||||
HISTORY
|
||||
-------
|
||||
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,29 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-run.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "MARCH 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-rmi \- Remove one or more images.
|
||||
.SH SYNOPSIS
|
||||
.B docker rmi
|
||||
[\fB-f\fR|\fB--force\fR[=\fIfalse\fR]
|
||||
IMAGE [IMAGE...]
|
||||
.SH DESCRIPTION
|
||||
This will remove one or more images from the host node. This does not remove images from a registry. You cannot remove an image of a running container unless you use the \fB-f\fR option. To see all images on a host use the \fBdocker images\fR command.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -f, --force=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, force the removal of the image. The default is \fIfalse\fR.
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.PP
|
||||
.B Removing an image
|
||||
.TP
|
||||
Here is an example of removing and image:
|
||||
.sp
|
||||
.RS
|
||||
docker rmi fedora/httpd
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
March 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,277 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-run.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "MARCH 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-run \- Run a process in an isolated container
|
||||
.SH SYNOPSIS
|
||||
.B docker run
|
||||
[\fB-a\fR|\fB--attach\fR[=]] [\fB-c\fR|\fB--cpu-shares\fR[=0] [\fB-m\fR|\fB--memory\fR=\fImemory-limit\fR]
|
||||
[\fB--cidfile\fR=\fIfile\fR] [\fB-d\fR|\fB--detach\fR[=\fIfalse\fR]] [\fB--dns\fR=\fIIP-address\fR]
|
||||
[\fB--name\fR=\fIname\fR] [\fB-u\fR|\fB--user\fR=\fIusername\fR|\fIuid\fR]
|
||||
[\fB--link\fR=\fIname\fR:\fIalias\fR]
|
||||
[\fB-e\fR|\fB--env\fR=\fIenvironment\fR] [\fB--entrypoint\fR=\fIcommand\fR]
|
||||
[\fB--expose\fR=\fIport\fR] [\fB-P\fR|\fB--publish-all\fR[=\fIfalse\fR]]
|
||||
[\fB-p\fR|\fB--publish\fR=\fIport-mappping\fR] [\fB-h\fR|\fB--hostname\fR=\fIhostname\fR]
|
||||
[\fB--rm\fR[=\fIfalse\fR]] [\fB--priviledged\fR[=\fIfalse\fR]
|
||||
[\fB-i\fR|\fB--interactive\fR[=\fIfalse\fR]
|
||||
[\fB-t\fR|\fB--tty\fR[=\fIfalse\fR]] [\fB--lxc-conf\fR=\fIoptions\fR]
|
||||
[\fB-n\fR|\fB--networking\fR[=\fItrue\fR]]
|
||||
[\fB-v\fR|\fB--volume\fR=\fIvolume\fR] [\fB--volumes-from\fR=\fIcontainer-id\fR]
|
||||
[\fB-w\fR|\fB--workdir\fR=\fIdirectory\fR] [\fB--sig-proxy\fR[=\fItrue\fR]]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Run a process in a new container. \fBdocker run\fR starts a process with its own file system, its own networking, and its own isolated process tree. The \fIIMAGE\fR which starts the process may define defaults related to the process that will be run in the container, the networking to expose, and more, but \fBdocker run\fR gives final control to the operator or administrator who starts the container from the image. For that reason \fBdocker run\fR has more options than any other docker command.
|
||||
|
||||
If the \fIIMAGE\fR is not already loaded then \fBdocker run\fR will pull the \fIIMAGE\fR, and all image dependencies, from the repository in the same way running \fBdocker pull\fR \fIIMAGE\fR, before it starts the container from that image.
|
||||
|
||||
|
||||
.SH "OPTIONS"
|
||||
|
||||
.TP
|
||||
.B -a, --attach=\fIstdin\fR|\fIstdout\fR|\fIstderr\fR:
|
||||
Attach to stdin, stdout or stderr. In foreground mode (the default when -d is not specified), \fBdocker run\fR can start the process in the container and attach the console to the process’s standard input, output, and standard error. It can even pretend to be a TTY (this is what most commandline executables expect) and pass along signals. The \fB-a\fR option can be set for each of stdin, stdout, and stderr.
|
||||
|
||||
.TP
|
||||
.B -c, --cpu-shares=0:
|
||||
CPU shares in relative weight. You can increase the priority of a container with the -c option. By default, all containers run at the same priority and get the same proportion of CPU cycles, but you can tell the kernel to give more shares of CPU time to one or more containers when you start them via \fBdocker run\fR.
|
||||
|
||||
.TP
|
||||
.B -m, --memory=\fImemory-limit\fR:
|
||||
Allows you to constrain the memory available to a container. If the host supports swap memory, then the -m memory setting can be larger than physical RAM. The memory limit format: <number><optional unit>, where unit = b, k, m or g.
|
||||
|
||||
.TP
|
||||
.B --cidfile=\fIfile\fR:
|
||||
Write the container ID to the file specified.
|
||||
|
||||
.TP
|
||||
.B -d, --detach=\fItrue\fR|\fIfalse\fR:
|
||||
Detached mode. This runs the container in the background. It outputs the new container's id and and error messages. At any time you can run \fBdocker ps\fR in the other shell to view a list of the running containers. You can reattach to a detached container with \fBdocker attach\fR. If you choose to run a container in the detached mode, then you cannot use the -rm option.
|
||||
|
||||
.TP
|
||||
.B --dns=\fIIP-address\fR:
|
||||
Set custom DNS servers. This option can be used to override the DNS configuration passed to the container. Typically this is necessary when the host DNS configuration is invalid for the container (eg. 127.0.0.1). When this is the case the \fB-dns\fR flags is necessary for every run.
|
||||
|
||||
.TP
|
||||
.B -e, --env=\fIenvironment\fR:
|
||||
Set environment variables. This option allows you to specify arbitrary environment variables that are available for the process that will be launched inside of the container.
|
||||
|
||||
.TP
|
||||
.B --entrypoint=\ficommand\fR:
|
||||
This option allows you to overwrite the default entrypoint of the image that is set in the Dockerfile. The ENTRYPOINT of an image is similar to a COMMAND because it specifies what executable to run when the container starts, but it is (purposely) more difficult to override. The ENTRYPOINT gives a container its default nature or behavior, so that when you set an ENTRYPOINT you can run the container as if it were that binary, complete with default options, and you can pass in more options via the COMMAND. But, sometimes an operator may want to run something else inside the container, so you can override the default ENTRYPOINT at runtime by using a \fB--entrypoint\fR and a string to specify the new ENTRYPOINT.
|
||||
|
||||
.TP
|
||||
.B --expose=\fIport\fR:
|
||||
Expose a port from the container without publishing it to your host. A containers port can be exposed to other containers in three ways: 1) The developer can expose the port using the EXPOSE parameter of the Dockerfile, 2) the operator can use the \fB--expose\fR option with \fBdocker run\fR, or 3) the container can be started with the \fB--link\fR.
|
||||
|
||||
.TP
|
||||
.B -P, --publish-all=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true publish all exposed ports to the host interfaces. The default is false. If the operator uses -P (or -p) then Docker will make the exposed port accessible on the host and the ports will be available to any client that can reach the host. To find the map between the host ports and the exposed ports, use \fBdocker port\fR.
|
||||
|
||||
.TP
|
||||
.B -p, --publish=[]:
|
||||
Publish a container's port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) (use 'docker port' to see the actual mapping)
|
||||
|
||||
.TP
|
||||
.B -h , --hostname=\fIhostname\fR:
|
||||
Sets the container host name that is available inside the container.
|
||||
|
||||
.TP
|
||||
.B -i , --interactive=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, keep stdin open even if not attached. The default is false.
|
||||
|
||||
.TP
|
||||
.B --link=\fIname\fR:\fIalias\fR:
|
||||
Add link to another container. The format is name:alias. If the operator uses \fB--link\fR when starting the new client container, then the client container can access the exposed port via a private networking interface. Docker will set some environment variables in the client container to help indicate which interface and port to use.
|
||||
|
||||
.TP
|
||||
.B -n, --networking=\fItrue\fR|\fIfalse\fR:
|
||||
By default, all containers have networking enabled (true) and can make outgoing connections. The operator can disable networking with \fB--networking\fR to false. This disables all incoming and outgoing networking. In cases like this, I/O can only be performed through files or by using STDIN/STDOUT.
|
||||
|
||||
Also by default, the container will use the same DNS servers as the host. but you canThe operator may override this with \fB-dns\fR.
|
||||
|
||||
.TP
|
||||
.B --name=\fIname\fR:
|
||||
Assign a name to the container. The operator can identify a container in three ways:
|
||||
.sp
|
||||
.nf
|
||||
UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
|
||||
UUID short identifier (“f78375b1c487”)
|
||||
Name (“jonah”)
|
||||
.fi
|
||||
.sp
|
||||
The UUID identifiers come from the Docker daemon, and if a name is not assigned to the container with \fB--name\fR then the daemon will also generate a random string name. The name is useful when defining links (see \fB--link\fR) (or any other place you need to identify a container). This works for both background and foreground Docker containers.
|
||||
|
||||
.TP
|
||||
.B --privileged=\fItrue\fR|\fIfalse\fR:
|
||||
Give extended privileges to this container. By default, Docker containers are “unprivileged” (=false) and cannot, for example, run a Docker daemon inside the Docker container. This is because by default a container is not allowed to access any devices. A “privileged” container is given access to all devices.
|
||||
|
||||
When the operator executes \fBdocker run -privileged\fR, Docker will enable access to all devices on the host as well as set some configuration in AppArmor (\fB???\fR) to allow the container nearly all the same access to the host as processes running outside of a container on the host.
|
||||
|
||||
.TP
|
||||
.B --rm=\fItrue\fR|\fIfalse\fR:
|
||||
If set to \fItrue\fR the container is automatically removed when it exits. The default is \fIfalse\fR. This option is incompatible with \fB-d\fR.
|
||||
|
||||
.TP
|
||||
.B --sig-proxy=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, proxify all received signals to the process (even in non-tty mode). The default is true.
|
||||
|
||||
.TP
|
||||
.B -t, --tty=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true Docker can allocate a pseudo-tty and attach to the standard input of any container. This can be used, for example, to run a throwaway interactive shell. The default is value is false.
|
||||
|
||||
.TP
|
||||
.B -u, --user=\fIusername\fR,\fRuid\fR:
|
||||
Set a username or UID for the container.
|
||||
|
||||
.TP
|
||||
.B -v, --volume=\fIvolume\fR:
|
||||
Bind mount a volume to the container. The \fB-v\fR option can be used one or more times to add one or more mounts to a container. These mounts can then be used in other containers using the \fB--volumes-from\fR option. See examples.
|
||||
|
||||
.TP
|
||||
.B --volumes-from=\fIcontainer-id\fR:
|
||||
Will mount volumes from the specified container identified by container-id. Once a volume is mounted in a one container it can be shared with other containers using the \fB--volumes-from\fR option when running those other containers. The volumes can be shared even if the original container with the mount is not running.
|
||||
|
||||
.TP
|
||||
.B -w, --workdir=\fIdirectory\fR:
|
||||
Working directory inside the container. The default working directory for running binaries within a container is the root directory (/). The developer can set a different default with the Dockerfile WORKDIR instruction. The operator can override the working directory by using the \fB-w\fR option.
|
||||
|
||||
.TP
|
||||
.B IMAGE:
|
||||
The image name or ID.
|
||||
|
||||
.TP
|
||||
.B COMMAND:
|
||||
The command or program to run inside the image.
|
||||
|
||||
.TP
|
||||
.B ARG:
|
||||
The arguments for the command to be run in the container.
|
||||
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.sp
|
||||
.B Exposing log messages from the container to the host's log
|
||||
.TP
|
||||
If you want messages that are logged in your container to show up in the host's syslog/journal then you should bind mount the /var/log directory as follows.
|
||||
.sp
|
||||
.RS
|
||||
docker run -v /dev/log:/dev/log -i -t fedora /bin/bash
|
||||
.RE
|
||||
.sp
|
||||
From inside the container you can test this by sending a message to the log.
|
||||
.sp
|
||||
.RS
|
||||
logger "Hello from my container"
|
||||
.sp
|
||||
.RE
|
||||
Then exit and check the journal.
|
||||
.RS
|
||||
.sp
|
||||
exit
|
||||
.sp
|
||||
journalctl -b | grep hello
|
||||
.RE
|
||||
.sp
|
||||
This should list the message sent to logger.
|
||||
.sp
|
||||
.B Attaching to one or more from STDIN, STDOUT, STDERR
|
||||
.TP
|
||||
If you do not specify -a then Docker will attach everything (stdin,stdout,stderr). You can specify to which of the three standard streams (stdin, stdout, stderr) you’d like to connect instead, as in:
|
||||
.sp
|
||||
.RS
|
||||
docker run -a stdin -a stdout -i -t fedora /bin/bash
|
||||
.RE
|
||||
.sp
|
||||
.B Linking Containers
|
||||
.TP
|
||||
The link feature allows multiple containers to communicate with each other. For example, a container whose Dockerfile has exposed port 80 can be run and named as follows:
|
||||
.sp
|
||||
.RS
|
||||
docker run --name=link-test -d -i -t fedora/httpd
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
A second container, in this case called linker, can communicate with the httpd container, named link-test, by running with the \fB--link=<name>:<alias>\fR
|
||||
.sp
|
||||
.RS
|
||||
docker run -t -i --link=link-test:lt --name=linker fedora /bin/bash
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
Now the container linker is linked to container link-test with the alias lt. Running the \fBenv\fR command in the linker container shows environment variables with the LT (alias) context (\fBLT_\fR)
|
||||
.sp
|
||||
.nf
|
||||
.RS
|
||||
# env
|
||||
HOSTNAME=668231cb0978
|
||||
TERM=xterm
|
||||
LT_PORT_80_TCP=tcp://172.17.0.3:80
|
||||
LT_PORT_80_TCP_PORT=80
|
||||
LT_PORT_80_TCP_PROTO=tcp
|
||||
LT_PORT=tcp://172.17.0.3:80
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
PWD=/
|
||||
LT_NAME=/linker/lt
|
||||
SHLVL=1
|
||||
HOME=/
|
||||
LT_PORT_80_TCP_ADDR=172.17.0.3
|
||||
_=/usr/bin/env
|
||||
.RE
|
||||
.fi
|
||||
.sp
|
||||
.TP
|
||||
When linking two containers Docker will use the exposed ports of the container to create a secure tunnel for the parent to access.
|
||||
.TP
|
||||
.sp
|
||||
.B Mapping Ports for External Usage
|
||||
.TP
|
||||
The exposed port of an application can be mapped to a host port using the \fB-p\fR flag. For example a httpd port 80 can be mapped to the host port 8080 using the following:
|
||||
.sp
|
||||
.RS
|
||||
docker run -p 8080:80 -d -i -t fedora/httpd
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
.B Creating and Mounting a Data Volume Container
|
||||
.TP
|
||||
Many applications require the sharing of persistent data across several containers. Docker allows you to create a Data Volume Container that other containers can mount from. For example, create a named container that contains directories /var/volume1 and /tmp/volume2. The image will need to contain these directories so a couple of RUN mkdir instructions might be required for you fedora-data image:
|
||||
.sp
|
||||
.RS
|
||||
docker run --name=data -v /var/volume1 -v /tmp/volume2 -i -t fedora-data true
|
||||
.sp
|
||||
docker run --volumes-from=data --name=fedora-container1 -i -t fedora bash
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
Multiple -volumes-from parameters will bring together multiple data volumes from multiple containers. And it's possible to mount the volumes that came from the DATA container in yet another container via the fedora-container1 intermidiery container, allowing to abstract the actual data source from users of that data:
|
||||
.sp
|
||||
.RS
|
||||
docker run --volumes-from=fedora-container1 --name=fedora-container2 -i -t fedora bash
|
||||
.RE
|
||||
.TP
|
||||
.sp
|
||||
.B Mounting External Volumes
|
||||
.TP
|
||||
To mount a host directory as a container volume, specify the absolute path to the directory and the absolute path for the container directory separated by a colon:
|
||||
.sp
|
||||
.RS
|
||||
docker run -v /var/db:/data1 -i -t fedora bash
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
When using SELinux, be aware that the host has no knowledge of container SELinux policy. Therefore, in the above example, if SELinux policy is enforced, the /var/db directory is not writable to the container. A "Permission Denied" message will occur and an avc: message in the host's syslog.
|
||||
.sp
|
||||
.TP
|
||||
To work around this, at time of writing this man page, the following command needs to be run in order for the proper SELinux policy type label to be attached to the host directory:
|
||||
.sp
|
||||
.RS
|
||||
chcon -Rt svirt_sandbox_file_t /var/db
|
||||
.RE
|
||||
.sp
|
||||
.TP
|
||||
Now, writing to the /data1 volume in the container will be allowed and the changes will also be reflected on the host in /var/db.
|
||||
.sp
|
||||
.SH HISTORY
|
||||
March 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,49 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker-tag.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "APRIL 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker-tag \- Tag an image in the repository
|
||||
.SH SYNOPSIS
|
||||
.B docker tag
|
||||
[\fB-f\fR|\fB--force\fR[=\fIfalse\fR]
|
||||
\fBIMAGE\fR [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
||||
.SH DESCRIPTION
|
||||
This will tag an image in the repository.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -f, --force=\fItrue\fR|\fIfalse\fR:
|
||||
When set to true, force the tag name. The default is \fIfalse\fR.
|
||||
.TP
|
||||
.B REGISTRYHOST:
|
||||
The hostname of the registry if required. This may also include the port separated by a ':'
|
||||
.TP
|
||||
.B USERNAME:
|
||||
The username or other qualifying identifier for the image.
|
||||
.TP
|
||||
.B NAME:
|
||||
The image name.
|
||||
.TP
|
||||
.B TAG:
|
||||
The tag you are assigning to the image.
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
.PP
|
||||
.B Tagging an image
|
||||
.TP
|
||||
Here is an example where an image is tagged with the tag 'Version-1.0' :
|
||||
.sp
|
||||
.RS
|
||||
docker tag 0e5574283393 fedora/httpd:Version-1.0
|
||||
.RE
|
||||
.sp
|
||||
.B Tagging an image for an internal repository
|
||||
.TP
|
||||
To push an image to an internal Registry and not the default docker.io based registry you must tag it with the registry hostname and port (if needed).
|
||||
.sp
|
||||
.RS
|
||||
docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
|
||||
.RE
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,172 +0,0 @@
|
||||
.\" Process this file with
|
||||
.\" nroff -man -Tascii docker.1
|
||||
.\"
|
||||
.TH "DOCKER" "1" "APRIL 2014" "0.1" "Docker"
|
||||
.SH NAME
|
||||
docker \- Docker image and container command line interface
|
||||
.SH SYNOPSIS
|
||||
.B docker [OPTIONS] [COMMAND] [arg...]
|
||||
.SH DESCRIPTION
|
||||
\fBdocker\fR has two distinct functions. It is used for starting the Docker daemon and to run the CLI (i.e., to command the daemon to manage images, containers etc.) So \fBdocker\fR is both a server as deamon and a client to the daemon through the CLI.
|
||||
.sp
|
||||
To run the Docker deamon you do not specify any of the commands listed below but must specify the \fB-d\fR option. The other options listed below are for the daemon only.
|
||||
.sp
|
||||
The Docker CLI has over 30 commands. The commands are listed below and each has its own man page which explain usage and arguements.
|
||||
.sp
|
||||
To see the man page for a command run \fBman docker <command>\fR.
|
||||
.SH "OPTIONS"
|
||||
.B \-D=false:
|
||||
Enable debug mode
|
||||
.TP
|
||||
.B\-H=[unix:///var/run/docker.sock]: tcp://[host[:port]] to bind or unix://[/path/to/socket] to use.
|
||||
When host=[0.0.0.0], port=[4243] or path
|
||||
=[/var/run/docker.sock] is omitted, default values are used.
|
||||
.TP
|
||||
.B \-\-api-enable-cors=false
|
||||
Enable CORS headers in the remote API
|
||||
.TP
|
||||
.B \-b=""
|
||||
Attach containers to a pre\-existing network bridge; use 'none' to disable container networking
|
||||
.TP
|
||||
.B \-\-bip=""
|
||||
Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b
|
||||
.TP
|
||||
.B \-d=false
|
||||
Enable daemon mode
|
||||
.TP
|
||||
.B \-\-dns=""
|
||||
Force Docker to use specific DNS servers
|
||||
.TP
|
||||
.B \-g="/var/lib/docker"
|
||||
Path to use as the root of the Docker runtime
|
||||
.TP
|
||||
.B \-\-icc=true
|
||||
Enable inter\-container communication
|
||||
.TP
|
||||
.B \-\-ip="0.0.0.0"
|
||||
Default IP address to use when binding container ports
|
||||
.TP
|
||||
.B \-\-iptables=true
|
||||
Disable Docker's addition of iptables rules
|
||||
.TP
|
||||
.B \-\-mtu=1500
|
||||
Set the containers network mtu
|
||||
.TP
|
||||
.B \-p="/var/run/docker.pid"
|
||||
Path to use for daemon PID file
|
||||
.TP
|
||||
.B \-r=true
|
||||
Restart previously running containers
|
||||
.TP
|
||||
.B \-s=""
|
||||
Force the Docker runtime to use a specific storage driver
|
||||
.TP
|
||||
.B \-v=false
|
||||
Print version information and quit
|
||||
.SH "COMMANDS"
|
||||
.TP
|
||||
.B attach
|
||||
Attach to a running container
|
||||
.TP
|
||||
.B build
|
||||
Build a container from a Dockerfile
|
||||
.TP
|
||||
.B commit
|
||||
Create a new image from a container's changes
|
||||
.TP
|
||||
.B cp
|
||||
Copy files/folders from the containers filesystem to the host at path
|
||||
.TP
|
||||
.B diff
|
||||
Inspect changes on a container's filesystem
|
||||
|
||||
.TP
|
||||
.B events
|
||||
Get real time events from the server
|
||||
.TP
|
||||
.B export
|
||||
Stream the contents of a container as a tar archive
|
||||
.TP
|
||||
.B history
|
||||
Show the history of an image
|
||||
.TP
|
||||
.B images
|
||||
List images
|
||||
.TP
|
||||
.B import
|
||||
Create a new filesystem image from the contents of a tarball
|
||||
.TP
|
||||
.B info
|
||||
Display system-wide information
|
||||
.TP
|
||||
.B insert
|
||||
Insert a file in an image
|
||||
.TP
|
||||
.B inspect
|
||||
Return low-level information on a container
|
||||
.TP
|
||||
.B kill
|
||||
Kill a running container (which includes the wrapper process and everything inside it)
|
||||
.TP
|
||||
.B load
|
||||
Load an image from a tar archive
|
||||
.TP
|
||||
.B login
|
||||
Register or Login to a Docker registry server
|
||||
.TP
|
||||
.B logs
|
||||
Fetch the logs of a container
|
||||
.TP
|
||||
.B port
|
||||
Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
|
||||
.TP
|
||||
.B ps
|
||||
List containers
|
||||
.TP
|
||||
.B pull
|
||||
Pull an image or a repository from a Docker registry server
|
||||
.TP
|
||||
.B push
|
||||
Push an image or a repository to a Docker registry server
|
||||
.TP
|
||||
.B restart
|
||||
Restart a running container
|
||||
.TP
|
||||
.B rm
|
||||
Remove one or more containers
|
||||
.TP
|
||||
.B rmi
|
||||
Remove one or more images
|
||||
.TP
|
||||
.B run
|
||||
Run a command in a new container
|
||||
.TP
|
||||
.B save
|
||||
Save an image to a tar archive
|
||||
.TP
|
||||
.B search
|
||||
Search for an image in the Docker index
|
||||
.TP
|
||||
.B start
|
||||
Start a stopped container
|
||||
.TP
|
||||
.B stop
|
||||
Stop a running container
|
||||
.TP
|
||||
.B tag
|
||||
Tag an image into a repository
|
||||
.TP
|
||||
.B top
|
||||
Lookup the running processes of a container
|
||||
.TP
|
||||
.B version
|
||||
Show the Docker version information
|
||||
.TP
|
||||
.B wait
|
||||
Block until a container stops, then print its exit code
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
For specific examples please see the man page for the specific Docker command.
|
||||
.sp
|
||||
.SH HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on dockier.io source material and internal work.
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
[ $(id -u) -eq 0 ] || {
|
||||
printf >&2 '%s requires root\n' "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf >&2 '%s: [-r release] [-m mirror] [-s]\n' "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
tmp() {
|
||||
TMP=$(mktemp -d /tmp/alpine-docker-XXXXXXXXXX)
|
||||
ROOTFS=$(mktemp -d /tmp/alpine-docker-rootfs-XXXXXXXXXX)
|
||||
trap "rm -rf $TMP $ROOTFS" EXIT TERM INT
|
||||
}
|
||||
|
||||
apkv() {
|
||||
curl -s $REPO/$ARCH/APKINDEX.tar.gz | tar -Oxz |
|
||||
grep '^P:apk-tools-static$' -A1 | tail -n1 | cut -d: -f2
|
||||
}
|
||||
|
||||
getapk() {
|
||||
curl -s $REPO/$ARCH/apk-tools-static-$(apkv).apk |
|
||||
tar -xz -C $TMP sbin/apk.static
|
||||
}
|
||||
|
||||
mkbase() {
|
||||
$TMP/sbin/apk.static --repository $REPO --update-cache --allow-untrusted \
|
||||
--root $ROOTFS --initdb add alpine-base
|
||||
}
|
||||
|
||||
conf() {
|
||||
printf '%s\n' $REPO > $ROOTFS/etc/apk/repositories
|
||||
}
|
||||
|
||||
pack() {
|
||||
local id
|
||||
id=$(tar --numeric-owner -C $ROOTFS -c . | docker import - alpine:$REL)
|
||||
|
||||
docker tag $id alpine:latest
|
||||
docker run -i -t alpine printf 'alpine:%s with id=%s created!\n' $REL $id
|
||||
}
|
||||
|
||||
save() {
|
||||
[ $SAVE -eq 1 ] || return
|
||||
|
||||
tar --numeric-owner -C $ROOTFS -c . | xz > rootfs.tar.xz
|
||||
}
|
||||
|
||||
while getopts "hr:m:s" opt; do
|
||||
case $opt in
|
||||
r)
|
||||
REL=$OPTARG
|
||||
;;
|
||||
m)
|
||||
MIRROR=$OPTARG
|
||||
;;
|
||||
s)
|
||||
SAVE=1
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
REL=${REL:-edge}
|
||||
MIRROR=${MIRROR:-http://nl.alpinelinux.org/alpine}
|
||||
SAVE=${SAVE:-0}
|
||||
REPO=$MIRROR/$REL/main
|
||||
ARCH=$(uname -m)
|
||||
|
||||
tmp
|
||||
getapk
|
||||
mkbase
|
||||
conf
|
||||
pack
|
||||
save
|
||||
@@ -57,7 +57,6 @@ mknod -m 666 $DEV/tty0 c 4 0
|
||||
mknod -m 666 $DEV/full c 1 7
|
||||
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
|
||||
docker run -i -t archlinux echo Success.
|
||||
|
||||
@@ -43,7 +43,7 @@ usage() {
|
||||
debianStable=wheezy
|
||||
debianUnstable=sid
|
||||
# this should match the name found at http://releases.ubuntu.com/
|
||||
ubuntuLatestLTS=trusty
|
||||
ubuntuLatestLTS=precise
|
||||
# this should match the name found at http://releases.tanglu.org/
|
||||
tangluLatest=aequorea
|
||||
|
||||
@@ -219,7 +219,6 @@ if [ -z "$strictDebootstrap" ]; then
|
||||
|
||||
# make sure our packages lists are as up to date as we can get them
|
||||
sudo chroot . apt-get update
|
||||
sudo chroot . apt-get dist-upgrade -y
|
||||
fi
|
||||
|
||||
if [ "$justTar" ]; then
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# can configure the list of syscalls. When run, this script produces output
|
||||
# which, when stored in a file, can be passed to docker as follows:
|
||||
#
|
||||
# docker run --lxc-conf="lxc.seccomp=$file" <rest of arguments>
|
||||
# docker run -lxc-conf="lxc.seccomp=$file" <rest of arguments>
|
||||
#
|
||||
# The included sample file shows how to cut about a quarter of all syscalls,
|
||||
# which affecting most applications.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Gurjeet Singh <gurjeet@singh.im> (gurjeet.singh.im)
|
||||
@@ -0,0 +1,23 @@
|
||||
# ZFS Storage Driver
|
||||
|
||||
This is a placeholder to declare the presence and status of ZFS storage driver
|
||||
for containers.
|
||||
|
||||
The current development is done in Gurjeet Singh's fork of Docker, under the
|
||||
branch named [zfs_driver].
|
||||
|
||||
[zfs_driver]: https://github.com/gurjeet/docker/tree/zfs_driver
|
||||
|
||||
|
||||
# Status
|
||||
|
||||
Alpha: The code is now capable of creating, running and destroying containers
|
||||
and images.
|
||||
|
||||
The code is under development. Contributions in the form of suggestions,
|
||||
code-reviews, and patches are welcome.
|
||||
|
||||
Please send the communication to gurjeet@singh.im and CC at least one Docker
|
||||
mailing list.
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/dotcloud/docker/utils"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) Attach(container *Container, stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error {
|
||||
var (
|
||||
cStdout, cStderr io.ReadCloser
|
||||
nJobs int
|
||||
errors = make(chan error, 3)
|
||||
)
|
||||
|
||||
if stdin != nil && container.Config.OpenStdin {
|
||||
nJobs += 1
|
||||
if cStdin, err := container.StdinPipe(); err != nil {
|
||||
errors <- err
|
||||
} else {
|
||||
go func() {
|
||||
utils.Debugf("attach: stdin: begin")
|
||||
defer utils.Debugf("attach: stdin: end")
|
||||
// No matter what, when stdin is closed (io.Copy unblock), close stdout and stderr
|
||||
if container.Config.StdinOnce && !container.Config.Tty {
|
||||
defer cStdin.Close()
|
||||
} else {
|
||||
defer func() {
|
||||
if cStdout != nil {
|
||||
cStdout.Close()
|
||||
}
|
||||
if cStderr != nil {
|
||||
cStderr.Close()
|
||||
}
|
||||
}()
|
||||
}
|
||||
if container.Config.Tty {
|
||||
_, err = utils.CopyEscapable(cStdin, stdin)
|
||||
} else {
|
||||
_, err = io.Copy(cStdin, stdin)
|
||||
}
|
||||
if err == io.ErrClosedPipe {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
utils.Errorf("attach: stdin: %s", err)
|
||||
}
|
||||
errors <- err
|
||||
}()
|
||||
}
|
||||
}
|
||||
if stdout != nil {
|
||||
nJobs += 1
|
||||
if p, err := container.StdoutPipe(); err != nil {
|
||||
errors <- err
|
||||
} else {
|
||||
cStdout = p
|
||||
go func() {
|
||||
utils.Debugf("attach: stdout: begin")
|
||||
defer utils.Debugf("attach: stdout: end")
|
||||
// If we are in StdinOnce mode, then close stdin
|
||||
if container.Config.StdinOnce && stdin != nil {
|
||||
defer stdin.Close()
|
||||
}
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
_, err := io.Copy(stdout, cStdout)
|
||||
if err == io.ErrClosedPipe {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
utils.Errorf("attach: stdout: %s", err)
|
||||
}
|
||||
errors <- err
|
||||
}()
|
||||
}
|
||||
} else {
|
||||
go func() {
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
if cStdout, err := container.StdoutPipe(); err != nil {
|
||||
utils.Errorf("attach: stdout pipe: %s", err)
|
||||
} else {
|
||||
io.Copy(&utils.NopWriter{}, cStdout)
|
||||
}
|
||||
}()
|
||||
}
|
||||
if stderr != nil {
|
||||
nJobs += 1
|
||||
if p, err := container.StderrPipe(); err != nil {
|
||||
errors <- err
|
||||
} else {
|
||||
cStderr = p
|
||||
go func() {
|
||||
utils.Debugf("attach: stderr: begin")
|
||||
defer utils.Debugf("attach: stderr: end")
|
||||
// If we are in StdinOnce mode, then close stdin
|
||||
if container.Config.StdinOnce && stdin != nil {
|
||||
defer stdin.Close()
|
||||
}
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
_, err := io.Copy(stderr, cStderr)
|
||||
if err == io.ErrClosedPipe {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
utils.Errorf("attach: stderr: %s", err)
|
||||
}
|
||||
errors <- err
|
||||
}()
|
||||
}
|
||||
} else {
|
||||
go func() {
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
|
||||
if cStderr, err := container.StderrPipe(); err != nil {
|
||||
utils.Errorf("attach: stdout pipe: %s", err)
|
||||
} else {
|
||||
io.Copy(&utils.NopWriter{}, cStderr)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return utils.Go(func() error {
|
||||
defer func() {
|
||||
if cStdout != nil {
|
||||
cStdout.Close()
|
||||
}
|
||||
if cStderr != nil {
|
||||
cStderr.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
// 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 += 1 {
|
||||
utils.Debugf("attach: waiting for job %d/%d", i+1, nJobs)
|
||||
if err := <-errors; err != nil {
|
||||
utils.Errorf("attach: job %d returned error %s, aborting all jobs", i+1, err)
|
||||
return err
|
||||
}
|
||||
utils.Debugf("attach: job %d completed successfully", i+1)
|
||||
}
|
||||
utils.Debugf("attach: all jobs completed successfully")
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// +build !exclude_graphdriver_aufs
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"github.com/dotcloud/docker/daemon/graphdriver"
|
||||
"github.com/dotcloud/docker/daemon/graphdriver/aufs"
|
||||
"github.com/dotcloud/docker/graph"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
)
|
||||
|
||||
// Given the graphdriver ad, if it is aufs, then migrate it.
|
||||
// If aufs driver is not built, this func is a noop.
|
||||
func migrateIfAufs(driver graphdriver.Driver, root string) error {
|
||||
if ad, ok := driver.(*aufs.Driver); ok {
|
||||
utils.Debugf("Migrating existing containers")
|
||||
if err := ad.Migrate(root, graph.SetupInitLayer); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// +build !exclude_graphdriver_btrfs
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
_ "github.com/dotcloud/docker/daemon/graphdriver/btrfs"
|
||||
)
|
||||
@@ -1,7 +0,0 @@
|
||||
// +build !exclude_graphdriver_devicemapper
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
_ "github.com/dotcloud/docker/daemon/graphdriver/devmapper"
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user