Compare commits

...

2,202 commits

Author SHA1 Message Date
Joffrey F
aa8fb8f708 Merge pull request #4499 from xulike666/function-name-modification
function-name-modification for tests/*
2017-02-16 11:59:36 -08:00
Joffrey F
b49f42f9b7 Merge pull request #4496 from xulike666/quick-easy-typo-fix
fix a typo in script/release/utils.sh
2017-02-16 11:59:17 -08:00
Joffrey F
afd3bcfbf4 Merge pull request #4484 from shin-/4425-sys-path-fix
Reinitialize sys.path after it's been potentially modified by pip
2017-02-16 11:39:54 -08:00
Aaron.L.Xu
d20e3f3342 function-name-modification for tests/*
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-16 15:25:20 +08:00
Aaron.L.Xu
27297fd1af fix a typo in script/release/utils.sh
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-16 11:14:49 +08:00
Joffrey F
66f4a795a2 Don't import pip inside Compose
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-15 16:31:50 -08:00
Joffrey F
40c26ca676 Merge pull request #4480 from shin-/4479-merge-secrets
Fix `config` command output with service.secrets section
2017-02-14 17:08:18 -08:00
Joffrey F
abce83ef25 Fix config command output with service.secrets section
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-13 16:51:50 -08:00
Joffrey F
bb5d7b2433 Merge pull request #4473 from Vehsamrak/patch-1
Compose file reference link fix in README.md
2017-02-13 13:03:39 -08:00
Petr Karmashev
252699c1d1 Compose file reference link fix in README.md
Signed-off-by: Petr Karmashev <smonkl@bk.ru>
2017-02-12 02:10:34 +03:00
Joffrey F
ad0e6d219b Merge pull request #4469 from dnephin/fix_secrets_config
Fixes secrets config loading
2017-02-10 18:39:53 -08:00
Daniel Nephin
dc5b3f3b3e Fix secrets config.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-02-10 17:11:24 -05:00
Joffrey F
1fe2443735 Merge pull request #4438 from fate-grand-order/master
fix typo in CHANGELOG.md
2017-02-09 16:35:35 -08:00
Joffrey F
27e0f31275 Merge pull request #4443 from xulike666/fix-accessibility
Referencing the right segment of code in compose/bundle.py
2017-02-09 16:34:48 -08:00
Joffrey F
2f13201b9e Merge pull request #4453 from kevinetc123/patch-typo
fix typo in project.py
2017-02-09 16:33:07 -08:00
Joffrey F
276db7231a Merge pull request #4455 from dnephin/fix_3.1
Fix version 3.1
2017-02-09 12:38:29 -08:00
Daniel Nephin
c092fa37de Fix version 3.1
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-02-09 12:39:57 -05:00
kevinetc123
47e4442722 fix typo in project.py
Signed-off-by: kevinetc123 <kaiwentan@harmonycloud.cn>
2017-02-09 19:10:26 +08:00
Joffrey F
b306e843d3 Merge pull request #4448 from shin-/1.11-release
1.11 release-master realign
2017-02-08 13:54:12 -08:00
Joffrey F
fc7b74d7f9 Bump to next dev version
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-08 13:47:08 -08:00
Joffrey F
2cd6cb9a47 Bump 1.10.1
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-08 13:45:25 -08:00
Joffrey F
01d1895a35 Bump 1.11.0
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-08 13:44:40 -08:00
Joffrey F
979a0d53f7 Bump 1.11.0-rc1
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-08 13:44:31 -08:00
Aaron.L.Xu
f083526829 referencing right segment of code
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-08 18:50:26 +08:00
fate-grand-order
b392b6e12e fix typo in CHANGELOG.md
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-02-07 15:59:34 +08:00
Joffrey F
165eb9c91a Merge pull request #3558 from shin-/1135-pyinstaller-update
Use newer version of PyInstaller to fix prelinking issues
2017-02-06 15:00:39 -08:00
Joffrey F
1636985a7a Merge pull request #4426 from shin-/4392-context-mgr
Close the open file handle using context manager
2017-02-06 13:30:49 -08:00
Kevin Jing Qiu
a3a9d8944a Close the open file handle using context manager
Signed-off-by: Kevin Jing Qiu <kevin.qiu@points.com>
2017-02-03 14:50:40 -08:00
Joffrey F
951497c0f2 Merge pull request #4419 from shin-/4418-healthcheck-extends
Don't re-parse healthcheck values coming from extended services
2017-02-03 12:24:53 -08:00
Joffrey F
e22164ec9f Merge pull request #4035 from urda/urda/compose-top
Added `top` to `docker-compose` to display running processes
2017-02-02 15:41:14 -08:00
Joffrey F
f106d23776 Merge pull request #4414 from shin-/4184-merge-pids
Add missing comma in DOCKER_CONFIG_KEYS list
2017-02-02 14:51:42 -08:00
Joffrey F
cf43e6edf7 Don't re-parse healthcheck values coming from extended services
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-02 14:50:53 -08:00
Joffrey F
7e8958e6ca Add missing comma in DOCKER_CONFIG_KEYS list
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-01 16:40:43 -08:00
Joffrey F
11038c455b Merge pull request #4334 from muicoder/master
add IMAGE_EVENTS: load/save
2017-02-01 15:49:03 -08:00
Peter Urda
a67500ee57
Added top to docker-compose to display running processes.
This commit allows `docker-compose` to access `top` for containers
much like running `docker top` directly on a given container.

This commit includes:

* `docker-compose` CLI changes to expose `top`
* Completions for `bash` and `zsh`
* Required testing for the new `top` command

Signed-off-by: Peter Urda <peter.urda@gmail.com>
2017-02-01 15:42:30 -08:00
Joffrey F
1f39b33357 Merge pull request #3989 from mattjbray/patch-1
Zsh completion: permit multiple --file arguments
2017-02-01 15:08:39 -08:00
Joffrey F
67e1111806 Merge pull request #4410 from shin-/4408-colors-no-tty
Don't strip ANSI color codes when output is not a TTY
2017-02-01 14:20:10 -08:00
Joffrey F
84774cacd2 Upgrade python and pip versions in Dockerfile
Add libbz2 dependency

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-01 14:12:41 -08:00
Joffrey F
c9eb9380ed Merge pull request #4368 from dnephin/secrets-using-bind-mounts
Secrets using bind mounts
2017-02-01 14:11:20 -08:00
Joffrey F
c16cd77737 Merge pull request #4406 from shin-/bump_docker_py
Bump docker SDK version
2017-01-31 15:36:30 -08:00
Joffrey F
8efb7e6e8b Don't strip ANSI color codes when output is not a TTY
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-31 12:51:46 -08:00
Daniel Nephin
59d1847d9b Fix some test failures.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:40 -05:00
Daniel Nephin
3a2735abb9 Rebase compose v3.1 on the latest v3
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Daniel Nephin
0d609b68ac Add a warning for unsupported secret fields.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Daniel Nephin
4053adc7d3 Add an integration test for secrets using bind mounts.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Daniel Nephin
e0c6397999 Implement secrets using bind mounts
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Daniel Nephin
add56ce818 Read service secrets as a type.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Daniel Nephin
a82de8863e Add v3.1 with secrets.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-31 09:53:16 -05:00
Joffrey F
2593366a3e Bump docker SDK version
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-30 16:49:05 -08:00
Joffrey F
22249add84 Use newer version of PyInstaller to fix prelinking issues
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-30 13:52:27 -08:00
Joffrey F
76d4f5bea6 Merge pull request #4383 from shin-/4344-detect-docker-py
Detect conflicting version of the docker python SDK
2017-01-30 12:14:27 -08:00
Joffrey F
5895d8bbc9 Detect conflicting version of the docker python SDK and prevent execution
until issue is fixed

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-26 17:12:41 -08:00
Joffrey F
e05a9f4e62 Merge pull request #4389 from shin-/4372-normalize-time-values
Convert time data back to string values when serializing config
2017-01-26 13:47:34 -08:00
Joffrey F
e10d1140b9 Convert time data back to string values when serializing config
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-26 11:59:22 -08:00
Joffrey F
56e01f25ea Merge pull request #4367 from dnephin/add-missing-network-internal-to-v3
Add missing network.internal to v3 schema.
2017-01-25 13:41:41 -08:00
Joffrey F
c86faab4ec Merge pull request #4370 from shin-/4357-win32-unicode-paths
Don't encode build context path on Windows
2017-01-23 12:04:42 -08:00
Joffrey F
20d6f450b5 Don't encode build context path on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-20 15:05:53 -08:00
Daniel Nephin
644e1716c3 Add missing network.internal to v3 schema.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-20 12:55:59 -05:00
Joffrey F
9a0962dacb Merge pull request #4361 from shin-/4348-serialize-ext-volumes
Remove external_name from volume def in config output
2017-01-19 17:41:08 -08:00
Joffrey F
263b9e9317 Merge pull request #4360 from shin-/4359-volume-labels
Fix volume definition in v3 schema
2017-01-19 17:40:29 -08:00
Joffrey F
d83d31889e Remove external_name from volume def in config output
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-19 16:05:13 -08:00
Joffrey F
5c2165eaaf Fix volume definition in v3 schema
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-19 15:41:31 -08:00
Joffrey F
8a27a0f059 Merge pull request #4350 from shin-/fix-invalid-depends-on-merge
depends_on merge now retains condition information when present
2017-01-19 14:50:29 -08:00
Joffrey F
b47c97e94e Merge pull request #4358 from shin-/1.11-dev
1.11.0dev
2017-01-19 14:50:10 -08:00
Joffrey F
a482c138d8 Merge pull request #4353 from xulike666/fight-for-readability
Fix typo in script/test/versions.py
2017-01-19 14:49:05 -08:00
Joffrey F
1c46525c2b 1.11.0dev
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-19 14:47:31 -08:00
Aaron.L.Xu
169289c8b6 find a fishbone
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-01-20 00:52:19 +08:00
Joffrey F
1a02121ab5 depends_on merge now retains condition information when present
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-18 17:52:03 -08:00
Joffrey F
708c4f9534 Merge pull request #4339 from shin-/4328-catch-healthcheck-exception
Catch healthcheck exceptions in parallel_execute
2017-01-17 14:16:37 -08:00
Joffrey F
56a1b02aac Catch healthcheck exceptions in parallel_execute
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-17 13:22:16 -08:00
muicoder
931027c598 add IMAGE_EVENTS: load/save
Signed-off-by: muicoder <muicoder@gmail.com>
2017-01-16 10:53:40 +08:00
Joffrey F
5ade097d74 Merge pull request #4324 from shin-/4321-v3-depends-on
Provide valid serialization of depends_on when format is not 2.1
2017-01-12 11:52:15 -08:00
Joffrey F
62cdd25b7d Merge pull request #4323 from shin-/fix-push-release-script
Use correct wheel file name in twine upload command
2017-01-12 11:52:05 -08:00
Joffrey F
2df31bb13c Provide valid serialization of depends_on when format is not 2.1
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-11 16:25:40 -08:00
Joffrey F
29b46d5b26 Use correct wheel file name in twine upload command
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-11 15:39:48 -08:00
Joffrey F
2091149fee Merge pull request #4317 from shin-/release-script-fixes
Fix docker image build script when using universal wheels
2017-01-10 17:21:27 -08:00
Joffrey F
19190ea0df Fix docker image build script when using universal wheels
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-10 16:43:26 -08:00
Joffrey F
1c1fe89e43 Merge pull request #4316 from shin-/update-setup-py
Update setup.py extra_requires
2017-01-10 15:50:11 -08:00
Joffrey F
52792b7a96 Update setup.py extra_requires
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-10 14:59:11 -08:00
Joffrey F
9f6778aa73 Merge pull request #4172 from graingert/enable-universal-wheels
enable universal wheels
2017-01-10 14:57:22 -08:00
Joffrey F
545153f117 Merge pull request #4288 from tntC4stl3/fix_404_issue
Fix 404 issue, change APIError to more accureate ImageNotFound
2017-01-09 16:43:57 -08:00
Joffrey F
3f7b3fbf0a Merge pull request #4304 from shin-/4302-dockerignore-windows
Use docker SDK patch
2017-01-09 16:14:57 -08:00
Joffrey F
88294b46dd Merge pull request #4294 from shin-/4240-compose-convert-false
Ensure falsy values in COMPOSE_CONVERT_WINDOWS_PATHS are properly recognized
2017-01-09 15:49:44 -08:00
Joffrey F
2c157e8fa9 Use docker SDK 2.0.1
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-09 15:27:20 -08:00
Joffrey F
b570cba965 Merge pull request #3961 from ankon/patch-1
Fix typo
2017-01-09 12:15:04 -08:00
Joffrey F
3bb8a7d178 Merge pull request #4297 from shin-/4271-fix-schemas
Fix config schemas (misplaced "additionalProperties")
2017-01-06 12:10:22 -08:00
Joffrey F
45c7ee4466 Merge pull request #4279 from dnephin/fix-schema-typo
Fix schema typo
2017-01-05 17:15:39 -08:00
Joffrey F
e063c5739f Fix config schemas (misplaced "additionalProperties")
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-05 11:18:21 -08:00
Joffrey F
534b4ed820 Falsy values in COMPOSE_CONVERT_WINDOWS_PATHS are properly recognized
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 15:45:11 -08:00
Joffrey F
27d91bba01 Merge pull request #4293 from shin-/stop_timeout_v2.1
Add support for stop_grace_period in v2
2017-01-04 15:14:18 -08:00
Joffrey F
1be41f59c9 Add support for stop_grace_period in v2
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 14:30:20 -08:00
Joffrey F
838bdd71f3 Merge pull request #4291 from shin-/unify-healthcheck-def-v2v3
Unify healthcheck spec definition in v2 and v3
2017-01-04 13:53:39 -08:00
Joffrey F
47b672e393 Merge pull request #4051 from shin-/update-release-process
Update release process document to account for recent changes.
2017-01-04 13:15:49 -08:00
Joffrey F
8145429399 Unify healthcheck spec definition in v2 and v3
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 13:14:23 -08:00
Joffrey F
be88bb0e6c Merge pull request #4267 from shin-/3754-depends-on-healthcheck
Allow service dependencies to wait on healthy containers
2017-01-04 13:00:19 -08:00
Joffrey F
bef2308530 Fix condition name in config tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 11:28:30 -08:00
Joffrey F
04394b1d0a Expand depends_on to allow different conditions (service_start, service_healthy)
Rework "up" and "start" to wait on conditional state of dependent services
Add integration tests

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 11:28:30 -08:00
Joffrey F
f6edd610f3 Add 3.0 schema to docker-compose.spec
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 11:26:45 -08:00
Joffrey F
0edfe08bf0 Add healthchecks to 2.1 schema. Update depends_on
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-04 11:26:45 -08:00
Thomas Grainger
2648af6807
enable universal wheels
Signed-off-by: Thomas Grainger <tom.grainger@procensus.com>
2017-01-04 18:33:58 +00:00
Jun Guo
c73fc26824 Fix 404 issue, change APIError to more accureate ImageNotFound
Signed-off-by: Jun Guo <blackhumour.gj@gmail.com>
2017-01-04 15:42:31 +08:00
Daniel Nephin
a74b2f2f70 Fix schema typo.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-28 15:16:53 -05:00
Joffrey F
09690e1758 Merge pull request #4220 from shin-/4211-default_network_labels
Add default labels to networks and volumes created by Compose
2016-12-20 02:34:57 -08:00
Joffrey F
3058e39407 Merge pull request #4268 from shin-/jtakkala-3765-sysctl-support
Add sysctl option support when creating service
2016-12-20 02:34:02 -08:00
Joffrey F
e1ebb0df22 Merge pull request #4070 from shin-/use-colorama
Use colorama to enable colored output on Windows
2016-12-20 02:32:51 -08:00
Joffrey F
ba47fb99ba Add default labels to networks and volumes created by Compose
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-19 20:43:35 -08:00
Joffrey F
346802715d Use colorama to enable colored output on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-19 20:40:47 -08:00
Joffrey F
eb6441c8e3 Add sysctls option to 3.0 schema
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-19 20:35:09 -08:00
Joffrey F
82230071d5 Merge branch '3765-sysctl-support' of https://github.com/jtakkala/compose into jtakkala-3765-sysctl-support
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-19 20:33:54 -08:00
Joffrey F
e6b2949edc Merge pull request #4216 from lawliet89/userns_mode
Implement `userns_mode` HostConfig for services
2016-12-19 18:12:15 -08:00
Joffrey F
ea7b565009 Merge pull request #4232 from shin-/attachable_networks
Make created networks attachable for file format >=2.1
2016-12-16 13:06:57 -08:00
Joffrey F
e736151ee4 Make created networks attachable for file format >=2.1
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-16 12:23:24 -08:00
Joffrey F
fb165d9c15 Add v3_only marker to healthcheck test
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-16 12:21:59 -08:00
Joffrey F
9cb6a70b6f Merge pull request #4219 from shin-/dockerpy_2.0
Use docker SDK 2.0
2016-12-14 16:19:34 -08:00
Joffrey F
04e5925a23 Use docker SDK 2.0
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-14 15:36:08 -08:00
Joffrey F
635a281777 Merge pull request #4163 from aanand/add-healthcheck
Implement 'healthcheck' option
2016-12-14 15:35:05 -08:00
Aanand Prasad
599b29e405 Merge pull request #4213 from shin-/4212-interactive-connect
Win32 interactive run - Connect container to networks before starting
2016-12-08 13:41:33 +00:00
Aanand Prasad
30eac9f1ae Merge pull request #4226 from dnephin/update-api-version-for-v3
Increase minimum version for compose format v3
2016-12-07 16:59:28 +00:00
Daniel Nephin
e04a12b5ca Increase minimum version for v3.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-07 11:16:40 -05:00
Joffrey F
b453ee46e8 Merge pull request #4228 from shin-/bump_version
Bump master version to 1.10.0dev
2016-12-06 17:50:44 -08:00
Joffrey F
4d0575355c Bump master version to 1.10.0dev
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-06 17:14:05 -08:00
Yong Wen Chua
62f8b1402e Implement userns_mode HostConfig for services
Fixes #3349

This allows the key `userns_mode` to be used in service definitions.
Since `userns_mode` requires API version > 1.23, this is only available
in 2.1 and 3.0 versions of compose file

Signed-off-by: Yong Wen Chua <me@yongwen.xyz>
2016-12-05 14:25:56 +08:00
Joffrey F
6aacf51427 Win32 interactive run - Connect container to networks before starting
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-02 16:10:15 -08:00
Joffrey F
9bfb855b89 Merge pull request #4187 from ijc25/pull-urxvt-corruption
progress_stream: Avoid undefined ANSI escape codes
2016-12-02 13:54:08 -08:00
Ian Campbell
dc9184a90f progress_stream: Avoid undefined ANSI escape codes
The ANSI escape codes \e[0A (cursor up 0 lines) and \e[0B (cursor down 0 lines)
are not well defined and are treated differently by different terminals. In
particular xterm treats 0 as a missing parameter and therefore defaults to 1,
whereas rxvt-unicode treats these escapes as a request to move 0 lines.

However the use of these codes is unnecessary and were really just hiding the
fact that we were not correctly computing diff when adding a new line. Having
added the new line to the ids map and output the corresponding \n the correct
diff would be 1 and not 0 (which xterm interprets as 1) as currently.

Rather than changing the hardcoded 0 to a 1 pull the diff calculation out and
always do it since it produces the correct answer in both cases.

This fixes similar corruption when compose is pulling an image to that seen
with `docker pull` and rxvt-unicode (and likely other terminals in that family)
seen in docker/docker#28111.

This is the same as the fix made to Docker's pkg/jsonmessage in
https://github.com/docker/docker/pull/28238 (and I have shamelessly ripped off
most of this commit message from there).

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-11-25 10:16:37 +00:00
Joffrey F
def150a129 Merge pull request #4173 from graingert/case-pypi-correctly
case PyPI correctly
2016-11-22 18:15:10 -08:00
Aanand Prasad
af894b4dff Merge pull request #4170 from dnephin/warn-on-deploy
Update messages about docker stack deploy
2016-11-22 17:07:13 +00:00
Thomas Grainger
024b5dd6da
case PyPI correctly
Signed-off-by: Thomas Grainger <tom.grainger@procensus.com>
2016-11-22 11:15:21 +00:00
Daniel Nephin
c26a2afaf3 Update messages about docker stack deploy.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-11-21 16:34:49 -05:00
Aanand Prasad
716a6baa59 Implement 'healthcheck' option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-18 14:47:02 +00:00
Joffrey F
f5ad3e7577 Merge pull request #4165 from shin-/changelog_update
Changelog update
2016-11-17 13:29:32 -08:00
Joffrey F
b93211881b Changelog update
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-16 13:35:29 -08:00
Aanand Prasad
466ebb6cc1 Merge pull request #4146 from dnephin/add-stop-grace-period
Add stop grace period to v3
2016-11-16 17:56:20 +00:00
Daniel Nephin
079c95c340 Use stop grace period for container stop.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-11-16 12:12:28 -05:00
Daniel Nephin
6cac48c056 Add a vendored and modified pytimeparse
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-11-16 12:10:32 -05:00
Aanand Prasad
586443ba5d Merge pull request #4147 from aanand/version-3.0
Support version 3.0 of the Compose file format
2016-11-16 16:34:50 +00:00
Aanand Prasad
f75ef6862f Warn if any services use 'deploy'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-16 16:07:02 +00:00
Aanand Prasad
d717c88b6e Support version 3.0 of the Compose file format
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-16 16:07:02 +00:00
Joffrey F
721bf89447 Merge pull request #4134 from shin-/fix_none_opts_network_check
Avoid breaking when remote driver options are null
2016-11-15 15:01:24 -08:00
Joffrey F
09540339e0 Merge pull request #4131 from aanand/test-environment-overrides-env-file
Test that values in 'environment' override env files
2016-11-15 14:18:54 -08:00
Joffrey F
7f60ff5ae6 Avoid breaking when remote driver options are null.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-15 12:00:52 -08:00
Joffrey F
3d0747017a Merge pull request #4151 from shin-/fix_ignore_pull_failure_behavior_1.13
Handle new pull failures behavior in Engine 1.13
2016-11-15 12:00:19 -08:00
Joffrey F
efb4ed1b9e Handle new pull failures behavior in Engine 1.13
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-15 11:30:52 -08:00
Joffrey F
d7e9748501 Merge pull request #4150 from shin-/test_only_ubuntu_host
Limit testing pool to Ubuntu hosts to avoid errors with dind
2016-11-14 18:04:30 -08:00
Joffrey F
0291d9ade5 Limit testing pool to Ubuntu hosts to avoid errors with dind not
starting properly.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-14 17:23:25 -08:00
Jari Takkala
91620ae97b Add sysctl option support when creating service
Closes #3765

Signed-off-by: Jari Takkala <jtakkala@gmail.com>
2016-11-10 16:41:16 -05:00
Aanand Prasad
ba249e5179 Test that values in 'environment' override env files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-09 15:10:27 +00:00
Joffrey F
0e28163ccb Merge pull request #4115 from shin-/fix_overlay_options_mismatch
Call check_remote_network_config from Network.ensure
2016-11-08 15:35:38 -08:00
Aanand Prasad
0902edef43 Merge pull request #4113 from shin-/4103-merge-empty-logging
Fix logging dict merging
2016-11-08 14:56:27 +00:00
Joffrey F
4aa7d15d97 Call check_remote_network_config from Network.ensure
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-04 10:51:14 -07:00
Joffrey F
10417eebd7 Fix logging dict merging
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-03 17:22:31 -07:00
Joffrey F
9046e33ab2 Merge pull request #4112 from mikedougherty/rm-docs-checker
Remove docs checker from Jenkinsfile and use cleanWorkspace option on wrappedNode
2016-11-03 17:22:05 -07:00
Mike Dougherty
da1508051d Remove docs checker from Jenkinsfile and use cleanWorkspace option on wrappedNode
Signed-off-by: Mike Dougherty <mike.dougherty@docker.com>
2016-11-03 14:00:17 -07:00
Joffrey F
969abca47f Merge pull request #4098 from shin-/fix_overlay_options_mismatch
Add whitelisted driver option added by the overlay driver
2016-11-03 11:43:11 -07:00
Joffrey F
d525dd1846 Merge pull request #4104 from shin-/bump_docker_py
Bump docker-py
2016-11-03 11:43:04 -07:00
Joffrey F
7a430dbe96 Updated docker-py dependency to latest version
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-02 16:56:45 -07:00
Joffrey F
3b46a62f36 Merge pull request #4073 from mikedougherty/jenkinsfile
Update Jenkinsfile to run "janky" tasks
2016-11-02 14:55:11 -07:00
Joffrey F
ba43d08fbd Add whitelisted driver option added by the overlay driver to avoid breakage
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-01 11:47:12 -07:00
Joffrey F
ed71391f66 Merge pull request #4062 from strayobject/patch-1
fix(docs): updated documentation links
2016-10-28 11:55:58 -07:00
Joffrey F
e563b58595 Merge pull request #4071 from NiR-/fix/run-as-container
Fix path of the parent dir of COMPOSE_FILE
2016-10-27 15:03:54 -07:00
Aanand Prasad
62c9ed93d0 Merge pull request #4084 from shin-/bump_docker_py
Bump docker-py version to include latest patch
2016-10-27 12:53:44 -07:00
Joffrey F
046144e8f4 Bump docker-py version to include latest patch
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-27 12:13:32 -07:00
Mike Dougherty
4871523d5e Update Jenkinsfile to perform existing jenkins tasks
Signed-off-by: Mike Dougherty <mike.dougherty@docker.com>
2016-10-25 11:51:02 -07:00
Aanand Prasad
505c785c5c Merge pull request #4066 from shin-/fix-schema-divergence
Fix schema divergence - add missing fields to compose 2.1 schema
2016-10-25 11:20:51 -07:00
Albin Kerouanton
99343fd76c Fix path of the parent dir of COMPOSE_FILE
Signed-off-by: Albin Kerouanton <albin.kerouanton@knplabs.com>
2016-10-25 11:09:45 +02:00
Aanand Prasad
8b5782ba9f Merge pull request #4067 from shin-/portable-find-exe
Replace "which" calls with the portable find_executable function
2016-10-24 16:15:21 -07:00
Aanand Prasad
d586328812 Merge pull request #4065 from shin-/refine-swarm-warning
Do not print Swarm mode warning when connecting to a UCP server
2016-10-24 16:15:14 -07:00
Aanand Prasad
021bb41fc6 Merge pull request #4069 from shin-/project_tests_robustness
Improve robustness of a couple integration tests with occasional failures
2016-10-24 15:35:52 -07:00
Joffrey F
60d005b055 Improve robustness of a couple integration tests with occasional failures
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-24 13:58:45 -07:00
Joffrey F
d2fb146913 Replace "which" calls with the portable find_executable function
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-24 13:22:52 -07:00
Joffrey F
43e29b41c0 Fix schema divergence - add missing fields to compose 2.1 schema
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-24 11:51:45 -07:00
Joffrey F
a652b6818c Merge pull request #4064 from shin-/missing-2.1-spec
Add missing config schema to docker-compose.spec
2016-10-24 11:43:17 -07:00
Joffrey F
ea68be3441 Do not print Swarm mode warning when connecting to a UCP server
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-24 11:36:44 -07:00
Joffrey F
2c24bc3a08 Add missing config schema to docker-compose.spec
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-24 10:55:04 -07:00
Michal Zdrojewski
3d8dc6f47a fix(docs): updated documentation links
Signed-off-by: Michal Zdrojewski <code@strayobject.co.uk>
2016-10-24 15:41:31 +01:00
Joffrey F
f039c8b43c Update release process document to account for recent changes.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-20 17:47:07 -07:00
Joffrey F
3147090fb4 Merge pull request #4030 from shin-/npipe-fixes
Bump docker-py dependency (includes several npipe fixes)
2016-10-19 11:44:52 -07:00
Joffrey F
de15ec835a Merge pull request #3980 from aanand/shell-out-attach
Attach interactively on Windows by shelling out
2016-10-19 11:14:36 -07:00
Joffrey F
2d3c76950f Merge pull request #3972 from shin-/fix-contributors-script
Fix the contributors script
2016-10-18 15:25:55 -07:00
Joffrey F
932b3cc10a Merge pull request #4026 from shin-/3923-windows-volumes
Do not normalize volume paths on Windows by default
2016-10-18 14:41:52 -07:00
Joffrey F
db5d2bcb10 Merge pull request #3990 from shin-/fix-osx-build
Fix openssl dependency in OSX binary build
2016-10-18 14:14:30 -07:00
Joffrey F
cd94c37f5d Fix merge error (missing Network.labels attribute)
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-18 14:09:31 -07:00
Joffrey F
efb09af271 Do not normalize volume paths on Windows by default
Add environment variable to enable normalization if needed.
Do not normalize internal paths

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-18 12:17:56 -07:00
Joffrey F
f60c60205b Merge branch 'dbdd4us-master' 2016-10-17 14:09:40 -07:00
Joffrey F
14716bc2da Merge branch 'master' of https://github.com/dbdd4us/compose into dbdd4us-master 2016-10-17 14:09:09 -07:00
Joffrey F
882084932d Upgrade docker-py to latest version
Adjust required requests version

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-17 14:03:21 -07:00
Joffrey F
a5c1e4b0cd Merge pull request #3991 from shin-/3906-isolation-config
Add support for "isolation" in config
2016-10-17 11:02:11 -07:00
Joffrey F
95c6cc0420 Merge pull request #3994 from shin-/3430-enable-ipv6
Add support for enable_ipv6 in network definition.
2016-10-17 11:02:00 -07:00
Joffrey F
50faddb683 Merge pull request #4034 from realab/fix-restart-with-null-string
fix serialize restart spec with null string
2016-10-14 14:34:35 -07:00
Aanand Prasad
925915eb25 Show clear error when docker binary can't be found
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-10-14 17:31:21 +01:00
Aanand Prasad
8314a48a2e Attach interactively on Windows by shelling out
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-10-14 17:31:21 +01:00
Aanand Prasad
8b383ad795 Refactor "docker not found" message generation, add Windows message
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-10-14 17:31:21 +01:00
realityone
22d91f60be
fix serialize restart spec with null string
Signed-off-by: realityone <realityone@me.com>
2016-10-14 18:20:55 +08:00
dbdd
bdcce13f4a add support for creating volume and network with label definition
Signed-off-by: dbdd <wangtong2712@gmail.com>
2016-10-12 10:35:14 +08:00
Joffrey F
e4bb9bde30 Merge pull request #3964 from shin-/3963-unicode-env
Don't break when interpolating environment with unicode characters
2016-10-11 12:00:36 -07:00
Joffrey F
7f1606545d Merge pull request #4004 from shin-/4000-extend-logging
Properly merge logging dictionaries in overriding configs
2016-10-11 12:00:06 -07:00
Joffrey F
0603b445e2 Properly merge logging dictionaries in overriding configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-10 15:39:05 -07:00
Joffrey F
9248298a4a Merge pull request #4016 from shin-/4008-unicode-formatter
Handle formatter case where logrecord message is binary containing unicode
2016-10-06 16:49:03 -07:00
Joffrey F
bc3ed6dead Merge pull request #3992 from shin-/3701-npipe-windows-default
Use docker-py's default behavior when no explicit host on Windows
2016-10-06 16:48:35 -07:00
Joffrey F
e5ded6ff9b Add support for enable_ipv6 in network definition.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-06 15:49:08 -07:00
Joffrey F
804555bc4d Merge pull request #4015 from dnephin/fix-inline-defaults
Support non-alphanumeric default values.
2016-10-06 15:46:35 -07:00
Joffrey F
17c5b45641 Handle formatter case where logrecord message is binary containing
unicode characters.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-06 15:39:47 -07:00
Daniel Nephin
2bce81508e Support non-alphanumeric default values.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-10-06 17:04:19 -04:00
Victoria Bialas
8f636d8279 Merge pull request #4010 from londoncalling/add-vnext-info
updated README per vnext branch plan
2016-10-05 18:47:00 -07:00
Joffrey F
b50b14f937 Fix openssl dependency in OSX binary build
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-05 17:08:14 -07:00
Victoria Bialas
a8ff4285d1 updated README per vnext branch plan
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-10-05 16:19:09 -07:00
Joffrey F
eac01a7cd5 Merge pull request #3108 from dnephin/inplace_var_defaults
Support inline default values for interpolation
2016-10-05 14:22:02 -07:00
John Mulhausen
85d6d7955f Merge pull request #4005 from johndmulhausen/master
Remove old documentation source, add README on migration
2016-10-04 19:08:36 -07:00
John Mulhausen
1a4e81920b Remove old documentation source, add README on migration
Signed-off-by: John Mulhausen <john@docker.com>
2016-10-04 17:58:44 -07:00
Matt Bray
a37d99f201 Zsh completion: change --file description text
Signed-off-by: Matt Bray <mattjbray@gmail.com>
2016-09-30 00:45:46 +01:00
Daniel Nephin
fe08be698d Support inline default values.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-29 12:46:11 -04:00
Joffrey F
007cf96452 Use docker-py's default behavior when no explicit host on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-28 15:36:57 -07:00
Joffrey F
dc8a39f70d Add support for "isolation" in config
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-28 15:31:58 -07:00
Matthew Bray
90356b7040 Zsh completion: permit multiple --file arguments
Before this change:

```
$ docker-compose --file docker-compose.yml -<TAB>
 -- option --
--help                 -h  -- Get help
--host                 -H  -- Daemon socket to connect to
--project-name         -p  -- Specify an alternate project name (default: directory name)
--skip-hostname-check      -- Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)
--tls                      -- Use TLS; implied by --tlsverify
--tlscacert                -- Trust certs signed only by this CA
--tlscert                  -- Path to TLS certificate file
--tlskey                   -- Path to TLS key file
--tlsverify                -- Use TLS and verify the remote
--verbose                  -- Show more output
--version              -v  -- Print version and exit
```

(Note the `--file` argument is no longer available to complete.)

After this change:

```
docker-compose --file docker-compose.yml -<TAB>
 -- option --
--file                 -f  -- Specify an alternate docker-compose file (default: docker-compose.yml)
--help                 -h  -- Get help
--host                 -H  -- Daemon socket to connect to
--project-name         -p  -- Specify an alternate project name (default: directory name)
--skip-hostname-check      -- Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)
--tls                      -- Use TLS; implied by --tlsverify
--tlscacert                -- Trust certs signed only by this CA
--tlscert                  -- Path to TLS certificate file
--tlskey                   -- Path to TLS key file
--tlsverify                -- Use TLS and verify the remote
--verbose                  -- Show more output
--version              -v  -- Print version and exit
```

Signed-off-by: Matt Bray <mattjbray@gmail.com>
2016-09-28 12:04:13 +01:00
Joffrey F
5667de87e8 Fix the contributors script to show only contributors on the current branch
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-22 12:34:59 -07:00
Joffrey F
f65f89ad8c Merge pull request #3653 from shin-/3637-link-local-ips
Add support for link-local IPs in service.networks definition
2016-09-22 11:58:29 -07:00
Daniel Nephin
5b27389571 Merge pull request #3956 from shin-/update_dockerpy_version
Bump docker-py dependency
2016-09-21 10:08:48 -04:00
Joffrey F
53fa44c01e Don't break when interpolating environment with unicode characters
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-20 18:05:59 -07:00
Joffrey F
7687412e03 Merge pull request #3922 from shin-/3897-volumespec_parse_win32
Improve volumespec parsing on windows platforms
2016-09-20 13:09:37 -07:00
Joffrey F
33424189d4 Denormalize function defaults to latest version
Minor docs fix

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-20 11:47:14 -07:00
Joffrey F
7911659266 Improve volumespec parsing on windows platforms
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-20 11:24:24 -07:00
Andreas Kohn
cb3bf869f4 Fix typo
Signed-off-by: Andreas Kohn <andreas.kohn@gmail.com>
2016-09-20 13:59:17 +02:00
Joffrey F
1648a3e257 Merge pull request #3709 from Knetic/groupadd
Supported group_add
2016-09-19 17:18:06 -07:00
Joffrey F
fc6791f3f0 Bump docker-py dependency
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-16 14:12:15 -07:00
Joffrey F
1d03baa9b1 Merge pull request #3954 from shin-/windows_tcp_default
Force default host on windows to the default TCP host (instead of npipe)
2016-09-16 14:09:10 -07:00
Joffrey F
64517e31fc Force default host on windows to the default TCP host (instead of npipe)
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-16 11:43:25 -07:00
Joffrey F
66b395d950 Include docker-py link-local fix and improve integration test
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-15 14:55:42 -07:00
Joffrey F
fd254caa68 Add support for link-local IPs in service.networks definition
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-15 14:55:14 -07:00
Joffrey F
651283eef9 Merge pull request #3941 from shin-/3888-recover-apierror-logs
Catch APIError while printing container logs
2016-09-13 12:58:40 -07:00
Joffrey F
f065ce0f73 Merge pull request #3942 from shin-/3873-syslog-logs-error
Only allow log streaming if logdriver is json-file
2016-09-13 12:28:27 -07:00
Joffrey F
3fcd648ba2 Catch APIError while printing container logs
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-13 12:10:41 -07:00
Joffrey F
7dd2e33057 Only allow log streaming if logdriver is json-file or journald
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-13 11:56:26 -07:00
Joffrey F
1b2354c6f4 Merge pull request #3943 from aanand/fix-integration-test-on-docker-for-mac
Fix integration test on Docker for Mac
2016-09-13 11:54:16 -07:00
Daniel Nephin
ac9198e638 Merge pull request #3930 from shin-/update_dockerpy_version
Update docker-py dependency to latest release
2016-09-13 10:35:56 -04:00
Daniel Nephin
9faa852d41 Merge pull request #3921 from shin-/3890-pull-services
Fix command hint in bundle to pull services instead of images
2016-09-13 10:32:14 -04:00
Aanand Prasad
9759f27fa6 Fix integration test on Docker for Mac
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-09-13 14:50:37 +01:00
Joffrey F
b64bd07f22 Update docker-py dependency to latest release
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-12 14:34:07 -07:00
George Lester
dada36f732 Supported group_add
Signed-off-by: George Lester <glester491@gmail.com>
2016-09-11 23:10:49 -07:00
Joffrey F
817c76c8e9 Fix command hint in bundle to pull services instead of images
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-08 11:17:39 -07:00
Joffrey F
3dec600d82 Merge pull request #3830 from shin-/3534-machine-config-args
Remove surrounding quotes from TLS paths, if present
2016-09-07 18:35:43 -07:00
Ben Firshman
c197e02ecc Merge pull request #3814 from aanand/disambiguate-swarm
Disambiguate 'Swarm' in integration doc
2016-09-07 10:46:14 +01:00
Joffrey F
267a243f80 Merge pull request #3799 from aanand/handle-connection-error-on-project-init
Handle connection errors on project initialization
2016-09-06 10:25:48 -07:00
Sven Dowideit
08179fc7e3 Merge pull request #3865 from SvenDowideit/add-jenkinsfile
Add docs checking Jenkinsfile
2016-08-24 15:01:36 +10:00
Sven Dowideit
bf91c64983 Add docs checking Jenkinsfile
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-08-22 12:18:07 +10:00
Ben Firshman
acfe100686 Merge pull request #3542 from jfroche/add_swappiness
Add support for swappiness constraint
2016-08-16 13:58:33 +01:00
Jean-François Roche
d824cb9b06 Add support for swappiness constraint
Run a service using `docker run --memory-swappiness=0` (see
https://docs.docker.com/engine/reference/run/)

refs #2383

Signed-off-by: Jean-François Roche <jfroche@affinitic.be>
2016-08-16 11:02:51 +02:00
Joffrey F
13bcd85eb3 Merge pull request #3808 from jgsqware/patch-1
Update rm.md
2016-08-09 15:16:48 -07:00
Joffrey F
c0305024f5 Remove surrounding quotes from TLS paths, if present
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-08-09 15:13:01 -07:00
JG²
17f46f8999 Update rm.md
Receiving this message when using the -a flag : `--all flag is obsolete. This is now the default behavior of `docker-compose rm`, I proposed to mark it in the docs but I don't know which way is the best

Signed-off-by: jgsqware <garciagonzalez.julien@gmail.com>
2016-08-05 13:41:20 +02:00
Aanand Prasad
4cba653eeb Disambiguate 'Swarm' in integration doc
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-08-04 15:19:02 +01:00
Aanand Prasad
d29f8e1022 Merge pull request #3789 from shin-/3788-json-splitter-fix
json_splitter: Don't break when buffer contains leading whitespace.
2016-08-03 13:23:52 +01:00
Joffrey F
9abbe1b7f8 Catchable error for parse failures in split_buffer
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-08-02 12:48:32 -07:00
Aanand Prasad
b3a4d76d4f Handle connection errors on project initialization
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-08-02 11:44:25 +01:00
Victoria
589fb4925e Merge pull request #3797 from aanand/note-about-experimental-build
Add note to bundle docs about requiring an experimental Engine build
2016-08-01 12:25:38 -07:00
Aanand Prasad
48258e2b46 Add note to bundle docs about requiring an experimental Engine build
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-08-01 12:25:49 +01:00
Joffrey F
6ce066274e Merge pull request #3784 from aanand/fix-timeout-error
Fix stacktrace when handling timeout error
2016-07-29 14:09:21 -07:00
Joffrey F
6f4be1cffc json_splitter: Don't break when buffer contains leading whitespace.
Add error logging with detailed output for decode errors

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-29 14:05:59 -07:00
Aanand Prasad
5aeeecb6f2 Fix stacktrace when handling timeout error
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-29 17:12:46 +01:00
Daniel Nephin
dec2c83014 Merge pull request #3778 from shin-/1.8.0-release-master-changes
1.8.0 release master changes
2016-07-27 18:04:43 -04:00
Joffrey F
d5765b7856 Merge pull request #3771 from aanand/shell-completion-for-push-images
Shell completion for --push-images
2016-07-27 13:35:05 -07:00
Joffrey F
6ab0607e61 Switch back to dev version
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-27 13:30:52 -07:00
Joffrey F
1110af1bae Bump 1.8.0
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-27 13:30:06 -07:00
Aanand Prasad
7fafd72c1e Bump 1.8.0-rc3
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-27 13:22:20 -07:00
Aanand Prasad
60622026fa Bump 1.8.0-rc2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-27 13:22:07 -07:00
Joffrey F
22c0779a49 Bump 1.8.0-rc1
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-27 13:21:47 -07:00
Joffrey F
647f260b0a Merge pull request #3774 from aanand/fix-tls-version-error-message
Fix error message for unrecognised TLS version
2016-07-27 10:35:21 -07:00
Aanand Prasad
ec825af3d3 Fix error message for unrecognised TLS version
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-27 18:26:40 +01:00
Aanand Prasad
6633f1962c Shell completion for --push-images
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-27 16:00:53 +01:00
Aanand Prasad
e9d62e8404 Merge pull request #3676 from aanand/warn-for-swarm-mode
Show a warning when engine is in swarm mode
2016-07-27 15:38:09 +01:00
Aanand Prasad
ef4ad93d1e Merge pull request #3760 from bfirsh/useragent
Add user agent to API calls
2016-07-27 14:55:18 +01:00
Aanand Prasad
69b91ef6ba Merge pull request #3636 from dnephin/add_missing_ref_docs
Add missing reference docs for push and bundle
2016-07-27 14:30:17 +01:00
Ben Firshman
1877a41b92
Add user agent to API calls
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-07-27 14:26:15 +01:00
Aanand Prasad
5f0186e008 Merge pull request #3769 from shin-/upgrade-dockerpy-1.9.0
Update to docker-py 1.9.0
2016-07-27 11:56:13 +01:00
Joffrey F
7f3375c2ce Update docker-py requirement to the latest release
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-07-26 13:07:38 -07:00
Daniel Nephin
2fec6966d4 Add reference docs for push and bundle.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-07-26 15:18:09 -04:00
Ben Firshman
4a8b88bc2e Merge pull request #3763 from aanand/remove-experimental-networking-doc
Remove doc on experimental networking support
2016-07-26 14:24:04 +01:00
Aanand Prasad
8ffbe8e083 Remove note about .dsb
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-26 11:59:04 +01:00
Aanand Prasad
28e6508f4a Add note about missing volume mount support
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-26 11:51:30 +01:00
Aanand Prasad
8924f6c05c Fix example image hash
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-26 11:51:16 +01:00
Aanand Prasad
4598dfc79f Merge pull request #3762 from aanand/pull-flag-on-bundle
Rename --fetch-digests to --push-images and remove auto-pull
2016-07-26 11:01:32 +01:00
Aanand Prasad
887ed8d1b6 Rename --fetch-digests to --push-images and remove auto-pull
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-25 17:36:24 +01:00
Aanand Prasad
583bbb4635 Copy experimental bundle docs into Compose docs so URL is stable
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-25 13:46:56 +01:00
Aanand Prasad
2c9e46f60f Show a warning when engine is in swarm mode
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-25 13:46:56 +01:00
Aanand Prasad
07e2426d89 Remove doc on experimental networking support
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-25 13:38:04 +01:00
Daniel Nephin
619bf4c4df Merge pull request #3705 from aanand/fix-timeout-message
Fix timeout value in error message
2016-07-22 10:57:41 -04:00
Daniel Nephin
10749e187c Merge pull request #3718 from aanand/fix-run-entrypoint
Fix bugs with entrypoint/command in docker-compose run
2016-07-22 10:55:25 -04:00
Aanand Prasad
7f65caa97b Merge pull request #3747 from aanand/clarify-env-docs
Clarify environment, env_file and build.args docs
2016-07-21 16:14:26 +01:00
Daniel Nephin
a9b5e5abe0 Merge pull request #3751 from ijc25/master
Tidy up remaining lingering docker.client.Client objects in test suite
2016-07-21 11:13:29 -04:00
Ian Campbell
d6f70dddc7 Call the superclass tearDown in VolumeTest
Currently it doesn't actually seem to make any practical difference that this
is missing, but it seems like good practice to do so anyway, to be robust
against future test case changes which might require cleanup done in the super
class.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-07-21 13:17:53 +01:00
Ian Campbell
3124fec01a tearDown tmp_volumes array itself in VolumeTest
Each volume in the array holds a reference to a docker.client.Client object and
therefore a connection pool which leaves fds open once the test has completed.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-07-21 13:17:53 +01:00
Ian Campbell
5cdf30fc12 Teardown project and db in ResilienceTest
These hold a reference to a docker.client.Client object and therefore a
connection pool which leaves fds open once the test has completed.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-07-21 13:17:53 +01:00
Aanand Prasad
26b819ca67 Merge pull request #3748 from ijc25/master
tearDown the project override at the end of each test case
2016-07-20 16:28:45 +01:00
Ian Campbell
0483bcb472 delete DockerClientTestCase.client class attribute on tearDownClass
This is a docker.client.Client and therefore contains a connection pool, so
each subclass of DockerClientTestCase can end up holding on to up to 10 Unix
socket file descriptors after the tests contained in the sub-class are
complete.

Before this by the end of a test run I was seeing ~100 open file descriptors,
~80 of which were Unix domain sockets. By cleaning these up only 15 Unix
sockets remain at the end (out of ~25 fds, the rest of which are the Python
interpretter, opened libraries etc).

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-07-20 15:51:22 +01:00
Ian Campbell
6649e9aba3 tearDown the project override at the end of each test case
self._project.client is a docker.client.Client, so creating a new self._project
leaks (via the embedded connection pool) a bunch of Unix socket file
descriptors for each test which overrides self.project using this mechanism.

In my tests I observed the test harness using 800-900 file descriptor, which is
OK on Linux with the default limit of 1024 but breaks on OSX (e.g. with
Docker4Mac) where the default limit is only 256. The failure can be provoked on
Linux too with `ulimit -n 256`.

With this fix I have observed the process ending with ~100 file descriptors
open, including 83 Unix sockets, so I think there is likely at least one more
leak lurking.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-07-20 14:34:12 +01:00
Aanand Prasad
425303992c Reorder/clarify args docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-20 12:47:47 +01:00
Jarrod Pooler
9ab1d55d06 Updating arg docs in the proper place
Signed-off-by: Jarrod Pooler <jarrod.pooler@homesite.com>
2016-07-20 12:45:11 +01:00
Aanand Prasad
907b0690e6 Clarify environment and env_file docs
Add note to say that environment variables will not be automatically
made available at build time, and point to the `args` documentation.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-20 12:23:51 +01:00
Aanand Prasad
d7db15ce94 Merge pull request #3364 from TomasTomecek/3355-detailed-error-messages
service: detailed error messages for create and start
2016-07-11 16:29:35 -04:00
Aanand Prasad
593d1aeb09 Fix bugs with entrypoint/command in docker-compose run
- When no command is passed but `--entrypoint` is, set Cmd to `[]`
- When command is a single empty string, set Cmd to `[""]`

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-11 16:15:13 -04:00
Aanand Prasad
1e60030b94 Merge pull request #3488 from jgiannuzzi/internal_networks
Add support for creating internal networks
2016-07-11 15:24:29 -04:00
Jonathan Giannuzzi
83f35e132b Add support for creating internal networks
Signed-off-by: Jonathan Giannuzzi <jonathan@giannuzzi.be>
2016-07-11 11:34:01 +02:00
Tomas Tomecek
fea970dff3 service: detailed error messages for create and start
Fixes: #3355

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2016-07-11 10:45:27 +02:00
Aanand Prasad
c3fd6a8f4d Merge pull request #3704 from aanand/update-install-and-changelog-for-1.7.1
Update install.md and CHANGELOG.md for 1.7.1
2016-07-07 16:01:55 -07:00
Aanand Prasad
4207d43b85 Fix timeout value in error message
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-07 12:08:47 -07:00
Aanand Prasad
576a2ee7ae Stop checking the deprecated DOCKER_CLIENT_TIMEOUT variable
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-07 11:58:10 -07:00
Aanand Prasad
49d4fd2795 Update install.md and CHANGELOG.md for 1.7.1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-07 11:41:11 -07:00
Joffrey F
79ddf06267 Merge pull request #3662 from albers/completion-bundle--fetch-digests
bash completion for `docker-compose bundle --fetch-digests`
2016-07-07 10:39:18 -07:00
Aanand Prasad
89c9aed339 Merge pull request #3697 from aanand/pin-alpine-base-image
Pin base image to alpine:3.4 in Dockerfile.run
2016-07-06 18:04:47 -07:00
Aanand Prasad
08127625a0 Pin base image to alpine:3.4 in Dockerfile.run
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-06 18:01:27 -07:00
Aanand Prasad
1e176b58c5 Merge pull request #3592 from stakodiak/fix-privilege-typo
Fix a typo in a test's name.
2016-07-06 15:22:05 -07:00
Aanand Prasad
98818d4e50 Merge pull request #3591 from staticshock/togather
Fix a typo (togather -> together)
2016-07-06 11:45:22 -07:00
Aanand Prasad
554dc2496a Merge pull request #3590 from Knetic/oomscore
Added support for oom_score_adj
2016-07-06 11:45:09 -07:00
Aanand Prasad
dcc09b677b Merge pull request #3691 from aanand/fix-alias-tests-on-1.11
Fix alias tests on 1.11
2016-07-06 11:03:54 -07:00
Aanand Prasad
949b88fff9 Fix alias tests on 1.11
The fix in 8e04582052 caused a regression
when testing against 1.11.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-07-06 09:56:25 -07:00
Aanand Prasad
e659cd139b Merge pull request #3689 from bfirsh/docker-mac-not-running-error
Suggest to run Docker for Mac if it isn't running
2016-07-06 09:55:19 -07:00
Ben Firshman
5dabc81c16 Suggest to run Docker for Mac if it isn't running
Instead of suggesting docker-machine.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-07-06 15:43:22 +01:00
George Lester
6fe5d2b543 Implemented oom_score_adj
Signed-off-by: George Lester <glester491@gmail.com>
2016-07-05 23:43:32 -07:00
Aanand Prasad
967dce5807 Merge pull request #3671 from dnephin/fix_pip_version_osx
Update pip in travis osx build
2016-07-05 16:08:51 -07:00
Aanand Prasad
edd3637b9b Merge pull request #3669 from chrisclark/master
Docs: Typo leading to possible extreme agony
2016-07-05 16:08:08 -07:00
Ben Firshman
f9f151a51f Merge pull request #3679 from allencloud/make-output-consistent-typo
make-output-consistent-typo
2016-07-05 17:36:59 +01:00
allencloud
931b01acf9 make-output-consistent-typo
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-07-02 23:33:13 +08:00
Aanand Prasad
f1974f6c5e Merge pull request #3670 from aanand/3343-run-with-env-values-from-system
[Carry #3373] Unset env vars behavior in 'run' mirroring engine
2016-07-01 12:12:29 -07:00
Daniel Nephin
3d0a1de023 Upgrade pip on osx
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-30 20:52:15 -04:00
Aanand Prasad
50d5aab8ad Fix test: check container's Env array instead of the output of 'env'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-30 17:00:30 -07:00
Aanand Prasad
10ae81f8cf Post-merge fix - restore Environment import in main.py
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-30 15:49:16 -07:00
Joffrey F
5d244ef6d8 Unset env vars behavior in 'run' mirroring engine
Unset env vars passed to `run` via command line options take the
value of the system's var with the same name.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-30 15:48:23 -07:00
Chris Clark
a62739b906 Signed-off-by: Chris Clark <chris@untrod.com>
The postgres image expects a specific volume path. The docs had a typo in that path. This can cause a lot of agony. This is not hypothetical agony, but very real agony that was very recently experienced :)
2016-06-30 15:30:22 -07:00
Daniel Nephin
3d20e25bf8 Merge pull request #3661 from dnephin/fix_requirements
Add missing deps to requirements.txt
2016-06-30 18:21:40 -04:00
Aanand Prasad
bc0939dcf0 Merge pull request #3645 from leonhartX/zsh-completion-bundle
add zsh completion support for bundle
2016-06-30 10:32:44 -07:00
Aanand Prasad
c0237a487b Merge pull request #3221 from aeriksson/fix-zsh-autocomplete
Fix zsh autocomplete
2016-06-29 11:08:08 -07:00
Aanand Prasad
3c8fdb8752 Merge pull request #3615 from shin-/docker-py-bump190
Update docker-py version in requirements
2016-06-29 10:49:59 -07:00
Harald Albers
622de27c1e bash completion for docker-compose bundle --fetch-digests
Signed-off-by: Harald Albers <github@albersweb.de>
2016-06-29 08:45:36 -07:00
Daniel Nephin
2b6ea847b9 Update requirements.txt
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-29 10:38:01 -04:00
Ben Firshman
da2aae2a29 Merge pull request #3570 from davidjb/patch-1
Fix minor YAML typo
2016-06-29 15:20:16 +01:00
Ke Xu
edd28f09d1 change dsb to dab
Signed-off-by: Ke Xu <leonhartx.k@gmail.com>
2016-06-29 11:01:50 +09:00
Joffrey F
93cc2675c8 Merge pull request #3625 from albers/completion-bundle
bash completion for `docker-compose bundle`
2016-06-28 15:52:37 -07:00
Joffrey F
3649df83ab Merge pull request #3626 from albers/completion-push
bash completion for `docker-compose push`
2016-06-28 15:52:14 -07:00
Joffrey F
b89dc99e8e Merge pull request #3646 from leonhartX/zsh-completion-push
add zsh completion for push
2016-06-28 15:50:32 -07:00
Joffrey F
a822406eb0 Update docker-py version in requirements
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-28 15:49:06 -07:00
Aanand Prasad
72d3d5d84b Merge pull request #3612 from dnephin/tests_for_bundle
Add some unit tests and an acceptance test for bundle
2016-06-28 14:47:29 -07:00
Aanand Prasad
55e20d1727 Merge pull request #3652 from aanand/fix-tests-for-1.12
Fix tests to accommodate short-id container alias
2016-06-28 13:27:40 -07:00
Daniel Nephin
7c06f60573 Merge pull request #3563 from adamchainz/readthedocs.io
Convert readthedocs links for their .org -> .io migration for hosted projects
2016-06-28 12:35:19 -04:00
Daniel Nephin
00decf8677 Merge pull request #3638 from aanand/update-bundle-extension
Update bundle extension
2016-06-28 11:43:58 -04:00
Daniel Nephin
5640bd42a8 Add an acceptance test for bundle.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-28 10:18:59 -04:00
Daniel Nephin
95207561bb Add some unit tests for new bundle and push commands.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-28 10:18:20 -04:00
Aanand Prasad
8e04582052 Fix tests to accommodate short-id container alias
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-27 16:21:19 -07:00
Aanand Prasad
058a7659ba Update bundle extension
It's now .dab, for Distributed Application Bundle

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-27 14:16:44 -07:00
Aanand Prasad
fe0654603c Merge pull request #3619 from jgiannuzzi/fix_tests
Fix assertion that was always true
2016-06-27 14:16:00 -07:00
Andre Eriksson
c3247e7af8 zsh autocomplete: update misleading comment
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:07:59 -07:00
Andre Eriksson
b3d4e9c9d7 zsh autocomplete: break out duplicated flag messages into variables
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
0058b4ba0c zsh autocomplete: replace use of sed with cut
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
612d263d74 zsh autocomplete: fix issue when filtering on already selected services
Previously, the filtering on already selected services would break when
one service was a substring of another.

This commit fixes that.

Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
048408af48 zsh autocomplete: fix missing services issue for build/pull commands
Previously, the autocomplete for the build/pull commands would only add
services for which build/image were the _first_ keys, respectively, in
the docker-compose file.

This commit fixes this, so the appropriate services are listed
regardless of the order in which they appear

Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
d990f7899c zsh autocomplete: pass all relevant flags to docker-compose/docker
For autocomplete to work properly, we need to pass along some flags when
calling docker (--host, --tls, …) and docker-compose (--file, --tls, …).

Previously flags would only be passed to docker-compose, and the only
flags passed were --file and --project-name.

This commit makes sure that all relevant flags are passed to both
docker-compose and docker.

Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
97ba14c82a zsh autocomplete: use two underscores for all function names
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
1b5a94f4e4 zsh autocomplete: bring flag help texts up to date
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
8d2fbe3a55 zsh autocomplete: add 'build' flag for 'create' and 'up'
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
eb10f41d13 zsh autocomplete: fix incorrect flag exclusions for 'create' and 'up'
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
73a1b60ced zsh autocomplete: add missing 'remove-orphans' flag for 'up' and 'down'
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
b3d9652cc3 zsh autocomplete: add missing docker-compose base flags
Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Andre Eriksson
cbb44b1a14 fix broken zsh autocomplete for version 2 docker-compose files
This has the added benefit of making autocompletion work when the
docker-compose config file is in a parent directory.

Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
2016-06-27 11:00:17 -07:00
Ke Xu
a0a90b2352 add zsh completion for push
Signed-off-by: Ke Xu <leonhartx.k@gmail.com>
2016-06-27 18:00:52 +09:00
Ke Xu
aa7f522ab0 add zsh completion support for bundle
Signed-off-by: Ke Xu <leonhartx.k@gmail.com>
2016-06-27 17:48:14 +09:00
Sven Dowideit
5c1abe2e29 Merge pull request #3631 from jamesottaway/patch-1
Document `tmpfs` being v2 only
2016-06-27 11:50:15 +10:00
James Ottaway
f77dbc06cc Document tmpfs being v2 only
Signed-off-by: James Ottaway <git@james.ottaway.io>
2016-06-24 10:54:51 +10:00
Harald Albers
f49b624d95 bash completion for docker-compose push
Signed-off-by: Harald Albers <github@albersweb.de>
2016-06-22 17:19:20 +02:00
Harald Albers
e5c5dc09f8 bash completion for docker-compose bundle
Signed-off-by: Harald Albers <github@albersweb.de>
2016-06-22 17:06:30 +02:00
Jonathan Giannuzzi
3c77db709f Fix assertion that was always true
Signed-off-by: Jonathan Giannuzzi <jonathan@giannuzzi.be>
2016-06-20 14:48:45 +02:00
Anton Backer
80af26d2bb togather -> together
Signed-off-by: Anton Backer <anton.backer@newsela.com>
2016-06-15 15:55:45 -07:00
Aanand Prasad
352cdf0a80 Merge pull request #3601 from aanand/warn-on-missing-digests
Warn on missing digests, don't push/pull by default
2016-06-15 14:28:49 -07:00
Aanand Prasad
020d46ff21 Warn on missing digests, don't push/pull by default
Add a --fetch-digests flag to automatically push/pull

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-14 16:37:32 -07:00
Joffrey F
317cd98c0d Merge pull request #3599 from shin-/tls-version-unavailable-test
Skip TLS version test if TLSv1_2 is not available on platform
2016-06-14 12:34:43 -07:00
Victoria
f8f582f349 Merge pull request #3600 from londoncalling/fix-broken-links-PR-23492
fixes broken links in 3 Compose docs files due to topic re-org in PR#…

Merging to address broken links. One more to go in (DTR).
2016-06-14 12:30:41 -07:00
Victoria Bialas
a56e44f96e fixes broken links in 3 Compose docs files due to topic re-org in PR#23492
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-06-14 12:24:30 -07:00
Joffrey F
ee68a51e28 Skip TLS version test if TLSv1_2 is not available on platform
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-14 12:23:04 -07:00
Joffrey F
0fe82614a6 Merge pull request #3595 from dnephin/add-push-and-bundle
Add docker-compose push and docker-compose bundle
2016-06-14 10:57:32 -07:00
Aanand Prasad
8f8c17bf66 Merge pull request #3549 from shin-/KalleDK-master
Add support for COMPOSE_TLS_VERSION config option
2016-06-14 10:57:12 -07:00
Daniel Nephin
9b7bd69cfc Support entrypoint, labels, and user in the bundle.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-14 13:00:12 -04:00
Aanand Prasad
1ea9dda1d3 Implement 'docker-compose push' and 'docker-compose bundle'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-06-14 12:06:14 -04:00
Aanand Prasad
21f20cbc9b Merge pull request #3449 from Andrey9kin/ready/3281
Fix #3281: Unexpected result when using build args with default values
2016-06-14 08:05:07 -07:00
alex
68d73183eb Fix a typo in a test's name. 2016-06-13 23:36:34 -04:00
Aanand Prasad
2123906586 Merge pull request #3577 from sanmai-NL/3576-byte_str_fix
Fix byte/str typing error
2016-06-14 01:58:27 +01:00
Aanand Prasad
59e96fea4f Merge pull request #3588 from shin-/3285-root-mount
Fix split_path_mapping behavior when mounting "/"
2016-06-14 01:45:20 +01:00
Joffrey F
60f7e021ad Fix split_path_mapping behavior when mounting "/"
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-13 15:32:10 -07:00
Sander Maijers
61324ef308
Fix byte/str typing error
Signed-off-by: Sander Maijers <S.N.Maijers@gmail.com>
2016-06-10 16:30:46 +02:00
David Beitey
0287486b14 Fix minor YAML typo
Signed-off-by: David Beitey <david@davidjb.com>
2016-06-09 17:00:31 +10:00
Adam Chainz
9ddb7f3c90 Convert readthedocs links for their .org -> .io migration for hosted projects
As per [their blog post of the 27th April](https://blog.readthedocs.com/securing-subdomains/) ‘Securing subdomains’:

> Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.

Test Plan: Manually visited all the links I’ve modified.

Signed-off-by: Adam Chainz <adam@adamj.eu>
2016-06-08 03:52:12 +01:00
Aanand Prasad
e502417df2 Merge pull request #3475 from shin-/3429-networks-config-serialize
Output valid config in config command
2016-06-07 18:01:39 +02:00
Ben Firshman
6e2d1eb80e Merge pull request #3516 from albers/completion-rm--all
remove command completion for `docker-compose rm --a`
2016-06-06 22:23:56 +01:00
Joffrey F
ea640f3821 Remove external_name from serialized config output
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-03 12:10:09 -07:00
Joffrey F
427ec899df Merge pull request #3504 from denismakogon/issue-3503
Issue-3503: Improve timestamp validation in tests
2016-06-03 11:57:55 -07:00
Joffrey F
e7a8b2fed5 Update TLS version configuration code. Tests.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-06-03 11:45:22 -07:00
Sven Dowideit
17b219454f Merge pull request #3522 from SvenDowideit/fix-links
Fix links
2016-05-31 16:36:29 -07:00
Sven Dowideit
dd3590180d more fixes
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-05-31 21:18:42 +00:00
Andrey Devyatkin
a67ba5536d Fix #3281: Unexpected result when using build args with default values
Fix the issue when build arg is set to None instead of empty string. Usecase:

cat docker-compose.yml
  .... args:
  - http_proxy
  - https_proxy
  - no_proxy

If http_proxy, https_proxy, no_proxy environment variables are not defined then http_proxy,
https_proxy, no_proxy build args will be set to string None which breaks all downloads

With this change undefined build args will be set to empty string instead of string None

Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
2016-05-28 11:39:41 +02:00
Sven Dowideit
90fba58df9 Fix links
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-05-27 21:29:47 +00:00
Andrey Devyatkin
c148849f0e Fix #3281: Unexpected result when using build args with default values
Fix the issue when build arg is set to None instead of empty string. Usecase:

cat docker-compose.yml
.... args:
- http_proxy
- https_proxy
- no_proxy

If http_proxy, https_proxy, no_proxy environment variables are not defined then http_proxy,
https_proxy, no_proxy build args will be set to string None which breaks all downloads

With this change undefined build args will be set to empty string instead of string None

Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
2016-05-27 20:16:52 +02:00
Denis Makogon
1298b9aa5d Issue-3503: Improve timestamp validation in tests
CLITestCase.test_events_human_readable fails due to
 wrong assumption that host where tests were launched
 will have the same date time as Docker daemon.

 This fix introduces internal method for validating
 timestamp in Docker logs

Signed-off-by: Denys Makogon <lildee1991@gmail.com>
2016-05-27 14:50:13 +03:00
Andrey Devyatkin
e3e8a619cc Fix #3281: Unexpected result when using build args with default values
Fix the issue when build arg is set to None instead of empty string.
Usecase:

cat docker-compose.yml
....
args:
- http_proxy
- https_proxy
- no_proxy

If http_proxy, https_proxy, no_proxy environment variables are not defined
then http_proxy, https_proxy, no_proxy build args will be set to string None which breaks all downloads

With this change build args will not passed to docker engine if they are equal to string None

Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
2016-05-27 07:48:13 +02:00
Harald Albers
c46737ed02 remove command completion for docker-compose rm --a
As `--all|-a` is deprecated, there's no use to suggest it any
more in command completion.

Signed-off-by: Harald Albers <github@albersweb.de>
2016-05-26 12:48:53 -07:00
Aanand Prasad
86b5ed1a84 Merge pull request #3473 from shin-/3461-merge-port-mappings
Eliminate duplicates when merging port mappings from config files
2016-05-26 16:57:43 +01:00
Joffrey F
4bb80c25d3 Merge pull request #3483 from aanand/env-disambiguation
Add "disambiguation" page for environment variables
2016-05-24 13:29:22 -07:00
Joffrey F
048360d1ed Merge pull request #3489 from aanand/update-openssl-mac
Use latest OpenSSL version when building Mac binary on Travis
2016-05-23 13:52:51 -07:00
Aanand Prasad
a34cd5ed54 Add "disambiguation" page for environment variables
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-05-23 15:03:25 +01:00
Joffrey F
c4229b469a Improve merging for several service config attributes
All uniqueItems lists in the config now receive the same treatment removing
duplicates.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-20 15:29:04 -07:00
Joffrey F
842e372258 Eliminate duplicates when merging port mappings from config files
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-20 15:28:35 -07:00
Aanand Prasad
33bed5c706 Use latest OpenSSL version (1.0.2h) when building Mac binary on Travis
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-05-20 12:04:37 +01:00
Aanand Prasad
7763122ecb Merge pull request #3459 from shin-/2487-split-volume-path
Always use the Windows version of splitdrive when parsing volume mappings
2016-05-20 11:42:43 +01:00
Joffrey F
2b5b665d3a Add test for path mapping with Windows containers
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-19 14:53:37 -07:00
Joffrey F
9a39208741 Merge pull request #3482 from aanand/fix-prompt-buffering
Fix bug where confirmation prompt doesn't show due to line buffering
2016-05-19 08:52:34 -07:00
Aanand Prasad
ce8df9e789 Merge pull request #3466 from shin-/3330-rm-all-default
Update rm command to always remove one-off containers.
2016-05-19 16:46:31 +01:00
Aanand Prasad
0c8aeb9e05 Fix bug where confirmation prompt doesn't show due to line buffering
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-05-19 15:44:17 +01:00
Joffrey F
db0a6cf2bb Always use the Windows version of splitdrive when parsing volume mappings
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-17 16:33:59 -07:00
Joffrey F
844b7d463f Update rm command to always remove one-off containers.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-16 14:59:33 -07:00
Joffrey F
ca3aef0c84 Merge pull request #3436 from shin-/3374-exec-windows
Fail gracefully when -d is not provided for exec command on Win32
2016-05-12 15:14:15 -07:00
Joffrey F
e5645595e3 Fail gracefully when -d is not provided for exec command on Win32
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-12 14:00:54 -07:00
Joffrey F
c9fe8920c9 Merge pull request #3457 from dnephin/fix_versions_script
Skip invalid git tags in versions.py
2016-05-12 13:52:20 -07:00
Daniel Nephin
4bf5271ae2 Skip invalid git tags in versions.py
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-05-12 14:41:40 -04:00
Aanand Prasad
72f6a5c8d3 Merge pull request #3433 from anton44eg/issue_3432
add msg attribute to ProjectError class
2016-05-12 16:55:11 +01:00
Joffrey F
dc88e54010 Merge pull request #3399 from yorkedork/fix/env-file-validation
Adds additional validation to 'env_vars_from_file'.
2016-05-12 08:53:25 -07:00
Anton Simernia
4b01f6dcd6 add msg attribute to ProjectError class
Signed-off-by: Anton Simernia <anton.simernya@gmail.com>
2016-05-09 18:26:20 +07:00
Sven Dowideit
f1603a3ee2 Merge pull request #3092 from wenchma/service_image
Update image format for service conf reference
2016-05-09 10:16:37 +10:00
Sven Dowideit
5fa81c4044 Merge pull request #3417 from spectralsun/patch-1
Small typo
2016-05-09 10:15:56 +10:00
Garrett Seward
3b7191f246 Small typo
Signed-off-by: spectralsun <garrett@spectralsun.com>
2016-05-04 10:47:01 -07:00
Daniel Nephin
3bf75b7330 Merge pull request #3398 from shin-/docker-py-1.8.1
Require latest docker-py version
2016-05-03 15:47:47 -04:00
Sven Dowideit
c1c8c70800 Merge pull request #3392 from SvenDowideit/use-docs-base-oss
convert docs Dockerfiles to use docs/base:oss
2016-05-03 10:47:00 +10:00
Joffrey F
94bcbd1fb6 Merge pull request #3388 from andrerom/patch-1
Clarify env-file doc that .env is read from cwd
2016-05-02 16:04:03 -07:00
Joffrey F
3e11a95056 Merge pull request #3400 from shin-/3333-raise-up-errors
Properly handle APIError failures in Project.up
2016-05-02 14:34:12 -07:00
Joffrey F
310b3d9441 Properly handle APIError failures in Project.up
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-05-02 13:42:05 -07:00
Thom Linton
28fb91b344 Adds additional validation to 'env_vars_from_file'.
The 'env_file' directive and feature precludes the use of the name
'.env' in the path shared with 'docker-config.yml', regardless of
whether or not it is enabled.

This change adds an additional validation to allow the use of this
path provided it is not a file.

Signed-off-by: Thom Linton <thom.linton@gmail.com>
2016-04-29 17:53:31 -07:00
Joffrey F
c41f30c3ff Merge pull request #3385 from shin-/3316-skip-statusless-events
Skip event objects that don't contain a status field
2016-04-29 17:50:32 -07:00
Joffrey F
fe17e0f948 Skip event objects that don't contain a status field
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-29 16:39:42 -07:00
Joffrey F
bd7ec24e25 Merge pull request #3384 from shin-/3264-shorthand-host-support
Support combination of shorthand flag and equal sign for host option
2016-04-29 16:39:16 -07:00
Joffrey F
e4bb678875 Require latest docker-py version
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-29 16:37:26 -07:00
André R
84aa39e978 Clarify env-file doc that .env is read from cwd
Closes #3381

Signed-off-by: André R <ar@ez.no>
2016-04-28 23:14:06 +02:00
Joffrey F
8cc7d68a00 Merge pull request #3390 from aronahl/master
Add missing log event filter when using docker-compose logs.
2016-04-28 12:53:04 -07:00
Joffrey F
0b24883cef Support combination of shorthand flag and equal sign for host option
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-28 12:52:00 -07:00
Aaron Nall
2efcec776c Add missing log event filter when using docker-compose logs.
Signed-off-by: Aaron Nall <aronahl@hotmail.com>
2016-04-28 15:14:44 +00:00
Daniel Nephin
61794ba97c Merge pull request #3377 from shin-/3372-windowserror
Define WindowsError on non-win32 platforms
2016-04-28 10:33:18 -04:00
Sven Dowideit
87ee38ed2c convert docs Dockerfiles to use docs/base:oss
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-04-28 12:57:02 +00:00
Aanand Prasad
7ad7eb71ca Merge pull request #3164 from aanand/fix-config-v1
WIP: Fix output of 'config' for v1 files
2016-04-26 20:34:18 +01:00
Joffrey F
d3e645488a Define WindowsError on non-win32 platforms
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-26 11:40:31 -07:00
Aanand Prasad
756ef14edc Fix format of 'restart' option in 'config' output
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-26 19:21:03 +01:00
Aanand Prasad
6064d200f9 Fix output of 'config' for v1 files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-26 19:21:03 +01:00
Aanand Prasad
84a3e2fe79 Check full error message in test_up_with_net_is_invalid
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-26 19:21:03 +01:00
Aanand Prasad
a4d3dd6197 Remove v2_only decorators on config tests
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-26 19:21:03 +01:00
Joffrey F
0cd35913c3 Merge pull request #3382 from dnephin/upgrade_pip
Upgade pip to latest - attempt to fix jenkins builds
2016-04-26 09:38:12 -07:00
Daniel Nephin
26fe8213aa Upgade pip to latest
Hopefully fixes our builds.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-26 11:58:41 -04:00
Daniel Nephin
ac82597ac1 Merge pull request #3360 from bfirsh/better-validation-error-messages
Make validation errors less robotic
2016-04-21 11:32:23 -04:00
Daniel Nephin
1988dfeaf0 Merge pull request #3359 from bfirsh/clarify-compose-file-networks-documentation
Clarify service networks documentation
2016-04-21 11:19:32 -04:00
Joffrey F
da1d603463 Merge pull request #3351 from shin-/3342-setup-requirements
Force docker-py 1.8.0 or above
2016-04-20 17:40:51 -07:00
Joffrey F
75bcc382d9 Force docker-py 1.8.0 or above
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-20 16:56:48 -07:00
Ben Firshman
b67f110620 Explain the explanation about file versions
This explanation looked like it was part of the error. Added an
extra new line and a bit of copy to explain the explanation.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-04-20 16:40:16 -07:00
Ben Firshman
27628f8655 Make validation error less robotic
"ERROR: Validation failed in file './docker-compose.yml', reason(s):"

is now:

"ERROR: The Compose file './docker-compose.yml' is invalid because:"

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-04-20 16:38:09 -07:00
Ben Firshman
55fcd1c3e3 Clarify service networks documentation
When jumping straight to this bit of the docs, it's not clear
that these are options under a service rather than the top-level
`networks` key. Added a service to make this super clear.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-04-20 15:58:12 -07:00
Ben Firshman
a0aea42f75 Merge pull request #3326 from CRogers/patch-1
Readme should use new docker compose format instead of the old one
2016-04-20 23:06:35 +01:00
Ben Firshman
6ff3c47630 Merge pull request #3222 from jonlemmon/patch-1
Rails Docs: Add nodejs to apt-get install command
2016-04-20 22:57:50 +01:00
Daniel Nephin
8a34ee0eaa Merge pull request #3356 from metal3d/fix-help-acceptance-test
Fix the tests from jenkins
2016-04-20 12:18:20 -04:00
Patrice FERLET
ba10f1cd55 Fix the tests from jenkins
Acceptance tests didn't set "help" command to return "0" EXIT_CODE.

close #3354
related #3263

Signed-off-by: Patrice Ferlet <metal3d@gmail.com>
2016-04-20 13:23:37 +02:00
Aanand Prasad
cafe1315b2 Merge pull request #3334 from werehuman/fix-config-hash-change
Fix #3248: Accidental config_hash change
2016-04-19 12:42:19 +01:00
Aanand Prasad
984f839d33 Merge pull request #3263 from twitherspoon/3191_2_help_cli_feature
Added code to support no argument help command
2016-04-19 12:14:24 +01:00
Aanand Prasad
d21e1c5a30 Merge pull request #3335 from johnharris85/master
Fix CLI docstring to reflect Docopt behaviour.
2016-04-19 12:13:20 +01:00
Aanand Prasad
52fa010ac7 Merge pull request #3337 from dnephin/check_for_short_id_alias
Check for short id alias, and don't disconnect if it already exists
2016-04-19 12:12:43 +01:00
Daniel Nephin
d4bebbb1ba Merge pull request #3340 from johnharris85/2922-config-does-not-catch-missing-links
Fix #2922: Config does not catch missing links
2016-04-18 10:13:47 -04:00
johnharris85
6d2805917c Account for aliased links
Fix failing tests
Signed-off-by: John Harris <john@johnharris.io>
2016-04-17 15:25:06 -04:00
johnharris85
377be5aa1f Adding tests
Signed-off-by: John Harris <john@johnharris.io>
2016-04-17 14:01:06 -04:00
johnharris85
68272b0216 Config now catches undefined service links
Fixes issue #2922
Signed-off-by: John Harris <john@johnharris.io>
2016-04-17 14:00:07 -04:00
Daniel Nephin
56c6e29819 Unit test for skipping network disconnect.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-15 16:28:59 -04:00
Vladimir Lagunov
4702703615 Fix #3248: Accidental config_hash change
Signed-off-by: Vladimir Lagunov <lagunov.vladimir@gmail.com>
2016-04-15 15:34:30 +03:00
johnharris85
ad306f0479 Fix CLI docstring to reflect Docopt behaviour.
Signed-off-by: John Harris <john@johnharris.io>
2016-04-15 13:30:13 +01:00
Daniel Nephin
e1356e1f6f Set networking_config when creating a container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-14 18:09:06 -04:00
Daniel Nephin
abb5ae7fe4 Only disconnect if we don't already have the short id alias.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-14 16:05:14 -04:00
Callum Rogers
e71c62b8d1 Readme should use new docker compose format instead of the old one
Signed-off-by: Callum Rogers <callumrogers@hotmail.co.uk>
2016-04-14 10:49:10 +01:00
Aanand Prasad
e2cb7b0237 Merge pull request #3299 from dannyprout/2096-only-show-port-clash-warning-when-starting-multiple-containers
Only show port clash warning if multiple containers are about to be started
2016-04-14 10:40:02 +01:00
Aanand Prasad
aebb3d5d0a Merge pull request #3320 from dnephin/make_it_dev_again
Update release notes and set version to 1.8.0dev
2016-04-14 10:22:01 +01:00
Daniel Nephin
50287722f2 Update release notes and set version to 1.8.0dev
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-13 13:27:18 -04:00
Danyal Prout
339ebc0483 Fixes #2096: Only show multiple port clash warning if multiple containers
are about to be started.

Signed-off-by: Danyal Prout <me@dany.al>
2016-04-12 20:58:21 +01:00
Tony Witherspoon
ae46bf8907 Updated StringIO import to support io module
Signed-off-by: Tony Witherspoon <tony.witherspoon@gmail.com>
2016-04-12 12:29:59 -04:00
Tony Witherspoon
276738f733 Updated cli_test.py to validate against the updated help command conditions
Signed-off-by: Tony Witherspoon <tony.witherspoon@gmail.com>
2016-04-12 11:47:15 -04:00
Daniel Nephin
f10bc8072e Merge pull request #3310 from aanand/fix-logs-test
Attempt to fix flaky logs test
2016-04-12 10:44:04 -04:00
Aanand Prasad
7781f62ddf Attempt to fix flaky logs test
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-12 12:07:13 +01:00
Aanand Prasad
3d3f331404 Merge pull request #3303 from aanand/clarify-rm-and-down
Clarify behaviour of rm and down
2016-04-12 11:31:22 +01:00
Daniel Nephin
d05feb1a4d Merge pull request #3302 from aanand/feed-queue-refactor
feed_queue() refactor
2016-04-11 12:58:11 -04:00
Aanand Prasad
7cfb5e7bc9 Fix race condition
If processing of all objects finishes before the queue is drained,
parallel_execute_iter() returns prematurely.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-11 17:05:52 +01:00
Aanand Prasad
3722bb38c6 Clarify behaviour of rm and down
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-11 16:31:27 +01:00
Aanand Prasad
15c5bc2e6c Rename a couple of functions in parallel.py
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-11 13:05:30 +01:00
Aanand Prasad
0671b8b8c3 Document parallel helper functions
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-11 12:51:27 +01:00
Aanand Prasad
0e3db185cf Small refactor to feed_queue()
Put the event tuple into the results queue rather than yielding it from
the function.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-11 12:37:00 +01:00
Victoria
97467c7dec Merge pull request #3295 from londoncalling/docs-format-followup-PR3275
added some formatting on the Wordress steps, and made heading levels …
2016-04-08 16:56:57 -07:00
Victoria Bialas
4192a009da added some formatting on the Wordress steps, and made heading levels in these sample app topics consistent
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-04-08 16:40:07 -07:00
Victoria
80614cff9b Merge pull request #3275 from activatedgeek/patch-1
Updated Wordpress tutorial
2016-04-08 16:12:44 -07:00
Sanyam Kapoor
d4e9a3b6b1 Updated Wordpress tutorial
The new tutorial now uses official Wordpress Docker Image.

Signed-off-by: Sanyam Kapoor <1sanyamkapoor@gmail.com>
2016-04-09 02:05:45 +05:30
Daniel Nephin
3ca8858897 Merge pull request #3292 from dnephin/fix_up_build
Remove extra ensure_image_exists() which causes duplicate builds.
2016-04-08 15:45:37 -04:00
Daniel Nephin
83df95d511 Remove extra ensure_image_exists() which causes duplicate builds.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-08 15:21:12 -04:00
Daniel Nephin
e5443717fb Merge pull request #3291 from aanand/parallel-execute-refactor
Parallel execution refactor/fixes
2016-04-08 15:15:41 -04:00
Daniel Nephin
91a545813a Merge pull request #3276 from shin-/bump_docker_py
Use docker-py 1.8.0
2016-04-08 15:15:01 -04:00
Aanand Prasad
be27e266da Reduce queue timeout
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 19:07:40 +01:00
Aanand Prasad
5450a67c2d Hold state in an object
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 19:06:07 +01:00
Aanand Prasad
54b6fc4219 Refactor so there's only one queue
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 18:54:02 +01:00
Aanand Prasad
ffab27c049 Test events coming out of parallel_execute_stream in error case
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 18:53:16 +01:00
Aanand Prasad
3720b50c3b Extract get_deps test helper
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 18:48:07 +01:00
Aanand Prasad
af9526fb82 Move queue logic out of parallel_execute()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 18:30:28 +01:00
Aanand Prasad
141b96bb31 Abort operations if their dependencies fail
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 17:51:09 +01:00
Aanand Prasad
bcdf541c8c Refactor setup_queue()
- Stop sharing set objects across threads
- Use a second queue to signal when producer threads are done
- Use a single consumer thread to check dependencies and kick off new
  producers

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-04-08 16:24:29 +01:00
Tony Witherspoon
f5b80640fe Merge branch '3191_2_help_cli_feature' of https://github.com/twitherspoon/compose into 3191_2_help_cli_feature 2016-04-07 12:46:27 -04:00
twitherspoon
9f47e43b5c Merge branch 'master' into 3191_2_help_cli_feature 2016-04-07 12:43:34 -04:00
Tony Witherspoon
5d0aab4a8e updated cli_test.py to no longer expect raised SystemExit exceptions
Signed-off-by: Tony Witherspoon <tony.witherspoon@gmail.com>
2016-04-07 12:42:14 -04:00
Joffrey F
3ef6b17bfc Use docker-py 1.8.0
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-04-06 13:28:45 -07:00
Daniel Nephin
958f96c78a Merge pull request #3269 from dnephin/fix_logs_and_scale_down
Prevent unnecessary inspection of containers
2016-04-06 12:45:46 -04:00
Daniel Nephin
b33d7b3dd8 Prevent unnecessary inspection of containers when created from an inspect.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-04-06 11:14:42 -04:00
Tony Witherspoon
129fb5b356 Added code to output the top level command options if docker-compose help with no command options provided
Signed-off-by: Tony Witherspoon <tony.witherspoon@gmail.com>
2016-04-04 13:15:28 -04:00
Aanand Prasad
86530287d6 Merge pull request #2627 from bfirsh/update-roadmap
Update roadmap
2016-04-04 12:52:54 +01:00
Ben Firshman
c1026e815a Update roadmap
Bring it inline with current plans:

- Use in production is not necessarily about the command-line
  tool, but also improving file format, integrations, new tools,
  etc.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-04-01 12:55:16 -07:00
Ben Firshman
c72d62f96d Merge pull request #3187 from bfirsh/update-wordpress-example-to-use-official-images
Update wordpress example to use official images
2016-04-01 20:53:37 +01:00
Daniel Nephin
a63a05964b Merge pull request #3249 from aanand/better-env-substitution-example
Better variable substitution example
2016-04-01 15:12:18 -04:00
Joffrey F
9509508f3e Merge pull request #3226 from shin-/3210-assert-hostname
Fix assert_hostname logic in tls_config_from_options
2016-04-01 10:32:13 -07:00
Joffrey F
1a7a65f84d Include docker-py requirements fix
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-31 18:01:51 -07:00
Aanand Prasad
3034803258 Better variable substitution example
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-31 15:45:14 +01:00
Joffrey F
78a8be07ad Re-enabling assert_hostname when instantiating docker_client from the
environment.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-30 11:11:19 -07:00
Joffrey F
d27b82207c Remove obsolete assert_hostname tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-30 10:58:15 -07:00
Joffrey F
71c86acaa4 Update docker-py version to include match_hostname fix
Removed unnecessary assert_hostname computation in tls_config_from_options

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-29 18:01:27 -07:00
Aanand Prasad
85e2fb63b3 Merge pull request #3218 from sdurrheimer/zsh-completion-run-workdir
Add zsh completion for 'docker-compose run -w --workdir'
2016-03-29 16:50:12 +01:00
Aanand Prasad
024a810617 Merge pull request #3217 from sdurrheimer/zsh-completion-up-build
Add zsh completion for 'docker-compose up --build'
2016-03-29 16:49:49 +01:00
Aanand Prasad
668d45c7cc Merge pull request #3216 from sdurrheimer/zsh-completion-logs
Add zsh completion for 'docker-compose logs -f --follow --tail -t --t…
2016-03-29 16:49:36 +01:00
Aanand Prasad
09ea74245d Merge pull request #3215 from sdurrheimer/zsh-completion-exec-command
Add zsh completion for 'docker-compose exec' command
2016-03-29 16:49:15 +01:00
Aanand Prasad
386edd892c Merge pull request #3214 from sdurrheimer/zsh-completion-rm-all
Add zsh completion for 'docker-compose rm -a --all'
2016-03-29 16:48:53 +01:00
Joffrey F
7116aefe43 Fix assert_hostname logic in tls_config_from_options
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-28 17:39:20 -07:00
Jon Lemmon
93901ec480 Rails Docs: Add nodejs to apt-get install command
When using the latest version of Rails, the tutorial currently errors when running `docker-compose up` with the following error:

```
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
```

Installing nodejs in the build fixes the issue.

Signed-off-by: Jon Lemmon <jon.lemmon@enspiral.com>
2016-03-28 13:31:40 +13:00
Steve Durrheimer
8ae8f7ed4b Add zsh completion for 'docker-compose run -w --workdir'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-03-25 19:25:33 +01:00
Steve Durrheimer
9729c0d3c7 Add zsh completion for 'docker-compose up --build'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-03-25 19:15:34 +01:00
Steve Durrheimer
9d58b19ecc Add zsh completion for 'docker-compose logs -f --follow --tail -t --timestamps'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-03-25 19:09:53 +01:00
Steve Durrheimer
63b448120a Add zsh completion for 'docker-compose exec' command
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-03-25 19:03:36 +01:00
Steve Durrheimer
0f1fb42326 Add zsh completion for 'docker-compose rm -a --all'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-03-25 18:52:28 +01:00
Daniel Nephin
aa50023507 Merge pull request #3057 from shin-/2636-env-file
Add support for a default environment file
2016-03-24 14:26:03 -04:00
Joffrey F
12ad3ff301 Injecting os.environ in Environment instance happens outside of init method
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:28 -07:00
Joffrey F
1506f997de Better windows support for Environment class
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:28 -07:00
Joffrey F
b99037b4a6 Add support for DOCKER_* variables in .env file
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:28 -07:00
Joffrey F
c7afe16419 Account for case-insensitive env on windows platform
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
36f1b4589c Limit occurrences of creating an environment object.
.env file is always read from the project_dir

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
0ff53d9668 Less verbose environment invocation
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
dcdcf4869b Mention environment file in envvars.md
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
21aa7a0448 Documentation for .env file
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
f48da96e8b Test get_project_name from env file
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
d55fc85fea Added default env file test.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
1801f83bb8 Environment class cleanup
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
fd020ed2cf Tests use updated get_config_paths_from_options signature
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
5831b869e8 Update tests for new environment handling
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
b9ca5188a2 Remove Environment singleton, instead carry instance during config processing
Project name and compose file detection also updated

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
bf8e501b5e Fix pre-commit config
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Joffrey F
c69d8a3bd2 Implement environment singleton to be accessed throughout the code
Load and parse environment file from working dir

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:57:01 -07:00
Daniel Nephin
d1d8df7f72 Merge pull request #3192 from shin-/use-dockerpy-1.8
Require docker-py 1.8.0rc2
2016-03-24 13:55:59 -04:00
Joffrey F
d78b013bb0 Merge pull request #3204 from albers/completion-rm--all
bash completion for `docker-compose rm --all`
2016-03-24 10:44:36 -07:00
Joffrey F
aabeb56527 Merge pull request #3206 from albers/completion-exec
bash completion for `docker-compose exec`
2016-03-24 10:44:19 -07:00
Joffrey F
60470fb9f1 Require docker-py 1.8.0rc2
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-24 10:13:56 -07:00
Daniel Nephin
84a2e634a8 Merge pull request #3200 from dnephin/disable_broken_test
Disable a test that is failing against 1.11.0rc1.
2016-03-24 13:09:35 -04:00
Harald Albers
c9b02b7b34 bash completion for docker-compose exec
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 18:02:12 +01:00
Joffrey F
87231a25be Merge pull request #3202 from albers/completion-logs
bash completion for new `docker logs` options
2016-03-24 09:56:12 -07:00
Joffrey F
353c4deb19 Merge pull request #3203 from albers/completion-up--build
bash completion for `docker-compose up --build`
2016-03-24 09:55:58 -07:00
Daniel Nephin
732531b722 Disable a test that is failing against 1.11.0rc1.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-24 12:32:13 -04:00
Harald Albers
b030c3928a bash completion for docker-compose rm --all
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 17:29:04 +01:00
Harald Albers
5416e4c99b bash completion for docker-compose up --build
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 17:21:56 +01:00
Harald Albers
d8fb9d8831 bash completion for new docker logs options
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 17:11:10 +01:00
Aanand Prasad
2b063d332e Merge pull request #3196 from albers/completion-daemon-options
bash completion for new TLS options
2016-03-24 15:11:55 +00:00
Daniel Nephin
b09b6e390f Merge pull request #3199 from aanand/add-tls-flags-to-overview
Add TLS flags to CLI reference
2016-03-24 10:48:50 -04:00
Aanand Prasad
8282bb1b24 Add TLS flags to CLI reference
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-24 14:41:51 +00:00
Harald Albers
5b2c2e332f bash completion for TLS options
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 12:06:10 +01:00
Harald Albers
9094c4d97d prepare bash completion for new TLS options
Up to now there were two special top-level options that required special
treatment: --project-name and --file (and their short forms).
For 1.7.0, several TLS related options were added that have to be passed
to secondary docker-compose invocations as well.
This commit introduces a scalable treatment of those options.

Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-24 12:05:59 +01:00
Victoria
2a09fb02db Merge pull request #3182 from londoncalling/docs-fix-links-build-errors
fixed links showing as build errors per PR #3180
2016-03-23 15:08:25 -07:00
Victoria Bialas
d1ea4d72ac fixed links showing as build errors per PR #3180
fixed links per build errors

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-03-23 14:58:45 -07:00
Aanand Prasad
c3eca82749 Merge pull request #3128 from dnephin/add_network_settings_to_config_hash
Include network settings as part of the service config hash.
2016-03-23 17:01:32 +00:00
Ben Firshman
a53b29467a Update wordpress example to use official images
The orchardup images are very old and not maintained.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-03-22 17:19:50 -07:00
Daniel Nephin
2be2029791 Merge pull request #3139 from shin-/1716-tls-flags-support
Add support for TLS config command-line options
2016-03-22 18:24:52 -04:00
Joffrey F
2cc87555cb tls_config_from_options unit tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:57:45 -07:00
Joffrey F
4727115317 Bump docker-py version to include tcp host fix
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:47:53 -07:00
Joffrey F
442dff72b4 Improve assert_hostname setting in tls_config_from_options
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:47:53 -07:00
Joffrey F
26f3861791 Specifying --tls no longer overrides all other TLS options
Add an option to skip hostname verification

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:47:53 -07:00
Joffrey F
7166408d2a Fixed typos + simplified TLSConfig creation process.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:47:53 -07:00
Joffrey F
1ac33ea7e5 Add support for TLS config command-line options
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-22 11:47:53 -07:00
Aanand Prasad
4f5123bda9 Merge pull request #3168 from dnephin/fix_tty_timeout
Handle all timeout errors consistently
2016-03-22 10:14:52 +00:00
Aanand Prasad
aaa7b09369 Merge pull request #3181 from dnephin/fix_partial_change_test_failure
Fix flaky partial_change state test
2016-03-22 10:14:28 +00:00
Aanand Prasad
a20b84e6d2 Merge pull request #3178 from aanand/2774-off-one-offs
Remove one-off containers in `rm` and `down`
2016-03-22 10:12:21 +00:00
Daniel Nephin
5c968f9e15 Fix flaky partial_change state test.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-21 19:07:50 -04:00
Daniel Nephin
6718e82966 Merge pull request #3179 from dnephin/fix_tmpfs_test_failure
Only allow tmpfs with the v2 format
2016-03-21 18:40:51 -04:00
Daniel Nephin
be1476f24b Only allow tmpfs on v2.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-21 14:41:28 -04:00
Aanand Prasad
2bf5e46857 Stop and remove still-running one-off containers in 'down'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-21 18:08:07 +00:00
Aanand Prasad
a2317dfac2 Remove one-off containers in 'docker-compose down'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-21 16:15:49 +00:00
Aanand Prasad
81f6d86ad9 Warn when --all is not passed to rm
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-21 15:14:31 +00:00
Aanand Prasad
1bc9469674 Don't allow boolean values for one_off in Project methods
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-21 14:42:57 +00:00
Joffrey F
5826a2147b Use enum to represent 3 possible states of the one_off filter
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-21 12:12:52 +00:00
Joffrey F
187ea4cd81 Add --all option to rm command - remove one-off containers
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-21 12:12:52 +00:00
Aanand Prasad
28120148f4 Merge pull request #3137 from dnephin/add_tmpfs_to_config
Add support for docker run --tmpfs flag.
2016-03-21 12:10:12 +00:00
Kalle Møller
7fc40dd7cc Adding ssl_version to docker_clients kwargs
Select tls version based of COMPOSE_TLS_VERSION

Changed from SSL to TLS

Also did docs - missing default value

Using getattr and raises AttributeError in case of unsupported version

Signed-off-by: Kalle Møller <github.com@k-moeller.dk>
2016-03-19 01:15:03 +01:00
Daniel Nephin
dfac48f3f5 Make a new flaky test less flaky.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-18 18:20:03 -04:00
Daniel Nephin
089ec66522 Include network settings as part of the service config hash.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-18 18:20:03 -04:00
Philip Walls
85c7d3e5ce Add support for docker run --tmpfs flag.
Signed-off-by: Philip Walls <pawalls@rabidgeek.com>
2016-03-18 18:19:48 -04:00
Daniel Nephin
f1dce50b3d Handle all timeout errors consistently.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-18 18:19:35 -04:00
Daniel Nephin
25cbc2aae9 Fix flaky network test.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-18 18:19:16 -04:00
Daniel Nephin
d5ef0dfa92 Merge pull request #3162 from albers/completion-workdir
bash completion for `docker-compose run --workdir`
2016-03-18 11:25:41 -04:00
Harald Albers
e3c1b5886a bash completion for docker-compose run --workdir
Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-18 10:47:17 +01:00
Daniel Nephin
3a63a0815d Merge pull request #3158 from aanand/windows-install-docs
Windows install docs
2016-03-17 14:40:22 -04:00
Aanand Prasad
50fe014ba9 Remove hardcoded host from Engine install URLs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-17 18:10:32 +00:00
Aanand Prasad
10dfd54ebe Update install page with link to Windows Toolbox install instructions
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-17 18:09:38 +00:00
Aanand Prasad
72ed4d3f97 Merge pull request #3152 from aanand/update-mac-install-url
Update Mac Engine install URL in error message
2016-03-17 17:56:34 +00:00
Joffrey F
312d764c9c Merge pull request #3156 from graingert/fix-type-error-in-exc-handling
Fix TypeError in Exception handling
2016-03-17 08:51:33 -07:00
Daniel Nephin
b2b58402b3 Merge pull request #3154 from aanand/move-ip-docs-to-reference
Move ipv4_address/ipv6_address docs to reference section
2016-03-17 11:44:42 -04:00
Thomas Grainger
20bf05a6e3 Fix TypeError in Exception handling
Traceback (most recent call last):
  File "/tmp/tmp.02tgGaAGtW/docker-compose/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/tmp/tmp.02tgGaAGtW/docker-compose/lib/python3.4/site-packages/compose/cli/main.py", line 68, in main
    log_api_error(e)
  File "/tmp/tmp.02tgGaAGtW/docker-compose/lib/python3.4/site-packages/compose/cli/main.py", line 89, in log_api_error
    if 'client is newer than server' in e.explanation:
TypeError: 'str' does not support the buffer interface

Signed-off-by: Thomas Grainger <tagrain@gmail.com>
2016-03-17 15:13:01 +00:00
Aanand Prasad
7424938fc8 Move ipv4_address/ipv6_address docs to reference section
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-17 11:32:36 +00:00
Aanand Prasad
92d69b0cb6 Update Mac Engine install URL in error message
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-17 09:56:44 +00:00
Aanand Prasad
371ea479f5 Merge pull request #3075 from dnephin/reactive_logs
Display logs for new containers started after the command is run
2016-03-16 21:03:25 +00:00
Aanand Prasad
abddabfb0a Merge pull request #3135 from dnephin/fix_down_idempotency
Make down idempotent, continue to remove resources if one is missing
2016-03-16 20:26:18 +00:00
Joffrey F
dd40331b44 Merge pull request #3102 from shin-/1477-a-modest-proposal
Add flag to up/down to remove orphaned containers
2016-03-16 10:58:15 -07:00
Aanand Prasad
1696506ff4 Merge pull request #3136 from dnephin/add_workdir_to_run
Add workdir to run
2016-03-16 12:45:00 +00:00
Joffrey F
20c29f7e47 Add flag to up/down to remove orphaned containers
Add --remove-orphans to CLI reference docs
Add --remove-orphans to bash completion file
Test orphan warning and remove_orphan option in up

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-15 16:11:49 -07:00
Daniel Nephin
52b791a264 Split off build_container_options() to reduce the complexity of run
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 15:29:24 -04:00
Simon van der Veldt
658803edf8 Add -w or --workdir to compose run to override workdir from commandline
Signed-off-by: Simon van der Veldt <simon.vanderveldt@gmail.com>
2016-03-15 15:28:32 -04:00
Daniel Nephin
bf96edfe11 Reduce the args of some functions by including presenters as part of the thread_args.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 15:15:00 -04:00
Daniel Nephin
e5529a89e1 Make down idempotent, continue to remove resources if one is missing.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:26:29 -04:00
Daniel Nephin
e8a93821d4 Fix race condition where a container stopping and starting again would cause logs to miss logs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:11 -04:00
Daniel Nephin
8d9adc0902 Fix flaky log test by using container status, instead of boolean state.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
3f7e5bf768 Filter logs by service names.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
48ed68eeaa Fix geneartors for python3.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
4312c93eae Add an acceptance test to show logs behaves properly for stopped containers.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
4cad2a0c5f Handle events for removed containers.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
44c1747127 Add tests for reactive log printing.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Daniel Nephin
65797558f8 Refactor log printing to support containers that are started later.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-15 13:17:10 -04:00
Aanand Prasad
94b1862579 Merge pull request #2679 from IlyaSkriblovsky/dependency-ordered-start-stop
Parallel up/start/stop
2016-03-15 11:51:44 +00:00
Ilya Skriblovsky
34de1f0a4c Removed unused parallel.parallel_stop
Signed-off-by: Ilya Skriblovsky <IlyaSkriblovsky@gmail.com>
2016-03-14 22:56:58 +03:00
Ilya Skriblovsky
5df774bd10 Fixed testing error handling by up
Signed-off-by: Ilya Skriblovsky <IlyaSkriblovsky@gmail.com>
2016-03-14 22:55:42 +03:00
Ilya Skriblovsky
f933381a12 Dependency-ordered start/stop/up
Signed-off-by: Ilya Skriblovsky <IlyaSkriblovsky@gmail.com>
2016-03-14 22:55:42 +03:00
Aanand Prasad
e5cd869c61 Merge pull request #3095 from dnephin/refactor_command_dispatch
Refactor command dispatch and fix api version mismatch error
2016-03-14 16:18:29 +00:00
Aanand Prasad
9853b876af Merge pull request #3101 from bfirsh/less-scary-swarm-compose-docs
Better Compose in production docs
2016-03-14 16:12:46 +00:00
Ben Firshman
1485a56c75 Better Compose in production docs
The Compose/Swarm integration has been working really well for
users, so it seems pretty safe to remove the scary warnings about
it not being ready.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-03-10 08:55:07 -08:00
Daniel Nephin
99d68be815 Merge pull request #3011 from mdaue/2804
Fix #2804: Add ipv4 and ipv6 static addressing
2016-03-09 16:28:15 -08:00
Matt Daue
ee136446a2 Fix #2804: Add ipv4 and ipv6 static addressing
- Added ipv4_network and ipv6_network to the networks section in the
  service section for each configured network
- Added feature documentation
- Added unit tests

Signed-off-by: Matt Daue <mattdaue@gmail.com>
2016-03-09 18:37:52 -05:00
Daniel Nephin
8a86e204a0 Merge pull request #3063 from albers/completion-multiple-compose-files
add support for multiple compose files to bash completion
2016-03-09 11:12:34 -08:00
Joffrey F
7a30fc0983 Merge pull request #3089 from ltiao/patch-1
Fixed indentation level in example.
2016-03-09 10:56:50 -08:00
Joffrey F
7033042656 Merge pull request #3039 from dbonev/3020-build-arguments-object-syntax
Allowing null for build args
2016-03-09 10:55:05 -08:00
Daniel Nephin
7de9b08ca5 Merge pull request #3066 from shin-/3062-dont-log-noop-volume-create
Don't call create on existing volumes
2016-03-08 15:04:59 -08:00
Daniel Nephin
0a091055d2 Improve handling of connection errors and error messages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-08 15:39:11 -05:00
Daniel Nephin
886328640f Convert some cli tests to pytest.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-08 14:42:51 -05:00
Daniel Nephin
9f9dcc098a Make TopLevelCommand use the project field.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-08 14:36:53 -05:00
Daniel Nephin
53bea8a720 Refactor command dispatch to improve unit testing and support better error messages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-08 14:23:27 -05:00
Daniel Nephin
a6649b308e Merge pull request #3094 from aanand/fix-version-in-docs-example
Fix version in aliases example
2016-03-08 11:18:45 -08:00
Aanand Prasad
e700d7ca6a Fix version in docs example
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-08 18:15:18 +01:00
wenchma
000eaee16a Update image format for service conf reference
Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
2016-03-08 17:14:38 +08:00
Louis Tiao
88a719b4b6 Fixed indentation level in example.
Signed-off-by: Louis Tiao <louistiao@gmail.com>
2016-03-08 15:53:55 +11:00
Joffrey F
d2b065e615 Don't raise ConfigurationError for volume driver mismatch
when driver is unspecified

Add testcase

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-07 18:07:41 -08:00
Joffrey F
698998c410 Don't call create on existing volumes
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-03-07 18:00:27 -08:00
Dimitar Bonev
81b7fba33e Allowing null for build args
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-03-05 15:57:06 +02:00
Aanand Prasad
9e242cdc75 Merge pull request #3032 from dnephin/multiple_files_from_env_var
Support multiple files in COMPOSE_FILE env var
2016-03-03 17:23:22 +00:00
Aanand Prasad
4ae71f41dd Merge pull request #2832 from aanand/refactor-cli-unit-tests
Refactor CLI initialization and unit tests
2016-03-02 16:10:44 -08:00
Daniel Nephin
53a3d14046 Support multiple files in COMPOSE_FILE env var.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-02 18:47:58 -05:00
Aanand Prasad
20caf02bf6 Create real Project objects in CLI unit tests
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-02 15:11:34 -08:00
Aanand Prasad
4644f2c0f9 Remove environment-overriding unit test for 'run'
There's already an acceptance test for it

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-02 15:11:32 -08:00
Aanand Prasad
575b48749d Remove unused global_options arg from dispatch()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-02 15:09:48 -08:00
Aanand Prasad
2c75a8fdf5 Extract helper methods for building config objects from dicts
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-02 15:09:48 -08:00
Aanand Prasad
f75408923e Merge pull request #3053 from dnephin/handle_booleans_in_mappings
Don't allow booleans for mapping types
2016-03-02 15:04:20 -08:00
Aanand Prasad
3f98c0716e Merge pull request #3052 from dnephin/merge_v1_logging
Fix merging of logging options in v1 config
2016-03-02 15:03:36 -08:00
Aanand Prasad
f84ebf9b18 Merge pull request #3048 from dnephin/osx_bin_from_travis
Build OSX binary on Travis
2016-03-02 15:02:57 -08:00
Aanand Prasad
1655be6c5b Merge pull request #2601 from dnephin/dont_build_on_up
Only build as part of `up` if `--build` flag is set
2016-03-02 15:02:18 -08:00
Daniel Nephin
e1b87d7be0 Update reference docs for the new flag.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-02 15:32:51 -05:00
Daniel Nephin
b7fb3a6d9b Add --build flag for up and create
Also adds a warning when up builds an image without the --build flag
so that users know it wont happen on the next up.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-02 15:32:51 -05:00
Harald Albers
0049743615 add support for multiple compose files to bash completion
Since 1.6.0, Compose supports multiple compose files specified with `-f`.
These need to be passed to the docker invocations done by the
completion.

Signed-off-by: Harald Albers <github@albersweb.de>
2016-03-02 21:18:33 +01:00
Aanand Prasad
3f3c05e465 Merge pull request #3049 from aanand/clarify-depends-on
Clarify depends_on logic
2016-03-02 11:59:06 -08:00
Aanand Prasad
aa7b862f4c Clarify depends_on logic
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-03-02 10:29:24 -08:00
Aanand Prasad
0b3561a7d5 Merge pull request #2720 from seguins/2227-improvements-logs
Add flags on logs
2016-03-01 17:41:31 -08:00
Aanand Prasad
af12c78915 Merge pull request #3056 from dnephin/fix_shutdown_errors
Fix signal handling with pyinstaller.
2016-03-01 14:56:27 -08:00
Daniel Nephin
ed4473c849 Fix signal handling with pyinstaller.
Raise a ShutdownException instead of a KeyboardInterupt when a thread.error
is caught. This thread.error is only raised when run from a pyinstaller
binary (for reasons unknown).

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-01 16:39:43 -05:00
Stéphane Seguin
038da4eea3 Logs args of LogPrinter as a dictionary
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2016-03-01 20:24:15 +01:00
Stéphane Seguin
9b36dc5c54 Add --tail flag as option on logs.
Closes #265
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2016-03-01 20:23:46 +01:00
Stéphane Seguin
d9b4286f91 Add -t, --timestamps flag as option on logs.
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2016-03-01 20:23:46 +01:00
Stéphane Seguin
82632098a3 Add -f, --follow flag as option on logs.
Closes #2187
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2016-03-01 20:23:43 +01:00
Aanand Prasad
7684604830 Merge pull request #3023 from londoncalling/fix-note-3019
WIP: updated note format for dockerfile per Aanand's comments on PR #…
2016-03-01 11:11:55 -08:00
Daniel Nephin
18510b4024 Don't allow booleans for mapping types.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-01 11:57:35 -05:00
Daniel Nephin
b726f508a6 Fix merging of logging options in v1 config.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-01 11:43:26 -05:00
Daniel Nephin
04877d47aa Build osx binary on travis and upload to bintray.
This requires a change to the make-branch script, to have it push the bump branch
to the docker remote instead of the user remote. Pushing to the docker remote
triggers the travis build, which builds the binary.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-03-01 11:34:54 -05:00
Aanand Prasad
fc99c7ee19 Merge pull request #2584 from mjgpy3/patch-1
Update `volumes_from` docs to state default
2016-02-29 15:37:46 -08:00
Aanand Prasad
210856179d Merge pull request #3036 from JesusTinoco/master
Display in the log output the name of those containers created using …
2016-02-29 15:17:14 -08:00
Daniel Nephin
f5ce31d43e Merge pull request #3024 from aanand/update-build-image-docs
Update docs about using build and image together
2016-02-29 14:03:54 -08:00
Daniel Nephin
4db1fef58c Merge pull request #3022 from aanand/update-build-image-extends-note
Update note about build + image with extends
2016-02-29 14:03:28 -08:00
Daniel Nephin
8d24af92e0 Merge pull request #3030 from aanand/document-startup-order-workarounds
Document ways to make services wait for dependencies
2016-02-29 13:01:32 -08:00
Aanand Prasad
97c9c12660 Merge pull request #2023 from TomasTomecek/593-implement-exec
implement exec
2016-02-29 12:21:41 -08:00
Aanand Prasad
6b947ee478 Document ways to make services wait for dependencies
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-29 11:24:58 -08:00
Jesus
6bfb23baaa Display containers name when scale a container
Display in the log output the name of those containers created using the scale command and
change the test_scale_with_api_error test to support the containers name when scale

Signed-off-by: Jesus Rodriguez Tinoco <jesus.rodriguez.tinoco@gmail.com>
2016-02-29 20:19:03 +01:00
Tomas Tomecek
d28c5dda92 implement exec
Resolves #593

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2016-02-29 10:50:09 +01:00
Aanand Prasad
62fb6b99eb Update FAQ regarding long stop times
- It happens on recreate, not just stop

- We now support `stop_signal`, which can help in some cases

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-26 14:34:44 -08:00
Aanand Prasad
1502c5a14d Merge pull request #3025 from aanand/release-notes-1.6.2
Add release notes for 1.6.2
2016-02-26 10:36:26 -08:00
Aanand Prasad
c72e9b3843 Add release notes for 1.6.2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-25 17:55:04 -08:00
Aanand Prasad
5be48ba1ed Update docs about using build and image together
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-25 17:19:58 -08:00
Aanand Prasad
adb8de367e Merge pull request #2388 from dnephin/fix_long_lines
Wrap long lines
2016-02-25 16:52:33 -08:00
Aanand Prasad
42f4d814d7 Merge pull request #2880 from dnephin/merge_jsonschemas
Merge jsonschemas to a single schema file per version
2016-02-25 16:51:56 -08:00
Victoria Bialas
5cc420e727 WIP: updated note format for dockerfile per Aanand's comments on PR #3019
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-25 16:47:46 -08:00
Aanand Prasad
c2c8c41ef2 Merge pull request #2608 from dnephin/more_cyclomatic_reduction
More cyclomatic complexity reduction
2016-02-25 16:41:49 -08:00
Aanand Prasad
2cd1b94dd3 Update note about build + image with extends
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-25 15:15:18 -08:00
Aanand Prasad
5111d0862c Merge pull request #2672 from dnephin/organize_scripts
Organize scripts into directories
2016-02-25 14:09:03 -08:00
Daniel Nephin
11dc720752 Move test scripts to script/test.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:24:13 -08:00
Daniel Nephin
ec6bb1660d Move run scripts to script/run
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:24:13 -08:00
Daniel Nephin
a87d482a3b Move all build scripts to script/build
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:24:13 -08:00
Daniel Nephin
dc3a5ce624 Refactor config validation to support constraints in the same jsonschema
Reworked the two schema validation functions to read from the same schema but
use different parts of it. Error handling is now split as well by the
schema that is being used to validate.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:20:17 -08:00
Daniel Nephin
43ecf8793a Address old TODO, and small refactor of container name logic in service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:19:38 -08:00
Daniel Nephin
cdda616d6b Reduce complexity of sort_service_dicts.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:19:38 -08:00
Daniel Nephin
84a1822e40 Reduce complexity of _get_container_create_options
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 16:19:38 -08:00
Daniel Nephin
be554c3a74 Merge v1 config jsonschemas into a single file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 15:59:10 -08:00
Daniel Nephin
adb64ef8d5 Merge v2 config jsonschemas into a single file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-24 15:59:10 -08:00
Daniel Nephin
38dd342b7b Merge pull request #3009 from dnephin/update_release_notes
Add release notes for 1.6.1
2016-02-23 16:02:18 -08:00
Joffrey F
f48d321b5b Merge pull request #3008 from shin-/update_dockerpy_version
Update docker-py version in requirements to 1.7.2
2016-02-23 15:41:11 -08:00
Daniel Nephin
49ef8a271d Add release notes for 1.6.1
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-23 15:13:01 -08:00
Daniel Nephin
0467bc3dcf Merge pull request #2998 from londoncalling/docs-wordpress-example
updated Wordpress example to be easier to follow, added/updated images
2016-02-23 15:10:11 -08:00
Joffrey F
97bbee19b7 Update docker-py version in requirements to 1.7.2
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-23 14:55:06 -08:00
Victoria Bialas
e6797e1166 updated Wordpress example to be easier to follow, added/updated images
docs update per Mary's comments on the PR

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-23 11:59:19 -08:00
Daniel Nephin
f2ccbeff76 Merge pull request #2997 from dnephin/fix_env_var_without_value
Fix env var without value
2016-02-23 11:58:30 -08:00
Daniel Nephin
d451578152 Make environment variables without a value the same as docker-cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-23 11:14:59 -08:00
Daniel Nephin
4b04280db8 Revert "Change special case from '_', None to ()"
This reverts commit 677c50650c.

Revert "Modify service_test.py::ServiceTest::test_resolve_env to reflect new behavior"

This reverts commit 0019037712.

Revert "Mangle the tests. They pass for better or worse!"

This reverts commit 7ab9509ce6.

Revert "If an env var is passthrough but not defined on the host don't set it."

This reverts commit 6540efb3d3.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-23 11:13:57 -08:00
Daniel Nephin
1d67e6f0f0 Merge pull request #2995 from dnephin/fix_warning_about_bools
Fix warning about boolean values
2016-02-23 11:11:54 -08:00
Daniel Nephin
ba799d2e86 Merge pull request #2996 from dnephin/fix_abort_on_container_exit
Fix abort on container exit
2016-02-23 10:52:12 -08:00
Joffrey F
a7fd578b14 Merge pull request #2962 from shin-/2960-volume-driver
Update docs for volume_driver option
2016-02-22 17:23:07 -08:00
Joffrey F
176b966486 Update documentation for volume_driver option.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-22 16:51:33 -08:00
Daniel Nephin
7e3d756a18 Merge pull request #2992 from shin-/update_dockerpy_version
Use docker-py 1.7.1
2016-02-22 16:50:36 -08:00
Daniel Nephin
15b2094bad Stop other containers if the flag is set.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-22 16:48:46 -08:00
Richard Bann
bf2bf21720 Add failing test for --abort-on-container-exit
Handle --abort-on-container-exit. Fixes #2940

Signed-off-by: Richard Bann <richardbann@gmail.com>
2016-02-22 16:39:40 -08:00
Daniel Nephin
0a06d827fa Fix warning about boolean values.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-22 14:56:01 -08:00
Joffrey F
ba39d4cc77 Use docker-py 1.7.1
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-22 12:56:54 -08:00
Daniel Nephin
d5514965d5 Merge pull request #2975 from dnephin/fix_crash_on_none_in_config
Fix validation message when there are multiple nested oneOf validations.
2016-02-19 15:53:26 -05:00
Daniel Nephin
02535f0cf1 Fix validation message when there are multiple ested oneOf validations.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-19 14:22:55 -05:00
Daniel Nephin
c7ceacfeae Merge pull request #2948 from dnephin/validate_top_level
Validate that each section of the config is a mapping
2016-02-19 13:41:50 -05:00
Aanand Prasad
bed0cfeb32 Merge pull request #2807 from aanand/swarm-doc
Update Swarm integration guide and make it an official part of the docs
2016-02-19 10:25:28 -08:00
Daniel Nephin
0d218c34c7 Make config validation error messages more consistent.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-19 13:12:57 -05:00
Daniel Nephin
4b2a666231 Validate that each section of the config is a mapping before running interpolation.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-19 12:38:52 -05:00
Aanand Prasad
520c695bf4 Update Swarm integration guide and make it an official part of the docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-19 09:32:43 -08:00
Aanand Prasad
1f2c2942d7 Merge pull request #2963 from londoncalling/docs-alias-repr2829
corrected description of network aliases, added real-world example pe…
2016-02-19 09:26:40 -08:00
Victoria Bialas
753c953870 Merge branch 'docs-alias-repr2829' of github.com:londoncalling/compose into docs-alias-repr2829
Fixed file format of one word, legacy, adding signature to that commit.

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-18 18:32:44 -08:00
Victoria Bialas
eb4a98c0d1 corrected description of network aliases, added real-world example per #2907
copyedit to make  show as file format

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-18 18:05:52 -08:00
Victoria Bialas
630a50295b copyedit to make show as file format
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-18 18:05:30 -08:00
Victoria Bialas
068a56eb97 corrected description of network aliases, added real-world example per #2907
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-18 17:49:28 -08:00
Joffrey F
5fc0df4be2 Merge pull request #2907 from shin-/2829-net-alias
Allow user to specify custom network aliases
2016-02-18 16:01:30 -08:00
Joffrey F
0cb8ba3775 Use modern set notation in _get_aliases
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:28:12 -08:00
Joffrey F
7152f7ea76 Handle mismatched network formats in config files
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:24:41 -08:00
Joffrey F
825a0941f0 Network aliases are now part of the network dictionary
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:47 -08:00
Joffrey F
4b99b32ffb Add v2_only decorator to network aliases test
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:47 -08:00
Joffrey F
41e399be98 Fix network list serialization in py3
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:47 -08:00
Joffrey F
7801cfc5d1 Document network_aliases config
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:47 -08:00
Joffrey F
633e349ab9 Test network_aliases feature
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:46 -08:00
Joffrey F
2b5d3f51cb Allow user to specify custom network aliases
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 15:23:46 -08:00
Joffrey F
d3a95c2892 Merge pull request #2938 from shin-/2927-buildargs-types
Constraint build argument types. Numbers are cast into strings.
2016-02-18 15:07:09 -08:00
Joffrey F
93a02e497d Apply driver_opts processing to network configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-18 10:53:40 -08:00
Aanand Prasad
85ba08bb13 Merge pull request #2932 from AvdN/patch-1
reset colors after warning
2016-02-18 09:25:02 -08:00
Aanand Prasad
50dc27aed7 Merge pull request #2913 from clkao/container-install-fixes
A few fixes to the container-based install, which is broken on:
2016-02-18 09:24:10 -08:00
Aanand Prasad
bd72670947 Merge pull request #2894 from dnephin/only_set_constraint_with_volumes
Only set a container affinity if there are volumes to copy over
2016-02-18 08:46:29 -08:00
Daniel Nephin
4f7530c480 Only set a container affinity if there are volumes to copy over.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-17 22:35:14 -05:00
Joffrey F
1952b52392 Constraint build argument types. Numbers are cast into strings
Numerical driver_opts are also valid and typecast into strings.
Additional config tests.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-17 11:53:29 -08:00
Joffrey F
706062ad16 Merge pull request #2934 from dnephin/fix_volume_copy
Fix copying of volumes by using the name of the volume
2016-02-17 11:52:18 -08:00
Daniel Nephin
d4f2f54cf8 Merge pull request #2936 from dnephin/update_docs_for_161
Update docs, fix broken link, use v2 compose file format
2016-02-17 13:34:39 -05:00
Daniel Nephin
4a09da43ea Fix copying of volumes by using the name of the volume instead of the host path.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-17 13:34:14 -05:00
Joffrey F
89108f2a0f Merge pull request #2939 from AvdN/patch-2
for 1.6.0 the version value needs to be a string
2016-02-17 09:42:41 -08:00
Anthon van der Neut
1512793b30 for 1.6.0 the version value needs to be a string
After conversion a file would immediately not load in docker-compose 1.6.0 with the message:

  ERROR: Version in "./converted.yml" is invalid - it should be a string.

Signed-off-by: Anthon van der Neut anthon@mnt.org
Signed-off-by: Anthon van der Neut <a.van.der.neut@ruamel.eu>
2016-02-17 10:01:16 +01:00
Daniel Nephin
471264239f Update guides to use v2 config format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-16 16:43:26 -05:00
Daniel Nephin
4de12ad7a1 Update link to docker volume create docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-16 16:43:22 -05:00
Joffrey F
ec3af7d491 Merge pull request #2920 from londoncalling/docs-examples
update to description of files generated from examples, which are no …
2016-02-16 11:51:14 -08:00
Victoria Bialas
8af0a0f85b update to description of files generated from examples, which are no longer owned by root w/new release
updated descriptions of changing file ownership and images per Seb's comments

fixed line wraps

fixed line breaks per Joffrey's comments

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2016-02-16 11:34:59 -08:00
moxiegirl
b8c35e1298 Merge pull request #2884 from moxiegirl/remove-tutorials
Updating Dockerfile
2016-02-16 08:09:49 -08:00
Anthon van der Neut
69d0154718 reset colors after warning
If a warning is shown, and you happen to have no color setting in your (bash) prompt, the \033[37m setting, stays active. With the message hardly readable (light grey on my default light yellow background), that means the prompt is barely visible and you need to do `tput reset`.
Would probably be better if the background color was set as well in case you have dark on light theme by default in your terminal.

Signed-off-by: Anthon van der Neut <a.van.der.neut@ruamel.eu>
2016-02-16 15:42:43 +01:00
Chia-liang Kao
2204b642ef Quote argv as they are
Signed-off-by: Chia-liang Kao <clkao@clkao.org>
2016-02-14 01:57:04 +08:00
Chia-liang Kao
e6a675f338 Detect -t and -i separately
Signed-off-by: Chia-liang Kao <clkao@clkao.org>
2016-02-14 01:56:26 +08:00
Chia-liang Kao
dd55415d4f Don't mount pwd if it is /
Signed-off-by: Chia-liang Kao <clkao@clkao.org>
2016-02-14 01:56:17 +08:00
Daniel Nephin
74dc1b1411 Merge pull request #2893 from shin-/2833-run-dependencies
Bring up all dependencies when running a single service.
2016-02-12 16:33:01 -05:00
Daniel Nephin
16200b0bce Merge pull request #2903 from shin-/2899-invalid-driver-opts
driver_opts can only be of type string
2016-02-12 14:41:05 -05:00
Joffrey F
a8fda480e3 driver_opts can only be of type string
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-12 10:51:11 -08:00
Joffrey F
367fabdbfa Bring up all dependencies when running a single service.
Added test for running a depends_on service

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-12 09:46:10 -08:00
Joffrey F
e1d67ad68a Merge pull request #2882 from shin-/2715-old-server-error
Detailed error message when daemon version is too old.
2016-02-11 16:03:20 -08:00
Daniel Nephin
b6812b8600 Merge pull request #2877 from dnephin/fix_merging_build
Fix build section without context
2016-02-11 18:53:23 -05:00
Joffrey F
79f993f52c Detailed error message when daemon version is too old.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-11 15:20:32 -08:00
Joffrey F
77cf67ba8a Merge pull request #2888 from dnephin/upgrade_pyinstaller
Upgrade pyinstaller.
2016-02-11 12:11:57 -08:00
Joffrey F
5eb45a31e6 Merge pull request #2883 from shin-/2849-log-volume-creation
Add logging when initializing a volume.
2016-02-11 12:11:28 -08:00
Joffrey F
e225f12551 Add logging when initializing a volume.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-02-11 11:40:22 -08:00
Joffrey F
830a9fc118 Merge pull request #2889 from dnephin/fix_test_broken_on_master
Shm_size requires docker 1.10
2016-02-11 11:18:45 -08:00
Daniel Nephin
532dffd688 Fix build section without context.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-11 14:12:02 -05:00
Daniel Nephin
1e7dd2e740 Upgrade pyinstaller.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-11 13:50:41 -05:00
Daniel Nephin
740329a131 Shm_size requires docker 1.10.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-11 13:50:23 -05:00
Daniel Nephin
7bae4cdbb2 Merge pull request #2875 from aanand/fix-version-in-install-guide
Fix version in install guide
2016-02-11 12:43:51 -05:00
Aanand Prasad
23ab2c7e44 Merge pull request #2878 from dnephin/merge_build_args
Merge build.args when merging services
2016-02-11 17:41:41 +00:00
Aanand Prasad
b8f7bbb84e Merge pull request #2830 from nubs/master
Add support for shm_size.  Fixes #2823.
2016-02-11 17:34:44 +00:00
Joffrey F
a5d95612e0 Merge pull request #2881 from humitos/patch-1
Typo fixed
2016-02-11 09:28:08 -08:00
Mary Anthony
643166ae98 Updating Dockerfile
Signed-off-by: Mary Anthony <mary@docker.com>
2016-02-10 20:47:15 -08:00
Manuel Kaufmann
ac14642d94 Typo fixed
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
2016-02-10 19:00:17 -05:00
Spencer Rinehart
ab40d389d0 Fix sorting of DOCKER_START_KEYS.
Make sure it's sorted!

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
2016-02-10 15:25:18 -06:00
Spencer Rinehart
5e6dc3521c Add support for shm_size. Fixes #2823.
shm_size controls the size of /dev/shm in the container and requires
Docker 1.10 or newer (API version 1.22).  This requires docker-py 1.8.0
(docker/docker-py#923).

Similar to fields like `mem_limit`, `shm_size` may be specified as
either an integer or a string (e.g., `64M`).

Updating docker-py to the master branch in order to get the unreleased
dependency on `shm_size` there in place.

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
2016-02-10 15:25:18 -06:00
Daniel Nephin
37564a73c3 Merge build.args when merging services.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-10 13:54:40 -05:00
Aanand Prasad
7b5bad6050 Merge pull request #2851 from cr7pt0gr4ph7/2839-fix-networks-merging
Fix merge behavior for 'networks' and 'network_mode'.
2016-02-10 17:51:01 +00:00
Aanand Prasad
c43b25b0cf Merge pull request #2827 from loic/patch-1
Fixed typo in compose-file.md
2016-02-10 15:58:54 +00:00
Aanand Prasad
ab9d82b400 Merge pull request #2842 from michael-k/links
Fixed broken links on pypi
2016-02-10 15:58:39 +00:00
Aanand Prasad
88b11afde2 Merge pull request #2858 from dnephin/fix_upgrading_url_in_changelog
Fix upgrading url in changelog
2016-02-10 15:58:02 +00:00
Aanand Prasad
28689a57a7 Merge pull request #2871 from yograterol/patch-1
Typo into the doc with `networks` in yaml
2016-02-10 15:57:45 +00:00
Aanand Prasad
ab6e07da7d Fix version in install guide
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-10 15:56:50 +00:00
Yohan Graterol
59a2920758 Typo into the doc with networks in yaml
Signed-off-by: Yohan Graterol <yohangraterol92@gmail.com>
2016-02-09 18:45:04 -05:00
Daniel Nephin
6f06b3bd30 Merge pull request #2853 from dnephin/fix_short_id_alias
Use 12 characters for the short id
2016-02-09 14:56:24 -05:00
Michael Käufl
481caa8e48 Used absolute links in readme
This prevents links being broken on pypi
(e.g. https://pypi.python.org/pypi/docs/index.md#features)

Signed-off-by: Michael Käufl <docker-compose@c.michael-kaeufl.de>
2016-02-09 13:29:14 +01:00
Daniel Nephin
63870fbccd Fix upgrading url.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-08 18:15:21 -05:00
cr7pt0gr4ph7
582de19a5a Simplify unit tests in config/config_test.py by using class variables instead of methods for parametrizing tests.
Signed-off-by: cr7pt0gr4ph7 <cr7pt0gr4ph7@gmail.com>
2016-02-08 21:57:15 +01:00
Daniel Nephin
859cc2348c Merge pull request #2744 from aanand/pytest-ini
Add pytest.ini
2016-02-08 14:19:40 -05:00
Joffrey F
fdf4a2e89e Merge pull request #2734 from jrabbit/empty-env-var-2359
Empty env var #2359
2016-02-08 11:17:54 -08:00
Daniel Nephin
421981e7d2 Use 12 characters for the short id to match docker and fix backwards compatibility.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-08 12:18:48 -05:00
Lukas Waslowski
5bd88f634f Handle the 'network_mode' key when merging multiple compose files.
Fixes docker/compose#2840.

Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
2016-02-08 15:33:26 +01:00
Lukas Waslowski
5a3a10d43b Correctly merge the 'services/<service>/networks' key in the case of multiple compose files.
Fixes docker/compose#2839.

Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
2016-02-08 15:17:21 +01:00
Lukas Waslowski
e929086c49 Separate MergePortsTest from MergeListsTest and add MergeNetworksTest.
Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
2016-02-08 14:29:03 +01:00
jrabbit
677c50650c Change special case from '_', None to ()
Signed-off-by: jrabbit <jackjrabbit@gmail.com>
2016-02-06 02:54:06 -05:00
Aanand Prasad
8acb5e17e8 Add pytest section to tox.ini
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-05 13:07:01 +00:00
Loïc Bistuer
b635647105 Fixed typo in compose-file.md
Signed-off-by: Loïc Bistuer <loic.bistuer@gmail.com>
2016-02-05 09:50:22 +07:00
Daniel Nephin
57fc85b457 Wrap long lines and restrict lines to 105 characters.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-04 19:05:39 -05:00
Daniel Nephin
28e652daec Merge pull request #2826 from aanand/bump-1.7.0dev
Bump 1.7.0dev
2016-02-04 18:56:27 -05:00
Aanand Prasad
869e815213 Bump 1.7.0dev
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-04 23:46:41 +00:00
Aanand Prasad
422ff623b4 Merge pull request #2819 from bfirsh/improve-names-in-compose-file-2-example
Improve names in Compose file 2 example
2016-02-04 19:42:22 +00:00
Aanand Prasad
c2db1a24bf Merge pull request #2822 from aanand/update-docker-py-and-dockerpty
Update docker-py and dockerpty
2016-02-04 19:40:41 +00:00
Aanand Prasad
be236d8801 Update docker-py and dockerpty
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-04 19:16:01 +00:00
Aanand Prasad
93426cec4c Merge pull request #2824 from dnephin/docs_version_is_a_string
Update docs for version being a string
2016-02-04 17:20:32 +00:00
Daniel Nephin
a7c2987991 Update docs for version being a string.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-04 12:19:43 -05:00
Aanand Prasad
386974f831 Merge pull request #2814 from nubs/patch-1
Fix example formatting for depends_on.
2016-02-04 15:56:27 +00:00
Daniel Nephin
80d02e84e2 Merge pull request #2808 from aanand/connect-before-start
Connect container to networks before starting it
2016-02-03 23:49:56 -05:00
Ben Firshman
bdddbe3a73 Improve names in Compose file 2 example
Just makes it a bit clearer what's going on.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-02-03 17:42:57 -08:00
Spencer Rinehart
f612bc98d9 Fix example formatting for depends_on.
Markdown was acting against expectations here by merging the example indented YAML into the previous list item instead of treating it as a code block.

I decided that a better way of handling this would be to add a "Simple example:" line that is also used elsewhere in this file.  It resets the markdown indentation in a way that works.

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
2016-02-03 14:36:46 -06:00
Daniel Nephin
89c5b800e6 Merge pull request #2782 from dbonev/2772-compose-project-name-empty
Falling back to default project name on empty COMPOSE_PROJECT_NAME
2016-02-02 20:37:38 -05:00
Sven Dowideit
bd1c8973ab Merge pull request #2809 from moxiegirl/fixing-dup-identifier
Fixing duplicate identifiers for 1.10
2016-02-02 15:43:09 -08:00
Mary Anthony
a713447e0b Fixing duplicate identifiers
Signed-off-by: Mary Anthony <mary@docker.com>
2016-02-02 12:04:13 -08:00
Aanand Prasad
2651c00f0c Connect container to networks before starting it
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 19:31:49 +00:00
Daniel Nephin
4c4e94bc19 Merge pull request #2785 from dnephin/depends_on_with_extends
Fix list options when used with extends and multiple files
2016-02-02 13:36:46 -05:00
Daniel Nephin
1cb67b781c Merge pull request #2777 from dnephin/reorder_docs
Re-order docs in menu, fix menu title capitalization, cleanup command reference
2016-02-02 11:26:26 -05:00
Daniel Nephin
c290e560cb Merge pull request #2786 from dnephin/refactor_project
Fix a few bugs around networking and project initilization
2016-02-02 11:19:34 -05:00
Aanand Prasad
7a197e5a69 Merge pull request #2802 from dnephin/appveyor_to_bintray_deploy
Deploying to bintray from appveyor using the new bintray support
2016-02-02 16:13:07 +00:00
Daniel Nephin
c81cc24e72 Merge pull request #2806 from aanand/run-tests-with-tty
Run test containers in TTY mode
2016-02-02 10:56:21 -05:00
Daniel Nephin
3d3388d59b Extract volume init and removal from project.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:53:04 -05:00
Daniel Nephin
e551988616 Include networks in the config_hash.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:52:03 -05:00
Daniel Nephin
0810eeba10 Don't initialize networks that aren't used by any services.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:52:03 -05:00
Daniel Nephin
8e838968fe Refactor project network initlization.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:51:31 -05:00
Daniel Nephin
3ec87adccc Update merge docs with depends_on, and correction about how links and volumes_from are merged.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:49:43 -05:00
Daniel Nephin
e32863f89e Make links unique-by-alias when merging
Factor out MergeDict from merge_service_dicts to reduce complexity below limit.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:48:47 -05:00
Daniel Nephin
bf6a5d3e49 Fix merging of lists with multiple files.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:48:18 -05:00
Ryan Taylor Long
c70c72f49a Add depends_on to ALLOWED_KEYS
This ensures and already existing `depends_on` is not deleted when the service on which it is defined also employs `extends`.

Signed-off-by: Ryan Taylor Long <ryan@rtlong.com>
2016-02-02 10:48:18 -05:00
Daniel Nephin
7b03de7d01 Move command reference to overview.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:46:52 -05:00
Daniel Nephin
cf24c36c55 Rename the old environment variable page to link environment variables.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:46:29 -05:00
Daniel Nephin
2df5593e8f Cleanup command-line reference docs by renaming overview to envvars.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:46:28 -05:00
Daniel Nephin
5e30f089e3 Use the same capitalization for all menu items in the docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:46:28 -05:00
Daniel Nephin
4f92004d9a Re-order compose docs so that quickstart guides come before other documentation.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-02 10:46:28 -05:00
Aanand Prasad
60a5b39f6f Merge pull request #2783 from aanand/fix-validation-v2
Fix validation and version checking
2016-02-02 15:19:50 +00:00
Aanand Prasad
1152c5b25b Tweak and test warning shown when version is a dict
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:58:34 +00:00
Aanand Prasad
ef8db3650a Improve error messages for invalid versions
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:58:34 +00:00
Aanand Prasad
aeef61fcd8 Make 'version' a string
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:58:34 +00:00
Aanand Prasad
a8de582425 Remove redundant check - self.config should never be None
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:47:44 +00:00
Aanand Prasad
4ac004059a Normalise/fix config field designators in validation messages
- Instead of "Service 'web' configuration key 'image'", just say
  "web.image"

- Fix the "Service 'services'" bug in the v2 file format

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:47:43 +00:00
Aanand Prasad
d40bc6e4a0 Convert validation error tests to pytest style
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:47:43 +00:00
Aanand Prasad
e8756905ba Run test containers in TTY mode
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-02-02 13:31:28 +00:00
Daniel Nephin
6928c24323 Deploying to bintray from appveyor using the new bintray support.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-02-01 16:44:45 -05:00
Daniel Nephin
9c6c50c607 Merge pull request #2796 from mustafau/patch-1
Update link to "Common Use Cases" title
2016-02-01 11:24:18 -05:00
Aanand Prasad
1816147d57 Merge pull request #2740 from albers/completion-create
bash completion for `docker-compose create`
2016-02-01 15:44:07 +00:00
Aanand Prasad
c1cb75cc4f Merge pull request #2741 from sdurrheimer/zsh-completion-create-command
Add zsh completion for 'docker-compose create'
2016-02-01 15:43:47 +00:00
Aanand Prasad
b912b306f1 Merge pull request #2784 from dnephin/signal_race
Fix race condition with up and setting signal handlers
2016-02-01 15:15:59 +00:00
Mustafa Ulu
0b7877d82a Update link to "Common Use Cases" title
It is now under overview.md

Signed-off-by: Mustafa Ulu <mustafau@sabanciuniv.edu>
2016-02-01 00:17:18 +02:00
Dimitar Bonev
34ccb90d7e Falling back to default project name when COMPOSE_PROJECT_NAME is set to empty
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-01-30 10:14:45 +02:00
Daniel Nephin
b4868d0259 Fix race condition with up and setting signal handlers.
Also print stdout on wait_for_container().

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-29 13:04:04 -05:00
Daniel Nephin
40d69675f3 Merge pull request #2745 from albers/completion-services
Fix computation of service lists in bash completion
2016-01-28 16:08:46 -05:00
Daniel Nephin
517d3a581c Merge pull request #2768 from aanand/fix-make-branch
Fixes to make-branch script
2016-01-28 15:05:21 -05:00
Daniel Nephin
883e45626f Merge pull request #2706 from dnephin/dont_copy_host_volumes
Don't copy host volumes on recreate
2016-01-28 15:02:53 -05:00
Aanand Prasad
12af889e26 Merge pull request #2737 from moxiegirl/new-navigation
New navigation for 1.10 release
2016-01-28 12:38:28 +00:00
Mary Anthony
3fc72038c5 New navigation for 1.10 release
Updating with Joffrey's comments

Signed-off-by: Mary Anthony <mary@docker.com>
2016-01-27 12:05:56 -08:00
Aanand Prasad
634ae7daa5 Let the user specify any repo as their fork
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-27 15:40:28 +00:00
Aanand Prasad
3547c55523 Default to vim if EDITOR is not set
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-27 15:40:28 +00:00
Aanand Prasad
8c250e220c Merge pull request #2754 from aanand/upgrading-improvements
Improvements to upgrade guide and script
2016-01-27 13:48:23 +00:00
Aanand Prasad
888f4b43c9 Merge pull request #2762 from aanand/remove-links-warnings
Remove outdated warnings about links from docs
2016-01-27 13:08:15 +00:00
Aanand Prasad
d3a1cea170 Remove outdated warnings about links from docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-27 02:34:59 +00:00
Aanand Prasad
3aa545eb8e Merge pull request #2755 from aanand/fix-rebase-script
Fix rebase-bump-commit script
2016-01-27 02:05:24 +00:00
Aanand Prasad
ca81672b82 Merge pull request #2761 from aanand/fix-bridge-plus-host
Remove ability to join bridge network + user-defined networks
2016-01-27 01:41:07 +00:00
Aanand Prasad
650b0cec38 Remove ability to join bridge network + user-defined networks
Containers connected to the bridge network can't have aliases, so it's
simpler to rule that they can *either* be connected to the bridge
network (via `network_mode: bridge`) *or* be connected to user-defined
networks (via `networks` or the default network).

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-27 00:42:09 +00:00
Joffrey F
e69ef1c456 Bump docker-py version to latest RC
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-27 00:36:38 +00:00
Aanand Prasad
d3d09ceb08 Merge pull request #2756 from aanand/external-links-v2
Add back external links in v2
2016-01-27 00:34:17 +00:00
Aanand Prasad
cd4cc8b8c6 Merge pull request #2760 from aanand/fix-docs-whitespace
Fix trailing whitespace in docker-compose.md
2016-01-26 23:39:59 +00:00
Aanand Prasad
b84da7c78b Fix trailing whitespace in docker-compose.md
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 23:22:21 +00:00
Aanand Prasad
0ba02b4a18 Add back external links in v2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 18:48:43 +00:00
Aanand Prasad
e40a46349f Fix rebase-bump-commit script
Trim whitespace from wc's output before constructing arguments to `git rebase`

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 17:42:44 +00:00
Aanand Prasad
bacc2b730e Merge pull request #2748 from schmunk42/master
fixed documentation about traversing yml files
2016-01-26 17:20:40 +00:00
Aanand Prasad
7d403d09cf Extract helper methods
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 16:08:34 +00:00
Aanand Prasad
aa4d43af0b Create declarations for named volumes
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 16:07:26 +00:00
Aanand Prasad
f86fe11825 Make sure version line is at the top of the file
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 15:54:18 +00:00
Aanand Prasad
47b22e90f9 Make warnings a bit more readable
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 15:53:25 +00:00
Aanand Prasad
4736b4409a Update for links, external_links, network_mode
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 15:53:02 +00:00
Aanand Prasad
c39d5a3f06 Add note about named volumes to upgrade guide
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-26 15:51:09 +00:00
Joffrey F
4b84d088e0 Merge pull request #2743 from aanand/network-mode
Implement network_mode option
2016-01-25 18:26:35 -08:00
Aanand Prasad
ed1b204804 Rename 'net' to 'network mode' in various classes/methods
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-25 23:55:20 +00:00
Aanand Prasad
a9c623fdf2 Test that net can be extended
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-25 23:55:20 +00:00
Aanand Prasad
e566a4dc1c Implement network_mode in v2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-25 23:24:55 +00:00
Aanand Prasad
a267d8fe3c Merge pull request #2728 from shin-/2709_service_volumes
Match named volumes in service definitions with declared volumes
2016-01-25 23:24:09 +00:00
Joffrey F
af6b18cad8 Merge pull request #2746 from aanand/alias-containers-by-short-id
Alias containers by short id
2016-01-25 13:55:30 -08:00
Tobias Munk
5fe0b57e5c fixed documentation about traversing yml files
Signed-off-by: Tobias Munk <schmunk@usrbin.de>
2016-01-25 19:33:39 +01:00
Aanand Prasad
313c584185 Alias containers by short id
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-25 16:14:21 +00:00
Harald Albers
73a0d83075 Fix computation of service list in bash completion
The previous approach assumed that the service list could be extracted
from a single file. It did not follow extends and overrides.

Signed-off-by: Harald Albers <github@albersweb.de>
2016-01-25 15:51:58 +01:00
Aanand Prasad
3fff286e1a Merge pull request #2727 from dbonev/2703-strict-validation-of-networks
Network fields schema validation
2016-01-25 14:39:54 +00:00
Steve Durrheimer
381d58bc66 Add zsh completion for 'docker-compose create'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-01-25 10:27:21 +01:00
Harald Albers
7f3a319ecc bash completion for docker-compose create
Signed-off-by: Harald Albers <github@albersweb.de>
2016-01-25 10:15:14 +01:00
jrabbit
0019037712 Modify service_test.py::ServiceTest::test_resolve_env to reflect new behavior
Signed-off-by: jrabbit <jackjrabbit@gmail.com>
2016-01-24 15:25:06 -05:00
jrabbit
7ab9509ce6 Mangle the tests. They pass for better or worse!
Signed-off-by: jrabbit <jackjrabbit@gmail.com>
2016-01-23 16:19:17 -05:00
jrabbit
6540efb3d3 If an env var is passthrough but not defined on the host don't set it.
This doesn't change too much code and keeps the generators.

Signed-off-by: jrabbit <jackjrabbit@gmail.com>
2016-01-23 15:58:06 -05:00
Joffrey F
139c7f7830 Move named volumes matching to config validation phase
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-22 17:42:24 -08:00
Joffrey F
48377a354f is_named_volume also tests for home paths ~
Fix bug with VolumeSpec not being updated
Fix integration test

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-22 16:05:21 -08:00
Dimitar Bonev
3a72edb906 Network fields schema validation
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-01-22 16:42:10 +02:00
Aanand Prasad
35788f47ff Merge pull request #2729 from shin-/bump_docker_py
Use latest docker-py rc
2016-01-22 11:40:35 +00:00
Aanand Prasad
49c83b16c2 Merge pull request #2726 from aanand/no-logs-on-interactive-run
Pass logs=False to dockerpty
2016-01-22 11:37:58 +00:00
Joffrey F
9e67eae311 Match named volumes in service definitions with declared volumes
Raise ConfigurationError for undeclared named volumes
Test new behavior

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-21 18:10:53 -08:00
Joffrey F
77b435f4fe Use latest docker-py rc
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-21 18:07:14 -08:00
Daniel Nephin
963ec1ceda Merge pull request #2707 from dnephin/add_stop_signal_to_docs
Add stop signal to the docs
2016-01-21 18:41:28 -05:00
Aanand Prasad
da2b6329ae Add test for logs=False
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>

Conflicts:
	compose/cli/main.py
2016-01-21 19:20:50 +00:00
Alf Lervag
6e73fb38ea Fixes #2448
Signed-off-by: Alf Lervag <alf.lervag@bouvet.no>

Conflicts:
	compose/cli/main.py
	requirements.txt
2016-01-21 19:19:37 +00:00
Aanand Prasad
8662ce8e21 Merge pull request #2723 from aanand/fix-run-with-networking
Fix 'run' behaviour with networks
2016-01-21 19:07:53 +00:00
Aanand Prasad
730c33b28c Merge pull request #2699 from aanand/update-compose-file-docs
Update Compose file documentation for version 2
2016-01-21 18:57:16 +00:00
Joffrey F
fec8cc9f80 Update documentation for external param
Signed-off-by: Joffrey F <joffrey@docker.com>

Conflicts:
	docs/compose-file.md
2016-01-21 18:51:28 +00:00
Aanand Prasad
59493dd7aa Add links to networks key references
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:51:28 +00:00
Aanand Prasad
2f41f3aa7e Update documentation for links
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:51:28 +00:00
Aanand Prasad
9a3378930f Document depends_on
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:50:44 +00:00
Aanand Prasad
0554c6e6fd Update Compose file documentation for version 2
- Explain each version in its own section
- Explain how to upgrade from version 1 to 2
- Note which keys are restricted to particular versions
- A few corrections to the docs for version-specific keys

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:50:44 +00:00
Aanand Prasad
f3e55568d1 Fix interactive run with networking
Make sure we connect the container to all required networks *after*
starting the container and *before* hijacking the terminal.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:42:59 +00:00
Aanand Prasad
09dbc7b4cb Stop connecting to all networks on container creation
This relies on an Engine behaviour which is a bug, not an intentional
feature - we have to connect to networks one at a time

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 18:04:50 +00:00
Aanand Prasad
a14906fd35 Fix 'run' behaviour with networks
- Test that one-off containers join all networks
- Don't set any aliases

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 17:28:55 +00:00
Aanand Prasad
1e51b7e88b Merge pull request #2722 from aanand/fix-scale-race-condition
Fix scale race condition
2016-01-21 17:08:15 +00:00
Aanand Prasad
013c5ea3f9 Merge pull request #2713 from aanand/links-v2
Support links in v2 files
2016-01-21 17:08:05 +00:00
Aanand Prasad
7a4fdfd034 Merge pull request #2712 from jzvelc/fix_v2_service_extend
Fix `extends` when using v2 config format
2016-01-21 17:06:21 +00:00
Aanand Prasad
642e71b4c7 Stop and remove containers in parallel when scaling down
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 15:28:40 +00:00
Aanand Prasad
755c49b500 Fix scale when containers exit immediately
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 15:19:55 +00:00
Aanand Prasad
ee63075a34 Support links in v2 files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 14:34:26 +00:00
Aanand Prasad
5a249bd9f5 Fix Windows build failures when installing dependencies from git
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-21 11:39:08 +00:00
Jure Žvelc
907c3ce42b Fix for extending services written in v2 format.
Signed-off-by: Jure Žvelc <jzvelc@gmail.com>
2016-01-20 18:46:16 +01:00
Aanand Prasad
e35bf47a7f Merge pull request #2708 from dnephin/implement_depends_on
Implement depends_on
2016-01-20 17:46:10 +00:00
Aanand Prasad
fd6b7d1747 Merge pull request #2693 from dnephin/migrate_v1_to_v2
Add a migration script for v1 to v2 compose format
2016-01-20 17:45:01 +00:00
Daniel Nephin
3b1a0e6fc9 Add stop signal to the docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 21:33:04 -05:00
Daniel Nephin
5aadf5a187 Update tests in sort_services_test.py to use pytest.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 15:52:17 -05:00
Daniel Nephin
146587643c Move ulimits validation to validation.py and improve the error message.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 15:47:57 -05:00
Daniel Nephin
0bce467782 Implement depends_on to define an order for services in the v2 format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 15:41:45 -05:00
Daniel Nephin
85619842be Add migration script.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 14:50:41 -05:00
Daniel Nephin
c39489f540 Don't copy over volumes that were previously host volumes, and are now container volumes.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-19 14:41:21 -05:00
Daniel Nephin
c47aea9c12 Merge pull request #2698 from aanand/fix-name-is-reserved
Fix "name is reserved" with Engine 1.10 RC1
2016-01-19 10:15:06 -05:00
Daniel Nephin
1be147f775 Merge pull request #2696 from aanand/test-external-default
Test that you can set the default network to be external
2016-01-19 10:09:42 -05:00
Aanand Prasad
2106481c23 Fix "name is reserved" with Engine 1.10 RC1
Ensure link aliases are unique (this deduping was previously performed
on the server).

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-19 11:27:27 +00:00
Aanand Prasad
5b2b4cbb07 Merge pull request #2692 from aanand/fix-tls-paramater-error
Catch TLSParameterErrors from docker-py
2016-01-19 11:25:21 +00:00
Aanand Prasad
746033ed9d Test that you can set the default network to be external
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-19 10:57:12 +00:00
Aanand Prasad
413cdbcb81 Merge pull request #2675 from sdurrheimer/zsh-completion-up-abort-on-container-exit
Add zsh completion for 'docker-compose up --abort-on-container-exit'
2016-01-19 10:41:08 +00:00
Aanand Prasad
683c8b0067 Merge pull request #2676 from sdurrheimer/zsh-completion-down-command
Add zsh completion for 'docker-compose down'
2016-01-19 10:40:29 +00:00
Aanand Prasad
9d2e1f58d9 Merge pull request #2677 from sdurrheimer/zsh-completion-fix-invalid-commands-cache
Fix zsh completion to ensure we have enough commands to store in the …
2016-01-19 10:40:03 +00:00
Aanand Prasad
adedbee41b Merge pull request #2694 from dnephin/release_script_fixes
Fix some bugs in release scripts
2016-01-19 10:39:06 +00:00
Aanand Prasad
9ccef1ea91 Catch TLSParameterErrors from docker-py
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-18 21:48:12 +00:00
Daniel Nephin
66dd9ae9a4 Fix some bugs in release scripts.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-18 15:59:40 -05:00
Aanand Prasad
341fa58b21 Merge pull request #2690 from aanand/ipam-config
Allow custom ipam config
2016-01-18 19:44:07 +00:00
Aanand Prasad
b863fe5723 Merge pull request #2687 from aanand/update-networking-docs
Update networking docs
2016-01-18 18:59:33 +00:00
Aanand Prasad
afae365050 Allow custom ipam config
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-18 18:56:18 +00:00
Aanand Prasad
6b105a6e92 Update networking docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-18 18:45:29 +00:00
Aanand Prasad
da490f5b0a Merge pull request #2686 from aanand/fix-custom-default-network
Allow overriding of config for the default network
2016-01-18 17:08:25 +00:00
Aanand Prasad
e7673bf920 Allow overriding of config for the default network
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-18 16:17:39 +00:00
Aanand Prasad
53d56ea245 Quote network names in error messages
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-18 16:15:52 +00:00
Steve Durrheimer
d54190167a Fix zsh completion to ensure we have enough commands to store in the cache
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-01-16 13:53:16 +01:00
Steve Durrheimer
f6561f1290 Add zsh completion for 'docker-compose down'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-01-16 13:47:48 +01:00
Steve Durrheimer
e7180982aa Add zsh completion for 'docker-compose up --abort-on-container-exit'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-01-16 13:22:02 +01:00
Joffrey F
a677a2c1f0 Merge pull request #2674 from dnephin/use-1.10-rc1
Test against docker 1.10.0-rc1
2016-01-15 17:13:56 -08:00
Daniel Nephin
ab927b986f Test against 1.10rc1.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-15 19:04:01 -05:00
Daniel Nephin
cce3b29688 Merge pull request #2665 from dnephin/check_extends_use_same_version
Validate that an extended config file has the same version as the base
2016-01-15 18:07:56 -05:00
Daniel Nephin
9e805731e7 Merge pull request #2671 from dnephin/fix_linux_master_build
Fix linux master build
2016-01-15 15:23:24 -05:00
Daniel Nephin
82b288b25b Fix linux master build.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-15 15:02:19 -05:00
Daniel Nephin
0f1a798f28 Increase the timeout for all acceptance tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-15 10:14:55 -05:00
Aanand Prasad
a104e11191 Merge pull request #2659 from aanand/default-network-alias
Containers join each network aliased to their service's name
2016-01-15 03:30:07 +00:00
Daniel Nephin
dc1104649f Validate that an extended config file has the same version as the base.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 22:28:20 -05:00
Aanand Prasad
de6d6a42d7 Tag some more v2-dependent tests
Not clear why the config tests are v2-dependent; needs investigating

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:46:24 +00:00
Aanand Prasad
4772815491 Disable tests until Engine 1.10 change has been worked around
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:46:24 +00:00
Aanand Prasad
fbc275e06b Work around error message change in Engine
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:46:24 +00:00
Aanand Prasad
cba75627e1 Fix error when joining host/bridge network
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:46:24 +00:00
Aanand Prasad
ab2d18851f Test against a dev build of Engine 1.10
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:46:20 +00:00
Aanand Prasad
406b6b28f4 Tag v2-only tests
- Don't run them against Engine < 1.10
- Set the API version appropriately for the Engine version, so all tests
  use API version 1.22 against Engine 1.10

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:08:20 +00:00
Aanand Prasad
abd031cb3d Containers join each network aliased to their service's name
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-15 02:08:20 +00:00
Daniel Nephin
2a2eb81215 Merge pull request #2662 from dnephin/fix_config_printing_unicode
Fix config printing unicode objects
2016-01-14 19:26:39 -05:00
Aanand Prasad
493df49d55 Merge pull request #2658 from dnephin/warn_on_caps
Error when the project name is invalid for the default image name
2016-01-14 23:41:04 +00:00
Daniel Nephin
1bfbba36b2 Ensure that the config output by config command never contains python objects.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 18:33:58 -05:00
Daniel Nephin
3021ee12fe Fix config command to print the new sections of the config
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 18:28:17 -05:00
Daniel Nephin
0f234154c2 Remove all non-external networks on down.
Also moves the shutdown test fixtures to be a more general v2-full fixture.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 18:28:17 -05:00
Daniel Nephin
b98e2169e6 Error when the project name is invalid for the image name.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 18:25:23 -05:00
Daniel Nephin
b689c4a218 Move service validation to validate_service().
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 18:25:22 -05:00
Joffrey F
796d97e394 Merge pull request #2617 from gutweiler/extra-hosts-ipv6
Extra hosts ipv6
2016-01-14 15:19:12 -08:00
Joffrey F
842dc14417 Merge pull request #2660 from albers/completion-down
bash completion for `docker-compose down`
2016-01-14 15:17:45 -08:00
Joffrey F
07c5103fe1 Merge pull request #2661 from albers/completion--abort-on-container-exit
bash completion for `docker-compose up --abort-on-container-exit`
2016-01-14 15:17:22 -08:00
Aanand Prasad
47e53b49c2 Merge pull request #2653 from shin-/Runscope-build-args
Support for build arguments
2016-01-14 23:13:54 +00:00
Joffrey F
1ae57d92d4 Remove duplicate functions
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-14 14:39:06 -08:00
Aanand Prasad
ee7a51c179 Merge pull request #2650 from dnephin/interpolate_config_in_volumes
Interpolate variables in the new sections of the Compose file
2016-01-14 22:04:46 +00:00
Clemens Gutweiler
ce9f2681a2 Fixes #1422: ipv6 addr contains colons, so we split only by the first char.
Signed-off-by: Clemens Gutweiler <cg@vioma.de>
2016-01-14 22:26:35 +01:00
Joffrey F
13063a96cb Fix handling of service.dockerfile key
Made invalid in v2 format
Doesn't break build config anymore

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-14 12:15:37 -08:00
Garrett Heel
9cfa71ceee Add support for build arguments
Allows 'build' configuration option to be specified as an
object and adds support for build args.

Signed-off-by: Garrett Heel <garrettheel@gmail.com>
2016-01-14 12:14:56 -08:00
Daniel Nephin
77b4ebc31f Merge pull request #2591 from moxiegirl/remove-todo
Fixing TODO visible in docs
2016-01-14 15:06:38 -05:00
Daniel Nephin
79df2ebe1b Support variable interpolation for volumes and networks sections.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 14:04:57 -05:00
Harald Albers
fca3e47a75 bash completion for docker-compose up --abort-on-container-exit
Signed-off-by: Harald Albers <github@albersweb.de>
2016-01-14 10:43:53 -08:00
Aanand Prasad
3750811eed Merge pull request #2564 from aanand/2478-networks-in-compose-file
Declare networks in Compose file
2016-01-14 18:32:29 +00:00
Harald Albers
a7be0afa5b bash completion for docker-compose down
Signed-off-by: Harald Albers <github@albersweb.de>
2016-01-14 10:32:06 -08:00
Aanand Prasad
d98b64f6e7 Remove duplicated logic from initialize_networks()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:09:45 +00:00
Aanand Prasad
4e61377c6d Move get_networks() out of Project class
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:01:44 +00:00
Aanand Prasad
87326c00eb Python 3 fixes
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:00:39 +00:00
Aanand Prasad
73fbd01cfe Support the 'external' option for networks
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:00:39 +00:00
Aanand Prasad
ca68c9faa4 Services can join 'bridge' or 'host'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:00:39 +00:00
Aanand Prasad
e75629392d Don't join the bridge network by default in v2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 18:00:39 +00:00
Aanand Prasad
9c91cf2967 Test discoverability across multiple networks
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 17:59:37 +00:00
Aanand Prasad
3eafdbb01b Connect services to networks with the 'networks' key
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 17:59:37 +00:00
Aanand Prasad
3f9038aea9 Remove test duplication
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 17:59:37 +00:00
Aanand Prasad
35e347cf92 Disable the use of 'net' in v2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 17:59:37 +00:00
Aanand Prasad
69ed5f9c48 Specify networks in Compose file
There's not yet a proper way for services to join networks

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-14 17:59:36 +00:00
Aanand Prasad
8fca4f1628 Merge pull request #2649 from dnephin/make_volumes_from_more_explicit
Make volumes from more explicit in V2 config format
2016-01-14 17:15:27 +00:00
Daniel Nephin
172b955d79 Merge pull request #2646 from dnephin/docker_compose_down
docker-compose down
2016-01-14 11:59:02 -05:00
Daniel Nephin
b76dc1e05e Require volumes_from a container to be explicit in V2 config.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 11:45:16 -05:00
Daniel Nephin
c3968a439f Refactor config loading to move version check into ConfigFile.
Adds the cached_property package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 11:45:15 -05:00
Daniel Nephin
de949284f5 Refactor config loading for handling volumes_from in v2.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 11:43:47 -05:00
Aanand Prasad
dbe04a70f0 Merge pull request #2655 from shin-/updated_volume_definition
Properly validate volume definition
2016-01-14 16:37:39 +00:00
Daniel Nephin
c64af0a459 Add an acceptance test and docs for the down subcommand
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 11:11:08 -05:00
Daniel Nephin
c8ed156806 Adding docker-compose down
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-14 10:59:53 -05:00
Aanand Prasad
18df1e170d Merge pull request #2625 from kojiromike/allow-list-entrypoints
Allow Entrypoints to be Lists
2016-01-14 12:48:13 +00:00
Aanand Prasad
7733600262 Merge pull request #2508 from jstewmon/stop_signal
add support for stop_signal to compose file
2016-01-14 12:46:04 +00:00
Aanand Prasad
1ffd172084 Merge pull request #2654 from dnephin/fix_multiplex_test
Fix flaky multiplex test
2016-01-14 12:27:46 +00:00
Joffrey F
e41e6c1241 Properly validate volume definition
Test valid empty volume definitions

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-13 18:22:29 -08:00
Daniel Nephin
6877c6ca06 Fix flaky multiplex test.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-13 20:58:44 -05:00
Joffrey F
153185eadb Merge pull request #2647 from shin-/preexisting_volume_detection_rb1
Support for external volumes
2016-01-13 17:02:36 -08:00
Michael A. Smith
9bff308251 Document Entrypoints and Commands as Lists
Signed-off-by: Michael A. Smith <msmith3@ebay.com>
2016-01-13 17:47:30 -05:00
Michael A. Smith
59a4ab9634 Allow Entrypoints to be Lists
Signed-off-by: Michael A. Smith <msmith3@ebay.com>
2016-01-13 17:45:56 -05:00
Jonathan Stewmon
b6618815b9 update docker-py requirement to use master branch
Signed-off-by: Jonathan Stewmon <jstewmon@rmn.com>
2016-01-13 16:18:00 -06:00
Joffrey F
e76b2679eb external volume disallows other config keys
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-13 14:12:03 -08:00
Aanand Prasad
fa01883cb2 Merge pull request #2632 from hourliert/master
Mount $HOME in /root to share docker config between containers.
2016-01-13 21:17:18 +00:00
Aanand Prasad
a08e02f3bd Merge pull request #2643 from sdurrheimer/zsh-completion-events
Add zsh completion for 'docker-compose events'
2016-01-13 21:10:36 +00:00
Aanand Prasad
9f34354c19 Merge pull request #2638 from albers/completion-events
Add bash completion for `docker-compose events`
2016-01-13 21:10:09 +00:00
Joffrey F
c260eb910b Merge pull request #2629 from dbonev/2611-support-port-range-in-compose
Port range in exposed ports
2016-01-13 13:09:22 -08:00
Aanand Prasad
3aba5bb67e Merge pull request #2620 from dbonev/2607-ulimits-not-merged-in-extended-services
Ulimits are now merged into extended services
2016-01-13 21:05:38 +00:00
Daniel Nephin
d56f64c30a Merge pull request #2130 from scipetr/master
Add flag for stops all containers if any container was stopped.
2016-01-13 15:55:19 -05:00
Daniel Nephin
eced525317 Merge pull request #2651 from aanand/increase-signal-test-timeout
Increase timeout on signal-handling tests
2016-01-13 15:45:34 -05:00
Aanand Prasad
85a210d9eb Increase timeout on signal-handling tests
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-13 20:34:07 +00:00
Joffrey F
d601199eb5 Normalize external_name
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-13 12:07:08 -08:00
Joffrey F
8616b2de51 Update error message when external volume is missing
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-13 11:23:06 -08:00
Evgeniy Dobrohvalov
bf48a781db Add flag for stops all containers if any container was stopped.
Signed-off-by: Evgeniy Dobrohvalov <scipetr@gmail.com>
2016-01-13 13:12:09 +03:00
Joffrey F
f774422d18 Test Volume.exists() behavior
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-12 16:58:24 -08:00
Joffrey F
9cb58b796e Implement ability to specify external volumes
External volumes are created and managed by the user.
They are not namespaced.
They are expected to exist at the beginning of the up phase.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-12 16:53:49 -08:00
Joffrey F
05935b5e54 Don't recreate pre-existing volumes.
During the initialize_volumes phase, if a volume using the
non-namespaced name already exists, don't create the namespaced
equivalent.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-12 15:42:42 -08:00
Jonathan Stewmon
5d8c2d3cec add support for stop_signal to compose file
Signed-off-by: Jonathan Stewmon <jstewmon@rmn.com>
2016-01-12 17:21:49 -06:00
Joffrey F
ad8faad296 Merge pull request #2579 from vdemeester/update-reference-with-config-and-create
Add config and create to docs/reference
2016-01-12 15:16:45 -08:00
Aanand Prasad
d4b4b126fb Merge pull request #2635 from aanand/use-networking
Use networking for version 2 Compose files
2016-01-12 22:19:50 +00:00
Dimitar Bonev
3a46abd17f Allowed port range in exposed ports
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-01-13 00:13:04 +02:00
Dimitar Bonev
2f07e2ac36 Ulimits are now merged into extended services
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-01-12 23:59:23 +02:00
Aanand Prasad
70cce961a8 Don't allow links or external_links in v2 files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-12 21:29:45 +00:00
Aanand Prasad
9e17cff0ef Refactor API version switching logic
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-12 21:29:45 +00:00
Aanand Prasad
a027a0079c Use networking for version 2 Compose files
- Remove --x-networking and --x-network-driver
- There's now no way to set a network driver - this will be added back
  with the 'networks' key

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-12 21:29:40 +00:00
Aanand Prasad
1a66543461 Make the default network name '{project name}_default'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-12 21:08:28 +00:00
Aanand Prasad
b786b47bc8 Remove version checks from tests requiring API v1.21
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-12 21:08:28 +00:00
Aanand Prasad
0c626e63bc Merge pull request #2458 from dnephin/image_and_build_together
Image and build together
2016-01-12 21:08:00 +00:00
Steve Durrheimer
b59387401c Add zsh completion for 'docker-compose events'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2016-01-12 22:04:05 +01:00
Daniel Nephin
d32a3ec08f Merge pull request #2639 from dnephin/fix_pep8_errors
Fix pep8 errors from the new pep8 release.
2016-01-12 14:13:23 -05:00
Daniel Nephin
e98ab0e534 Allow both image and build together.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-12 14:10:00 -05:00
Daniel Nephin
ed4db542d6 Fix pep8 errors from the new pep8 release.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-12 14:02:30 -05:00
Aanand Prasad
9e36847eb9 Merge pull request #2637 from dnephin/fix_pre_commit_on_master
Fix pre-commit on master
2016-01-12 18:54:16 +00:00
Harald Albers
6c205a8e01 Add bash completion for docker-compose events
Signed-off-by: Harald Albers <github@albersweb.de>
2016-01-12 10:51:04 -08:00
Daniel Nephin
12b5405420 Fix pre-commit on master.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-12 13:27:18 -05:00
Daniel Nephin
304a44aeab Merge pull request #2585 from dnephin/short_signal_handlers
Fix signal handlers by moving shutdown logic out of handler
2016-01-12 12:55:53 -05:00
Aanand Prasad
52e50a9d9a Merge pull request #2626 from shin-/dbonev-2503-move-logging-config-under-separate-key
Move logging config under separate key in v2 compose files
2016-01-12 15:21:10 +00:00
Aanand Prasad
063a25ae7d Merge pull request #2392 from dnephin/docker_compose_events
docker-compose events
2016-01-12 11:45:27 +00:00
Joffrey F
ca634649bb Changed logging override test into integration test
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-11 16:25:19 -08:00
Joffrey F
46a474ecd9 Move v1-v2 config normalization to separate function.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-11 15:53:28 -08:00
Joffrey F
c32991a8d4 Remove superfluous service code
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-11 15:39:59 -08:00
Thomas Hourlier
f7a7e68df6 Mount $HOME in /root to share docker config.
Fixes #2630

Signed-off-by: Thomas Hourlier <thomas.hourlier@cnode.fr>
2016-01-11 09:52:51 -08:00
Daniel Nephin
d3cd038b84 Update event field names to match the new API fields.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-11 11:51:17 -05:00
Daniel Nephin
2f8cb55412 Merge pull request #2571 from vdemeester/fix-unpause-typo
Fix typo in unpause reference doc
2016-01-09 12:31:21 -05:00
Daniel Nephin
37d41f22c6 Merge pull request #2572 from vdemeester/fix-run-missing-flag
Add missing --name flag to run reference doc
2016-01-09 12:30:57 -05:00
Joffrey F
46585fb8e1 Support legacy logging options format
Additional test for legacy compose file.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-08 14:37:07 -08:00
Daniel Nephin
fc57fc1dc1 Merge pull request #2609 from dnephin/dont_warn_on_container_volume
Don't warn when the container volume is a compose option
2016-01-08 17:18:02 -05:00
Daniel Nephin
ab98c70dd1 Merge pull request #2612 from dnephin/merge_extends_from_multiple_files
Fix extends with multiple files
2016-01-08 17:17:41 -05:00
Joffrey F
21aae13e77 Move logging config changes to v2 spec
Reorganize JSON schemas
Update fixtures
Update service validation function

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-08 13:21:45 -08:00
Daniel Nephin
d1d3969661 Add docker-compose event
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-08 13:43:30 -05:00
Daniel Nephin
f38c29f37b Merge pull request #2624 from aanand/fix-script-clean
Fix script/clean on systems where `find` requires a path argument
2016-01-08 10:17:01 -05:00
Aanand Prasad
978e9cf38f Fix script/clean on systems where find requires a path argument
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-01-08 13:10:05 +00:00
Dimitar Bonev
ed5f7bd394 log_driver and log_opt moved to logging key.
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2016-01-08 01:54:45 +02:00
Aanand Prasad
e7bba2affe Merge pull request #2300 from dnephin/always_unicode_literal
Use "unicode_literals" in all files
2016-01-07 18:28:22 +00:00
Daniel Nephin
bf1552da79 Use json to encode invalid values in configuration errors so that the user sees a proper repr of the value.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-07 13:09:24 -05:00
Daniel Nephin
475a091768 Update pre-commit config to enforace that future imports exist in all files.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-07 13:09:03 -05:00
Aanand Prasad
ed87d1f848 Merge pull request #2421 from shin-/2110-compose_yml_v2
Add support for declaring named volumes in compose files
2016-01-07 16:45:58 +00:00
Vincent Demeester
0bca8d9cb3 Add config and create to docs/reference
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-06 21:28:52 +01:00
Vincent Demeester
4e75ed4231 Add missing --name flag to run reference doc
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-06 21:15:11 +01:00
Vincent Demeester
77d2aae72d Fix typo in unpause reference doc
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-06 21:14:30 +01:00
Daniel Nephin
c7b71422c0 Fix extends with multiple files.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-06 13:30:40 -05:00
Joffrey F
1dcdd98da4 Add TODO note to restore n-1 version testing after 1.10 release
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:24:58 -08:00
Joffrey F
a7689f3da8 Handle volume driver change error in config.
Assume version=1 if file is empty in get_config_version
Empty files are invalid anyway, so this simplifies the algorithm
somewhat.
https://github.com/docker/compose/pull/2421#discussion_r47223144

Don't leak version considerations in interpolation/service validation

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:22:13 -08:00
Joffrey F
f3a9533dc0 version no longer optional arg for process_config_file
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:21:54 -08:00
Joffrey F
661519ac1c Only test latest version in CI script
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:21:53 -08:00
Joffrey F
ec5111f1c2 Volumes are now prefixed with the project name
When created through the compose file, volumes are prefixed
with the name of the project they belong to + underscore,
similarly to how containers are currently handled.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:21:53 -08:00
Joffrey F
ecef5d37a7 Add v2 configuration tests
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:21:53 -08:00
Joffrey F
df6877a277 Use newer docker-py version
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Joffrey F
abe145bbe7 Update config resolution to always use explicit version numbers
Also includes several bugfixes for resolution and validation.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Joffrey F
b253efd8a7 Update docs to define and document new compose.yml file format
Add volume configuration reference section.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Joffrey F
b4be7b870f Add support for declaring named volumes in compose files
* Bump default API version to 1.21 (required for named volume management)
* Introduce new, versioned compose file format while maintaining support
  for current (legacy) format
* Test updates to reflect changes made to the internal API

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Daniel Nephin
4bf2f8c4f9 Fix lookup of linked containers for API version 1.20
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-05 15:09:39 -08:00
Daniel Nephin
97fe2ee40c Don't preserve host volumes on container recreate.
Fixes a regression after the API changed to use Mounts.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-05 15:09:39 -08:00
Daniel Nephin
c64b7cbb10 Ignore errors from API about not being able to kill a container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-05 15:09:39 -08:00
Joffrey F
afab5c76ea Update service volume tests to use mounts key
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Joffrey F
3bdcc9d954 Update service tests to use mounts instead of volumes
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-01-05 15:09:39 -08:00
Daniel Nephin
73de81b51c Upgrade tests to use new Mounts in container inspect.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-05 15:09:39 -08:00
Daniel Nephin
ad9011ed96 Don't warn when the container volume is specified as a compose option.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-05 17:30:27 -05:00
Aanand Prasad
4017ea99fe Merge pull request #2599 from dnephin/inject_project_name
Remove support for fig.yaml, FIG_FILE, and FIG_PROJECT_NAME
2016-01-05 12:29:38 +00:00
Aanand Prasad
c1a21d2497 Merge pull request #2577 from TomasTomecek/easier-development
allow running compose from git
2016-01-05 12:27:35 +00:00
Daniel Nephin
2acc29cf1c Remove support for fig.yaml, FIG_FILE, and FIG_PROJECT_NAME.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-04 15:37:21 -05:00
Mary Anthony
d4e913e42c Fixing TODO visible in docs
Signed-off-by: Mary Anthony <mary@docker.com>
2015-12-31 19:04:38 -08:00
Daniel Nephin
778c213dfc Fix signal handlers by moving shutdown logic out of handler.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-30 11:21:20 -05:00
Michael Gilliland
39af6b653b Update volumes_from docs to state default
[Proof of read-write](cfb1b37da2/compose/config/types.py (L26)).

I found myself wondering what the default was a couple of times, and finally decided to change it :)

Signed-off-by: Michael Gilliland <gillilandmj@upmc.edu>
2015-12-28 16:44:31 -05:00
Tomas Tomecek
adde805829 allow running compose from git
with:

```
$ git clone docker/compose && cd compose
$ export PYTHONPATH="$PWD:$PYTHONPATH"
$ python -m compose --help
```

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2015-12-26 11:03:58 +01:00
Daniel Nephin
ea8cc1c3dc Merge pull request #2562 from thaJeztah/update-links
Update links
2015-12-21 08:31:39 -08:00
Aanand Prasad
a2d2915a64 Merge pull request #2547 from seguins/1125-docker-compose-create
Add docker-compose create command.
2015-12-21 14:20:56 +00:00
Sebastiaan van Stijn
5ed559fa0e Update links
Updates some links to their new locations, and
replaces some http:// with https:// links.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2015-12-21 01:52:54 +01:00
Aanand Prasad
12a08255b5 Merge pull request #2554 from aanand/clarify-rm-behaviour
Clarify behaviour of 'rm'
2015-12-18 16:42:05 +00:00
Stéphane Seguin
3c76d5a467 Add docker-compose create command.
Closes #1125

Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2015-12-18 08:53:26 +01:00
Aanand Prasad
2e9a49b4eb Clarify behaviour of 'rm'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-12-17 17:50:45 +00:00
Aanand Prasad
100d6f2fbb Merge pull request #2552 from dbonev/2452-implement-cpu-quota
Added support for cpu_quota flag
2015-12-17 12:21:15 +00:00
Dimitar Bonev
a542041264 Added support for cpu_quota flag
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2015-12-16 21:25:30 +02:00
Aanand Prasad
c8f63306e0 Merge pull request #2550 from dbonev/1236-restart-to-exit-with-non-zero
Start, restart, pause and unpause exit with non-zero if nothing to do
2015-12-16 15:25:34 +00:00
Aanand Prasad
ae7e48ea2f Merge pull request #2526 from dnephin/remove_extra_coverage_files
Ignore extra coverage files
2015-12-16 15:18:10 +00:00
Dimitar Bonev
bc843d6758 Start, restart, pause and unpause exit with non-zero if nothing to do
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2015-12-15 23:11:11 +02:00
Daniel Nephin
5b32d32b2d Merge pull request #2521 from jeanpralo/master
Add method to get more info about container status
2015-12-15 12:04:42 -08:00
Jean Praloran
c8f266b637 add restarting status for human_readable_state
Signed-off-by: Jean Praloran <jeanpralo@gmail.com>
2015-12-16 08:19:28 +13:00
Daniel Nephin
a1217dc050 Merge pull request #2536 from dbonev/2345-incorrect-network-name
Incorrect network name shown in the log when no driver is specified
2015-12-11 14:39:36 -08:00
Dimitar Bonev
6d709caaa5 Fixes incorrect network name shown in the log when no driver is specified
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
2015-12-11 10:14:01 +02:00
Daniel Nephin
1d3aeaaae7 Ignore extra coverge files
These files are created because we run acceptance tests in a subprocess.
They have the process id in their name, so they wont be removed by the
normal coverage cleanup on each run.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-10 15:29:36 -08:00
Aanand Prasad
bc09698897 Merge pull request #2527 from dnephin/fix_dns_config_option
Fix dns and dns_search when used strings and without extends.
2015-12-10 11:31:01 +00:00
Daniel Nephin
fa3528ea25 Fix dns and dns_search when used strings and without extends.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-09 16:32:39 -08:00
Daniel Nephin
6fe747e0ee Merge pull request #2522 from sdurrheimer/zsh-completion-config-cmd
Add zsh completion for config subcommand
2015-12-09 10:40:44 -08:00
Aanand Prasad
0b7a407055 Merge pull request #2519 from seguins/clean_service
Remove unused functions in service
2015-12-09 13:51:27 +00:00
Aanand Prasad
67829f08b6 Merge pull request #2518 from albers/completion-config
Add bash completion for config subcommand
2015-12-09 12:43:41 +00:00
Steve Durrheimer
01bba5ea23 Add zsh completion for config subcommand
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-12-09 08:57:14 +01:00
Stéphane Seguin
999d15b225 Remove unused functions in service
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2015-12-08 21:11:05 +01:00
Harald Albers
a5b48a3dc2 Add bash completion for config subcommand
Signed-off-by: Harald Albers <github@albersweb.de>
2015-12-08 10:23:55 -08:00
Aanand Prasad
dc39b01e00 Merge pull request #2512 from albers/completion-url
Use more robust download URL for completions
2015-12-08 16:27:09 +00:00
Aanand Prasad
53cc99a822 Merge pull request #2513 from punkstar/detect-tty
Only allocate a tty if we detect one
2015-12-08 15:26:46 +00:00
Aanand Prasad
82dfd465a2 Merge pull request #2407 from dnephin/config_command
New `docker-compose config` command
2015-12-08 15:16:48 +00:00
Daniel Nephin
437f3f8adb Add docker-compose config subcommand.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-07 18:51:01 -08:00
Aanand Prasad
ecf2dd11f9 Merge pull request #2467 from dnephin/remove_migrate_to_labels
Remove migrate-to-labels.
2015-12-07 14:31:23 +00:00
Aanand Prasad
9f4e83e456 Merge pull request #2466 from dnephin/remove_insecure_ssl_warning
Removes the deprecated --allow-insecure-ssl flag
2015-12-07 14:29:33 +00:00
Aanand Prasad
50dcb1d7e7 Merge pull request #2468 from dnephin/increase_timeout_in_tests
Increase timeout in tests
2015-12-07 14:29:08 +00:00
Nick Jones
f2c232bb10 Only allocate a tty if we detect one
Signed-off-by: Nick Jones <nick@nicksays.co.uk>
2015-12-07 09:56:28 +00:00
Harald Albers
2525752a05 Use more robust download URL for completions
Signed-off-by: Harald Albers <github@albersweb.de>
2015-12-07 09:10:19 +01:00
Daniel Nephin
509059cdab Merge pull request #2492 from jake-low/no-yaml-warning
Stop warning about ".yaml" file extension
2015-12-04 12:22:56 -08:00
Daniel Nephin
3e7b2ab865 Merge pull request #2506 from dnephin/update_changelog
Cherry-pick release notes for 1.5.2
2015-12-04 12:21:27 -08:00
Daniel Nephin
de4a18ea6c Cherry-pick release notes for 1.5.2
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-04 10:26:20 -08:00
Aanand Prasad
0a84833474 Merge pull request #2505 from thaJeztah/update-maintainers
update maintainers file for parsing
2015-12-04 16:16:09 +00:00
Sebastiaan van Stijn
7698da57ca update maintainers file for parsing
this updates the MAINTAINERS file to the new format,
so that it can be parsed and collected in the docker/opensource
repository.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2015-12-04 16:52:29 +01:00
jake-low
e760c42ae0 Stop warning about ".yaml" extension
".yaml" is the preferred extension according to http://www.yaml.org/faq.html

Signed-off-by: jake-low <jakelow42@gmail.com>
2015-12-02 21:45:36 -08:00
Daniel Nephin
707281aadb Merge pull request #2291 from dnephin/compose_faq
FAQ document for Compose
2015-12-02 11:12:37 -08:00
Daniel Nephin
3f39ffe72e FAQ document for Compose
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-02 10:47:32 -08:00
moxiegirl
0eba234c54 Merge pull request #2461 from SvenDowideit/move-to-docs-base-latest
Use FROM docs/base:latest again
2015-12-01 08:54:13 -08:00
Daniel Nephin
377f084dfe Increase timeout in tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-27 13:54:00 -05:00
Daniel Nephin
a21f9993b3 Remove migrate-to-labels.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-27 12:04:45 -05:00
Daniel Nephin
2f568984f7 Fixes #2368, removes the deprecated --allow-insecure-ssl flag.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-27 11:52:25 -05:00
Aanand Prasad
defcf5a21f Merge pull request #2464 from aanand/validate-expose
Validate `expose`
2015-11-27 14:44:55 +00:00
Aanand Prasad
ccf548b98c Validate the 'expose' option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-26 19:27:32 +00:00
Aanand Prasad
042c7048f2 Split out ports validation tests into type, uniqueness, format
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-26 19:27:31 +00:00
Aanand Prasad
374b16843f Fix ports validation message
- The `raises` kwarg to the `cls_check` decorator was being used
  incorrectly (it should be an exception class, not an object).

- We need to check for `error.cause` and get the message out of the
  exception object.

NB: The particular case where validation fails in the case of `ports` is
only when ranges don't match in length - no further validation is
currently performed client-side.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-26 18:54:30 +00:00
Aanand Prasad
d52508e2b1 Refactor ports section of fields schema
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-26 18:52:14 +00:00
Aanand Prasad
0fedd9969f Merge pull request #2430 from dnephin/build_from_url
Build from url
2015-11-26 18:15:03 +00:00
Daniel Nephin
2ab3cb212a Add integration test and docs for build with a git url.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-26 11:32:39 -05:00
Jonas Eckerström
f7239f41ef Added support for url buid paths
Signed-off-by: Jonas Eckerström <jonaseck@gmail.com>
2015-11-26 11:29:07 -05:00
Aanand Prasad
b85bfce65e Fix ports validation test
We were essentially only testing that *at least one* of the invalid
values fails the validation check, rather than that *all* of them fail.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-26 15:06:30 +00:00
Sven Dowideit
fd06d699f2 Use FROM docs/base:latest again
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-11-26 20:30:12 +10:00
Aanand Prasad
7b893164a4 Merge pull request #2450 from dnephin/fix_env_file_ordering
Fix env_file overrides with extends
2015-11-25 16:35:40 +00:00
Daniel Nephin
e67bc2569c Properly resolve environment from all sources.
Split env resolving into two phases. The first phase is to expand the paths
of env_files, which is done before merging extends. Once all files are merged
together, the final phase is to read the env_files and use them as the base
for environment variables.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-25 11:02:20 -05:00
Aanand Prasad
cfb1b37da2 Merge pull request #2405 from dnephin/move_all_validation_to_config
Move all validation to config
2015-11-25 15:16:21 +00:00
Daniel Nephin
8930fa25d6 Merge pull request #2387 from dnephin/update_release_notes
cherry-pick release notes from 1.5.1
2015-11-24 13:25:21 -05:00
Daniel Nephin
6e89a5708f cherry-pick release notes from 1.5.1
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-24 13:24:46 -05:00
Aanand Prasad
c1c1dceb59 Merge pull request #2453 from dnephin/fix_test_assertion
Add missing assert and autospec
2015-11-24 16:45:04 +00:00
Aanand Prasad
88e9c1ccd9 Merge pull request #2438 from dnephin/fix_flaky_pull_test
Fix `build --pull` test flakes
2015-11-24 16:44:53 +00:00
Aanand Prasad
689f040c97 Merge pull request #2429 from dnephin/fix_links_in_readme
Fix use case link in readme
2015-11-24 15:56:05 +00:00
Daniel Nephin
e40670207f Add missing assert and autospec.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-24 10:42:25 -05:00
Aanand Prasad
50bc734492 Merge pull request #2427 from dnephin/note_about_pip_version
Add note about required pip version.
2015-11-24 15:21:37 +00:00
Daniel Nephin
533f33271a Move service sorting to config package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:33:00 -05:00
Daniel Nephin
effa9834a5 Remove unnecessary intermediate variables in get_container_host_config.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:33:00 -05:00
Daniel Nephin
dac75b07dc Move volume parsing to config.types module
This removes the last of the old service.ConfigError

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:33:00 -05:00
Daniel Nephin
efec2aae6c Fixes #2008 - re-use list_or_dict schema for all the types
At the same time, moves extra_hosts validation to the config module.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:31:58 -05:00
Daniel Nephin
12b82a20ff Move restart spec to the config.types module.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:31:58 -05:00
Daniel Nephin
068edfa313 Move parsing of volumes_from to the last step of config parsing.
Includes creating a new compose.config.types module for all the domain objects.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:31:58 -05:00
Daniel Nephin
c9ca5e86b0 Remove project name validation
project name is already normalized to a valid name before creating a service.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 13:30:54 -05:00
Aanand Prasad
83ddec8df7 Merge pull request #2439 from solarce/sol-matrix-trusty-fix
Fixing matrix include so `os: linux` goes to trusty
2015-11-23 18:01:22 +00:00
Aanand Prasad
665de9a494 Merge pull request #2436 from dnephin/reduce_cyclomatic_complexity
Reduce cyclomatic complexity
2015-11-23 17:51:54 +00:00
Daniel Nephin
b4edf0c454 Move parallel_execute to a new module.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-23 11:34:48 -05:00
Aanand Prasad
aafacd3495 Merge pull request #2418 from dnephin/fix_env_with_extends
Fix env_file and environment when used with extends
2015-11-23 14:48:04 +00:00
Brandon Burton
13081d4516 Fixing matrix include so os: linux goes to trusty
Signed-off-by: Brandon Burton <brandon@inatree.org>
2015-11-20 16:07:37 -08:00
Daniel Nephin
2351e11cc8 Make sure we always have the latest busybox image, so that build --pull tests don't flake.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-20 17:51:36 -05:00
Daniel Nephin
64447879d2 Reduce complexity of merge_service_dicts
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-20 17:09:55 -05:00
Daniel Nephin
d1adbb9b25 Refactor parallel_execute.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-20 17:09:51 -05:00
Daniel Nephin
c4096525c2 Merge pull request #2364 from dnephin/handle_signals_properly
Handle SIGTERM/SIGINT properly for up and run
2015-11-20 11:58:04 -05:00
Daniel Nephin
8bc84c74e7 Merge pull request #2417 from dnephin/inlude_git_sha_in_version
Add the git sha to version output
2015-11-20 11:39:38 -05:00
Daniel Nephin
331450dace Merge pull request #2390 from dnephin/fix_extra_warnings_on_masked_volumes
Fix extra warnings on masked volumes
2015-11-20 11:37:54 -05:00
Daniel Nephin
91fb6156c6 Merge pull request #2393 from seguins/1814-restart-stopped-containers
Fix restart with stopped containers.
2015-11-20 11:35:24 -05:00
Daniel Nephin
46446111e5 Merge pull request #2400 from dnephin/fix_stream_with_empty_object
Fix a bug in progress_stream when an `ADD <url>` was used
2015-11-20 11:33:45 -05:00
Daniel Nephin
6224b6edd9 Fix use case link in readme.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-19 14:53:28 -05:00
Joffrey F
dd1a2b36fa Merge pull request #2389 from hypriot/use-uname-for-target
Use uname to build target name for different platforms
2015-11-19 10:36:33 -08:00
Joffrey F
449cdcc966 Merge pull request #2420 from simonvanderveldt/fix-script-runsh-env-vars
run.sh script: Also pass DOCKER_TLS_VERIFY and DOCKER_CERT_PATH env vars to compose container
2015-11-19 10:35:28 -08:00
Daniel Nephin
3fdf0f43be Add note about required pip version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-19 12:55:03 -05:00
Daniel Nephin
21a72e350b Merge pull request #2413 from SvenDowideit/stop-docs-validation-errors
2 small changes to clear up docs-validation complaints
2015-11-19 12:52:43 -05:00
Sven Dowideit
acf31181e8 Some small changes to clear up docs-validation complaints
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-11-19 13:35:09 +10:00
Daniel Nephin
1e8f76767f Fix env_file and environment when used with extends.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-18 16:07:11 -05:00
Daniel Nephin
c78c32c2e8 Fixes #2398 - the build progress stream can contain empty json objects.
Previously these empty objects would hit a bug in splitting objects causing it crash.
With this fix the empty objects are returned properly.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-18 16:04:41 -05:00
Simon van der Veldt
efbfa9e38f run.sh script: Also pass DOCKER_TLS_VERIFY and DOCKER_CERT_PATH
env vars to compose container

Signed-off-by: Simon van der Veldt <simon.vanderveldt@gmail.com>
2015-11-18 21:40:16 +01:00
Daniel Nephin
d4b9845201 Add the git sha to version output
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-18 13:21:14 -05:00
Daniel Nephin
2f20dfe508 Merge pull request #2409 from dnephin/fix_the_build
Fix texttable dep. 0.8.2 was removed from pypi.
2015-11-17 20:06:40 -05:00
Daniel Nephin
265828f4eb Fix texttable dep. 0.8.2 was removed from pypi.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-17 18:36:58 -05:00
Stéphane Seguin
61f91ebff7 Fix restart with stopped containers.
Fixes #1814

Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
2015-11-14 12:23:23 +01:00
Daniel Nephin
e1308a8329 Fix extra warnings on masked volumes.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-13 10:49:17 -05:00
Stefan Scherer
c99f2f8efd Use uname to build target name for different platforms
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
2015-11-13 08:33:51 +01:00
Daniel Nephin
6236bb0019 Handle both SIGINT and SIGTERM for docker-compose run.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 17:41:44 -05:00
Daniel Nephin
ea4230e7a2 Handle both SIGINT and SIGTERM for docker-compose up.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 17:41:44 -05:00
Daniel Nephin
9f6a5a964a Merge pull request #2355 from dnephin/refactor_handle_error
Refactor process_error and include a filename as part of the validation error messages
2015-11-12 15:01:32 -05:00
Daniel Nephin
9c305ac10f Remove name field from the list of ALLOWED_KEYS
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:26:13 -05:00
Daniel Nephin
589755d034 Inclide the filename in validation errors.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 12:44:45 -05:00
Daniel Nephin
fa96484d28 Refactor process_errors into smaller functions
So that it passed new max-complexity requirement

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 12:44:24 -05:00
Daniel Nephin
f7d8087694 Add ids to config schemas
Also enforce a max complexity for functions and add some new tests for config.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 12:40:36 -05:00
Joffrey F
0a35fd93cd Merge pull request #2373 from shin-/2370-env_vars_with_dashes
Allow dashes in environment variable names
2015-11-11 13:20:22 -08:00
Joffrey F
d6b44905f2 Add test for environment variable dashes support
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-11 12:52:30 -08:00
Joffrey F
513dfda218 Allow dashes in environment variable names
See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
Environment variable names used by the utilities in the Shell and
Utilities volume of POSIX.1-2008 consist solely of uppercase letters,
digits, and the <underscore> ( '_' ) from the characters defined in
Portable Character Set and do not begin with a digit. Other characters may
be permitted by an implementation; applications shall tolerate the
presence of such names.

Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-11 12:45:02 -08:00
Daniel Nephin
a746d673b1 Merge pull request #2350 from dnephin/remove_name_from_schema
Remove name field from the config schema
2015-11-11 15:43:03 -05:00
Daniel Nephin
76f3c9c739 Merge pull request #2349 from dnephin/validate_all_files
Validate all files before merging them
2015-11-11 15:27:47 -05:00
Daniel Nephin
08bd2a318f Merge pull request #2371 from shin-/yvespp-master
Removed unneeded newlines on docker-compose pull with no tty (#2311 update)
2015-11-11 15:20:31 -05:00
Joffrey F
c573fcc70a Reorganize conditional branches to improve readability
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-11 11:21:24 -08:00
Yves Peter
b8b4c84573 Fixes #1490
progress_stream would print a lot of new lines on "docker-compose pull" if there's no tty.

Signed-off-by: Yves Peter <ypdraw@gmail.com>
2015-11-11 11:20:59 -08:00
Aanand Prasad
2063b39868 Merge pull request #2336 from dnephin/warn_on_volume_masking
Add a warning when the host volume in the compose file is masked by a data volume
2015-11-11 17:21:29 +00:00
Daniel Nephin
19b2c41c7e Add a test for invalid field 'name', and fix an existing test for invalid service names.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-11 11:00:11 -05:00
Daniel Nephin
1f7faadc77 Remove name from config schema.
Refactors config validation of a service to use a ServiceConfig data object.
Instead of passing around a bunch of related scalars, we can use the
ServiceConfig object as a parameter to most of the service validation functions.

This allows for a fix to the config schema, where the name is a field in the
schema, but not actually in the configuration. My passing the name around as
part of the ServiceConfig object, we don't need to add it to the config options.
Fixes #2299

validate_against_service_schema() is moved from a conditional branch in
ServiceExtendsResolver() to happen as one of the last steps after all
configuration is merged. This schema only contains constraints which only need
to be true at the very end of merging.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-11 11:00:11 -05:00
Daniel Nephin
5e97b806d5 Fix a bug in ExtendsResolver where the service name of the extended service was wrong.
This bug can be seen by the change to the test case. When the extended service
uses a different name, the error was reported incorrectly.

By fixing this bug we can simplify self.signature and self.detect_cycles to
always use self.service_name.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-11 10:58:07 -05:00
Daniel Nephin
a92d86308f Rename ServiceLoader to ServiceExtendsResolver
ServiceLoader has evolved to be not really all that related to "loading" a
service. It's responsibility is more to do with handling the `extends`
field, which is only part of loading.  The class and its primary method
(make_service_dict()) were renamed to better reflect their responsibility.

As part of that change process_container_options() was removed from
make_service_dict() and renamed to process_service().  It contains logic for
handling the non-extends options.

This change allows us to remove the hacks from testcase.py and only call
the functions we need to format a service dict correctly for integration tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-11 10:58:07 -05:00
Daniel Nephin
98ad5a05e4 Validate additional files before merging them.
Consolidates all the top level config handling into `process_config_file` which
is now used for both files and merge sources.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-11 10:56:15 -05:00
Aanand Prasad
7466d14826 Merge pull request #2363 from dnephin/pr-2261
Rebase of PR 2261
2015-11-11 15:48:28 +00:00
Daniel Nephin
c006c6ea09 Merge pull request #2341 from dnephin/dont_create_default_network_sometimes
Only create the default network if at least one service needs it
2015-11-11 10:48:08 -05:00
Daniel Nephin
7365a398b3 Update doc wording for ulimits.
and move tests to the correct module

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-10 15:03:20 -05:00
Kevin Greene
22d90d2180 Added ulimits functionality to docker compose
Signed-off-by: Kevin Greene <kevin@spantree.net>
2015-11-10 14:07:04 -05:00
Daniel Nephin
a8ac6e6f93 Add a warning when the host volume config is being ignored.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-10 13:48:53 -05:00
Daniel Nephin
7d6c63d1b7 Merge pull request #2361 from dnephin/pr-2262
Rebase of PR 2262
2015-11-10 13:42:08 -05:00
Joffrey F
2c2b8a8322 Merge pull request #2360 from shin-/2357-http_timeout_exit_1
Use exit code 1 when encountering a ReadTimeout
2015-11-10 10:31:58 -08:00
Daniel Nephin
338bbb5063 Re-order flags in bash completion
and remove unnecessary variables from build command.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-10 13:11:59 -05:00
Joffrey F
133d213e78 Use exit code 1 when encountering a ReadTimeout
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-10 10:11:20 -08:00
Adrian Budau
c5c36d8b00 Added --force-rm to compose build.
It's a flag passed to docker build that removes the intermediate
containers left behind on fail builds.

Signed-off-by: Adrian Budau <budau.adi@gmail.com>
2015-11-10 13:05:04 -05:00
Daniel Nephin
45724fc667 Only create the default network if at least one service needs it.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-10 12:43:55 -05:00
Daniel Nephin
3474bb6cf5 Cleanup workaround in testcase.py
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-10 12:43:55 -05:00
Aanand Prasad
0017f43d7f Merge pull request #2339 from dnephin/recreate_deps_on_create
Recreate dependents when a dependency is created
2015-11-10 17:36:23 +00:00
Daniel Nephin
c8fa0a902a Merge pull request #2331 from dnephin/flush_log_buffer_when_printing_logs
Flush the log stream after writing each line
2015-11-10 12:34:42 -05:00
Aanand Prasad
917b885a44 Merge pull request #2334 from dnephin/dont_set_hostname
Don't set the hostname to the service name with networking.
2015-11-10 17:34:02 +00:00
Daniel Nephin
b09cf86dd6 Merge pull request #2326 from dnephin/unicode_decode_error
Unicode decode error
2015-11-10 12:29:52 -05:00
Joffrey F
774d852f93 Merge pull request #2335 from dnephin/volumes_refactoring
Some small refactoring around volumes
2015-11-09 14:05:52 -08:00
Daniel Nephin
e5fbf35ce1 Merge pull request #2351 from shin-/2322_config_hash_volumes_from
Update service config_dict computation to include volumes_from mode
2015-11-09 16:26:47 -05:00
Joffrey F
a1e140f5a3 Update service config_dict computation to include volumes_from mode
Ensure config_hash is updated when volumes_from mode is changed, and
service is recreated on next up as a result.

Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-09 13:07:26 -08:00
Daniel Nephin
b7fe86b99a Merge pull request #2348 from aanand/fix-parallel-output
Fix parallel output
2015-11-09 13:09:50 -05:00
Aanand Prasad
1bfb710326 Fix parallel output
We were outputting an extra line, which in *some* cases, on *some*
terminals, was causing the output of parallel actions to get messed up.

In particular, it would happen when the terminal had just been cleared
or hadn't yet filled up with a screen's worth of text.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-11-09 17:24:21 +00:00
Daniel Nephin
7c2a16234f Recreate dependents when a dependency is created (not just when it's recreated).
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-06 12:29:52 -05:00
Daniel Nephin
ec22d98377 Use VolumeSpec instead of re-parsing the volume string.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 18:11:56 -05:00
Daniel Nephin
0e19c92e82 Make working_dir consistent in the config package.
- make it a positional arg, since it's required
- make it the first argument for all functions that require it
- remove an unnecessary one-line function that was only called in one place

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 18:11:56 -05:00
Daniel Nephin
3456002aef Don't set the hostname to the service name with networking.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 17:50:32 -05:00
Daniel Nephin
d32bb8efee Fix #1549 - flush after each line of logs.
Includes some refactoring of log_printer_test to support checking for flush(), and so that each test calls the unit-under-test directly, instead of through a helper function.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 15:33:42 -05:00
Daniel Nephin
26c7dd3712 Handle non-utf8 unicode without raising an error.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 12:56:36 -05:00
Aanand Prasad
67dc90ec0e Merge pull request #2314 from dnephin/fix_up_require_build_error
Fix `up` "requires build" error
2015-11-05 15:52:56 +00:00
Aanand Prasad
97dee9d54a Merge pull request #2310 from dnephin/update_release_notes
Update release notes
2015-11-05 15:52:41 +00:00
Daniel Nephin
8ff960afd1 Fix service recreate when image changes to build.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 10:27:11 -05:00
Daniel Nephin
ce322047a0 Move config hash tests to service_test.py
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 10:27:11 -05:00
Daniel Nephin
0227b3adbd Upgrade pyyaml to 3.11
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 10:26:54 -05:00
Daniel Nephin
d18ad4c812 Fix rebase-bump-commit script when used with a final release.
Previously it would find commits for RC releases, which broke the rebase.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 10:25:46 -05:00
Daniel Nephin
6b002fb922 Cherry-pick release notes froim 1.5.0
And bump version to 1.6.0dev

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-05 10:25:46 -05:00
Daniel Nephin
50f06c6ba2 Merge pull request #2325 from dnephin/fix_jenkins_build
Fix jenkins CI
2015-11-04 17:25:17 -05:00
Daniel Nephin
385b4280a1 Fix jenkins CI by using an older docker version to match the host.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-04 15:33:37 -05:00
Aanand Prasad
6a8806fe8d Merge pull request #2304 from dnephin/remove_start_container
Remove service.start_container()
2015-11-04 10:19:33 +00:00
Aanand Prasad
4ebe68e612 Merge pull request #2290 from dnephin/docs_multi_file_compose
Docs for using multiple compose files
2015-11-03 17:14:57 +00:00
Daniel Nephin
e503e085ac Re-order extends docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:52:44 -05:00
Daniel Nephin
8bdde9a731 Replace composition with Compose app.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:28:51 -05:00
Daniel Nephin
eab265befa Document using multiple Compose files use cases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:28:51 -05:00
Daniel Nephin
c5cf5cfad4 Changes to production.md for working with multiple Compose files.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:28:51 -05:00
Daniel Nephin
1c4c7ccfac Support a volume to the docs directory and add --watch, so docs can be refreshed.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:28:51 -05:00
Daniel Nephin
7014cabb04 Remove duplication from extends docs.
Start restructuring extends docs in preparation for adding documentation about using multiple compose files.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 11:28:51 -05:00
Aanand Prasad
767a13f771 Merge pull request #2165 from dnephin/more_user_docs
Restructure intro docs
2015-11-03 16:22:28 +00:00
Daniel Nephin
3d9e3d0877 Remove service.start_container()
It has been an unnecessary wrapper around container.start() for a little while now, so we can call it directly.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-03 10:17:09 -05:00
Aanand Prasad
19a41997c2 Merge pull request #2306 from dnephin/cli_tests_use_cli
Update cli test suite to run the executable in a child process
2015-11-03 15:05:47 +00:00
Daniel Nephin
45635f7097 Move cli tests to a new testing package.
These cli tests are now a different kind of that that run the compose binary. They are not the same as integration tests that test some internal interface.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 19:28:58 -05:00
Daniel Nephin
8057bb3fcc Update cli tests to use subprocess.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 17:35:00 -05:00
Daniel Nephin
c58cf036e3 Touch up intro paragraph with feedback from @moxiegirl.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
a3fb13e141 Add another feature to the docs - multiple environments per host.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
d9bc91b7cc Update intro docs based on feedback.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
db3b90b84e Updates to gettingstarted guide from PR feedback.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
86d845fde3 Flush out features and use cases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
186d43c59f Extract the getting started guide from the index page.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
53a0de7cf2 Add missing title to compose file reference.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 15:16:23 -05:00
Daniel Nephin
3738da09e2 Merge pull request #2298 from dnephin/update_networking_test_for_rc4
Fix networking tests to work with new API in engine rc4
2015-11-02 15:10:17 -05:00
Daniel Nephin
abde64d610 On a test failure only show the last 100 lines of daemon output.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 14:16:52 -05:00
Daniel Nephin
1b5b407619 Fix networking tests to work with new API in engine rc4 (https://github.com/docker/docker/pull/17536)
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-02 13:40:56 -05:00
Daniel Nephin
77e1fe1915 Merge pull request #2295 from dnephin/default_network_should_be_none
Don't set a default network driver, let the server decide
2015-10-30 15:29:30 -04:00
Daniel Nephin
66ef2519d3 Merge pull request #2265 from dnephin/volumes_in_guides_doc
Update tutorials and small fix with rails tutorial
2015-10-30 13:30:00 -04:00
Daniel Nephin
c7d164d01c Fixes #1843, #1936 - chown files back to host user in django example.
Also add a missing 'touch Gemfile.lock' to fix the rails tutorial.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-30 12:42:15 -04:00
Daniel Nephin
491d052088 Don't set a default network driver, let the server decide.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-30 11:53:36 -04:00
Daniel Nephin
c439e056a0 Merge pull request #2288 from dnephin/warning_about_vars
Add console color to warnings and errors so they are more obvious
2015-10-30 10:58:00 -04:00
Daniel Nephin
04a76dc284 Merge pull request #2287 from shin-/2284-ensure-network-exists-run
Ensure network exists when calling run before up
2015-10-30 10:41:55 -04:00
Joffrey F
072e7687ae Integration test for run command with networking enabled
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-10-30 14:15:47 +01:00
Daniel Nephin
eb9b8dc592 Merge pull request #2283 from dnephin/fix_not_none_log_driver
Logs are available for all log drivers except for none.
2015-10-29 15:01:05 -04:00
Daniel Nephin
841ed4ed21 Remove the duplicate 'Warning' prefix now that the logger adds the prefix.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-29 14:18:28 -04:00
Daniel Nephin
d836973a04 Use colors when logging warnings or errors, so they are more obvious.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-29 14:06:50 -04:00
mnowster
057b8e291c Merge pull request #2286 from mnowster/2281-docs-curl-command
Clarify the command is an example
2015-10-29 17:20:59 +00:00
Joffrey F
596261e759 Ensure network exists when calling run before up
Otherwise the daemon will error out because the network doesn't exist
yet.

Signed-off-by: Joffrey F <joffrey@docker.com>
2015-10-29 17:56:01 +01:00
Mazz Mosley
983dc12160 Clarify the command is an example
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-29 16:52:00 +00:00
Daniel Nephin
eab9d86a3d Logs are available for all log drivers except for none.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-29 11:28:17 -04:00
mnowster
6cd9bab35b Merge pull request #2276 from dnephin/update_networking_docs
Update docs about networking for current release
2015-10-29 15:19:02 +00:00
mnowster
64a2713714 Merge pull request #2264 from mnowster/2259-unicode-error-volume-paths
Handle non-ascii volume directories
2015-10-29 14:42:29 +00:00
Mazz Mosley
5dc14f3925 Handle non-ascii chars in volume directories
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-29 12:05:51 +00:00
mnowster
0b25014020 Merge pull request #2278 from dnephin/disable_flaky_test
Disable flaky test against 1.8.3
2015-10-29 12:04:54 +00:00
mnowster
3a2df57f3d Merge pull request #2273 from mnowster/cross-ref-docs
Add cross references for env/cli
2015-10-29 12:04:10 +00:00
Daniel Nephin
a71d9af522 Disable a test against docker 1.8.3 because it fails due to a bug in docker engine.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-28 17:54:38 -04:00
Daniel Nephin
0ef3b47f74 Update docs about networking for current release.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-28 15:17:11 -04:00
mnowster
66f1c8e6c0 Merge pull request #2272 from dnephin/update_release_docs_and_scripts
Another release, another round of fixes to the release scripts
2015-10-28 17:54:48 +00:00
mnowster
dfaa18ebc5 Merge pull request #2274 from mnowster/docs-key-dependency-clarification
Clarify `dockerfile` requires `build` key
2015-10-28 17:45:27 +00:00
Mazz Mosley
e13b8949b0 Add cross references for env/cli
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-28 17:42:30 +00:00
Mazz Mosley
c341860d11 Clarify dockerfile requires build key
Credit to @funkyfuture for the first PR addressing the clarification.
https://github.com/docker/compose/pull/1767

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-28 17:27:38 +00:00
Daniel Nephin
8306405340 On error print daemon logs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-28 12:40:59 -04:00
Daniel Nephin
bbc76e6034 Convert the README to rst and fix the logo url before packaging it up for pypi.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-28 12:11:29 -04:00
Daniel Nephin
c4f0f24c57 Fix release script notes about software and typos.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-28 12:10:30 -04:00
mnowster
7e48b0b289 Merge pull request #2271 from mnowster/2270-pypi-page-info
Include link to github for code & issues
2015-10-28 15:30:07 +00:00
Mazz Mosley
379af594da Include link to github for code&issues
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-28 14:59:43 +00:00
Daniel Nephin
b6b9b002e5 Merge pull request #2254 from mnowster/1756-dont-display-output-from-previous-runs
1756 dont display output from previous runs
2015-10-27 18:45:47 -04:00
Mazz Mosley
76d52b1c5f Remove redundant try/except
Code cleanup. We no longer need this as the api returns a 304 for any
stopped containers, which doesn't raise an error.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 17:12:18 +00:00
Mazz Mosley
30a84f1be6 Move rename functionality into Container
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 17:12:18 +00:00
Mazz Mosley
bee063c07d Fix tests
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 17:12:18 +00:00
Mazz Mosley
7603ebea9b Attach to a container's log_stream before they're started
So we're not displaying output of all previous logs for a container, we attach,
if possible, to a container before the container is started.

LogPrinter checks if a container has a log_stream already attached and
print from that rather than always attempting to attach one itself.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 17:12:18 +00:00
mnowster
ffa2b08dbb Merge pull request #2258 from dnephin/dont_link_when_using_networking
Fix running one-off containers with --x-networking
2015-10-27 15:32:20 +00:00
Daniel Nephin
7878d38dee Fix running one-off containers with --x-networking by disabling linking to self.
docker create fails if networking and links are used together.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-27 11:11:15 -04:00
mnowster
a4b002a76e Merge pull request #2257 from mnowster/2226-additional-classifiers
Include additional classifiers
2015-10-27 11:12:38 +00:00
Mazz Mosley
fe760a7b62 Include additional classifiers
I've included Python 2/3 as they are not parent classifiers but
sibling classifiers. They denote that this project will work with
*some* versions of python and by having them, they'll show up for
people searching for python 2 or 3 projects.

According to the internet :)

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-26 17:08:45 +00:00
mnowster
f3d49e38c0 Merge pull request #2245 from dnephin/upgrade_to_pyinstaller_3
Upgrade to pyinstaller 3
2015-10-26 11:54:02 +00:00
Daniel Nephin
0340361f56 Upgrade pyinstaller to 3.0
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-23 13:34:49 -04:00
mnowster
986036b6f9 Merge pull request #2223 from au-phiware/master
Powershell script to run compose in a container.
2015-10-23 18:10:18 +01:00
mnowster
5d60fbe31e Merge pull request #1659 from viranch/hostip-random-port
Allow scaling services that have port binding of the form `host_ip::container_port`
2015-10-23 17:11:28 +01:00
mnowster
e6f3946c17 Merge pull request #2239 from dnephin/fix_unicode_in_env
Fix unicode in environment variables for python2
2015-10-23 11:03:59 +01:00
moxiegirl
e2af02b158 Merge pull request #2238 from SvenDowideit/possible-link-fixes
Possible link fixes
2015-10-22 16:27:44 -07:00
Sven Dowideit
cf197253cd Possible link fixes
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-10-23 09:00:08 +10:00
Daniel Nephin
ae47435425 Fix unicode in environment variables for python2.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-22 12:12:43 -04:00
mnowster
6f78271b82 Merge pull request #2236 from dnephin/use_inspect_network
Use inspect network to query for an existing network
2015-10-22 13:37:27 +01:00
Daniel Nephin
cf40a38820 Merge pull request #2237 from dnephin/env_ci_storage_graph
Make storage driver configurable in CI
2015-10-21 16:29:40 -04:00
Daniel Nephin
f7100b2ef3 Change version check from engine version to api version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 15:40:50 -04:00
Daniel Nephin
1bc3c97f2a Make storage driver configurable in CI
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 15:26:44 -04:00
Daniel Nephin
0fed5e6864 Use inspect network to query for an existing network.
And more tests for get_network()

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 13:05:14 -04:00
mnowster
c34a9f165d Merge pull request #2207 from dnephin/make_config_loader_immutable
Refactor of ServiceLoader to make it immutable
2015-10-21 17:14:40 +01:00
Daniel Nephin
b500fa2351 Refactor ServiceLoader to be immutable.
Mutable objects are harder to debug and harder to reason about. ServiceLoader was almost immutable. There was just a single function which set fields for a second function. Instead of mutating the object, we can pass those values as parameters to the next function.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 11:14:35 -04:00
Daniel Nephin
4505632274 Some minor style cleanup
- fixed a docstring to make it PEP257 compliant
- wrapped some long lines
- used a more specific error

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 11:13:00 -04:00
mnowster
fb69391889 Merge pull request #2233 from dnephin/some_unit_test_cleanup
Cleanup some unit tests and whitespace
2015-10-21 10:39:28 +01:00
mnowster
44e1fc3a32 Merge pull request #2230 from dnephin/lowercase_windows_drive
Lowercase windows drive letter
2015-10-21 10:36:46 +01:00
Daniel Nephin
b1f8ed84a3 Cleanup some unit tests and whitespace.
Remove some unnecessary newlines.
Remove a unittest that was attempting to test behaviour that was removed a while ago, so isn't testing anything.
Updated some unit tests to use mocks instead of a custom fake.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-20 14:23:56 -04:00
Daniel Nephin
5523c3d745 Minor refactor to use guard and replace instead of split+join
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-20 12:09:01 -04:00
Daniel Nephin
3f0e083585 Force windows drives to be lowercase.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-20 11:39:06 -04:00
mnowster
5ed9f9bdf7 Merge pull request #2206 from dnephin/fix_extends_from_second_file
extends must be copied from override file
2015-10-20 10:22:58 +01:00
Daniel Nephin
3725c3ab7e Merge pull request #2225 from mnowster/2221-blank-env-vars
2221 allow empty environment keys
2015-10-19 14:06:31 -04:00
Daniel Nephin
938d49cbdc Fixes #2205 - extends must be copied from override file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-19 13:41:58 -04:00
mnowster
f1f3acd070 Merge pull request #2210 from dnephin/fix_empty_override
Properly validate files when multiple files are used
2015-10-19 18:32:48 +01:00
Daniel Nephin
937e087c6c Fixes #2203 - properly validate files when multiple files are used.
Remove the single-use decorators so the functionality can be used directly as a function.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-19 12:39:45 -04:00
Daniel Nephin
cd0b63879b Merge pull request #2208 from dnephin/another_release_script_fix
Fix check for tags in release script `make-branch`
2015-10-19 12:34:25 -04:00
Daniel Nephin
129e2f9482 Fix check for tags.
If there is a branch with the same name as a tag it fails without the
--tags. This was only a problem when we're branching from a git tag.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-19 12:33:25 -04:00
mnowster
a75bdfe11c Merge pull request #2220 from ticosax/trove-classifire
Add trove classifier to declare supported python versions.
2015-10-19 17:20:31 +01:00
Mazz Mosley
08add665e9 Environment keys can contain empty values
Environment keys that contain no value, get populated with values taken
from the environment not from the build phase but from running the command `up`.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-19 16:32:12 +01:00
mnowster
159cddf563 Merge pull request #2209 from dnephin/fix_error_on_invalid_yaml
Give the user a better error message when the yaml file is invalid
2015-10-19 16:29:36 +01:00
Daniel Nephin
076b5bc31c Merge pull request #2197 from sdurrheimer/zsh-completion-network-options
Add zsh completion for 'docker-compose --x-networking --x-network-dri…
2015-10-19 10:37:57 -04:00
Mazz Mosley
ff83c459d0 Improve error message for type constraints
It was missing a space between the different types, when there
were 3 possible type values.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-19 14:36:56 +01:00
Corin Lawson
4d8e667c3e Powershell script to run compose in a container.
This script assumes the typical environment that Windows users operate,
namely, VirtualBox running the boot2docker ISO, managed by
docker-machine. I wrote this script for my Windows using colleagues and
first placed it in the public domain as a gist:
https://gist.github.com/au-phiware/25213e72c80040f398ba
In short, that script works for me.

I have adapted that script to use the (yet to be) official image
(docker/compose:latest) and also added an extra environment variable to
provide additional options to docker run.

Signed-off-by: Corin Lawson <corin@phiware.com.au>
2015-10-19 22:32:35 +11:00
mnowster
1a97a8ef86 Merge pull request #2213 from viranch/trim-dockerfile
Trim Dockerfile
2015-10-19 12:08:20 +01:00
Steve Durrheimer
ac06366ef9 Add zsh completion for 'docker-compose --x-networking --x-network-driver'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-10-19 12:31:17 +02:00
mnowster
bca018c50a Merge pull request #2211 from albers/completion-networking
bash completion for networking options
2015-10-19 11:23:03 +01:00
mnowster
2516aa8e08 Merge pull request #2212 from albers/completion-nospace
fix problem with bash completion in old bash
2015-10-19 11:22:44 +01:00
Nicolas Delaby
37921b40dd Add trove classifier to declare supported python versions.
Signed-off-by: Nicolas Delaby <nicolas.delaby@lock8.me>
2015-10-19 10:52:39 +02:00
Viranch Mehta
07e9f6500c Pipe curl's download directly to extract/execute program to reduce number of commands
Signed-off-by: Viranch Mehta <viranch.mehta@gmail.com>
2015-10-18 01:06:50 +05:30
Viranch Mehta
258c8bc54d Fix specifies_host_port() to handle port binding with host IP but no host port
Signed-off-by: Viranch Mehta <viranch.mehta@gmail.com>
2015-10-18 00:40:51 +05:30
Harald Albers
fa44a5fac2 fix problem with bash completion in old bash
Signed-off-by: Harald Albers <github@albersweb.de>
2015-10-17 09:51:37 -07:00
Harald Albers
43a89e1702 bash completion for networking options
Signed-off-by: Harald Albers <github@albersweb.de>
2015-10-17 09:30:53 -07:00
Daniel Nephin
ae3c66baed Merge pull request #2204 from mnowster/2123-escaping-env-variables
Attempt to document escaping env vars
2015-10-16 15:51:58 -04:00
Daniel Nephin
26dc0b785b Give the user a better error message (without a stack trace) when there is a yaml error.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-16 15:05:06 -04:00
mnowster
4b939d3560 Merge pull request #2199 from cweagans/1752-docker-compose-pull-service-nodeps
docker-compose pull SERVICE should not pull SERVICE's dependencies
2015-10-16 17:12:28 +01:00
mnowster
a712d828d4 Merge pull request #2200 from aanand/revert-tutorials
Revert networking-related changes to getting started guides
2015-10-16 17:06:31 +01:00
Mazz Mosley
7b109bc026 Attempt to document escaping env vars
People are likely to run into their env vars being set to empty strings,
if they're not aware that they need to escape them for Compose to not
interpolate them.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-16 15:32:02 +01:00
mnowster
b0c895c5f5 Merge pull request #2193 from mrfuxi/less-verbose-extends-docs
Docs for shorthand notation of extends. Issue #1989
2015-10-16 10:25:10 +01:00
Aanand Prasad
1ed23fb2de Revert networking-related changes to getting started guides
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-16 11:58:27 +05:30
Cameron Eagans
53fc6d06f6 docker-compose pull SERVICE should not pull SERVICE's dependencies
Signed-off-by: Cameron Eagans <me@cweagans.net>
2015-10-15 17:33:32 -06:00
Karol Duleba
ccfb6e6fa8 Docs for shorthand notation of extends. Issue #1989
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-10-15 22:17:13 +01:00
Daniel Nephin
8f840a55de Merge pull request #2194 from dnephin/update_release_docs
Update release docs
2015-10-15 15:40:13 -04:00
mnowster
4d8b184b14 Merge pull request #2196 from md2perpe/patch-1
Remove incorrectly placed comment
2015-10-15 15:31:49 +01:00
mnowster
971bfd403e Merge pull request #2195 from timbutler/master
Fix link to Release Process doc in README.md
2015-10-15 15:30:00 +01:00
Per Persson
c6ff81fe30 Remove incorrectly placed comment
I'm not sure if it should be there at all, but at least it should hardly be where it currently is located.

Signed-off-by: Per Persson <per.persson@exertisztorm.com>
2015-10-15 15:25:52 +02:00
Tim Butler
7e59a7ea32 Fix link to Release Process doc in README.md
Signed-off-by: Tim Butler <tim.butler.au@gmail.com>
2015-10-15 17:09:57 +10:00
Daniel Nephin
fbe8e76902 Add missing merge for release branch.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 15:24:05 -04:00
Daniel Nephin
58e6d4487a Fix some release docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 15:16:58 -04:00
Daniel Nephin
338f2f4507 Add a script to generate contributor list.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 15:14:04 -04:00
Daniel Nephin
0409b287ad Merge pull request #2191 from dnephin/networking
Networking
2015-10-14 12:31:26 -04:00
mnowster
6b68a84b9b Merge pull request #2019 from mrfuxi/less-verbose-extends
Allow to extend service using shorthand notation. Closes #1989
2015-10-14 17:13:09 +01:00
Daniel Nephin
e2f792c4f4 If -x-networking is used, set the correct API version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 12:09:50 -04:00
Aanand Prasad
d5f5eb1924 Enable use of Docker networking with the --x-networking flag
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-14 11:19:43 -04:00
Daniel Nephin
f228173660 Print docker version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 11:18:21 -04:00
Daniel Nephin
7c6e7e0dce Update docker-py to 1.5.0
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 11:18:21 -04:00
Daniel Nephin
b9c76dfabd Merge pull request #2181 from mnowster/2128-split-drive-not-handling-relative-paths
2128 split drive not handling relative paths
2015-10-14 11:04:42 -04:00
Daniel Nephin
f1e3c7b8b8 Merge pull request #2189 from mnowster/support-for-cgroup_parent
Support for cgroup parent
2015-10-14 10:59:04 -04:00
Mazz Mosley
ca36628a0e Test cgroup_parent option is being sent.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-14 15:02:42 +01:00
Mohit Soni
f4efa29377 Added support for cgroup_parent
This change adds cgroup-parent support to compose project. It allows
each service to specify a 'cgroup_parent' option.

Signed-off-by: Mohit Soni <mosoni@paypal.com>
2015-10-14 15:02:42 +01:00
mnowster
26ff729696 Merge pull request #2164 from dnephin/rename_compose_reference
Rename "yml reference" to "Compose file reference"
2015-10-14 14:58:35 +01:00
Daniel Nephin
fbfbe60246 Rename yml.md to compose-file.md and add an alias for the old url.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 09:51:34 -04:00
Daniel Nephin
01f44efe0d Re-arrange volume_driver in compose file reference.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 09:50:37 -04:00
Daniel Nephin
e6344f819a Rename yaml reference to compose file reference.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-14 09:50:37 -04:00
Karol Duleba
c7ffbf97c8 Extend oneOf error handling. Issue #1989
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-10-14 14:31:35 +01:00
mnowster
bc82f065bc Merge pull request #1994 from charleswhchan/patch-3
Touchup "Quickstart Guide: Compose and Django"
2015-10-14 12:46:16 +01:00
Charles Chan
5fa5ea0e16 Touchup "Quickstart Guide: Compose and Django"
Also incorporated the structural changes by @moxiegirl in PR #1994 as well as subsequent issues reported by @aanand.

Signed-off-by: Charles Chan <charleswhchan@users.noreply.github.com>
2015-10-13 20:10:41 -07:00
Daniel Nephin
c06d9ec672 Merge pull request #2179 from moxiegirl/retooling-hugo-15
Updating to new tooling:supports Github source linking
2015-10-13 18:12:56 -04:00
Mary Anthony
e9ee244e5a Aaaaaaaaaaaargh
Signed-off-by: Mary Anthony <mary@docker.com>
2015-10-13 15:06:37 -07:00
Mary Anthony
0e9c542865 Updating to new tooling:supports Github source linking
Fixing HEAD
Updating to match daniel
Fixing the index link

Signed-off-by: Mary Anthony <mary@docker.com>
2015-10-13 14:04:25 -07:00
mnowster
129092b7b4 Merge pull request #2159 from dnephin/update_pip_install_docs
Update pip install instructions to be more reliable
2015-10-13 17:35:59 +01:00
Mazz Mosley
c1d5ecaafe Workaround splitdrive limitations
splitdrive doesn't handle relative paths, so if volume_path contains
a relative path, we handle that differently and manually set drive to ''.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-13 17:27:25 +01:00
Daniel Nephin
9aaecf95a4 Update pip install instructions to be more reliable.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-13 12:25:06 -04:00
Mazz Mosley
bc6b3f970b container paths don't need to be expanded
They should not ever be relative.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-13 17:03:09 +01:00
mnowster
4b845746ef Merge pull request #2154 from dnephin/publish_master_builds
Publish master builds to bintray
2015-10-13 14:50:25 +01:00
mnowster
928300478b Merge pull request #2162 from dnephin/docs_cleanup_and_fixes
Docs changes, fixed some links, removed older links, etc
2015-10-13 14:25:33 +01:00
Daniel Nephin
9b9c8f9cbc Clarify irc details, and remove "infancy" statement.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 11:14:21 -04:00
Daniel Nephin
e90d2b418d Update title for command-line completion docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 11:14:21 -04:00
Daniel Nephin
182c2537d0 Fix links between reference sections
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 11:14:21 -04:00
Daniel Nephin
cd48a7026a Cleanup doc reference links.
Removed 'Compose command line completion' and 'Compose environment variables' from the list. command line completion is linked to from install docs, and environment variables are deprecated.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 11:13:24 -04:00
Daniel Nephin
6e838b5de1 Add link to master builds from install docs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 10:03:44 -04:00
Daniel Nephin
0e9ec8aa74 Add publish to bintray step to appveyor.yml
Remove Set-PSDebug -trace to prevent the 9000+ lines of debug output
from spamming the logs on appveyor.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-09 10:02:59 -04:00
Daniel Nephin
94e6727831 Re-order docs Makefile for better caching.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-08 19:12:02 -04:00
Daniel Nephin
5fbde6106e Merge pull request #2157 from mnowster/2151-missing-port-range
Put port ranges back in
2015-10-08 10:22:33 -04:00
Mazz Mosley
a3eb563f94 Put port ranges back in
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-08 11:50:27 +01:00
mnowster
7538d7d258 Merge pull request #2152 from ronen/patch-1
Bug fix: Use app's Gemfile.lock in Dockerfile
2015-10-08 11:14:48 +01:00
ronen barzel
23fcace36c Bug fix: Use app's Gemfile.lock in Dockerfile
The Dockerfile should use the same Gemfile.lock as the app, to make sure the container gets the expected versions of gems installed.  Aside from wanting that in principle, without it you can get mysterious gem dependency errors.  Here's the scenario:

1. Suppose `Gemfile` includes `gem "some-active-gem", "~> 1.0"
2. When developing the app, you run `bundle install`, which installs the latest version--let's say, 1.0.1-and records it in `Gemfile.lock`
3. Suppose the developers of `some-active-gem` then release v1.0.2
4. Now build the container: docker runs `bundle install`, which installs v1.0.2 and records it in `Gemfile.lock` and then "ADD"s the app worktree, which replaces the `Gemfile.lock` with the one from the worktree that lists v1.0.1.
5. Immediately run your app and it fails with the error `Could not find some-active-gem-1.0.1 in any of the sources` which is a bit befuddling since you just saw it run bundle install so you expect all gem dependencies to be resolved properly.

Signed-off-by: ronen barzel <ronen@barzel.org>
2015-10-08 03:08:50 +01:00
Daniel Nephin
9ce1884925 Add upload to bintray from travis.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-07 14:54:05 -04:00
mnowster
7fe2068c9c Merge pull request #2150 from dnephin/fix_image_name_in_runsh
Update release script and run.sh image name
2015-10-07 16:38:45 +01:00
Daniel Nephin
ad96e10938 Add travis.yml for building binaries.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-07 11:07:20 -04:00
Daniel Nephin
34f5912bbc Update release script and run.sh image name.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-07 11:00:40 -04:00
mnowster
c8cd618df9 Merge pull request #2145 from dnephin/update_release_scripts
Update release scripts for release image
2015-10-07 15:51:04 +01:00
Daniel Nephin
dbe311caaa Merge pull request #2149 from mnowster/2146-improve-bool-warning-message
Improve boolean warning message.
2015-10-07 10:23:58 -04:00
Mazz Mosley
8efc39e616 Improve boolean warning message.
Including examples of more boolean types, eg yes/N as it's not
always immediately clear that they are treated as booleans.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 14:59:08 +01:00
Aanand Prasad
627f1acdc4 Merge pull request #2126 from mnowster/1188-support-ro-options-in-volumes-from
1188 support ro options in volumes from
2015-10-07 11:57:14 +01:00
Aanand Prasad
60c9225d22 Merge pull request #2140 from dnephin/fix_patch_stdout
Reduce the scope of sys.stdout patching
2015-10-07 11:43:25 +01:00
Mazz Mosley
21a1affc63 Re-word docs.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Mazz Mosley
f9028703f4 Pick the first container
Rather than inefficiently looping through all the containers that a
service has and overriding each volumes_from value, pick the first
one and return that.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Mazz Mosley
0ff84a78c6 Use multiple returns rather than overriding.
Also added a doc string for clarity.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Mazz Mosley
467c731869 address PR feedback
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Aanand Prasad
fda615008c Merge pull request #2142 from dnephin/fix_error_cant_connect
Fix error when compose can't connect to docker
2015-10-07 11:22:32 +01:00
Daniel Nephin
4ae2a0e610 Update release scripts for release image.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 15:21:34 -04:00
Aanand Prasad
807ab89750 Merge pull request #2144 from dnephin/remove_router_php
Remove unnecessary router.php from wordpress example.
2015-10-06 17:25:00 +01:00
Daniel Nephin
97dc4895ac Remove unnecessary router.php from wordpress example.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 11:37:36 -04:00
Aanand Prasad
02a20c0373 Merge pull request #2069 from dnephin/test_against_latest_version_tags
Test against a list of versions generated from docker/docker tags
2015-10-06 16:33:15 +01:00
Aanand Prasad
bf2faf6cdb Merge pull request #2132 from dnephin/fix_build_against_swarm
Fix build against swarm
2015-10-06 16:26:48 +01:00
Daniel Nephin
6edb6fa262 Test against a list of versions generated from docker/docker tags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:51:52 -04:00
Daniel Nephin
15d0c60a73 Fix split buffer with inconsistently delimited json objects.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:43:07 -04:00
Daniel Nephin
3661e8bc74 Fix build against the swarm cluster by joining buffered output before parsing json.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:37:05 -04:00
Daniel Nephin
fe65c0258d Remove unused attach_socket function from Container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:37:05 -04:00
Daniel Nephin
13d5efcd8b Merge pull request #2143 from aanand/windows-preparation-instructions
Add preparation instructions to Windows build script
2015-10-06 10:13:06 -04:00
Vincent Demeester
5b55a08846 Add support for ro option in volumes_from
Fixes #1188

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-10-06 13:12:55 +01:00
Aanand Prasad
018b1b1c0f Add preparation instructions to Windows build script
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-06 12:57:01 +01:00
Daniel Nephin
fbaea58fc1 Fix #2133 - fix call to get_client()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-05 15:57:49 -04:00
Daniel Nephin
aefb7a44b2 Refactor command class hierarchy to remove an unnecessary intermediate base class Command.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-05 15:49:35 -04:00
Daniel Nephin
e230142a25 Reduce the scope of sys.stdout patching.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-03 01:24:28 -04:00
mnowster
19271898de Merge pull request #1806 from dnephin/run_script
Docker image and bash script for running compose in a container
2015-10-02 17:12:25 +01:00
mnowster
8616e291c5 Merge pull request #2034 from dnephin/release_scripts
Automated release scripts
2015-10-02 16:56:29 +01:00
Daniel Nephin
39cea970b8 alpine docker image for running compose and a script to pull and run it with the
correct volumes.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-10-02 11:38:35 -04:00
Daniel Nephin
04375fd566 Restore notes about building non-linux binaries.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 11:25:16 -04:00
Daniel Nephin
1a2a0dd53d Fix some bugs in the release scripts
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 11:21:38 -04:00
Daniel Nephin
dc56e4f97e Update release process docs to use scripts.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 11:21:38 -04:00
Daniel Nephin
da91b81bb8 Add scripts for automating parts of the release.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-02 11:21:38 -04:00
Aanand Prasad
6c88640887 Merge pull request #2122 from mnowster/2050-relative-volume-paths-windows
2050 ensure windows volume paths are compatible with engine
2015-10-02 16:17:43 +01:00
Mazz Mosley
bef5c2238e Skip a test for now
This needs resolving outside of this PR, as it is a much bigger piece
of work.

https://github.com/docker/compose/issues/2128

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 15:29:26 +01:00
Mazz Mosley
af8032a5f4 Fix incorrect test name
I'd written relative, when I meant absolute. D'oh.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Mazz Mosley
2276326d7e volume path compatibility with engine
An expanded windows path of c:\shiny\thing:\shiny:rw
needs to be changed to be linux style path, including the drive,
like /c/shiny/thing /shiny
to be mounted successfully by the engine.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Daniel Nephin
5b95c989cd Merge pull request #2125 from aanand/pass-all-docker-env-vars-to-pytest
Pass all DOCKER_ env vars to py.test
2015-10-01 13:47:03 -04:00
Mazz Mosley
58270d8859 Remove duplicate and re-order alphabetically
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-01 16:06:57 +01:00
Mazz Mosley
f4cd5b1d45 Handle windows volume paths
When a relative path is expanded and we're on a windows platform,
it expands to include the drive, eg C:\ , which was causing a ConfigError
as we split on ":" in parse_volume_spec and that was giving too many parts.

Use os.path.splitdrive instead of manually calculating the drive.

This should help us deal with windows drives as part of the volume
path better than us doing it manually.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-01 16:06:57 +01:00
mnowster
c673ce37c7 Merge pull request #2124 from aanand/dont-expand-volume-names
Don't expand volume names
2015-10-01 15:05:38 +01:00
Aanand Prasad
e38334efbd Don't expand volume names
Only expand volume host paths if they begin with a dot.

This is a breaking change. The deprecation warning preparing users for
this change has been removed.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-01 14:48:38 +01:00
Aanand Prasad
bb470798d4 Pass all DOCKER_ env vars to py.test
This ensures that `tox` will run against SSL-protected Docker daemons.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-01 12:26:58 +01:00
Daniel Nephin
dabf1e8657 Merge pull request #2087 from dnephin/release_notes
Add release notes for 1.4.2
2015-09-24 14:37:10 -04:00
Karol Duleba
91b227d133 Allow to extend service using shorthand notation. Closes #1989
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-09-24 18:01:47 +01:00
Daniel Nephin
bd1373f527 Bump 1.4.2
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-23 14:24:13 -04:00
mnowster
03ae2462d4 Merge pull request #2086 from dnephin/windows
Build the windows binary on appveyor, and disable some unit tests on windows
2015-09-23 15:58:28 +01:00
Daniel Nephin
78c0734cbd Disable some tests in windows for now.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-23 10:42:57 -04:00
Daniel Nephin
d5991761cd Fix building the binary on appveyor, and have it create an artifact.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-23 10:40:28 -04:00
Daniel Nephin
27e09dae5f Merge pull request #2083 from dnephin/fix_test_assumes_busybox
Fix a test case that assumes busybox image id
2015-09-23 09:40:45 -04:00
Aanand Prasad
9e75797943 Merge pull request #2084 from dnephin/windows
WIP: Add appveyor config for testing on windows and building windows binary
2015-09-22 19:37:45 +02:00
Daniel Nephin
0058d5dd4f Add appveyor config
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-22 12:45:19 -04:00
Daniel Nephin
c37a0c38a2 Fix a test case that assumes busybox image id.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-22 12:28:59 -04:00
mnowster
1e25d40c53 Merge pull request #2080 from moxiegirl/fix-2079
Fixing misspelling of WordPress
2015-09-21 17:17:31 +01:00
mnowster
6f12224ec9 Merge pull request #2005 from lnmunhoz/master
Fix error message and class name from Boot2Docker to DockerMachine
2015-09-21 17:05:03 +01:00
Mary Anthony
62ca8469b0 Fixing misspelling of WordPress
Signed-off-by: Mary Anthony <mary@docker.com>
2015-09-21 08:58:05 -07:00
mnowster
aa70209ade Merge pull request #1957 from aanand/stub-run-on-windows
WIP: Build Windows binary
2015-09-21 16:21:12 +01:00
mnowster
9f067fde10 Merge pull request #2078 from mnowster/aanand-remove-custom-docker-client-logic
Remove custom docker client initialization logic
2015-09-21 15:34:57 +01:00
Aanand Prasad
e5eaf68490 Remove custom docker client initialization logic
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-21 15:27:42 +01:00
moxiegirl
1deb534fee Merge pull request #2066 from mnowster/reorder-reference-docs
Reorder reference docs
2015-09-21 06:12:49 -07:00
mnowster
b9252aa48e Merge pull request #2032 from villlem/master
Flag to skip all pull errors when pulling images
2015-09-21 13:41:08 +01:00
Aanand Prasad
6817f76fd5 Merge pull request #2070 from albers/completion-run-name
Add bash completion for `docker-compose run --name`
2015-09-21 12:36:23 +02:00
Aanand Prasad
c950474810 Merge pull request #2071 from dnephin/fix_dist_directory_for_build
Restore the dist volume mount for building linux binaries
2015-09-21 12:35:58 +02:00
Aanand Prasad
36d886b8b0 Merge pull request #2073 from sdurrheimer/zsh-completion-run-name
Add zsh completion for 'docker-compose run --name'
2015-09-21 12:35:29 +02:00
Aanand Prasad
6ebfffed7d Merge pull request #2074 from sdurrheimer/zsh-completion-build-pull
Add zsh completion for 'docker-compose build --build'
2015-09-21 12:34:51 +02:00
Aanand Prasad
18dbe1b1c0 Merge pull request #2051 from dnephin/extend_compose_files
Extend compose files by allowing multiple files
2015-09-21 12:34:22 +02:00
Vojta Orgon
c9083e21c8 Flag to skip all pull errors when pulling images.
Signed-off-by: Vojta Orgon <villlem@gmail.com>
2015-09-21 11:59:23 +02:00
Daniel Nephin
22bc174650 Refactor config.load() to remove reduce() and document some types.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-18 17:11:16 -04:00
Steve Durrheimer
51ce16cf18 Add zsh completion for 'docker-compose build --build'
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-09-18 22:46:08 +02:00
Steve Durrheimer
12b38adfac Add zsh completion for 'docker-compose run --name'
Signed-off-by: Steve Durrheimer <steve.durrheimer@netapsys.fr>
2015-09-18 22:42:19 +02:00
Aanand Prasad
fb30498153 Catch WindowsError in call_silently
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-18 18:10:29 +01:00
Aanand Prasad
4ae7f00412 Build Windows binary
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-18 18:10:29 +01:00
Aanand Prasad
3e4182a480 Stub 'run' on Windows
Adapted from @dopry's work in https://github.com/docker/compose/pull/1900

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-18 18:10:17 +01:00
Aanand Prasad
bbc8b74c17 Merge pull request #2068 from mnowster/2037-jsonschema-resolver-windows-path-fix
Ensure RefResolver works across operating systems
2015-09-18 18:09:58 +01:00
Mazz Mosley
5509990a71 Ensure RefResolver works across operating systems
Slashes, paths and a tale of woe. Validation now works on windows \o/

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-18 17:51:26 +01:00
mnowster
61b819bd73 Merge pull request #2072 from albers/completion-build-pull
Add bash completion for `docker-compose build --pull`
2015-09-18 17:44:38 +01:00
Harald Albers
006146b2cd Add bash completion for docker-compose run --name
Signed-off-by: Harald Albers <github@albersweb.de>
2015-09-18 18:18:06 +02:00
Harald Albers
af7b98ff56 Add bash completion for docker-compose build --pull
Also adds a fix for an error message on some completions when no
compose file is present:

    docker-compose build awk: cannot open docker-compose.yml (No such file or directory)

Signed-off-by: Harald Albers <github@albersweb.de>
2015-09-18 18:12:30 +02:00
Daniel Nephin
db433041b4 Restore the dist volume mount for building linux binaries.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-18 12:08:09 -04:00
Aanand Prasad
3e58003bd3 Merge pull request #2041 from ggtools/master
Add new --pull option in build.
2015-09-18 16:49:05 +01:00
mnowster
e2ab2eb9d0 Merge pull request #2065 from dnephin/use-dind-image
Use dockerswarm/dind image for ci
2015-09-18 16:10:41 +01:00
mnowster
41660f98df Merge pull request #2045 from dnephin/cleanup_before_build
Clean before doing a build
2015-09-18 11:49:05 +01:00
Mazz Mosley
0232fb10d7 Alphabetise run options
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-18 11:30:24 +01:00
Mike Bailey
aac916c73e Alphabetise reference list
Bring in line with Glossary. https://docs.docker.com/reference/glossary/

Alphabetising list makes makes parsing by humans easier.

Signed-off-by: Mike Bailey <mike.bailey@rea-group.com>

Conflicts:
	docs/yml.md
2015-09-18 11:25:59 +01:00
Daniel Nephin
8b29a50b52 Trim the dockerfile and re-use the virtualenv we already have.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 18:46:29 -04:00
Daniel Nephin
9978c3ea52 Update scriptests/test-versions to work with daemon args, and move docker version constants into tests-versions.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-17 17:35:49 -04:00
Aanand Prasad
eb20590ca6 Use dockerswarm/dind image instead of doing docker-in-docker ourselves
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-17 16:53:20 -04:00
Daniel Nephin
577439ea7f Add a debug log message for config filenames.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:28:16 -04:00
Daniel Nephin
fd75e4bf63 Update docs about using multiple -f arguments
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:20:21 -04:00
Daniel Nephin
be0611bf3e Cleanup get_default_config_files tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
39ae85db8a Support a default docker-compose.override.yml for overrides
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
fe5daf860d Move find_candidates_in_parent_dirs() into a config module so that config doesn't import from cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
89be7f1fa7 Unit tests for multiple files
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
831276f531 Move config_test to the correct package name.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
c0c9a7c1e4 Update integration tests for multiple file support
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
10b3188214 Support multiple config files
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
258d0fa0c6 Remove some functions from Command class
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
2121f5117e Add docopt support for multiple files
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin
aab688d27e Merge pull request #1886 from mnowster/create-host-config-needs-version
Stop using deprecated `create_host_config` from utils
2015-09-17 12:37:22 -04:00
Daniel Nephin
9be748f85c Clean before doing a build so that we don't include stale build artifacts
in the binaries.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 12:27:51 -04:00
mnowster
1c823597bb Merge pull request #1995 from predakanga/master
Added support for IPC namespaces, fixes GH-1689
2015-09-17 17:14:44 +01:00
Mazz Mosley
39ba2c5a7c Fix leaky tests
It was mocking self.client but relying on the call to
utils.create_host_config which was not mocked. So now that function
has moved to also be on self.client we need to redefine the test
boundary, up to where we would call docker-py, not the result of
docker-py.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Mazz Mosley
6f6c04b5c9 Test what we are sending, not what we get
This is a unit test and we are mocking the client. The method to get
the create_config_host now lives on the client, so we mock that too.

So we can test to the boundary that the method is called with the
arguments we expect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Mazz Mosley
42c890796b Use docker.client.create_host_config
create_host_config from docker.utils will be deprecated so that
the new create_host_config has access to the _version so
we can ensure that network_mode only gets set to 'default' by
default if the version is high enough and won't explode.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
mnowster
e7ce4c85fa Merge pull request #2040 from TomasTomecek/2024-add-logo-to-docs
include logo in readme and docs
2015-09-17 16:59:25 +01:00
mnowster
d577cd6877 Merge pull request #2059 from ZJaffee/master
Change Wordpress > WordPress in the documentation #2052
2015-09-17 15:40:22 +01:00
Zachary Jaffee
fb83b4c6a4 updated wordpress format syntax
Signed-off-by: Zachary Jaffee <zjaffee@us.ibm.com>
2015-09-17 09:56:44 -04:00
Aanand Prasad
718f9bea17 Merge pull request #2055 from dnephin/fix_queue_lock
Fix stacktrace when ctrl-c stops logs
2015-09-17 11:32:23 +01:00
Daniel Nephin
c2b8d5863a Merge pull request #2053 from dnephin/update_release_notes
Add 1.4.1 release notes and download instructions
2015-09-16 14:17:40 -04:00
mnowster
25d40bd5f2 Merge pull request #2058 from aanand/fix-docs-typo
Fix typo in docs/index.md
2015-09-16 16:41:37 +01:00
Aanand Prasad
1ed13f401f Merge pull request #2035 from geron/patch-1
Fix schema.json MANIFEST.in entry
2015-09-16 12:43:27 +01:00
Aanand Prasad
bbc8765343 Fix typo in docs/index.md
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-16 12:38:59 +01:00
Daniel Nephin
bdfb21f017 Fixes #189 - stacktrace when ctrl-c stops logs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-15 20:46:22 -04:00
Daniel Nephin
7c32fcbcf5 Add 1.4.1 release notes and download instructions.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-15 18:03:17 -04:00
Christophe Labouisse
39786d4da7 Add new --pull option in build.
Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
2015-09-15 20:19:17 +02:00
moxiegirl
f49fc1867c Merge pull request #1959 from charleswhchan/patch-1
Touch up documentation for Docker Compose.
2015-09-15 10:17:49 -07:00
Aanand Prasad
1dabf1c366 Merge pull request #1878 from mnowster/change-default-log-driver-value
Change default `log_driver` value
2015-09-15 17:23:00 +01:00
Aanand Prasad
041a1ff08c Merge pull request #2000 from mnowster/do-not-allow-booleans-in-environment
Disallow booleans in environment
2015-09-15 16:24:59 +01:00
Mazz Mosley
fb96ed113a Stop sending json-file by default
By doing this we were over-riding any of the daemon's defaults.
Instead we can send an empty string which docker-py sends on
and the daemon interprets as, 'json-file' as a default if it
hasn't got any other daemon level config options.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:47:39 +01:00
Mazz Mosley
2f45649611 Handle invalid log_driver
Now docker-py isn't hardcoding a list of valid log_drivers, we
can expect an APIError in response rather than a ValueError
if we send an invalid log_driver.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:47:39 +01:00
Mazz Mosley
4b2fd7699b Relax constraints on key naming for environment
One of the use cases is swarm requires at least : character, so going
from conservative to relaxed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
Mazz Mosley
8caeffe27e Log a warning when boolean is found in environment
We're going to warn people that allowing a boolean in the environment is
being deprecated, so in a future release we can disallow it. This is to
ensure boolean variables are quoted in strings to ensure they don't get
mis-parsed by YML.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
Mazz Mosley
a594a2ccc2 Disallow booleans in environment
When users were putting true/false/yes/no in the environment key,
the YML parser was converting them into True/False, rather than leaving
them as a string.

This change will force people to put them in quotes, thus ensuring
that the value gets passed through as intended.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
mnowster
e33ab0cdd8 Merge pull request #2031 from aanand/docker-py-1.4.0
Update docker-py to 1.4.0
2015-09-15 15:31:52 +01:00
Aanand Prasad
1bef5cd166 Merge pull request #2014 from mnowster/improve-validation-messaging
Improve oneOf schema validation messaging
2015-09-15 15:29:11 +01:00
Mazz Mosley
1007ad0f86 Refactor to simplify _parse_valid_types
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 14:29:00 +01:00
Mazz Mosley
cf7b595385 Improve error messages from oneOf schema errors
oneOf schema ValidationError takes a little more work to parse and
pull out more detail so we can give a better error message back to
the user.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 14:29:00 +01:00
Tomas Tomecek
0bdbb33447 include logo in README
Resolves #2024

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2015-09-15 09:17:00 +02:00
Mazz Mosley
418ec5336b Improved messaging for simple type validator
English language is a tricky old thing and I've pulled out the validator type
parsing so that we can prefix our validator types with the correct article,
'an' or 'a'.

Doing a bit of extra hard work to ensure the error message is clear and
well constructed english.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-14 17:23:58 +01:00
Mazz Mosley
32cd404c8c Remove redundant oneOf definitions
For simple definitions where a field can be multiple types, we can
specify the allowed types in an array. It's simpler and clearer.

This is only applicable to *simple* definitions, like number, string, list,
object without any other constraints.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-14 17:23:58 +01:00
Charles Chan
a95ac0f0e0 Touch up documentation for Docker Compose.
index.md:
* clarify Python & Flask
* minor edits & reformatting

install.md:
* merge the elevated installation instructions with `sudo -i` discussed by @asveepay and @aanand in PR #1201; fixes #1081 (not sure what happened to the merge, but it's not showing up on the master branch or website)
* minor edits

Signed-off-by: Charles Chan <charleswhchan@users.noreply.github.com>
2015-09-13 20:00:55 -07:00
Aanand Prasad
d1dd06a7e2 Update docker-py to 1.4.0
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-11 15:42:20 -07:00
Aanand Prasad
dbc68ca747 Merge pull request #2018 from dnephin/fix_scale_test
Handle unexpected errors, but don't ignore background threads
2015-09-11 15:42:01 -07:00
Luiz Geron
1fcacae1fe Fix schema.json MANIFEST.in entry
docker-compose up doesn't run after install without this.

Signed-off-by: Luiz Geron <luiz@geron.me>
2015-09-11 19:14:51 -03:00
Daniel Nephin
61415cd8bc Fixes #1955 - Handle unexpected errors, but don't ignore background threads.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-11 17:41:10 -04:00
Aanand Prasad
e9871b084e Merge pull request #2020 from dnephin/fix_compose_with_logs_none
Fix compose up with other log drivers
2015-09-11 11:22:12 -07:00
Aanand Prasad
60701a71dc Merge pull request #2026 from ggtools/validation
Fix type for `tty` & `stdin_open`
2015-09-11 11:14:47 -07:00
Daniel Nephin
7d8ae9aa6d Refactor LogPrinter to make it immutable and remove logic from the constructor.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-11 12:56:56 -04:00
Daniel Nephin
413b76e228 Fix warning message when a container uses a non-json log driver
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-11 12:54:27 -04:00
Daniel Nephin
4641d40526 Document limitation of other log drivers.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-11 12:54:27 -04:00
Aanand Prasad
b25a300895 Merge pull request #1966 from dnephin/docs_update
Expose the CLI reference pages a bit better from the index
2015-09-10 17:00:41 -07:00
Aanand Prasad
87a50317ad Merge pull request #1954 from nhumrich/master
Allow for user relative paths on EXTEND
2015-09-10 16:35:40 -07:00
Christophe Labouisse
e80f0bdf86 Fix type for tty & stdin_open
Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
2015-09-10 23:49:07 +02:00
Daniel Nephin
1eb925ee31 Link between pages in the CLI reference section
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-10 13:53:26 -04:00
Daniel Nephin
4bdf57ead8 Add a where to go next section to the main index page for compose
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-10 13:53:26 -04:00
Daniel Nephin
860b304f4a Add COMPOSE_API_VERSION to the docs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-10 13:53:19 -04:00
Lachlan Pease
851129de6c Added documentation for IPC config
Signed-off-by: Lachlan Pease <predatory.kangaroo@gmail.com>
2015-09-10 23:34:07 +10:00
Nick H
a372275c6e Allow for user relative paths
'~/' in a path currently doesnt work, you get the following error:

[Errno 2] No such file or directory: u'/home/USER/folder/~/some/path/.yml'

Signed-off-by: Nick H <nick.humrich@gmail.com>
2015-09-09 14:54:08 -06:00
Aanand Prasad
9ce30e75df Merge pull request #2016 from mnowster/remove-unique-constraint-for-command
Remove uniqueness constraint for command
2015-09-09 10:05:41 -07:00
Daniel Nephin
469a709a37 Merge pull request #2017 from mnowster/remove-detach-field
Remove mistaken field
2015-09-09 12:52:44 -04:00
Mazz Mosley
4bed5de291 Remove item unique constraint for command
The command value can be a list, which would be a Unix command-line
invocation broken up into individual values, thus needing the ability to
have non unique values.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-09 16:39:06 +01:00
Mazz Mosley
7223d5cee0 Remove mistaken field
detach is a run param, not a config param. Oops, sorry!

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-09 16:23:54 +01:00
Aanand Prasad
2273e2bd3a Merge pull request #2011 from dnephin/add_extra_labels
Add more github label areas
2015-09-08 17:24:21 -07:00
Daniel Nephin
ad46757baf Add more github label areas.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-08 19:44:25 -04:00
Aanand Prasad
85709d85d2 Merge pull request #1862 from mrfuxi/costom-container-name-in-logs
Use custom container name in logs
2015-09-08 14:36:28 -07:00
Aanand Prasad
f7d86d3194 Merge pull request #1944 from funkyfuture/issue-1921
Adds pause- and unpause-command to docopt's TLC
2015-09-08 14:05:27 -07:00
Aanand Prasad
1c73ff33fe Merge pull request #1990 from shin-/1975-fix
Remove or space out suspension dots after service name
2015-09-08 12:27:39 -07:00
Aanand Prasad
abb0ab3f9d Merge pull request #2001 from mnowster/entrypoint-allow-as-a-string
Allow entrypoint to be a list or string
2015-09-08 12:08:40 -07:00
Lucas N. Munhoz
b33dd3bc01 Fix error message and class name from Boot2Docker to DockerMachine
Signed-off-by: Lucas N. Munhoz <ln.munhoz@gmail.com>
2015-09-08 10:08:38 -03:00
Mazz Mosley
866979c57b Allow entrypoint to be a list or string
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-07 17:26:38 +01:00
Karol Duleba
d83d6306c9 Use custom container name in logs. Fixes #1851
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-09-07 14:03:00 +01:00
Lachlan Pease
67957318ed Added IPC spec to fields_schema.json
Signed-off-by: Lachlan Pease <predatory.kangaroo@gmail.com>
2015-09-06 12:16:12 +10:00
Lachlan Pease
2468235472 Added support for IPC namespaces, fixes GH-1689
Signed-off-by: Lachlan Pease <predatory.kangaroo@gmail.com>
2015-09-06 12:09:24 +10:00
Joffrey F
6da7a9194c Remove or space out suspension dots after service name for easier copy-pasting
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-04 17:43:12 -07:00
Aanand Prasad
9da2bf3973 Merge pull request #1978 from aanand/use-docker-1.8.2-rc1
Test against Docker 1.8.2 RC1
2015-09-04 16:21:58 -07:00
Aanand Prasad
10cb0c921a Merge pull request #1963 from shin-/1923-catch-timeout
Exit gracefully when requests encounter a ReadTimeout exception.
2015-09-04 16:14:32 -07:00
Aanand Prasad
536638aaae Merge pull request #1962 from dnephin/use_enum_for_enum
Create a ConvergenceStrategy enum
2015-09-04 15:05:09 -07:00
Daniel Nephin
d84ee667ad Merge pull request #1983 from mnowster/update-testing-docs
Running a single test command updated
2015-09-04 12:28:08 -04:00
Mazz Mosley
31e8137452 Running a single test command updated
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-04 17:23:22 +01:00
Daniel Nephin
ff427e68ee Merge pull request #1982 from mnowster/fix-trailing-white-space
Remove trailing white space from docs/index.md
2015-09-04 12:20:29 -04:00
Mazz Mosley
0f60c783fa Remove trailing white space
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-04 17:01:44 +01:00
Daniel Nephin
0484e22a84 Add enum34 and use it to create a ConvergenceStrategy enum.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-04 10:45:53 -04:00
mnowster
d4372bc98f Merge pull request #1967 from charleswhchan/issue-1958
Fix #1958. Remove release notes for old version of Docker Compose.
2015-09-04 11:44:33 +01:00
Charles Chan
000bf1c16a Fix #1958. Remove release notes for old version of Docker Compose.
Replace by link to the latest CHANGELOG in GitHub.

Signed-off-by: Charles Chan <charleswhchan@users.noreply.github.com>
2015-09-03 21:18:26 -07:00
Aanand Prasad
a1ec26435c Test against Docker 1.8.2 RC1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-03 18:30:50 -07:00
Aanand Prasad
6a47fa066e Merge pull request #1960 from dnephin/fix_smart_recreate_when_service_is_removed
Fix config_hash context to properly represent the service
2015-09-03 11:41:30 -07:00
Aanand Prasad
c2f9ffad28 Merge pull request #1974 from dnephin/upgrade_requests
Bump requests to 2.7 to fix the ResponseNotReady() error
2015-09-03 11:38:17 -07:00
Aanand Prasad
dcf2f3f28c Merge pull request #1970 from mnowster/fix-expose-allowed-values
fix expose schema definition
2015-09-03 11:36:03 -07:00
Daniel Nephin
9d7ad796a3 bump requests to 2.7 to fix the ResponseNotReady() error, and add a missing default for tox posargs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 14:11:44 -04:00
Daniel Nephin
db9f577ad6 Extract link names into a function.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 14:08:44 -04:00
Daniel Nephin
187ad4ce26 Refactor network_mode logic out of Service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 13:02:46 -04:00
Daniel Nephin
c183e52502 Fixes #1757 - include all service properties in the config_dict()
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin
08ba857807 Cleanup some project logic.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin
e801981fed Sort config keys
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin
ef56523883 Make external_links a regular service.option so that it's part of the config hash
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Mazz Mosley
7326608369 expose array can contain either strings or numbers
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-03 16:44:01 +01:00
mnowster
2073805bc1 Merge pull request #1952 from aanand/bundle-schema-json
Bundle schema.json in binary
2015-09-03 10:40:11 +01:00
Aanand Prasad
ecea79fd4e Bundle schema files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 18:09:34 -07:00
Joffrey F
6a95f6d628 custom timeout test rewrite
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 18:00:08 -07:00
Aanand Prasad
b165ae07c9 Configure PyInstaller using docker-compose.spec
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 17:47:14 -07:00
Aanand Prasad
6baed6c354 Merge pull request #1965 from dnephin/fix_compose_up_attach
Attach to all containers when no service names are specified
2015-09-02 17:37:43 -07:00
Joffrey F
f9c7346380 HTTP_TIMEOUT as importable constant for consistency
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 16:29:19 -07:00
Joffrey F
b110bbe9e3 Refined error message when timeout is encountered.
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 14:31:30 -07:00
Joffrey F
e634fe3fd6 Deprecation warning when DOCKER_CLIENT_TIMEOUT is used
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 14:28:57 -07:00
Aanand Prasad
027414cfc0 Merge pull request #1918 from dnephin/fix_scripts_test
Fix scripts/test and add to note about pre-commit hook to contributing
2015-09-02 14:28:51 -07:00
Aanand Prasad
0060437f57 Merge pull request #1927 from mnowster/validate-extended-services
Validate and interpolate extended services
2015-09-02 13:41:21 -07:00
Daniel Nephin
48466d7d82 Fix #1961 - docker-compose up should attach to all containers with no service names are specified, and add tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-02 16:08:18 -04:00
Joffrey F
80c9092999 Document COMPOSE_HTTP_TIMEOUT env config
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 12:52:48 -07:00
Joffrey F
b54b932b54 Exit gracefully when requests encounter a ReadTimeout exception.
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 11:54:20 -07:00
Mazz Mosley
6a399a5b2f Update tests to be compatible with validation
Some were missing build '.' from their dicts, others were the
incorrect type and one I've moved from integration to unit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley
d31d24d19f Work around some coupling of links, net & volume_from
This is minimal disruptive change I could make to ensure
the service integration tests worked, now we have some validation
happening.

There is some coupling/entanglement/assumption going on here.

Project when creating a service, using it's class method from_dicts
performs some transformations on links, net & volume_from, which
get passed on to Service when creating. Service itself, then performs
some transformation on those values. This worked fine in the tests before
because those options were merely passed on via make_service_dict.

This is no longer true with our validation in place. You can't pass to
ServiceLoader [(obj, 'string')] for links, the validation expects it to be
a list of strings. Which it would be when passed into Project.from_dicts
method.

I think the tests need some re-factoring but for now, manually deleting
keys out of the kwargs and then putting them back in for Service Creation
allows the tests to continue.

I am not super happy about this approach. Hopefully we can come back and
improve it.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley
9b8e404d13 Pass service_name to process_errors
Previously on Buffy... The process_errors was parsing a load of
ValidationErrors that we get back from jsonschema which included
assumptions about the state of the instance we're validating.

Now it's split in two and we're doing field separate to service,
those assumptions don't hold and we can't logically retrieve the
service_name from the error parsing when we're doing service schema
validation, have to explicitly pass this in.

process_errors is high on my list for some future re-factoring to help
make it a bit clearer, smaller state of doing things.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
f51a5431ec Correct some schema field definitions
Now validation is split in two, the integration tests helped
highlight some places where the schema definition was incorrect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
9979880c9f Add in volume_driver
I'd missed out this field by accident previously.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
4b487e3957 Refactor extends back out of __init__
If make_service_dict is our factory function then we'll give it the
responsibility of validation/construction and resolving.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
9fa6e42f55 process_errors handle both schemas
Now the schema has been split into two, we need to modify the
process_errors function to accomodate.

Previously if an error.path was empty then it meant they were root
errors. Now that service_schema checks after the service has been
resolved, our service name is a key within the dictionary and
so our root error logic check is no longer true.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
950577d60f Split validation into fields and service
We want to give feedback to the user as soon as possible about the
validity of the config supplied for the services.

When extending a service, we can validate that the fields are
correct against our schema but we must wait until the *end* of
the extends cycle once all of the extended dicts have been merged
into the service dict, to perform the final validation check on the
config to ensure it is a complete valid service.

Doing this before that had happened resulted in false reports of
invalid config, as common config when split out, by itself, is not
a valid service but *is* valid config to be included.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
4a8b2947ca Interpolate extended config
This refactoring is now really coming together. Construction is
happening in the __init__, which is a constructor and helps
clean up the design and clarity of intent of the code. We can now
see (nearly) everything that is being constructed when a ServiceLoader
is created. It needs all of these data constructs to perform the
domain logic and actions. Which are now clearer to see and moving
more towards the principle of functions doing (mostly)one thing and
function names being more descriptive.

resolve_extends is now concerned with the resolving of extends, rather
than the construction, validation, pre processing and *then* resolving
of extends.

Happy days :)

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
36757cde1c Validate extended service against our schema
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
37bf8235b7 Get extended config path
Refactored out into it's own function.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
538a501eec Refactor validating extends file path
Separating out the steps we need to resolve extends, so that it
will be clear to insert pre-processing of interpolation and
validation.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
02c52ae673 Move resolve_environment within __init__
resolve_environment is specific to ServiceLoader, the function
does not need to be on the global scope, it is a part of the
ServiceLoader object. The environment needs to be resolved
before we can make any service dicts, it belongs in the
constructor.

This is cleaning up the design a little and being clearer
about intent and scope of functions.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
8a6061bfb9 __init__ takes service name and dict
Moving service name and dict out of the function make_service_dict
and into __init__. We always call make_service_dict with those so
let's put them in the initialiser. Slightly cleaner design intent.

The whole purpose of the ServiceLoader is to take a
service name&service dictionary then validate, process and return
service dictionaries ready to be created.

This is also another step towards cleaning the code up so we can
interpolate and validate an extended dictionary.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
1344533b24 filename is not optional
While it can be set to ultimately a value of None, when a
config file is read in from stdin, it is not optional.

We kinda make use of it's ability to be set to None in our
tests but functionally and design wise, it is required.

If filename is not set, extends does not work.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley
c907f35e74 Raise if working_dir is None
Check for this in the init so we can remove the duplication of
raising in further functions.

A ServiceLoader isn't valid without one.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Aanand Prasad
3bee62e4c5 Merge pull request #1956 from bfirsh/link-to-zenhub
Link to ZenHub instead of Waffle
2015-09-01 17:31:45 -07:00
Ben Firshman
6969829a70 Link to ZenHub instead of Waffle
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-09-01 17:23:39 -07:00
Aanand Prasad
c63ae64ca6 Merge pull request #1920 from dnephin/use_pytest
Use py.test as a test runner
2015-09-01 15:29:24 -07:00
Daniel Nephin
c1ed1efde8 Use py.test as the test runner
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-01 16:27:44 -04:00
Daniel Nephin
6ac617bae1 Split requirements-build.txt from requirements-dev.txt to support a leaner tox.ini
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-01 16:27:44 -04:00
Aanand Prasad
8479108ee8 Merge pull request #1945 from dnephin/issue_triage_doc
Add ISSUE-TRIAGE.md
2015-09-01 13:25:37 -07:00
Daniel Nephin
74782a56b5 Fix script/test by just calling script/test-versions directly instead of launching another container.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 17:08:47 -04:00
Daniel Nephin
5a5f28228a Document installing of pre-commit hooks.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 17:08:47 -04:00
Aanand Prasad
83c514f838 Merge pull request #1933 from dnephin/fix_scale_test_flakes
Fix flaky test
2015-08-31 13:52:33 -07:00
Daniel Nephin
235fe21fd0 Prevent flaky test by changing container names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 14:57:06 -04:00
mnowster
17bd11c334 Merge pull request #1940 from hermanjunge/patch-1
Fix doc install.md
2015-08-31 10:43:30 +01:00
Daniel Nephin
8f310767a6 Add ISSUE-TRIAGE.md doc
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-28 14:10:15 -04:00
Frank Sachsenheim
a4bab13aee Adds pause- and unpause-command to docopt's TLC
solves # 1921

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2015-08-28 19:05:19 +02:00
Herman Junge
9543cb341b Fix doc install.md
termial -> terminal

Signed-off-by: Herman Junge <hermanalonsojunge@gmail.com>
2015-08-28 11:51:04 -03:00
mnowster
0074d74d7a Merge pull request #1914 from bbirand/patch-1
Export COMPOSE_FILE
2015-08-28 12:13:42 +01:00
mnowster
f5d73fee57 Merge pull request #1932 from mrfuxi/image-dockerfile-validation
Do not allow to specify both image and dockerfile in configuration.
2015-08-28 10:12:54 +01:00
Daniel Nephin
d264c2e33a Resolves #1804
Fix mutation of service.options when a label or environment variable is specified in the config.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-27 18:05:21 -04:00
Karol Duleba
477d4f491d Do not allow to specify both image and dockerfile in configuration. Closes #1908
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-27 19:36:39 +01:00
Daniel Nephin
21c16a787a Merge pull request #1928 from albers/completion-timeout
Bash completion for `docker-compose scale --timeout`
2015-08-27 12:37:55 -04:00
Daniel Nephin
d45f00df13 Merge pull request #1935 from aanand/normalise-ignore-files
Normalise ignore files
2015-08-27 10:39:24 -04:00
Aanand Prasad
e777d08854 Merge pull request #1924 from dnephin/python3_fix_for_logs
Fix `docker-compose logs` on python3
2015-08-27 14:19:42 +01:00
Aanand Prasad
b39e549c87 Normalise ignore files
- Consistent order and contents (where possible)
- Prepend .gitignore paths with slashes where appropriate

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-27 13:51:51 +01:00
Aanand Prasad
7c8c23e0c7 Merge pull request #1917 from sdurrheimer/master
Update zsh completion with last changes
2015-08-27 13:17:19 +01:00
Aanand Prasad
4602ceca18 Merge pull request #1931 from dnephin/fix_regression_in_up
Only show logs for listed services in `up`
2015-08-27 13:00:59 +01:00
mnowster
5865df3633 Merge pull request #1934 from aanand/fix-release-process-typo
Fix typo in release process docs
2015-08-27 10:38:20 +01:00
Aanand Prasad
acca22206a Fix typo
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-27 10:36:12 +01:00
mnowster
0286d282f9 Merge pull request #1916 from aanand/improve-release-docs
Improve release docs
2015-08-27 10:34:32 +01:00
Daniel Nephin
3a0153859a Resolves #1856, fix regression in #1645. Includes some refactoring to make testing easier.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 16:21:31 -04:00
Aanand Prasad
ecd1cc31dc Merge pull request #1930 from dnephin/name_one_off_containers
Allow setting a one-off container name
2015-08-26 19:03:00 +01:00
Daniel Nephin
d2718bed99 Allow setting a one-off container name
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 13:33:03 -04:00
Daniel Nephin
bdec7e6b52 Cleanup some test case, remove unused mock return values, and use standard single underscore for unused variable
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 13:32:49 -04:00
Aanand Prasad
ae64f306f8 Merge pull request #1929 from dnephin/remove_flake8_ignores
Remove flake8 ignores and wrap the longest lines to 140 char
2015-08-26 18:19:20 +01:00
Daniel Nephin
54973e8200 Remove flake8 ignores and wrap the longest lines to 140 char.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 12:53:11 -04:00
Harald Albers
2cfda01ff4 Use consistent argument order in bash completion
In most of this file and in Dockers's bash completion the sort order of
options is to sort alphabetically by long option name.
The short options are put right behind their long couterpart.

This commit improves consistency.

Signed-off-by: Harald Albers <github@albersweb.de>
2015-08-26 18:31:36 +02:00
Harald Albers
b03a2f7910 Add completion for scale --timeout
Signed-off-by: Harald Albers <github@albersweb.de>
2015-08-26 18:31:36 +02:00
Harald Albers
7e22719090 Fix suppressed blank in completion of scale --help
Wrong placement of `compopt -o` introduces an unexpected behavior that did
not matter as long as --help was the only option (you would probably not
continue to type after --help): completion of options would not automatically
append a whitespace character as expected.

For the outstanding addition of the --timeout option, which has an
argument, this would mean that the user would have to type an extra
whitespace after completion of --timeout before the argument could be
added.

Signed-off-by: Harald Albers <github@albersweb.de>
2015-08-26 18:20:17 +02:00
Aanand Prasad
34249fad5d Improve release docs
Incorporating questions from
https://gist.github.com/aanand/e567bd8d6a5d8e28c829

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-26 17:06:10 +01:00
Daniel Nephin
9d9550c5b6 Fix log printing for python3 by converting everything to unicode.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-26 11:24:48 -04:00
Daniel Nephin
a348993d2c Remove two unused functions from cli/utils.py
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 16:55:29 -04:00
Daniel Nephin
2b589606da Move log_printer_test into correct testing module for naming convention.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 16:49:49 -04:00
Steve Durrheimer
196f0afe8d Update zsh completion with last changes
- sdurrheimer/docker-compose-zsh-completion@4ff5c0d Add pause and unpause commands
 - sdurrheimer/docker-compose-zsh-completion@9948d66 Add -t/--timeout flag to scale command
 - sdurrheimer/docker-compose-zsh-completion@7cf14c8 Improve -p/--publish flag for the run command
 - sdurrheimer/docker-compose-zsh-completion@cb16818 Don't trigger expensive completion function for flags
 - sdurrheimer/docker-compose-zsh-completion@52d33fa Several cosmetic improvements and return responses
 - sdurrheimer/docker-compose-zsh-completion@632ca9c Bump to version 1.5.0
 - sdurrheimer/docker-compose-zsh-completion@22f92d9 Refactor compose file and project-name option flags when invoking docker-compose
 - sdurrheimer/docker-compose-zsh-completion@1b512fc Refactor --help flags

Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-08-25 22:00:32 +02:00
Aanand Prasad
fc63454c99 Merge pull request #440 from dnephin/python3
Support python 3
2015-08-25 18:22:40 +01:00
Daniel Nephin
1451a6e188 Python3 requires a locale
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 11:10:02 -04:00
Daniel Nephin
bd7c032a00 Fix service integration tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:48:48 -04:00
Daniel Nephin
71ff872e8e Update unit tests for stream_output to match the behaviour of a docker-py response.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:48:48 -04:00
Daniel Nephin
7e4c3142d7 Have log_printer use utf8 stream.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:47:06 -04:00
Daniel Nephin
feaa4a5f1a Unit tests passing again.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:47:06 -04:00
Daniel Nephin
2943ac6812 Cleanup requirements.txt so we don't have to maintain separate copies for py2 and py3.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:46:08 -04:00
funkyfuture
9aa61e596e Run tests against Python 2.6, 2.7, 3.3, 3.4 and PyPy2
In particular it includes:
- some extension of CONTRIBUTING.md
- one fix for Python 2.6 in tests/integration/cli_test.py
- one fix for Python 3.3 in tests/integration/service_test.py
- removal of unused imports

Make stream_output Python 3-compatible

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2015-08-25 10:41:09 -04:00
Daniel Nephin
809443d6d0 Support python 3
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-25 10:37:29 -04:00
Aanand Prasad
17682c58db Merge pull request #1915 from dnephin/add_pre_commit_hooks
Add pre commit hooks
2015-08-25 13:49:33 +01:00
Daniel Nephin
59d4f304ee Run pre-commit on all files
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-24 17:04:50 -04:00
Daniel Nephin
fae6454661 Add pre-commit hooks
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-24 17:04:45 -04:00
Berk Birand
a57ce1b1ba Export COMPOSE_FILE
The environment variable is not used by `docker-compose` without the `export` line..

Signed-off-by: Berk Birand <berk@berkbirand.com>
2015-08-24 15:48:14 -04:00
Aanand Prasad
2da8b7e511 Merge pull request #1911 from aanand/test-against-docker-1.8.1
Test against Docker 1.8.1
2015-08-24 16:23:33 +01:00
Aanand Prasad
60ff4549c9 Merge pull request #1766 from funkyfuture/pause_unpause
Adds pause and unpause-commands
2015-08-24 16:10:22 +01:00
Daniel Nephin
1212193c02 Merge pull request #1898 from aanand/verbose-debug
Set log level to DEBUG when `--verbose` is passed
2015-08-24 07:55:10 -07:00
Frank Sachsenheim
dd738b380b Makes Service.config_hash a property
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2015-08-21 12:43:13 +02:00
Frank Sachsenheim
227584b864 Adds pause and unpause-commands
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2015-08-21 12:43:13 +02:00
mnowster
59d024f4f2 Merge pull request #1897 from qzio/log-opt/address-to-syslog-address
log_opt: change address to syslog-address
2015-08-21 10:43:02 +01:00
Joel Hansson
8caaee9eac schema.json: remove specific log_opt properties
Signed-off-by: Joel Hansson <joel.hansson@ecraft.com>
2015-08-21 08:41:45 +02:00
Aanand Prasad
c699876617 Set log level to DEBUG when --verbose is passed
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-20 16:09:28 +01:00
Joel Hansson
61936f6b88 log_opt: change address to syslog-address
Signed-off-by: Joel Hansson <joel.hansson@ecraft.com>
2015-08-20 16:46:06 +02:00
Aanand Prasad
a806d9e77b Merge pull request #1855 from mnowster/number-is-a-valid-service-name
A number is a valid service name
2015-08-20 12:02:58 +01:00
mnowster
340eaf44fa Merge pull request #1889 from mrfuxi/1670-images-digest
Allow to specify image by digest. Fixes #1670
2015-08-20 10:55:00 +01:00
Karol Duleba
56f03bc20a Allow to specify image by digest. Fixes #1670
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-19 21:13:34 +01:00
mnowster
5028e38261 Merge pull request #1170 from benhamill/fix_bash_completion
Fix Bash Completion
2015-08-19 14:54:30 +01:00
mnowster
8ff208babc Merge pull request #1847 from aanand/rename-changes.md-to-changelog.md
Rename CHANGES.md to CHANGELOG.md
2015-08-19 14:25:27 +01:00
mnowster
30b64e65cd Merge pull request #1859 from mrfuxi/extend-unexisting-service
Raise configuration error when trying to extend service that does not exist
2015-08-19 14:23:28 +01:00
mnowster
71ffa89890 Merge pull request #1870 from aanand/fix-volume-path-warning
Fix volume path warning
2015-08-19 14:21:19 +01:00
Aanand Prasad
6edc673aad Merge pull request #1881 from mhor/patch-1
remove extra ```
2015-08-18 12:12:46 +01:00
Maxime Horcholle
18a474211d remove extra ```
Signed-off-by: mhor <maxime.horcholle@gmail.com>
2015-08-18 09:09:37 +02:00
Aanand Prasad
0ad4725e7e Merge pull request #1879 from mnowster/improve-handling-of-parallelise-exceptions
Handle all exceptions from API
2015-08-17 17:04:45 +01:00
Mazz Mosley
f4a8fda283 Handle all exceptions
If we get back an error that wasn't an APIError, it was causing the
thread to hang. This catch all, while I appreciate feels risky to
have a catch all, is better than not catching and silently failing,
with a never ending thread.

If something worse than an APIError has gone wrong, we want to stop
the incredible journey of what we're doing.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-17 16:31:57 +01:00
Aanand Prasad
65afce526a Test against Docker 1.8.1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-14 12:42:33 +01:00
Aanand Prasad
478054af47 Rename CHANGES.md to CHANGELOG.md
To align with the docker/docker repo.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-14 11:27:27 +01:00
Aanand Prasad
530d20db6d Fix volume path warning
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-14 11:15:22 +01:00
Mazz Mosley
67995ab9e3 Pre-process validation steps
In order to validate a service name that has been specified as an
integer we need to run that as a pre-process validation step
*before* we pass the config to be validated against the schema.

It is not possible to validate it *in* the schema, it causes a
type error. Even though a number is a valid service name, it
must be a cast as a string within the yaml to avoid type error.

Taken this opportunity to move the code design in a direction
towards:

1. pre-process
2. validate
3. construct

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-13 16:32:20 +01:00
Daniel Nephin
b87c09b9fc Merge pull request #1824 from mrfuxi/run-with-ports
Allow manual port mapping when using "run" command
2015-08-13 08:29:25 -07:00
Aanand Prasad
2ddce83c8a Merge pull request #1854 from aanand/document-release-process
Fill out release process documentation
2015-08-13 10:46:12 +01:00
Karol Duleba
2e7f08c2ef Raise configuration error when trying to extend service that does not exist. Fixes #1826
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-12 22:34:25 +01:00
Karol Duleba
ff87ceabbd Allow manual port mapping when using "run" command. Fixes #1709
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-12 18:54:42 +01:00
Aanand Prasad
7d5e26bd37 Merge pull request #1857 from mnowster/mem-limit-validation
memory values can be strings or numbers
2015-08-12 17:48:55 +01:00
Mazz Mosley
440099754d memory values can be strings or numbers
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-12 17:29:33 +01:00
Aanand Prasad
711b0b4daf Merge pull request #1853 from aanand/only-use-overlay-in-ci
Only use overlay driver in CI
2015-08-12 17:05:59 +01:00
Aanand Prasad
f1eef7b416 Fill out release process documentation
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-12 16:31:37 +01:00
mnowster
c443e95f07 Merge pull request #1825 from aanand/dedupe-unset-env-warnings
Avoid duplicate warnings if an unset env variable is used multiple times
2015-08-12 15:57:04 +01:00
Aanand Prasad
4c65891db1 Avoid duplicate warnings if an unset env variable is used multiple times
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-12 15:39:33 +01:00
Aanand Prasad
bcb977425b Only use overlay driver in CI
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-12 15:36:10 +01:00
Aanand Prasad
2134800cad Merge pull request #1852 from mnowster/fix-testsuite-post-some-merges
Fix ports validation
2015-08-12 15:31:59 +01:00
Mazz Mosley
5e2ecff8a1 Fix ports validation
I had misunderstood the valid formats allowed for ports. They must
always be in a list.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-12 15:19:28 +01:00
Aanand Prasad
eea3b1cd6f Merge pull request #1850 from aanand/bump-1.5.0dev
Bump 1.5.0dev
2015-08-12 11:18:37 +01:00
Aanand Prasad
ed31673069 Merge pull request #1827 from mnowster/port-ranges
Port ranges
2015-08-12 11:17:22 +01:00
Aanand Prasad
fb4c9fbb8b Merge pull request #1808 from mnowster/129-validate-compose-yml
129 validate compose yml
2015-08-12 11:15:47 +01:00
Aanand Prasad
192dda4140 Bump 1.5.0dev
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-11 18:41:21 +01:00
Aanand Prasad
3e505e850f Merge pull request #1849 from moxiegirl/final-link-check
Fixing links after crawl
2015-08-11 18:14:01 +01:00
Mary Anthony
d454a584da Fixing links after crawl
Signed-off-by: Mary Anthony <mary@docker.com>
2015-08-11 09:38:49 -07:00
Mazz Mosley
810bb70249 Include schema in manifest
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 16:31:56 +01:00
Aanand Prasad
93cc7e3751 Merge pull request #1846 from aanand/fix-mem-limit-options
Fix mem_limit and memswap_limit regression
2015-08-11 15:59:08 +01:00
Aanand Prasad
982a845635 Fix mem_limit and memswap_limit regression
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-11 14:17:30 +01:00
Mazz Mosley
f8efb54c80 Handle $ref defined types errors
We use $ref in the schema to allow us to specify multiple type, eg
command, it can be a string or a list of strings.

It required some extra parsing to retrieve a helpful type to display
in our error message rather than 'string or string'. Which while
correct, is not helpful. We value helpful.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 13:08:12 +01:00
Mazz Mosley
68de84a0bf Clean up error.path handling
Tiny bit of refactoring to make it clearer and only pop service_name
once.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 12:01:27 +01:00
Mazz Mosley
df14a4384d Catch non-unique errors
When a schema type is set as unique, we should display the validation
error to indicate that non-unique values have been provided for a key.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 12:01:27 +01:00
Mazz Mosley
e0675b50c0 Retrieve sub property keys
The validation message was confusing by displaying only 1 level of
property of the service, even if the error was another level down.

Eg. if the 'files' property of 'extends' was the incorrect format,
it was displaying 'an invalid value for 'extends'', rather than
correctly retrieving 'files'.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 12:01:27 +01:00
Mazz Mosley
ece6a72712 Clean error.message
Unfortunately the way that jsonschema is calling %r on its property
and then encoding the complete message means I've had to do this
manual way of removing the literal string prefix, u'.

eg:

key = 'extends'
message = "Invalid value for %r" % key
error.message = message.encode("utf-8")"

results in:

"Invalid value for u'extends'"

Performing a replace to strip out the extra "u'", does not change the
encoding of the string, it is at this point the character u followed
by a '.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 12:01:27 +01:00
Mazz Mosley
b4872de213 Allow integer value for ports
While it was intended as a positive to be stricter in validation
it would in fact break backwards compatibility, which we do not
want to be doing.

Consider re-visiting this later and include a deprecation warning if
we want to be stricter.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-11 12:01:27 +01:00
Mazz Mosley
52733f6996 Merge pull request #1833 from aanand/deprecate-relative-volumes-without-dot
Show a warning when a relative path is specified without "./"
2015-08-11 11:21:17 +01:00
Ben Firshman
b7baa899e2 Merge pull request #1829 from vlajos/typofixes-vlajos-20150807
typofix - https://github.com/vlajos/misspell_fixer
2015-08-10 22:13:30 +01:00
Ben Firshman
afc9629c59 Merge pull request #1832 from aanand/use-docker-1.8.0-rc3
Test against Docker 1.8.0 RC3
2015-08-10 20:53:01 +01:00
Aanand Prasad
46e8e4322a Show a warning when a relative path is specified without "./"
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-10 19:56:36 +01:00
Ben Firshman
4e12ce39b3 Merge pull request #1835 from aanand/fix-crash-when-container-has-no-name
Ignore containers that don't have a name
2015-08-10 18:50:00 +01:00
Ben Firshman
197d332620 Merge pull request #1836 from aanand/use-overlay-driver-in-tests
Use overlay driver in tests
2015-08-10 18:47:29 +01:00
Aanand Prasad
7f90e9592a Use overlay driver in tests
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-10 18:05:09 +01:00
Aanand Prasad
dfa4bf4452 Ignore containers that don't have a name
If a container is in the process of being removed, or removal has
failed, it can sometimes appear in the output of GET /containers/json
but not have a 'Name' key. In that case, rather than crashing, we can
ignore it.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-10 16:29:12 +01:00
Aanand Prasad
6cb8e512f2 Merge pull request #1812 from moxiegirl/install-update-for-1811
Closes #1811 for Toolbox
2015-08-10 12:48:25 +01:00
Aanand Prasad
4390362366 Test against Docker 1.8.0 RC3
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-10 12:01:51 +01:00
Mary Anthony
7c128b46a1 - Closes #1811 for Toolbox
- Updating with comments

Signed-off-by: Mary Anthony <mary@docker.com>
2015-08-09 10:51:39 -07:00
Veres Lajos
11adca9324 typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
2015-08-07 22:34:24 +01:00
Mazz Mosley
d1455acb64 Update docs inline with feedback
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 16:30:00 +01:00
Yuval Kohavi
557cbb616c ports documentation
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
2015-08-07 16:22:39 +01:00
Yuval Kohavi
0fdd977b06 fixed merge issue from previous commit
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
2015-08-07 16:22:39 +01:00
Yuval Kohavi
297941e460 rebasing port range changes
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
2015-08-07 16:22:39 +01:00
Mazz Mosley
df74b131ff Use split_port for ports format check
Rather than implement the logic a second time, use docker-py
split_port function to test if the ports is valid.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 15:27:30 +01:00
Mazz Mosley
2e428f94ca Refactor validation out
Move validation out into its own file without causing circular
import errors.

Fix some of the tests to import from the right place.

Also fix tests that were not using valid test data, as the validation
schema is now firing telling you that you couldn't "just" have this
dict without a build/image config key.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
0557b5dce6 Remove dead code
These functions weren't being called by anything.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
ea3608e1f4 Improve test coverage for validation
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
d8aee782c8 Error handling
jsonschema provides a rich error tree of info, by parsing each error
we can pull out relevant info and re-write the error messages.

This covers current error handling behaviour.

This includes new error handling behaviour for types and formatting of
the ports field.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
8d6694085d Include remaining valid config properties
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
98c7a7da61 Order properties alphabetically
Improves readability.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
6c7c598546 Format validation of ports
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
76e6029f21 Replace service tests with config tests
We validate the config against our schema before a service is created
so checking whether a service name is valid at time of instantiation of
the Service class is not needed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
da36ee7cbc Perform schema validation
Define a schema that we can pass to jsonschema to validate against the
config a user has supplied. This will help catch a wide variety of common
errors that occur.

If the config does not pass schema validation then it raises an exception
and prints out human readable reasons.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley
22b7ee42de Merge pull request #1817 from aanand/update-volume-tests
Update volume tests for clarity
2015-08-06 18:09:58 +01:00
Aanand Prasad
fdaa5f2cde Update volume tests for clarity
- Better method names.

- Environment variable syntax in volume paths, even when a driver is
  specified, now *will* be processed (the test wasn't testing it
  properly). However, `~` will still *not* expand to the user's home
  directory.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 16:14:37 +01:00
Aanand Prasad
f7b9daf927 Merge pull request #1815 from aanand/abort-if-daemon-cant-start
Abort tests if daemon fails to start
2015-08-06 15:29:55 +01:00
Mazz Mosley
44f1207931 Merge pull request #1765 from aanand/interpolate-environment-variables
Interpolate environment variables
2015-08-06 15:13:30 +01:00
Aanand Prasad
4f14298694 Abort tests if daemon fails to start
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 14:45:35 +01:00
Aanand Prasad
ee6ff294a2 Show a warning when a variable is unset
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 14:24:11 +01:00
Aanand Prasad
8b5bd945d0 Interpolate environment variables
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 11:18:57 +01:00
Aanand Prasad
31ac3ce22a Split out compose.config.errors
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-05 15:50:22 +01:00
Aanand Prasad
92ef1f5702 Make compose.config a proper module
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-05 15:50:22 +01:00
Mazz Mosley
a248cfd65a Merge pull request #1692 from bfirsh/coverage
Add test coverage support
2015-08-05 11:32:33 +01:00
moxiegirl
8ddf37c4b3 Merge pull request #1778 from aanand/remove-script-docs
Remove custom docs script
2015-08-02 07:36:49 -07:00
Aanand Prasad
41b9df7639 Merge pull request #1800 from aanand/volume-driver-support
Support volume_driver
2015-07-31 16:28:46 +01:00
Daniel Nephin
b25f05bed4 Merge pull request #1799 from d2bit/clean-rails-quickstart-guide-db-config
Remove useless postgres 'port' configuration
2015-07-31 07:27:45 -07:00
Luke Marsden
a68ee0d9c2 Support volume_driver in compose
* Add support for volume_driver parameter in compose yml
* Don't expand volume host paths if a volume_driver is specified
  (i.e., disable compose feature "relative to absolute path
  transformation" when volume drivers are in use, since volume drivers
  can use name where host path is normally specified; this is a
  heuristic)

Signed-off-by: Luke Marsden <luke@clusterhq.com>
2015-07-31 15:23:15 +01:00
David BF
1a9ddf645d Remove useless postgres 'port' configuration
Signed-off-by: David BF <burretfresket@gmail.com>
2015-07-31 14:40:29 +02:00
Daniel Nephin
ea7276031c Merge pull request #1794 from aanand/add-test-for-trailing-slash-volume-copy
Add test for trailing slash volume copying bug
2015-07-30 07:18:57 -07:00
Aanand Prasad
27bd987f28 Add test for trailing slash volume copying bug
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-30 10:31:54 +01:00
Aanand Prasad
dc7bdd10d4 Merge pull request #1787 from aanand/fix-duplicate-volume-bind
Fix "Duplicate volume mount" error when config has trailing slashes
2015-07-30 09:59:08 +01:00
Aanand Prasad
b47bb84ea1 Merge pull request #1754 from aanand/wait-for-all-containers-to-exit
Wait for all containers to exit
2015-07-30 09:58:49 +01:00
Aanand Prasad
80d90a745a Make sure an exception in any iterator gets raised in the main thread
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>

Conflicts:
	compose/cli/multiplexer.py
2015-07-29 19:42:33 +01:00
Aanand Prasad
a9942b512a Wait for all containers to exit when running 'up' interactively
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 19:42:33 +01:00
Aanand Prasad
27378704df Isolate STOP logic in multiplexer module
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 19:42:33 +01:00
Aanand Prasad
03c3d4c768 generator -> iterator
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 19:42:33 +01:00
Aanand Prasad
9768872507 Fix "Duplicate volume mount" error when config has trailing slashes
When an image declares a volume such as `/var/lib/mysql`, and a Compose
file has a line like `./data:/var/lib/mysql/` (note the trailing slash),
Compose creates duplicate volume binds when *recreating* the container.
(The first container is created without a hitch, but contains multiple
entries in its "Volumes" config.)

Fixed by normalizing all paths in volumes config.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 18:42:08 +01:00
Aanand Prasad
276e369c31 Merge pull request #1777 from aanand/update-api-version
Update API version to 1.19
2015-07-29 16:59:42 +01:00
Aanand Prasad
118a389646 Update API version to 1.19
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 15:44:21 +01:00
Aanand Prasad
2759ab5ab6 Merge pull request #1780 from gheart/specify_api_version_via_env
Allow API version specification via env var
2015-07-29 15:42:57 +01:00
Aanand Prasad
1496734cbb Merge pull request #1779 from aanand/mac-binary-error-hint
Add hint about OS X binary compatibility
2015-07-29 15:06:55 +01:00
Reilly Herrewig-Pope
fc203d643a Allow API version specification via env var
Hard-coding the API version to '1.18' with the docker-py constructor will
cause the docker-py logic at
https://github.com/docker/docker-py/blob/master/docker/client.py#L143-L146
to always fail, which will cause authentication issues if you're using a
remote daemon using API version 1.19 - regardless of the API version of
the registry.

Allow the user to set the API version via an environment variable. If
the variable is not present, it will still default to '1.18' like it
does today.

Signed-off-by: Reilly Herrewig-Pope <reilly.herrewigpope@mandiant.com>
2015-07-29 08:44:47 -04:00
Aanand Prasad
b08e23d351 Add hint about OS X binary compatibility
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 10:44:38 +01:00
Aanand Prasad
430ba8cda3 Remove custom docs script
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-28 16:59:37 +01:00
Aanand Prasad
487eae3b7b Merge pull request #1774 from moxiegirl/test-entire-build
Contributors can build public docs with compose docs in context
2015-07-28 15:03:46 +01:00
Mary Anthony
7eabc06df5 Updating build so that contributors can build public docs
Changed base image

Signed-off-by: Mary Anthony <mary@docker.com>
2015-07-27 09:43:16 -07:00
Aanand Prasad
e832e86f09 Merge pull request #1762 from aanand/update-changelog-and-install
Update CHANGES.md and install.md for latest stable version
2015-07-23 16:37:02 +01:00
Daniel Nephin
33a108f9bb Merge pull request #1760 from alunduil/add-completion-to-sdist
add all completions to sdist
2015-07-23 07:34:30 -07:00
Mazz Mosley
65cc84140a Merge pull request #1736 from aanand/deprecate-allow-insecure-ssl
Deprecate --allow-insecure-ssl
2015-07-23 14:09:17 +01:00
Aanand Prasad
227435f613 Update CHANGES.md and install.md for latest stable version
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-23 11:09:27 +01:00
Aanand Prasad
70c7d27c4e Merge pull request #1758 from mnowster/improve-scale-test-coverage
Improve scale test coverage
2015-07-23 11:07:48 +01:00
Aanand Prasad
04a773f1c8 Deprecate --allow-insecure-ssl
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-23 10:56:21 +01:00
Aanand Prasad
f4dac02947 Update docker-py to 1.3.1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-23 10:56:21 +01:00
Mazz Mosley
2c8aade13e Space for errors
It was harder to see when there are errors if they came straight after
the other output. Putting a newline in there gives it a bit of visual
room.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-23 10:55:57 +01:00
Mazz Mosley
119901c19b Improve test coverage for scale
Also includes tiny amount of code cleanup, being explicit with imports.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-23 10:55:57 +01:00
Alex Brandt
ef44c46c72 add all completions to sdist
The zsh completion was recently added but missed from the sdist.  This
includes all completions that might be added at any point.

Signed-off-by: Alex Brandt <alunduil@alunduil.com>
2015-07-22 21:17:15 -05:00
Aanand Prasad
fc32ccefca Merge pull request #1755 from aanand/fix-container-name-one-off
Don't use custom name for one-off containers
2015-07-22 18:14:31 +01:00
Aanand Prasad
1739448402 Don't use custom name for one-off containers
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-22 15:39:56 +01:00
Mazz Mosley
620dac53f6 Merge pull request #1746 from aanand/remove-logging-test
Remove logging test
2015-07-21 16:34:58 +01:00
Aanand Prasad
dc62279d02 Merge pull request #1734 from mnowster/1653-scale-in-parallel
Parallelise scale
2015-07-21 16:02:04 +01:00
Aanand Prasad
4035a203fa Merge pull request #1745 from bfirsh/2015-07-21-roadmap-update
Update roadmap with state convergence
2015-07-21 16:01:13 +01:00
Aanand Prasad
233c509f71 Remove logging test
It doesn't do much other than cause the remainder of the test suite to
generate lots of junk output.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-21 15:56:37 +01:00
Mazz Mosley
e1c1a4c0aa Scale restarts stopped containers
This is existing behaviour and should be kept.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-21 15:41:22 +01:00
Ben Firshman
41406cdd68 Update roadmap with state convergence
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-07-21 15:37:55 +01:00
Mazz Mosley
cc0bfea8a1 Merge pull request #1711 from aanand/custom-names
Add container_name option for specifying a custom container name
2015-07-21 14:28:16 +01:00
Mazz Mosley
090879b67a Merge pull request #1737 from aanand/update-completion-for-force-recreate
Update bash and zsh completion for --force-recrate
2015-07-21 12:18:16 +01:00
Mazz Mosley
3ec7124539 Merge pull request #1742 from DoubleMalt/patch-1
Fix required version of websockets-client
2015-07-21 12:16:23 +01:00
Mazz Mosley
f721389447 Merge pull request #1743 from aanand/fix-stream-stack-trace
Stop printing a stack trace when there's an error when pulling
2015-07-21 12:15:18 +01:00
Mazz Mosley
da650e9cfd Refactor parallel execute
Refactored parallel execute and execute create into a single function
parallel_execute that can now handle both cases. This helps untangle it
from being so tightly coupled to the container.

Updated all the relevant operations to use the refactored function.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-21 11:56:59 +01:00
Aanand Prasad
38a6209acd Stop printing a stack trace when there's an error when pulling
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-21 11:07:20 +01:00
Christoph Witzany
04b7490ef2 Fix required version of websockets-client
Signed-off-by: Christoph Witzany <christoph@web.crofting.com>
2015-07-21 11:59:32 +02:00
Aanand Prasad
d1fdf1b809 Update bash and zsh completion for --force-recrate
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-20 17:18:39 +01:00
Mazz Mosley
5c29ded6ac Parallelise scale
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-20 16:33:04 +01:00
Mazz Mosley
85c90daa18 Merge pull request #1731 from aanand/fix-ctrl-c
Make parallel tasks interruptible with Ctrl-C
2015-07-20 16:05:26 +01:00
Aanand Prasad
4ba9d9dac2 Make parallel tasks interruptible with Ctrl-C
The concurrent.futures backport doesn't play well with
KeyboardInterrupt, so I'm using Thread and Queue instead.

Since thread pooling would likely be a pain to implement, I've just
removed `COMPOSE_MAX_WORKERS` for now. We'll implement it later if we
decide we need it.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-20 14:13:25 +01:00
Aanand Prasad
4ffae4a1ac Merge pull request #1725 from moxiegirl/update-docs-dockerfile
Updating with the latest image
2015-07-20 12:00:18 +01:00
Aanand Prasad
5f6d0d0824 Merge pull request #1721 from moxiegirl/remove-boot2docker-1720
Removing references to boot2docker
2015-07-20 11:52:15 +01:00
Aanand Prasad
05d8daa8e0 Merge pull request #1710 from mnowster/improve-output-for-parallel-executions
Improve output for parallel command
2015-07-20 11:49:37 +01:00
Aanand Prasad
9df2be80a8 Merge pull request #1717 from aanand/fix-up-docs
Fix regression in docs for 'up'
2015-07-20 11:45:50 +01:00
Mazz Mosley
9d9b865796 Add in error handling
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-20 10:21:49 +01:00
Mazz Mosley
61787fecea Resolve race condition
Sometimes, some messages were being executed at the same time, meaning
that the status wasn't being overwritten, it was displaying on a
separate line for both doing and done messages.

Rather than trying to have both sets of statuses being written out
concurrently, we write out all of the doing messages first. Then
the done messages are written out/updated, as they are completed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-20 10:21:49 +01:00
Mary Anthony
949dd5b2c7 Updating with the latest image
Signed-off-by: Mary Anthony <mary@docker.com>
2015-07-19 16:08:01 -07:00
Mary Anthony
4ca210edd7 Removing references to boot2docker
- Replace with machine references
- 1.8 boot2docker is deprecated

Signed-off-by: Mary Anthony <mary@docker.com>
2015-07-17 16:17:46 -07:00
Aanand Prasad
4b4c4f37bd Merge pull request #1718 from moxiegirl/propos-alternates
remove cli
2015-07-17 17:25:08 +01:00
Mary Anthony
2407193594 remove cli
Signed-off-by: Mary Anthony <mary@docker.com>
2015-07-17 09:15:29 -07:00
Aanand Prasad
98eab03c61 Merge pull request #1068 from likeon/master
Docs: yml link in getting started with django
2015-07-17 17:11:38 +01:00
Aanand Prasad
faa7da6eff Merge pull request #1515 from aanand/allow-any-volume-mode
Allow any volume mode to be specified
2015-07-17 17:10:59 +01:00
Aanand Prasad
89f6caf871 Allow any volume mode to be specified
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 16:14:09 +01:00
Aanand Prasad
a3191ab90f Add container_name option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 15:50:09 +01:00
Aanand Prasad
35092f1d5e Fix regression in docs for 'up'
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 15:29:02 +01:00
Aanand Prasad
445fe89fce Tweak wording of scale warning
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 15:24:17 +01:00
Aanand Prasad
9ffe69a572 Refactor can_be_scaled for clarity
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 15:24:17 +01:00
Aanand Prasad
6ca781416e Merge pull request #1715 from moxiegirl/propos-alternates
Updating Compose documentation
2015-07-17 15:23:53 +01:00
Mary Anthony
36f4d413fd Updating Compose documentation
- Split out commands into individual pages for maintainability
- Add full usage in commands pages for usability
- Updated description of the run command
- adding in Aanand's comment

Signed-off-by: Mary Anthony <mary@docker.com>
2015-07-17 07:05:45 -07:00
Mazz Mosley
c8643828d2 Merge pull request #1702 from aanand/smart-recreate-by-default
Smart recreate by default
2015-07-17 14:39:40 +01:00
Aanand Prasad
ced94a3504 Make smart recreate the default
Add --force-recreate flag to enable the old default behaviour of
recreating everything.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 11:28:02 +01:00
Aanand Prasad
b2cb5a48d2 Merge pull request #1714 from aanand/scale-timeout
Make scale timeout configurable, default to 10
2015-07-17 10:13:30 +01:00
Aanand Prasad
9d0bbdf8dd Make scale timeout configurable, default to 10
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-16 16:39:38 +01:00
Aanand Prasad
ca298309e0 Merge pull request #1713 from mnowster/increase-default-worker-number
Increase max-workers
2015-07-16 16:33:01 +01:00
Mazz Mosley
29f51f8216 Increase max-workers
There's significant speed improvement by having more workers. This
value still shouldn't cause anyone's machines to melt/explode.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-16 16:17:26 +01:00
Mazz Mosley
da6cbd4535 Improve output for parallel command
This approach takes the style of replacing the output message, in
place, when the command has finished executing. Bringing it a bit
more inline with what `docker pull` does.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-16 11:51:45 +01:00
Mazz Mosley
c7dccccd1f Merge pull request #1704 from aanand/fix-timeout-type
Make sure up/restart/stop timeout is an int
2015-07-16 10:50:06 +01:00
Mazz Mosley
3a775388b2 Merge pull request #1698 from aanand/use-docker-1.7.1
Test against Docker 1.6.2 and 1.7.1
2015-07-16 10:48:24 +01:00
moxiegirl
947bce043e Merge pull request #1699 from bfirsh/link-to-waffle-board-from-contributing
Link to waffle board from CONTRIBUTING.md
2015-07-15 15:13:51 -07:00
Aanand Prasad
7b9664be8e Merge pull request #1705 from aanand/fix-labels-null
Handle case where /containers/json returns "Labels": null
2015-07-15 17:30:31 +01:00
Aanand Prasad
0c5c8d1f00 Handle case where /containers/json returns "Labels": null
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 17:13:33 +01:00
Mazz Mosley
5a46230555 Merge pull request #1703 from aanand/rename-max-workers
Rename max workers environment variable
2015-07-15 16:59:53 +01:00
Aanand Prasad
ec8bf066ba Make sure up/restart/stop timeout is an int
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 16:56:39 +01:00
Aanand Prasad
f03dec766d Rename max workers env var and fix docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 16:43:43 +01:00
Aanand Prasad
35aef1aee0 Merge pull request #1687 from mnowster/1651-parallelise-stopping-containers
1651 parallelise stopping containers
2015-07-15 16:29:54 +01:00
Aanand Prasad
6c7c63ce34 Merge pull request #1693 from ekristen/remove_tty_wrap
Do not wrap table cells
2015-07-15 16:27:27 +01:00
Aanand Prasad
e675d67774 Test against Docker 1.6.2 and 1.7.1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 14:37:44 +01:00
Ben Firshman
200b408843 Link to waffle board from CONTRIBUTING.md
Closes #1067

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-07-15 11:56:46 +01:00
Mazz Mosley
03d34336a8 Document DEFAULT_MAX_WORKERS
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-15 11:56:06 +01:00
Aanand Prasad
847f839cab Merge pull request #1559 from aanand/update-swarm-docs
Update Swarm docs
2015-07-15 11:43:10 +01:00
Mazz Mosley
a68ca199a2 Execute container commands in parallel
Commands able to use this parallelisation are `stop`, `kill` and `rm`.

We're using a backported function from python 3, to allow us to make
the most of a pool of threads without having to write the low level
code for managing this ourselves.

A default value for number of threads is a low enough number so it
shouldn't cause performance problems but if someone knows the
capability of their system and wants to increase it, they can via
an environment variable DEFAULT_MAX_WORKERS

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-15 11:02:50 +01:00
Ben Firshman
aab6df6ba4 Add test coverage support
Prints out results on console and puts HTML report in `coverage-html`.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-07-15 10:09:37 +01:00
Erik Kristensen
7937611366 change 80 to 0
Signed-off-by: Erik Kristensen <erik@erikkristensen.com>
2015-07-14 12:31:00 -06:00
Erik Kristensen
b7edb3ca9d do not wrap table cells
Signed-off-by: Erik Kristensen <erik@erikkristensen.com>
2015-07-14 12:30:42 -06:00
Aanand Prasad
1e71eebc74 Merge pull request #1688 from aanand/use-docker-py-1.3.0
Use docker-py 1.3.0
2015-07-14 16:55:44 +01:00
Aanand Prasad
fdc34a187e Use docker-py 1.3.0
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-14 16:17:12 +01:00
Mazz Mosley
2db0a377e2 Minor test refactor
Rather than creating a docker client within each test, create one
at setup and make it accessible to the whole class.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-13 14:11:12 +01:00
Aanand Prasad
81707ef1ad Merge pull request #1643 from aanand/warn-about-legacy-one-off-containers
Show an error on 'run' when there are legacy one-off containers
2015-07-08 14:48:03 +01:00
Aanand Prasad
a8ad13734e Merge pull request #1666 from mnowster/docs-for-extends-file-default-behaviour
Docs for `file` default behaviour
2015-07-07 17:12:29 +01:00
Aanand Prasad
8b033d3946 Merge pull request #1665 from mnowster/1648-support-log-opt
1648 support log opt
2015-07-07 17:08:04 +01:00
Mazz Mosley
ef8ae07145 Docs for file default behaviour
Change in behaviour, `file` key is optional and if not set the
default is to look within the same file as `extends` is defined.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-07 17:01:09 +01:00
Mazz Mosley
6f31e8ebe9 Add support for log_opt
When specifying a log_driver you want to specify some options for
the logger as per the docker run --log-opt option. The logger
options are key value pairs.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-07 16:26:43 +01:00
Aanand Prasad
2bc10db545 Merge pull request #1658 from aanand/fix-smart-recreate-nonexistent-image
Fix smart recreate when 'image' is changed to something nonexistent
2015-07-07 16:12:44 +01:00
Aanand Prasad
531265bc84 Fix smart recreate when 'image' is changed to something nonexistent
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-07 16:01:44 +01:00
Mazz Mosley
c1223bfd3a Keep config keys in alphabetised order
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-07 12:02:05 +01:00
Aanand Prasad
e9da790f76 Merge pull request #1660 from mnowster/754-add-option-memswap-limit
Add in memswap_limit run option
2015-07-07 10:09:49 +01:00
Mazz Mosley
fc26982132 Add in memswap_limit run option
By allowing the memswap_limit option to be defined we also need to
check that mem_limit is set, you can't have swap without a limit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-06 17:08:57 +01:00
Aanand Prasad
e98caf5cf9 Show an error on 'run' when there are legacy one-off containers
Also warn the user about the one-off containers in the standard error
message about legacy containers.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-06 14:45:17 +01:00
Daniel Nephin
20218394b9 Merge pull request #1649 from albers/doc-completion-zsh
Mention zsh command completion in general install section
2015-07-06 06:41:09 -07:00
Aanand Prasad
fc8f564558 Merge pull request #1632 from mnowster/extends_file_default_behaviour
Extends file default behaviour and fixes circular reference bug
2015-07-06 13:28:54 +01:00
Aanand Prasad
0fa5808389 Merge pull request #1623 from mnowster/documentation-fixes
Documentation fixes
2015-07-06 13:25:56 +01:00
Harald Albers
2fc7cd6e03 Mention zsh command completion in general install section
Signed-off-by: Harald Albers <github@albersweb.de>
2015-07-05 19:18:24 +02:00
Aanand Prasad
d90202399a Merge pull request #1645 from dnephin/fix_up_race
Fix race condition in docker-compose up
2015-07-03 16:28:22 +01:00
Aanand Prasad
f42fd6a3ad Merge pull request #1642 from aanand/fix-1573
Fix bug where duplicate container is leftover after 'up' fails
2015-07-03 16:25:53 +01:00
Aanand Prasad
d85688892c Merge pull request #1644 from aanand/fix-rm-bug
Stop 'rm' and 'ps' listing services not defined in the current file
2015-07-03 16:22:48 +01:00
Daniel Nephin
bd554a6fea Fix race condition in docker-compose up.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-07-03 10:29:46 -04:00
Mazz Mosley
317bbec98c Move make_service_dict out of config
This top level function is a test helper, so I've moved it into the
config_test file and updated accordingly.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 15:06:53 +01:00
Mazz Mosley
6e6dbdad95 working_dir is no longer optional
When building test data using make_service_dict, we need to include
working_dir as it is core to some of the functionality of
ServiceLoader.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:56:18 +01:00
Aanand Prasad
0b887b841f Stop 'rm' and 'ps' listing services not defined in the current file
If you have an alternate YAML file with different services defined,
containers for those services will be shown in `docker-compose ps` even
if you don't pass that file in.

Furthermore, `docker-compose rm` will claim that it's going to remove
them, but actually won't.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-03 14:34:27 +01:00
Mazz Mosley
c6e03d739d Test self referencing 'file'
When specifying the 'file' key to a value of it's own name, test
that this works and does not cause a false positive circular reference
error.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:14:47 +01:00
Mazz Mosley
6a6e7934bd Refactor circular-reference check
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:05:35 +01:00
Mazz Mosley
ba71e2a549 Use new load_from_filename
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:05:14 +01:00
Mazz Mosley
c51d53afba Fix off by one error
In our circular reference check the stack was previously off by one,
by not including the current service name that was calling another.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 12:24:33 +01:00
Mazz Mosley
bd7fcd1123 Use absolute paths
A circular reference bug occurs when there is a difference in the paths
of the file specified in the extends. So one time it is relative, second
time is absolute thus allowing a further circular reference to occur.

By using absolute paths we can be sure that the service filename check
is correct.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 12:21:12 +01:00
Mazz Mosley
254bc4908c Move extends validation into ServiceLoader class
This refactoring allows us to raise an error when there is no
'file' key specified in the .yml and no self.filename set. This
error was specific to the tests, as the tests are
the only place that constructs service dicts without sometimes
setting a filename.

Moving the function within the class as well as it is code that
is exclusively for the use of validating properties for the
ServiceLoader class.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:31 +01:00
Mazz Mosley
24c1d95869 Refactor extends validation tests
Split them out into individual validation tests so it is clearer
to see what is going on and to enable adding further validation
tests.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:31 +01:00
Mazz Mosley
5e2d43843c Reduce path manipulation
If we're using self.filename, then it's already a full path and we
don't need to splice off the filename.yml just so we can .join it
back together again.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:31 +01:00
Mazz Mosley
6e4a954dbd 'file' key can be omitted from extends
If the 'file' key is not set in the extends_options dict then we
look for the 'service' from within the same file.

Fixes this issue: https://github.com/docker/compose/issues/1237

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:30 +01:00
Mazz Mosley
31dedd8bdd Rename function process to validate
The process function contained purely validation checks, so re-named
the function to aid intent clarity.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:30 +01:00
Aanand Prasad
62b47224f0 Fix bug where duplicate container is leftover after 'up' fails
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-03 10:46:07 +01:00
Aanand Prasad
db7e5124f3 Merge pull request #1488 from dnephin/config_from_stdin
Support reading config from stdin
2015-07-03 09:03:40 +01:00
Aanand Prasad
a6b9982a1e Merge pull request #1633 from jeffk/parse_env_vars_in_all_volumes
Added env var parsing to volume container paths
2015-07-03 08:55:48 +01:00
Aanand Prasad
40b8c3c892 Merge pull request #1624 from mnowster/1519_relax_service_name_restrictions
1519 relax service name restrictions
2015-07-03 08:54:16 +01:00
Daniel Nephin
ae96fc0071 Support reading config from stdin.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-07-02 22:16:22 -04:00
Ben Hamill
58f3b576c9 Replace - with _ in completion identifiers.
Signed-off-by: Ben Hamill <git-commits@benhamill.com>
2015-07-02 14:20:53 -05:00
Jeff Kramer
8709dc3c24 Added env var parsing to volume container paths
This commit adds environment variable parsing to the container side
of the volume mapping in configs. The common use case for this is
mounting SSH agent sockets in a container, using code like:

volumes:
    - $SSH_AUTH_SOCK:$SSH_AUTH_SOCK
environment:
    - SSH_AUTH_SOCK

Signed-off-by: Jeff Kramer <jeff.kramer@voxmedia.com>
2015-07-02 13:13:38 -05:00
Mazz Mosley
a8ea82f78f Improve link caption
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-02 15:39:22 +01:00
Mazz Mosley
cd2cdb25e3 Merge pull request #1631 from aanand/add-mazz-to-maintainers
Add Mazz to MAINTAINERS
2015-07-02 14:20:39 +01:00
moxiegirl
5185c9f70a Merge pull request #1619 from AndyWendt/patch-1
Added uninstall documentation for pip and curl
2015-07-02 06:07:59 -07:00
Mazz Mosley
f0dd63d5bc Don't use future tense
As per style-guide, future tense is not necessary.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 18:06:09 +01:00
Mazz Mosley
9549bd0539 Initial cap Docker
Use lowercase docker only when referencing a command/daemon

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 18:05:21 +01:00
Mazz Mosley
f33f673b49 Allow _.- chars in service names
As VALID_CHARS is shared with project names, these chars are also
now allowed within project names.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Mazz Mosley
8cf84ea552 Fix missing image names
These tests were indeed raising a config error, but not for the reason
intended/tested for. I've added in the image name so the config error
raise is correctly testing the Service name.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Mazz Mosley
8a47791161 Re-arrange for the more common case
boot2docker is the more common case so let's have that one first.
Also be more explicit and clear that the localhost:5000 is applicable
for people running on linux.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 16:20:29 +01:00
Mazz Mosley
ab03f2310b Include zsh shell
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 16:20:29 +01:00
Mazz Mosley
94ecc515d3 Link to docker's contrib workflow
This will aid people in how to make pull requests for code and docs.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 16:20:29 +01:00
Mazz Mosley
098ec3dcaa Add in git fork syncing links
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:11 +01:00
Mazz Mosley
4e0f4aa20a Split out release process
To aid clarity in how to contribute, I've moved the release process
out into it's own RELEASE_PROCESS.md file. The release process info
is only relevant for maintainers who are building new releases of
compose.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:11 +01:00
Mazz Mosley
c45c16cead Improve localhost & boot2docker info
Added a link to boot2docker for those unfamiliar with it.

http://0.0.0.0:5000 didn't resolve for me, however localhost:5000
did, so included reference to that.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:11 +01:00
Mazz Mosley
d0c499329e Add a note not to worry
When reading through the code for the first time and seeing redis,
those unfamiliar with docker first thought might be that they need
to install redis. Adding this sentence helps make it clearer that
this is not needed. Docker will take care of this in services.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:10 +01:00
Mazz Mosley
4c31741ac9 Include command completion link
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:10 +01:00
Mazz Mosley
a7a0888446 Re-phrasing for clarity
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:10 +01:00
Mazz Mosley
4d69a57edd Include flask output
When running `docker-compose up`, an extra line of output, from flask,
is outputted. I've included it so anyone new to docker-compose who
sees this output will know that it's expected and not worry that
something might have gone wrong.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:10 +01:00
Mazz Mosley
3906bd067e Remove redundant import
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 15:58:10 +01:00
Aanand Prasad
63941b8f6c Add Mazz to MAINTAINERS
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-01 15:38:07 +01:00
Aanand Prasad
75600e37ad Merge pull request #1605 from sdurrheimer/zsh-help-completion
Add --help to subcommands in zsh completion
2015-07-01 12:36:25 +01:00
Andy Wendt
8197d0e261 Added uninstall documentation for pip and curl
Signed-off-by: Andy Wendt <andy@awendt.com>
2015-06-30 10:27:44 -06:00
Steve Durrheimer
745e838673 Add --help to subcommands in zsh completion
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-06-26 09:00:47 +02:00
Daniel Nephin
8346186469 Merge pull request #1603 from albers/completion-help-option
Add --help to bash completion
2015-06-25 17:59:06 -07:00
Harald Albers
9a8020d1bf Add --help to bash completion
Signed-off-by: Harald Albers <github@albersweb.de>
2015-06-25 14:04:03 -07:00
Aanand Prasad
bee65e8354 Merge pull request #1587 from aanand/fix-detached-description
Fix -d description
2015-06-23 08:36:02 -07:00
Aanand Prasad
104568b27b Merge branch 'compose-swarm-networking-guide' 2015-06-22 08:44:52 -07:00
Aanand Prasad
52975eca6f Fixes
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-22 08:44:41 -07:00
Aanand Prasad
4647875408 Merge pull request #1589 from aanand/compose-swarm-networking-guide
Add experimental Compose/Swarm/multi-host networking guide
2015-06-22 07:59:17 -07:00
Aanand Prasad
16213dd493 Add experimental Compose/Swarm/multi-host networking guide
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-22 07:58:08 -07:00
Aanand Prasad
c8751980f9 Merge pull request #1578 from aanand/fix-migrate-help
Fix 'docker-compose help migrate-to-labels'
2015-06-21 17:25:52 -07:00
Aanand Prasad
4f83a18912 Merge pull request #1570 from aanand/fix-build-pull
Explicitly set pull=False when building
2015-06-21 17:25:46 -07:00
Aanand Prasad
52c19bf96c Fix -d description
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-21 13:06:25 -07:00
Aanand Prasad
81cbf558c3 Merge pull request #1586 from aanand/replace-ticks-with-indent
Replace backtick code blocks with indentation
2015-06-21 13:03:19 -07:00
Aanand Prasad
511fc4a05c Replace backtick code blocks with indentation
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-21 12:37:20 -07:00
Ben Firshman
911cd60360 Merge pull request #1580 from aanand/dont-set-network-mode-when-none-is-specified
Don't set network mode when none is specified
2015-06-19 16:01:04 -07:00
Aanand Prasad
93372dd665 Fix 'docker-compose help migrate-to-labels'
- Fix "No such command" error

- Add text from migration section of install docs

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-19 15:43:53 -07:00
Aanand Prasad
c22cc02df5 Don't set network mode when none is specified
Setting a value overrides the new default network option.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-19 15:22:13 -07:00
Aanand Prasad
37ee6b0c19 Merge pull request #1575 from moxiegirl/fix-yaml-code
Updating from three ticks to code block
2015-06-19 11:55:57 -07:00
Aanand Prasad
efee2df310 Merge pull request #1572 from sdurrheimer/fix-completion-docs-urls
Fix completion docs URLs
2015-06-19 11:42:39 -07:00
Steve Durrheimer
d0102f0761 Fix completion docs URLs
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-06-19 17:57:18 +02:00
Mary Anthony
c3df62472b Updating from three ticks to code block
Signed-off-by: Mary Anthony <mary@docker.com>
2015-06-19 02:28:09 -07:00
Aanand Prasad
bef0926c58 Explicitly set pull=False when building
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 17:43:16 -07:00
Daniel Nephin
c7c88bb4ff Merge pull request #1566 from aanand/bump-1.4.0dev
Bump 1.4.0dev
2015-06-18 19:57:53 -04:00
Aanand Prasad
5aa82a5519 Bump 1.4.0dev
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 11:56:43 -07:00
Aanand Prasad
8ffeaf2a54 Merge pull request #1565 from aanand/use-docker-1.7.0
Use docker 1.7.0 and docker-py 1.2.3
2015-06-18 11:23:40 -07:00
Aanand Prasad
ac56ef3d65 Update docker-py to 1.2.3 final
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 11:11:51 -07:00
Aanand Prasad
ae96e1af16 Use Docker 1.7.0
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 10:34:34 -07:00
Aanand Prasad
4e73e86d94 Merge pull request #1563 from moxiegirl/hugo-test-fixes
Hugo final 1.7 Documentation PR -- please read carefully
2015-06-18 10:20:10 -07:00
Mary Anthony
c26b1c8ee9 Entering fixes from Hugo
renaming compose-overview back to index
Updating with fixes per Aanand. And others found through test

Signed-off-by: Mary Anthony <mary@docker.com>
2015-06-17 21:50:43 -07:00
Aanand Prasad
77c939b256 Merge pull request #1142 from calou/master
Added support of option mac-address
2015-06-17 14:39:00 -07:00
Sébastien Gruchet
b76ac6e633 Added support to option mac-address
Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Updated doc

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Fixed LINT errors

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Changed mac-address entry order in config keys

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Changed attributes order in docs/yml.md

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>
2015-06-17 21:28:17 +02:00
Daniel Nephin
26ea27172e Merge pull request #1558 from aanand/use-docker-1.7-rc4
Use Docker 1.7 RC5
2015-06-16 22:01:50 -04:00
Aanand Prasad
bc7161b475 Merge pull request #1552 from aanand/add-upgrade-instructions
Add upgrading instructions to install docs
2015-06-16 16:26:40 -07:00
Aanand Prasad
e0af1a44ea Use Docker 1.7 RC5
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-16 15:14:48 -07:00
Aanand Prasad
bc14c473c9 Merge pull request #1521 from dano/validate-service-names
Validate that service names passed to Project.containers aren't bogus.
2015-06-16 10:45:49 -07:00
Dan O'Reilly
464ab3d727 Add a method specifically for service name validation.
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-06-15 23:06:06 -04:00
Daniel Nephin
f3df2a9fec Merge pull request #1551 from aanand/use-docker-1.7-rc3
Use Docker 1.7 RC3
2015-06-15 21:33:07 -04:00
Aanand Prasad
c421d23c34 Update Swarm docs
- Link to libnetwork

- Building now works, but is complicated by scaling

- Document how to set constraints/affinity

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-15 15:19:55 -07:00
Aanand Prasad
5b2a0cc73d Merge pull request #1406 from vdemeester/667-compose-port-scale
Fixing docker-compose port with scale (#667)
2015-06-15 10:58:44 -07:00
Aanand Prasad
acd8dce595 Add upgrading instructions to install docs
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-15 10:46:48 -07:00
Daniel Nephin
b3b44b8e4c Merge pull request #1550 from aanand/update-docker-py
Update setup.py with new docker-py minimum
2015-06-15 13:43:57 -04:00
Aanand Prasad
aaccd12d3d Merge pull request #1545 from moxiegirl/test-tooling
Updated for new documentation tooling
2015-06-15 10:36:37 -07:00
Aanand Prasad
b4c49ed805 Use Docker 1.7 RC3
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-15 10:25:58 -07:00
Aanand Prasad
4e108e377e Update setup.py with new docker-py minimum
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-15 10:18:15 -07:00
Aanand Prasad
5231288b4e Merge pull request #1489 from dnephin/faster_integration_tests
Faster integration tests
2015-06-15 10:04:45 -07:00
Mary Anthony
e40fc02561 Testing with documentation tooling
Updating with changes
Updating for Hugo
Adding a README'
moving index.md compose-overview.md in links
changing overview
Updating image to pull

Signed-off-by: Mary Anthony <mary@docker.com>
2015-06-14 16:00:08 -07:00
Daniel Nephin
06db577105 Move converge() to a test module, and use a short timeout for tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 17:18:27 -04:00
Travis Thieman
c24d5380e6 Extend up -t to pass timeout to stop running containers
Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
2015-06-14 16:45:28 -04:00
Daniel Nephin
60351a8e07 Speed up integration test and make cleanup easier by using labels
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 16:45:28 -04:00
Daniel Nephin
d827809ffb Use labels to filter containers.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 16:45:28 -04:00
Daniel Nephin
77e594dc94 Merge pull request #1544 from aanand/fix-volume-deduping
Fix volume binds de-duplication
2015-06-14 13:28:14 -04:00
Aanand Prasad
08bc4b830b Fix volume binds de-duplication
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-12 16:57:22 -04:00
Aanand Prasad
4c2112dbfd Merge pull request #1539 from bfirsh/add-image-affinity-to-test
Add image affinity to test script
2015-06-12 11:56:02 -04:00
Ben Firshman
ac222140e7 Add image affinity to test script
This will allow tests to be run on a Swarm. This is being fixed in
Swarm 0.4: https://github.com/docker/swarm/issues/743

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-06-11 15:58:07 -07:00
Ben Firshman
e3525d64b5 Merge pull request #1537 from aanand/reorder-service-utils
Reorder service.py utility methods
2015-06-11 21:55:33 +01:00
Ben Firshman
bd246fb011 Merge pull request #1538 from thieman/tnt-serivce-misspelled
Correct misspelling of "Service" in an error message
2015-06-11 21:54:53 +01:00
Travis Thieman
f31d4c8a93 Correct misspelling of "Service" in an error message
Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
2015-06-11 14:03:08 -04:00
Aanand Prasad
7995fc2ed2 Reorder service.py utility methods
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-11 11:44:13 -04:00
Vincent Demeester
a5fd91c705 Fixing docker-compose port with scale (#667)
Fixes #667 and Closes #735 (taking over it)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-06-10 23:26:33 +02:00
Aanand Prasad
0e9ccd36f3 Merge pull request #1497 from aanand/use-1.7-rc1
Run tests against Docker 1.7 RC2
2015-06-10 17:19:24 -04:00
Aanand Prasad
4fd5d58076 Test against Docker 1.7.0 RC2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-10 14:19:36 -04:00
Aanand Prasad
17e03b29f9 Merge pull request #1533 from edmorley/update-b2d-shellinit-example
Docs: Update boot2docker shellinit example to use 'eval'
2015-06-10 13:03:55 -04:00
Ed Morley
e3ba302627 Docs: Update boot2docker shellinit example to use 'eval'
The boot2docker documentation has since changed the recommended way to
use shellinit - see boot2docker/boot2docker#786.

Signed-off-by: Ed Morley <emorley@mozilla.com>
2015-06-10 14:38:35 +01:00
Daniel Nephin
87c30ae6e4 Merge pull request #1531 from aanand/test-crash-resilience
Test that data volumes now survive a crash when recreating
2015-06-09 22:22:56 -04:00
Daniel Nephin
95b2eaac04 Merge pull request #1529 from aanand/update-dockerpty
Update dockerpty to 0.3.4
2015-06-09 18:21:14 -04:00
Aanand Prasad
ff151c8ea0 Test that data volumes now survive a crash when recreating
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-09 13:06:09 -04:00
Aanand Prasad
66af37b135 Merge pull request #1474 from aanand/fix-ssl
Fix SSL "CERTIFICATE_VERIFY_FAILED" error
2015-06-09 11:56:27 -04:00
Dan O'Reilly
c59c9dd951 Add integration test for service name verification
Add a test to make sure NoSuchService is raised if
a bogus service name is given to 'docker-compose logs'.

Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-06-08 17:04:42 -04:00
Aanand Prasad
ce880af821 Update dockerpty to 0.3.4
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-08 17:01:03 -04:00
Daniel Nephin
5578ccbb01 Merge pull request #1527 from aanand/remove-logging-on-run-rm
Remove logging on run --rm
2015-06-08 16:21:02 -04:00
Daniel Nephin
38a11c4c28 Merge pull request #1526 from aanand/remove-start-or-create-containers
Remove Service.start_or_create_containers()
2015-06-08 12:49:32 -04:00
Daniel Nephin
e2b790f732 Merge pull request #1525 from aanand/fix-duplicate-logging
Fix duplicate logging on up/run
2015-06-08 12:48:46 -04:00
Aanand Prasad
b6a7db787f Remove logging on run --rm
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-08 11:16:00 -04:00
Aanand Prasad
db2d02dc0b Remove Service.start_or_create_containers()
It's only used in a single test method.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-08 10:59:03 -04:00
Aanand Prasad
f59b43ac27 Fix duplicate logging on up/run
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-08 10:52:15 -04:00
dano
2527ef8055 Validate that service names passed to Project.containers aren't bogus.
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-06-06 15:47:16 -04:00
Daniel Nephin
417e6ce0c9 Merge pull request #1508 from thaJeztah/update-dockerproject-links
Update dockerproject.com links
2015-06-04 11:18:23 -05:00
Aanand Prasad
7d2a89427c Merge pull request #1466 from noironetworks/changing-scale-to-warning
Modified scale awareness from exception to warning
2015-06-04 16:21:01 +01:00
Aanand Prasad
036a4c4258 Merge pull request #1507 from albers/completion-version
Support version command in Bash completion
2015-06-04 15:46:50 +01:00
Sebastiaan van Stijn
cfcc12692f Update dockerproject.com links
The dockerproject.com domain is moving to dockerproject.org
this changes the buildstatus link to point to the new
domain.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2015-06-03 23:03:17 +02:00
Harald Albers
be92b79b42 Support version command in Bash completion
Signed-off-by: Harald Albers <github@albersweb.de>
2015-06-03 13:25:26 -07:00
Aanand Prasad
417e8d80c3 Merge pull request #1499 from sdurrheimer/master
Support version command in zsh completion
2015-06-02 15:05:46 +01:00
Steve Durrheimer
77409737ce Support version command in zsh completion
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-06-02 12:38:23 +02:00
Aanand Prasad
2594282082 Build Python 2.7.9 in Docker image
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-01 17:56:15 +01:00
Aanand Prasad
8ad11c0bc8 Make sure we use Python 2.7.9 and OpenSSL 1.0.1 when building OSX binary
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-01 17:55:57 +01:00
Aanand Prasad
c571bb485d Report Python and OpenSSL versions in --version output
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-01 17:55:31 +01:00
Aanand Prasad
8eb65ed946 Merge pull request #878 from funkyfuture/versioncmd
Enhanced version information and Docker-like version command
2015-06-01 13:36:11 +01:00
Daniel Nephin
9a0bb325f2 Merge pull request #1481 from albers/completion-smart-recreate
Support --x-smart-recreate in bash completion
2015-05-30 09:01:39 -05:00
Daniel Nephin
d64bf88e26 Merge pull request #1475 from fordhurley/patch-1
Fix markdown formatting for `--service-ports` example
2015-05-30 08:43:48 -05:00
Aanand Prasad
c8e096e089 Merge pull request #1482 from bfirsh/add-build-and-dist-to-dockerignore
Make it possible to run tests remotely
2015-05-29 17:12:57 +01:00
Ben Firshman
b638728d6c Merge pull request #1325 from sdurrheimer/master
Zsh completion for docker-compose
2015-05-29 14:45:21 +01:00
Steve Durrheimer
1d5526c71d Support --x-smart-recreate and -v in zsh completion
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-05-29 14:24:55 +02:00
Steve Durrheimer
bc8d5923e7 Zsh completion for docker-compose
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
2015-05-29 14:24:55 +02:00
Ben Firshman
a6bd1d22a0 Don't mount code in a volume when running tests
An image is built anyway, so this is unnecessary. This makes it
possible to run the tests on a remote Docker daemon.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-29 13:23:42 +01:00
Ben Firshman
c128e881c1 Add build and dist to dockerignore
These are the bulk of what gets sent in the build. Makes builds
much faster, particularly remotely.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-29 13:07:19 +01:00
Aanand Prasad
a15f996744 Merge pull request #1480 from bfirsh/change-sigint-test-to-use-sigstop
Change kill SIGINT test to use SIGSTOP
2015-05-29 12:38:40 +01:00
Harald Albers
b3c1c9c954 Support --x-smart-recreate and -v in bash completion
Signed-off-by: Harald Albers <github@albersweb.de>
2015-05-29 13:30:01 +02:00
Ben Firshman
ec437313a7 Change kill SIGINT test to use SIGSTOP
I think the original intention of the original test was the check that
different signals work, I think. This does this -- it sends a signal
that doesn't cause the container to stop.

Closes #759. Replaces #1467.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-29 11:13:37 +01:00
Ford Hurley
5945db0fa8 Fix markdown formatting for --service-ports example
Signed-off-by: Ford Hurley <ford.hurley@gmail.com>
2015-05-28 15:45:21 -04:00
Ben Firshman
8574cb67a4 Merge pull request #1471 from aanand/prepare-osx-script
Script to prepare OSX build environment
2015-05-28 13:58:14 +01:00
funkyfuture
ae9d619d86 Add command for Docker-style version information
This adds a command 'version' to show software versions information
like Docker does. In addition it includes:
- version of the docker-py-package
- Python-implementation and -version

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2015-05-28 00:51:10 +02:00
Aanand Prasad
7d9aa8e0a9 Script to prepare OSX build environment
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-27 16:27:24 +01:00
Aanand Prasad
d0e87929a1 Merge pull request #1464 from twhiteman/bug1461
Possible division by zero error when pulling an image - fixes #1463
2015-05-27 12:49:58 +01:00
André Martins
ae63d35660 Modified scale awareness from exception to warning
Signed-off-by: André Martins <martins@noironetworks.com>
2015-05-26 23:59:45 +01:00
Todd Whiteman
b9c502531d Possible division by zero error when pulling an image - fixes #1463
Signed-off-by: Todd Whiteman <todd.whiteman@joyent.com>
2015-05-26 15:34:34 -07:00
Aanand Prasad
1344099e29 Merge pull request #1444 from aanand/migrate-in-dependency-order
Migrate containers in dependency order
2015-05-26 17:30:14 +01:00
Daniel Nephin
48f3d41947 Merge pull request #1447 from aanand/fix-convergence-when-service-not-created
Fix regression in `docker-compose up`
2015-05-26 10:54:28 -05:00
Aanand Prasad
7da8e6be3b Migrate containers in dependency order
This fixes a bug where migration would fail with an error if a
downstream container was migrated before its upstream dependencies, due
to `check_for_legacy_containers()` being implicitly called when we fetch
`links`, `volumes_from` or `net` dependencies.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 16:03:06 +01:00
Aanand Prasad
4795fd874f Fix regression in docker-compose up
When an upstream dependency (e.g. a db) has a container but a downstream
service (e.g. a web app) doesn't, a web container is not created on
`docker-compose up`.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 16:01:05 +01:00
Aanand Prasad
276fee105b Merge pull request #1459 from bfirsh/update-description
Update description of Compose
2015-05-26 15:57:26 +01:00
Ben Firshman
8af4ae7935 Merge pull request #1441 from aanand/abort-on-legacy-containers
Bail out immediately if there are legacy containers
2015-05-26 15:45:08 +01:00
Ben Firshman
91ceb33d5a Update description of Compose
"Define and run multi-container applications with Docker"

Not just development environments, and "complex" is not clear and
not really true.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-26 15:42:55 +01:00
Aanand Prasad
0b4d9401ee Bail out immediately if there are legacy containers
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 11:53:51 +01:00
Daniel Nephin
889d3636f4 Merge pull request #1440 from aanand/legacy-fixes
Legacy fixes
2015-05-24 12:42:14 -05:00
Daniel Nephin
b0f945d2da Merge pull request #1432 from albers/completion-migrate_to_labels
bash completion for migrate_to_labels
2015-05-23 18:21:44 -05:00
Daniel Nephin
93c529182e Merge pull request #1446 from aanand/fix-create-logging
Fix missing logging on container creation
2015-05-21 17:34:54 -05:00
Harald Albers
412034a023 bash completion for migrate-to-labels
Signed-off-by: Harald Albers <github@albersweb.de>
2015-05-21 12:45:04 -07:00
Aanand Prasad
30c9e7323a Fix missing logging on container creation
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 20:06:25 +01:00
Aanand Prasad
051f56a1e6 Fix bugs with one-off legacy containers
- One-off containers were included in the warning log messages, which can
  make for unreadable output when there are lots (as there often are).

- Compose was attempting to recreate one-off containers as normal
  containers when migrating.

Fixed by implementing the exact naming logic from before we used labels.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:49 +01:00
Aanand Prasad
b5ce23885b Split out fetching of legacy names so we can test it
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:49 +01:00
Aanand Prasad
0fdb8bf814 Refactor migration logic
- Rename `migration` module to `legacy` to make its legacy-ness explicit

- Move `check_for_legacy_containers` into `legacy` module

- Fix migration test so it can be run in isolation

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:09 +01:00
Aanand Prasad
e538923545 Merge pull request #1442 from aanand/dashes-in-migration-command
Rename migrate_to_labels -> migrate-to-labels
2015-05-21 18:19:30 +01:00
Daniel Nephin
c0f65a9f4c Merge pull request #1445 from aanand/replace-sleep-with-top
Use 'top' instead of 'sleep' as a dummy command
2015-05-21 11:51:23 -05:00
Aanand Prasad
b0cb31c186 Use 'top' instead of 'sleep' as a dummy command
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 16:24:29 +01:00
Aanand Prasad
3080244c0b Rename migrate_to_labels -> migrate-to-labels
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 14:54:41 +01:00
Aanand Prasad
b183a66db1 Merge pull request #1437 from dnephin/fix_project_containers
Project.containers with service_names
2015-05-21 10:42:08 +01:00
Daniel Nephin
022f81711e Fixes #1434, Project.containers with service_names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-20 20:47:34 -04:00
Aanand Prasad
4f40d0c168 Merge pull request #1433 from bfirsh/remove-whitespace-from-json-representation-of-container-config
Remove whitespace from json hash
2015-05-20 16:55:02 +01:00
Ben Firshman
f5ac1fa073 Remove whitespace from json hash
Reasoning:

e5d8447f06 (commitcomment-11243708)

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-20 16:02:08 +01:00
Ben Firshman
f79eb7b9ad Merge pull request #1382 from lsowen/security_opt
Add security_opt as a docker-compose.yml option
2015-05-20 13:40:42 +01:00
Aanand Prasad
b0b6ed31c4 Merge pull request #1430 from albers/fix-1426
Fix #1426 - migrate_to_labels not found
2015-05-20 12:31:18 +01:00
lsowen
ea7ee301c0 Add security_opt as a docker-compose.yml option
Signed-off-by: Logan Owen <lsowen@s1network.com>
2015-05-19 13:47:41 -04:00
Harald Albers
41315b32cb Fix #1426 - migrate_to_labels not found
Signed-off-by: Harald Albers <github@albersweb.de>
2015-05-19 16:37:50 +02:00
Aanand Prasad
80eaf4cc9f Merge pull request #1399 from aanand/state
Only recreate what's changed
2015-05-18 19:25:42 +01:00
Aanand Prasad
ef4eb66723 Implement smart recreate behind an experimental CLI flag
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-18 18:39:18 +01:00
Aanand Prasad
82bc7cd5ba Remove override_options arg from recreate_container(s)
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-18 17:42:09 +01:00
Aanand Prasad
3304c68891 Only set AttachStdin/out/err for one-off containers
If we're just streaming logs from `docker-compose up`, we don't need
to set AttachStdin/out/err, and doing so results in containers with
different configuration depending on whether `up` or `run` were invoked
with `-d` or not.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-18 17:41:04 +01:00
Aanand Prasad
1e6d912fbc Merge pull request #1356 from dnephin/use_labels_instead_of_names
Use labels instead of names to identify containers
2015-05-18 17:38:46 +01:00
Aanand Prasad
4ef3bbcdf2 Merge pull request #1415 from aanand/fix-run-race-condition
Fix race condition in `docker-compose run`
2015-05-18 16:16:31 +01:00
Daniel Nephin
62059d55e6 Add migration warning and option to migrate to labels.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:55:12 -04:00
Daniel Nephin
ed50a0a3a0 Resolves #1066, use labels to identify containers
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:47:26 -04:00
Daniel Nephin
28d2aff8b8 Fix teardown for integration tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:44:44 -04:00
Aanand Prasad
862971cffa Fix race condition in docker-compose run
We shouldn't start the container before handing it off to dockerpty -
dockerpty will start it after attaching, which is the correct order.
Otherwise the container might exit before we attach to it, which can
lead to weird bugs.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-15 12:16:24 +01:00
Daniel Nephin
c8022457eb Merge pull request #1413 from aanand/update-dockerpty
Update dockerpty to 0.3.3
2015-05-14 21:23:46 -04:00
Aanand Prasad
9bbf1a33d1 Update dockerpty to 0.3.3
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-14 20:03:50 +01:00
Aanand Prasad
0ac8c3cb03 Merge pull request #858 from dnephin/fix_volumes_recreate_on_1.4.1
Preserve individual volumes on recreate
2015-05-14 16:12:08 +01:00
Daniel Nephin
d5c9626040 Merge pull request #1411 from aanand/fix-extends-docs
Fix typo in extends.md
2015-05-14 09:53:38 -04:00
Aanand Prasad
ad9c5ad938 Fix typo in extends.md
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-14 10:48:35 +01:00
Daniel Nephin
70d2e64dfe Merge pull request #1407 from aanand/update-docker-py
Update docker-py to 1.2.2
2015-05-12 20:22:48 -04:00
Aanand Prasad
1dccd58209 Update docker-py to 1.2.2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-12 18:51:45 +01:00
Aanand Prasad
e0103ac0d4 Merge pull request #1405 from bfirsh/link-to-getting-started-guides-from-each-page
Link to getting started guides from each page
2015-05-12 14:40:53 +01:00
Ben Firshman
4d745ab87a Link to getting started guides from each page
These are really hard to find.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-12 12:44:43 +01:00
Daniel Nephin
417d9c2d51 Use individual volumes for recreate instead of volumes_from
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-11 13:01:43 -04:00
Daniel Nephin
4997facbb4 Merge pull request #1400 from DanElbert/754-device_option
Added devices config handling and device HostConfig handling
2015-05-11 12:42:48 -04:00
delbert@umn.edu
df87bd91c8 Added devices configuration option
Signed-off-by: Dan Elbert <dan.elbert@gmail.com>
2015-05-11 10:50:58 -05:00
Aanand Prasad
1748b0f81a Merge pull request #1349 from dnephin/rename_instead_of_intermediate
Rename container when recreating it
2015-05-08 10:33:28 +01:00
Daniel Nephin
6829efd4d3 Resolves #874, Rename instead of use an intermediate.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-07 21:53:41 -04:00
Daniel Nephin
99f2a3a583 Merge pull request #1396 from albers/completion-doc
Fix markdown formatting issue
2015-05-07 14:04:16 -04:00
Daniel Nephin
0f2f9db6d8 Merge pull request #1388 from vdemeester/1303-log-driver-support
Add support for log-driver as a docker-compose.yml option
2015-05-07 12:00:42 -04:00
Harald Albers
d6223371d6 Fix markdown formatting issue
Signed-off-by: Harald Albers <github@albersweb.de>
2015-05-07 04:41:12 -07:00
Daniel Nephin
4817d5944c Merge pull request #1391 from albers/completion-extglob
Fix #1386 by ensuring that exglob is set in bash completion
2015-05-06 10:46:13 -04:00
Vincent Demeester
f626fc5ce8 Add support for log-driver in docker-compose.yml
Closes #1303

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-05-06 13:18:58 +02:00
Harald Albers
1579a125a3 Ensure that exglob is set in bash completion
Signed-off-by: Harald Albers <github@albersweb.de>
2015-05-06 09:33:22 +02:00
Daniel Nephin
7fb9ec29c4 Merge pull request #1335 from chernjie/pid_readonly
docker-compose create --readonly
2015-05-05 20:50:01 -04:00
Daniel Nephin
f78e89f265 Merge pull request #1381 from sherter/help-fix
Show proper command in help text of build subcommand
2015-05-05 20:48:25 -04:00
CJ
b06294399a See #1335: Added --read-only
Signed-off-by: CJ <lim@chernjie.com>
2015-05-02 23:39:39 +08:00
Simon Herter
b8e0aed21c Show proper command in help text of build subcommand
The help text of the build subcommand suggested to use 'compose build' (instead of 'docker-compose build') to rebuild images.

Signed-off-by: Simon Herter <sim.herter@gmail.com>
2015-05-01 18:58:55 -04:00
Daniel Nephin
4bce388b51 Merge pull request #1376 from aanand/fix-build-non-ascii-filename
Make sure the build path we pass to docker-py is a binary string
2015-04-30 20:54:21 -04:00
Daniel Nephin
6c95eed781 Merge pull request #1269 from aanand/labels
Implement 'labels' option
2015-04-30 20:49:11 -04:00
Aanand Prasad
4f366d8355 Make sure the build path we pass to docker-py is a binary string
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-30 11:57:46 +01:00
Daniel Nephin
878d90febf Merge pull request #1374 from aanand/close-before-attaching
Close connection after building or pulling
2015-04-29 18:56:03 -04:00
Aanand Prasad
1a77feea3f Close connection before attaching on 'up' and 'run'
This ensures that the connection is not recycled, which can cause the
Docker daemon to complain if we've already performed another streaming
call such as doing a build.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-29 18:42:03 +01:00
Aanand Prasad
7e0ab0714f Merge pull request #1344 from dnephin/fix_pull_with_sha
Support image with ids instead of names
2015-04-29 16:46:34 +01:00
Aanand Prasad
2e6bc078fb Implement 'labels' option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-29 16:45:18 +01:00
Daniel Nephin
3dd860f0ba Fix #923, support image with ids instead of names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-04-29 10:13:18 -04:00
Daniel Nephin
de800dea0f Merge pull request #1370 from aanand/update-docker-version
Update Docker version to 1.6 stable
2015-04-29 10:03:13 -04:00
Aanand Prasad
fed4377ef6 Merge pull request #1351 from mchasal/1301-alphabetize_usage
Fix for #1301, Alphabetize Commands
2015-04-29 14:21:46 +01:00
Aanand Prasad
021bf46557 Update Docker version to 1.6 stable
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-29 13:58:32 +01:00
Aanand Prasad
b7e5116267 Merge pull request #1352 from bfirsh/add-irccloud-invite-link
Use cool new IRCCloud links for IRC channel
2015-04-29 13:25:25 +01:00
Daniel Nephin
9532e5a4f2 Merge pull request #1331 from xuxinkun/cpuset20150424
Add cpuset config.
2015-04-28 13:21:00 -04:00
Ben Firshman
e5a118e3ce Use cool new IRCCloud links for IRC channel
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-04-28 14:24:48 +01:00
Daniel Nephin
a631c1eddb Merge pull request #1357 from turtlemonvh/1350-extends_parent_build_directory_dne_error
Fix for #1350, nonexisting build path in parent section causes extending section to fail
2015-04-27 13:49:01 -04:00
Timothy Van Heest
855855a0e6 Fix for #1350, nonexisting build path in parent section causes extending section to fail
Signed-off-by: Timothy Van Heest <timothy.vanheest@gmail.com>
2015-04-27 10:55:30 -04:00
Daniel Nephin
b808674132 Merge pull request #1360 from aanand/remove-wercker
Remove wercker.yml
2015-04-27 10:17:41 -04:00
Ben Firshman
7e574fca71 Merge pull request #1358 from aanand/update-readme
Update README.md with changes to docs/index.md
2015-04-27 15:14:06 +01:00
Aanand Prasad
7d617d60bc Remove wercker.yml
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-27 15:10:01 +01:00
Aanand Prasad
da71e01d30 Merge pull request #1359 from aanand/remove-dco-validation
Remove DCO validation from CI script
2015-04-27 15:08:51 +01:00
Daniel Nephin
a89bc304f6 Merge pull request #1075 from KyleJamesWalker/master
Support alternate Dockerfile name.
2015-04-27 10:06:43 -04:00
Aanand Prasad
240495f07f Remove DCO validation from CI script
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-27 15:02:24 +01:00
Aanand Prasad
2e19887bf1 Update README.md with changes to docs/index.md
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-27 14:59:42 +01:00
Daniel Nephin
a982e516fc Merge pull request #1354 from xwisen/master
modified the release notes section the first[PR #972]to[PR #1088]
2015-04-27 09:56:46 -04:00
Ben Firshman
3af56e1602 Merge pull request #1200 from chanezon/1148-pat-paul
paulczar fixes plus example file
2015-04-27 14:54:14 +01:00
Aanand Prasad
16f8106149 Merge pull request #1158 from chernjie/addhosts
Add extra_hosts to yml configuration --add-hosts
2015-04-27 12:26:29 +01:00
CJ
86a08c00f2 See https://github.com/docker/compose/pull/1158#discussion_r29063218
Signed-off-by: CJ <lim@chernjie.com>
2015-04-27 14:07:21 +08:00
xwisen
0ca9fa8b2b modified the release notes section the first[PR #972]to[PR #1088]
Signed-off-by: xwisen <xwisen@gmail.com>
2015-04-26 13:16:23 +08:00
xuxinkun
688f82c1cf Add cpuset config.
Signed-off-by: xuxinkun <xuxinkun@gmail.com>
2015-04-26 00:14:52 +08:00
Michael Chase-Salerno
9a44708081 Fix for #1301, Alphabetize Commands
Signed-off-by: Michael Chase-Salerno <bratac@linux.vnet.ibm.com>
2015-04-24 20:45:18 +00:00
Daniel Nephin
89789c54ad Merge pull request #1232 from aleksandr-vin/add-parent-directories-search-for-default-compose-files
Add parent directories search for default compose-files
2015-04-24 13:12:24 -04:00
Kyle Walker
d17c4d27fa Support alternate Dockerfile name.
Signed-off-by: Kyle James Walker <KyleJamesWalker@gmail.com>
2015-04-24 08:30:36 -07:00
CJ
25ee3f0033 Remove extra s from --add-host
linting...
six.string_types
list-of-strings in examples
disallow extra_hosts support for list-of-dicts
A more thorough sets of tests for extra_hosts
Provide better examples
As per @aanand's [comment](https://github.com/docker/compose/pull/1158/files#r28326312)

  I think it'd be better to check `if not isinstance(extra_hosts_line,
  six.string_types)` and raise an error saying `extra_hosts_config must be
  either a list of strings or a string->string mapping`. We shouldn't need
  to do anything special with the list-of-dicts case.
order result to work with assert
use set() instead of sort()

Signed-off-by: CJ <lim@chernjie.com>
2015-04-24 09:21:29 +08:00
Thomas Desvenain
8098b65576 Fix when pyyaml has interpreted line as a dictionary
Added unit tests in build_extra_hosts + fix

Signed-off-by: CJ <lim@chernjie.com>
2015-04-24 09:21:21 +08:00
Sam Wing
fb81c37ca6 added the extra_hosts option to the yml configuration which exposes the --add-host flag from the docker client
Signed-off-by: Sam Wing <sampwing@gmail.com>
2015-04-23 21:54:59 +08:00
Daniel Nephin
e6ec76161d Merge pull request #1293 from mchasal/1224
1224: Check that image or build is specified.
2015-04-21 15:19:11 -04:00
Aanand Prasad
b317071cf3 Merge pull request #1205 from josephpage/run-rm-restart
[cli] run --rm overrides restart: always
2015-04-21 15:48:43 +01:00
Aanand Prasad
bb922d63f5 Merge pull request #1318 from aanand/fix-restart-timeout
Fix --timeout flag on restart, add tests for stop and restart
2015-04-21 15:07:07 +01:00
Aanand Prasad
2291fa2d45 Fix --timeout flag on restart, add tests for stop and restart
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-21 11:59:33 +01:00
Aanand Prasad
2cdde099fa Merge pull request #1297 from aanand/bump-1.3.0-dev
Bump 1.3.0dev
2015-04-16 18:02:59 +01:00
Aanand Prasad
310c7623f9 Bump 1.3.0dev
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-16 17:54:18 +01:00
Aanand Prasad
6e64802545 Merge pull request #1296 from aanand/merge-release-1.2.0
Merge release 1.2.0
2015-04-16 17:52:47 +01:00
Aanand Prasad
8b5015c10f Bump 1.2.0
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-16 17:48:28 +01:00
Michael Chase-Salerno
24a6c240fc Testcase for #1224, check that image or build is specified
Signed-off-by: Michael Chase-Salerno <bratac@linux.vnet.ibm.com>
2015-04-15 21:38:24 +00:00
Michael Chase-Salerno
15b763acdb Fix for #1224, check that image or build is specified
Signed-off-by: Michael Chase-Salerno <bratac@linux.vnet.ibm.com>
2015-04-15 02:03:02 +00:00
Daniel Nephin
3cd116b99d Merge pull request #1278 from albers/completion-run-user
Add bash completion for docker-compose run --user
2015-04-14 11:04:03 -04:00
Aanand Prasad
b559653c8c Merge pull request #1277 from fredlf/add-help-text
Adds Where to Get Help section
2015-04-14 15:16:11 +01:00
Harald Albers
5f17423d3e Add bash completion for docker-compose run --user
Signed-off-by: Harald Albers <github@albersweb.de>
2015-04-10 19:52:13 +02:00
Fred Lifton
2a442ec6d9 Adds Where to Get Help section
Signed-off-by: Fred Lifton <fred.lifton@docker.com>
2015-04-09 16:23:25 -07:00
Aleksandr Vinokurov
ceff5cb9ca Add parent directories search for default compose-files
Does not change directory to the parent with the compose-file found.
Works like passing '--file' or setting 'COMPOSE_FILE' with absolute path.
Resolves issue #946.

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
2015-04-09 22:36:47 +00:00
Ben Firshman
4926f8aef6 Merge pull request #1261 from aanand/fix-vars-in-volume-paths
Fix vars in volume paths
2015-04-09 14:44:07 +01:00
Daniel Nephin
927115c3d4 Merge pull request #1271 from sdake/master
Remove stray print
2015-04-09 09:41:27 -04:00
Steven Dake
1d7247b67e Remove stray print
A previous commit introduced a stray print operation.  Remove it.

Signed-off-by: Steven Dake <stdake@cisco.com>
2015-04-08 12:49:37 -07:00
Ben Firshman
a1cd00e3f0 Merge pull request #1251 from aanand/extends-guide
Add tutorial and reference for `extends`
2015-04-08 15:47:39 +01:00
Aanand Prasad
fd568b389d Fix home directory and env expansion in volume paths
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-07 16:23:45 +01:00
Aanand Prasad
4f95e81c6d Merge pull request #1166 from spk/fix_example_env_file
Docs: fix env_file example
2015-04-07 15:52:10 +01:00
Aanand Prasad
619e783a05 Merge pull request #1011 from sdake/master
Add a --pid=host feature to expose the host PID space to the container
2015-04-07 13:49:53 +01:00
Aanand Prasad
f3f7f000fe Add tutorial and reference for extends
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-07 13:46:14 +01:00
Aanand Prasad
219751abc7 Merge pull request #1258 from fredlf/1.6-docs-updates
Prepping for 1.6 release.
2015-04-07 11:22:02 +01:00
Joseph Page
0b48e137e8 add unit tests for run --rm with restart
Signed-off-by: Joseph Page <joseph.page@rednet.io>
2015-04-07 10:18:25 +02:00
Fred Lifton
947742852e Prepping for 1.6 release.
Adds release notes and edits/revises new Compose in production doc.
2015-04-06 16:47:07 -07:00
Steven Dake
94277a3eb0 Add --pid=host support
Allow docker-compsoe to use the docker --pid=host API available in 1.17

Signed-off-by: Steven Dake <stdake@cisco.com>
2015-04-06 12:44:35 -07:00
Steven Dake
11a2100d53 Add a --pid=host feature to expose the host PID space to the container
Docker 1.5.0+ introduces a --pid=host feature which allows sharing of PID
namespaces between baremetal and containers.  This is useful for atomic
upgrades, atomic rollbacks, and monitoring.

For more details of a real-life use case, check out:
http://sdake.io/2015/01/28/an-atomic-upgrade-process-for-openstack-compute-nodes/

Signed-off-by: Steven Dake <stdake@cisco.com>
2015-04-06 11:45:37 -07:00
Fred Lifton
530d7af5cf Merge pull request #1253 from aanand/production-guide
Add guide to using Compose in production
2015-04-06 10:49:49 -07:00
Aanand Prasad
502d58abe6 Add guide to using Compose in production
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-03 18:56:29 -04:00
Fred Lifton
eb073c53f4 Merge pull request #1249 from asveepay/update_doc
Update install docs for permission denied error
2015-04-03 12:31:38 -07:00
Roland Cooper
d866415b9a Update install docs for permission denied error
Signed-off-by: Roland Cooper <rcooper@enova.com>
2015-04-03 12:21:15 -05:00
Aanand Prasad
dd40658f87 Merge pull request #1238 from aanand/use-docker-1.6-rc3
Use Docker 1.6 RC3
2015-04-03 13:00:49 -04:00
Aanand Prasad
b3382ffd4f Use Docker 1.6 RC4
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-03 10:57:28 -04:00
Aanand Prasad
15a0fac939 Merge pull request #1141 from bfirsh/contributing-section-in-readme
Add contributing section to readme
2015-04-03 10:56:06 -04:00
Laurent Arnoud
e3cff5d17d Docs: fix env_file example
Thanks-to: @aanand
Signed-off-by: Laurent Arnoud <laurent@spkdev.net>
2015-04-01 11:15:09 +02:00
Daniel Nephin
0f70b8638f Merge pull request #1213 from moysesb/relative_build
Make value of 'build:' relative to the yml file.
2015-03-31 21:20:02 -04:00
Moysés Borges
8584525e8d Interpret 'build:' as relative to the yml file
* This fix introduces one side-effect: the build parameter is now
validated early, when the service dicionary is first constructed.
That leads to less scary stack traces when the path is not valid.

* The tests for the changes introduced here alter the fixtures
of those (otherwise unrelated) tests that make use of the 'build:'
parameter)

Signed-off-by: Moysés Borges Furtado <moyses.furtado@wplex.com.br>
2015-03-31 18:47:26 -03:00
Aanand Prasad
e3e2247159 Merge pull request #1231 from aanand/docker-1.6rc2
Test against Docker 1.6 RC2 only
2015-03-31 16:31:03 -04:00
Aanand Prasad
0650c4485a Test against Docker 1.6 RC2 only
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-31 16:04:22 -04:00
Aanand Prasad
e708f4f59d Merge pull request #1226 from aanand/merge-multi-value-options
Merge multi-value options when extending
2015-03-31 16:01:22 -04:00
Aanand Prasad
907918b492 Merge multi-value options when extending
Closes #1143.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-31 15:30:59 -04:00
Aanand Prasad
6dbe321a45 Merge pull request #1225 from aanand/fix-1222
When extending, `build` replaces `image` and vice versa
2015-03-31 15:23:34 -04:00
Aanand Prasad
2a415ede08 When extending, build replaces image and vice versa
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-30 17:14:19 -04:00
Ben Firshman
43369cda9c Merge pull request #1221 from aanand/update-swarm-doc
Update Swarm doc
2015-03-30 18:08:16 +01:00
Aanand Prasad
a2557a3354 Merge pull request #1198 from funkyfuture/reformat-contributing.md
Reformat CONTRIBUTING.md
2015-03-30 12:08:56 -04:00
Aanand Prasad
1a14449fe6 Update Swarm doc
- Co-scheduling will now work, so we can remove the stuff about
  `volumes_from` and `net` and manual affinity filters.

- Added a section about building.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-30 11:34:26 -04:00
Joseph Page
0b89ae6f20 [cli] run --rm overrides restart: always
docker/compose#1013

Signed-off-by: Joseph Page <joseph.page@rednet.io>
2015-03-30 14:45:24 +02:00
Patrick Chanezon
cec6dc28bb implemented @fredl suggestions
Signed-off-by: Patrick Chanezon <patlist@chanezon.com>
2015-03-27 17:12:29 -07:00
Aanand Prasad
853ce255ea Merge pull request #1202 from aanand/jenkins-script
WIP: Jenkins script
2015-03-27 14:59:49 -07:00
Aanand Prasad
db852e14e4 Add script/ci
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-27 14:39:32 -07:00
Patrick Chanezon
98dd0cd1f8 implemented @aanand comments
Signed-off-by: Patrick Chanezon <patlist@chanezon.com>
2015-03-27 13:26:51 -07:00
Patrick Chanezon
c441ac90d6 paulczar fixes plus example file
Signed-off-by: Patrick Chanezon <patlist@chanezon.com>
2015-03-26 16:35:53 -07:00
Aanand Prasad
9d7b54d8fd Merge pull request #1183 from pborreli/patch-2
Fixed typo
2015-03-26 12:31:07 -07:00
Pascal Borreli
59f04c6e29 Fixed typo
Signed-off-by: Pascal Borreli <pascal@borreli.com>
2015-03-26 19:03:06 +00:00
Aanand Prasad
367ae0c848 Merge pull request #1185 from akoskaaa/master
Make test files and config files pep8 valid
2015-03-26 10:04:37 -07:00
akoskaaa
4e0f555c58 make flake8 a bit more specific
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
2015-03-26 09:09:15 -07:00
Ben Firshman
baf18decae Merge pull request #1179 from aanand/test-1.6-rc
Add Docker 1.6 RC2 to tested versions
2015-03-26 14:18:36 +00:00
funkyfuture
826b8ca4d3 Reformat CONTRIBUTING.md
- some reformatting to make it better readable in smaller terminals
- adds a note that suggests validating DCO before pushing

Signed-off-by: funkyfuture <funkyfuture@riseup.net>
2015-03-26 13:11:05 +01:00
akoskaaa
fa2fb6bd38 [pep8] flake8 run for everything, fix items from this change
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
2015-03-25 23:15:34 -07:00
akoskaaa
f9ea5ecf40 [pep8] make test files and config files pep8 valid
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
2015-03-25 20:20:38 -07:00
Aanand Prasad
99f7eba930 Add Docker 1.6 RC2 to tested versions
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-25 14:48:39 -07:00
Ben Firshman
e1b27acd02 Add contributing section to readme
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-03-25 17:22:04 +01:00
likeon
f393447ac9 Docs: yml link in getting started with django
Signed-off-by: Alexander Sterchov i@likeon.name
2015-03-13 13:50:20 +03:00
264 changed files with 24342 additions and 5352 deletions

View file

@ -1,2 +1,9 @@
*.egg-info
.coverage
.git
.tox
build
coverage-html
docs/_site
venv
.tox

7
.gitignore vendored
View file

@ -1,8 +1,11 @@
*.egg-info
*.pyc
.tox
.coverage*
/.tox
/build
/coverage-html
/dist
/docs/_site
/venv
docker-compose.spec
README.rst
compose/GITSHA

25
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,25 @@
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 'v0.4.2'
hooks:
- id: check-added-large-files
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-json
- id: debug-statements
- id: end-of-file-fixer
- id: flake8
- id: name-tests-test
exclude: 'tests/(integration/testcases\.py|helpers\.py)'
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: git://github.com/asottile/reorder_python_imports
sha: v0.1.0
hooks:
- id: reorder-python-imports
language_version: 'python2.7'
args:
- --add-import
- from __future__ import absolute_import
- --add-import
- from __future__ import unicode_literals

29
.travis.yml Normal file
View file

@ -0,0 +1,29 @@
sudo: required
language: python
matrix:
include:
- os: linux
services:
- docker
- os: osx
language: generic
install: ./script/travis/install
script:
- ./script/travis/ci
- ./script/travis/build-binary
before_deploy:
- "./script/travis/render-bintray-config.py < ./script/travis/bintray.json.tmpl > ./bintray.json"
deploy:
provider: bintray
user: docker-compose-roleuser
key: '$BINTRAY_API_KEY'
file: ./bintray.json
skip_cleanup: true
on:
all_branches: true

1174
CHANGELOG.md Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,275 +0,0 @@
Change log
==========
1.1.0 (2015-02-25)
------------------
Fig has been renamed to Docker Compose, or just Compose for short. This has several implications for you:
- The command you type is now `docker-compose`, not `fig`.
- You should rename your fig.yml to docker-compose.yml.
- If youre installing via PyPi, the package is now `docker-compose`, so install it with `pip install docker-compose`.
Besides that, theres a lot of new stuff in this release:
- Weve made a few small changes to ensure that Compose will work with Swarm, Dockers new clustering tool (https://github.com/docker/swarm). Eventually you'll be able to point Compose at a Swarm cluster instead of a standalone Docker host and itll run your containers on the cluster with no extra work from you. As Swarm is still developing, integration is rough and lots of Compose features don't work yet.
- `docker-compose run` now has a `--service-ports` flag for exposing ports on the given service. This is useful for e.g. running your webapp with an interactive debugger.
- You can now link to containers outside your app with the `external_links` option in docker-compose.yml.
- You can now prevent `docker-compose up` from automatically building images with the `--no-build` option. This will make fewer API calls and run faster.
- If you dont specify a tag when using the `image` key, Compose will default to the `latest` tag, rather than pulling all tags.
- `docker-compose kill` now supports the `-s` flag, allowing you to specify the exact signal you want to send to a services containers.
- docker-compose.yml now has an `env_file` key, analogous to `docker run --env-file`, letting you specify multiple environment variables in a separate file. This is great if you have a lot of them, or if you want to keep sensitive information out of version control.
- docker-compose.yml now supports the `dns_search`, `cap_add`, `cap_drop`, `cpu_shares` and `restart` options, analogous to `docker run`s `--dns-search`, `--cap-add`, `--cap-drop`, `--cpu-shares` and `--restart` options.
- Compose now ships with Bash tab completion - see the installation and usage docs at https://github.com/docker/compose/blob/1.1.0/docs/completion.md
- A number of bugs have been fixed - see the milestone for details: https://github.com/docker/compose/issues?q=milestone%3A1.1.0+
Thanks @dnephin, @squebe, @jbalonso, @raulcd, @benlangfield, @albers, @ggtools, @bersace, @dtenenba, @petercv, @drewkett, @TFenby, @paulRbr, @Aigeruth and @salehe!
1.0.1 (2014-11-04)
------------------
- Added an `--allow-insecure-ssl` option to allow `fig up`, `fig run` and `fig pull` to pull from insecure registries.
- Fixed `fig run` not showing output in Jenkins.
- Fixed a bug where Fig couldn't build Dockerfiles with ADD statements pointing at URLs.
1.0.0 (2014-10-16)
------------------
The highlights:
- [Fig has joined Docker.](https://www.orchardup.com/blog/orchard-is-joining-docker) Fig will continue to be maintained, but we'll also be incorporating the best bits of Fig into Docker itself.
This means the GitHub repository has moved to [https://github.com/docker/fig](https://github.com/docker/fig) and our IRC channel is now #docker-fig on Freenode.
- Fig can be used with the [official Docker OS X installer](https://docs.docker.com/installation/mac/). Boot2Docker will mount the home directory from your host machine so volumes work as expected.
- Fig supports Docker 1.3.
- It is now possible to connect to the Docker daemon using TLS by using the `DOCKER_CERT_PATH` and `DOCKER_TLS_VERIFY` environment variables.
- There is a new `fig port` command which outputs the host port binding of a service, in a similar way to `docker port`.
- There is a new `fig pull` command which pulls the latest images for a service.
- There is a new `fig restart` command which restarts a service's containers.
- Fig creates multiple containers in service by appending a number to the service name (e.g. `db_1`, `db_2`, etc). As a convenience, Fig will now give the first container an alias of the service name (e.g. `db`).
This link alias is also a valid hostname and added to `/etc/hosts` so you can connect to linked services using their hostname. For example, instead of resolving the environment variables `DB_PORT_5432_TCP_ADDR` and `DB_PORT_5432_TCP_PORT`, you could just use the hostname `db` and port `5432` directly.
- Volume definitions now support `ro` mode, expanding `~` and expanding environment variables.
- `.dockerignore` is supported when building.
- The project name can be set with the `FIG_PROJECT_NAME` environment variable.
- The `--env` and `--entrypoint` options have been added to `fig run`.
- The Fig binary for Linux is now linked against an older version of glibc so it works on CentOS 6 and Debian Wheezy.
Other things:
- `fig ps` now works on Jenkins and makes fewer API calls to the Docker daemon.
- `--verbose` displays more useful debugging output.
- When starting a service where `volumes_from` points to a service without any containers running, that service will now be started.
- Lots of docs improvements. Notably, environment variables are documented and official repositories are used throughout.
Thanks @dnephin, @d11wtq, @marksteve, @rubbish, @jbalonso, @timfreund, @alunduil, @mieciu, @shuron, @moss, @suzaku and @chmouel! Whew.
0.5.2 (2014-07-28)
------------------
- Added a `--no-cache` option to `fig build`, which bypasses the cache just like `docker build --no-cache`.
- Fixed the `dns:` fig.yml option, which was causing fig to error out.
- Fixed a bug where fig couldn't start under Python 2.6.
- Fixed a log-streaming bug that occasionally caused fig to exit.
Thanks @dnephin and @marksteve!
0.5.1 (2014-07-11)
------------------
- If a service has a command defined, `fig run [service]` with no further arguments will run it.
- The project name now defaults to the directory containing fig.yml, not the current working directory (if they're different)
- `volumes_from` now works properly with containers as well as services
- Fixed a race condition when recreating containers in `fig up`
Thanks @ryanbrainard and @d11wtq!
0.5.0 (2014-07-11)
------------------
- Fig now starts links when you run `fig run` or `fig up`.
For example, if you have a `web` service which depends on a `db` service, `fig run web ...` will start the `db` service.
- Environment variables can now be resolved from the environment that Fig is running in. Just specify it as a blank variable in your `fig.yml` and, if set, it'll be resolved:
```
environment:
RACK_ENV: development
SESSION_SECRET:
```
- `volumes_from` is now supported in `fig.yml`. All of the volumes from the specified services and containers will be mounted:
```
volumes_from:
- service_name
- container_name
```
- A host address can now be specified in `ports`:
```
ports:
- "0.0.0.0:8000:8000"
- "127.0.0.1:8001:8001"
```
- The `net` and `workdir` options are now supported in `fig.yml`.
- The `hostname` option now works in the same way as the Docker CLI, splitting out into a `domainname` option.
- TTY behaviour is far more robust, and resizes are supported correctly.
- Load YAML files safely.
Thanks to @d11wtq, @ryanbrainard, @rail44, @j0hnsmith, @binarin, @Elemecca, @mozz100 and @marksteve for their help with this release!
0.4.2 (2014-06-18)
------------------
- Fix various encoding errors when using `fig run`, `fig up` and `fig build`.
0.4.1 (2014-05-08)
------------------
- Add support for Docker 0.11.0. (Thanks @marksteve!)
- Make project name configurable. (Thanks @jefmathiot!)
- Return correct exit code from `fig run`.
0.4.0 (2014-04-29)
------------------
- Support Docker 0.9 and 0.10
- Display progress bars correctly when pulling images (no more ski slopes)
- `fig up` now stops all services when any container exits
- Added support for the `privileged` config option in fig.yml (thanks @kvz!)
- Shortened and aligned log prefixes in `fig up` output
- Only containers started with `fig run` link back to their own service
- Handle UTF-8 correctly when streaming `fig build/run/up` output (thanks @mauvm and @shanejonas!)
- Error message improvements
0.3.2 (2014-03-05)
------------------
- Added an `--rm` option to `fig run`. (Thanks @marksteve!)
- Added an `expose` option to `fig.yml`.
0.3.1 (2014-03-04)
------------------
- Added contribution instructions. (Thanks @kvz!)
- Fixed `fig rm` throwing an error.
- Fixed a bug in `fig ps` on Docker 0.8.1 when there is a container with no command.
0.3.0 (2014-03-03)
------------------
- We now ship binaries for OS X and Linux. No more having to install with Pip!
- Add `-f` flag to specify alternate `fig.yml` files
- Add support for custom link names
- Fix a bug where recreating would sometimes hang
- Update docker-py to support Docker 0.8.0.
- Various documentation improvements
- Various error message improvements
Thanks @marksteve, @Gazler and @teozkr!
0.2.2 (2014-02-17)
------------------
- Resolve dependencies using Cormen/Tarjan topological sort
- Fix `fig up` not printing log output
- Stop containers in reverse order to starting
- Fix scale command not binding ports
Thanks to @barnybug and @dustinlacewell for their work on this release.
0.2.1 (2014-02-04)
------------------
- General improvements to error reporting (#77, #79)
0.2.0 (2014-01-31)
------------------
- Link services to themselves so run commands can access the running service. (#67)
- Much better documentation.
- Make service dependency resolution more reliable. (#48)
- Load Fig configurations with a `.yaml` extension. (#58)
Big thanks to @cameronmaske, @mrchrisadams and @damianmoore for their help with this release.
0.1.4 (2014-01-27)
------------------
- Add a link alias without the project name. This makes the environment variables a little shorter: `REDIS_1_PORT_6379_TCP_ADDR`. (#54)
0.1.3 (2014-01-23)
------------------
- Fix ports sometimes being configured incorrectly. (#46)
- Fix log output sometimes not displaying. (#47)
0.1.2 (2014-01-22)
------------------
- Add `-T` option to `fig run` to disable pseudo-TTY. (#34)
- Fix `fig up` requiring the ubuntu image to be pulled to recreate containers. (#33) Thanks @cameronmaske!
- Improve reliability, fix arrow keys and fix a race condition in `fig run`. (#34, #39, #40)
0.1.1 (2014-01-17)
------------------
- Fix bug where ports were not exposed correctly (#29). Thanks @dustinlacewell!
0.1.0 (2014-01-16)
------------------
- Containers are recreated on each `fig up`, ensuring config is up-to-date with `fig.yml` (#2)
- Add `fig scale` command (#9)
- Use `DOCKER_HOST` environment variable to find Docker daemon, for consistency with the official Docker client (was previously `DOCKER_URL`) (#19)
- Truncate long commands in `fig ps` (#18)
- Fill out CLI help banners for commands (#15, #16)
- Show a friendlier error when `fig.yml` is missing (#4)
- Fix bug with `fig build` logging (#3)
- Fix bug where builds would time out if a step took a long time without generating output (#6)
- Fix bug where streaming container output over the Unix socket raised an error (#7)
Big thanks to @tomstuart, @EnTeQuAk, @schickling, @aronasorman and @GeoffreyPlitt.
0.0.2 (2014-01-02)
------------------
- Improve documentation
- Try to connect to Docker on `tcp://localdocker:4243` and a UNIX socket in addition to `localhost`.
- Improve `fig up` behaviour
- Add confirmation prompt to `fig rm`
- Add `fig build` command
0.0.1 (2013-12-20)
------------------
Initial release.

1
CHANGES.md Symbolic link
View file

@ -0,0 +1 @@
CHANGELOG.md

View file

@ -1,6 +1,8 @@
# Contributing to Compose
Compose is a part of the Docker project, and follows the same rules and principles. Take a read of [Docker's contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) to get an overview.
Compose is a part of the Docker project, and follows the same rules and
principles. Take a read of [Docker's contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md)
to get an overview.
## TL;DR
@ -17,60 +19,56 @@ If you're looking contribute to Compose
but you're new to the project or maybe even to Python, here are the steps
that should get you started.
1. Fork [https://github.com/docker/compose](https://github.com/docker/compose) to your username.
1. Clone your forked repository locally `git clone git@github.com:yourusername/compose.git`.
1. Enter the local directory `cd compose`.
1. Set up a development environment by running `python setup.py develop`. This will install the dependencies and set up a symlink from your `docker-compose` executable to the checkout of the repository. When you now run `docker-compose` from anywhere on your machine, it will run your development version of Compose.
1. Fork [https://github.com/docker/compose](https://github.com/docker/compose)
to your username.
2. Clone your forked repository locally `git clone git@github.com:yourusername/compose.git`.
3. You must [configure a remote](https://help.github.com/articles/configuring-a-remote-for-a-fork/) for your fork so that you can [sync changes you make](https://help.github.com/articles/syncing-a-fork/) with the original repository.
4. Enter the local directory `cd compose`.
5. Set up a development environment by running `python setup.py develop`. This
will install the dependencies and set up a symlink from your `docker-compose`
executable to the checkout of the repository. When you now run
`docker-compose` from anywhere on your machine, it will run your development
version of Compose.
## Install pre-commit hooks
This step is optional, but recommended. Pre-commit hooks will run style checks
and in some cases fix style issues for you, when you commit code.
Install the git pre-commit hooks using [tox](https://tox.readthedocs.io) by
running `tox -e pre-commit` or by following the
[pre-commit install guide](http://pre-commit.com/#install).
To run the style checks at any time run `tox -e pre-commit`.
## Submitting a pull request
See Docker's [basic contribution workflow](https://docs.docker.com/opensource/workflow/make-a-contribution/#the-basic-contribution-workflow) for a guide on how to submit a pull request for code or documentation.
## Running the test suite
Use the test script to run linting checks and then the full test suite:
Use the test script to run linting checks and then the full test suite against
different Python interpreters:
$ script/test
$ script/test/default
Tests are run against a Docker daemon inside a container, so that we can test against multiple Docker versions. By default they'll run against only the latest Docker version - set the `DOCKER_VERSIONS` environment variable to "all" to run against all supported versions:
Tests are run against a Docker daemon inside a container, so that we can test
against multiple Docker versions. By default they'll run against only the latest
Docker version - set the `DOCKER_VERSIONS` environment variable to "all" to run
against all supported versions:
$ DOCKER_VERSIONS=all script/test
$ DOCKER_VERSIONS=all script/test/default
Arguments to `script/test` are passed through to the `nosetests` executable, so you can specify a test directory, file, module, class or method:
Arguments to `script/test/default` are passed through to the `tox` executable, so
you can specify a test directory, file, module, class or method:
$ script/test tests/unit
$ script/test tests/unit/cli_test.py
$ script/test tests.integration.service_test
$ script/test tests.integration.service_test:ServiceTest.test_containers
$ script/test/default tests/unit
$ script/test/default tests/unit/cli_test.py
$ script/test/default tests/unit/config_test.py::ConfigTest
$ script/test/default tests/unit/config_test.py::ConfigTest::test_load
## Building binaries
## Finding things to work on
Linux:
We use a [ZenHub board](https://www.zenhub.io/) to keep track of specific things we are working on and planning to work on. If you're looking for things to work on, stuff in the backlog is a great place to start.
$ script/build-linux
OS X:
$ script/build-osx
Note that this only works on Mountain Lion, not Mavericks, due to a [bug in PyInstaller](http://www.pyinstaller.org/ticket/807).
## Release process
1. Open pull request that:
- Updates the version in `compose/__init__.py`
- Updates the binary URL in `docs/install.md`
- Updates the script URL in `docs/completion.md`
- Adds release notes to `CHANGES.md`
2. Create unpublished GitHub release with release notes
3. Build Linux version on any Docker host with `script/build-linux` and attach to release
4. Build OS X version on Mountain Lion with `script/build-osx` and attach to release as `docker-compose-Darwin-x86_64` and `docker-compose-Linux-x86_64`.
5. Publish GitHub release, creating tag
6. Update website with `script/deploy-docs`
7. Upload PyPi package
$ git checkout $VERSION
$ python setup.py sdist upload
For more information about our project planning, take a look at our [GitHub wiki](https://github.com/docker/compose/wiki).

View file

@ -3,38 +3,69 @@ FROM debian:wheezy
RUN set -ex; \
apt-get update -qq; \
apt-get install -y \
python \
python-pip \
python-dev \
locales \
gcc \
make \
zlib1g \
zlib1g-dev \
libssl-dev \
git \
apt-transport-https \
ca-certificates \
curl \
lxc \
iptables \
libsqlite3-dev \
libbz2-dev \
; \
rm -rf /var/lib/apt/lists/*
ENV ALL_DOCKER_VERSIONS 1.3.3 1.4.1 1.5.0
RUN curl https://get.docker.com/builds/Linux/x86_64/docker-1.8.3 \
-o /usr/local/bin/docker && \
chmod +x /usr/local/bin/docker
# Build Python 2.7.13 from source
RUN set -ex; \
for v in ${ALL_DOCKER_VERSIONS}; do \
curl https://get.docker.com/builds/Linux/x86_64/docker-$v -o /usr/local/bin/docker-$v; \
chmod +x /usr/local/bin/docker-$v; \
done
curl -L https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz | tar -xz; \
cd Python-2.7.13; \
./configure --enable-shared; \
make; \
make install; \
cd ..; \
rm -rf /Python-2.7.13
# Build python 3.4 from source
RUN set -ex; \
curl -L https://www.python.org/ftp/python/3.4.6/Python-3.4.6.tgz | tar -xz; \
cd Python-3.4.6; \
./configure --enable-shared; \
make; \
make install; \
cd ..; \
rm -rf /Python-3.4.6
# Make libpython findable
ENV LD_LIBRARY_PATH /usr/local/lib
# Install pip
RUN set -ex; \
curl -L https://bootstrap.pypa.io/get-pip.py | python
# Python3 requires a valid locale
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
RUN useradd -d /home/user -m -s /bin/bash user
WORKDIR /code/
ADD requirements.txt /code/
RUN pip install -r requirements.txt
RUN pip install tox==2.1.1
ADD requirements.txt /code/
ADD requirements-dev.txt /code/
RUN pip install -r requirements-dev.txt
ADD .pre-commit-config.yaml /code/
ADD setup.py /code/
ADD tox.ini /code/
ADD compose /code/compose/
RUN tox --notest
ADD . /code/
RUN python setup.py install
RUN chown -R user /code/
ENTRYPOINT ["/usr/local/bin/docker-compose"]
ENTRYPOINT ["/code/.tox/py27/bin/docker-compose"]

14
Dockerfile.run Normal file
View file

@ -0,0 +1,14 @@
FROM alpine:3.4
ARG version
RUN apk -U add \
python \
py-pip
COPY requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt
COPY dist/docker_compose-${version}-py2.py3-none-any.whl /code/
RUN pip install --no-deps /code/docker_compose-${version}-py2.py3-none-any.whl
ENTRYPOINT ["/usr/bin/docker-compose"]

64
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,64 @@
#!groovy
def image
def buildImage = { ->
wrappedNode(label: "ubuntu && !zfs", cleanWorkspace: true) {
stage("build image") {
checkout(scm)
def imageName = "dockerbuildbot/compose:${gitCommit()}"
image = docker.image(imageName)
try {
image.pull()
} catch (Exception exc) {
image = docker.build(imageName, ".")
image.push()
}
}
}
}
def runTests = { Map settings ->
def dockerVersions = settings.get("dockerVersions", null)
def pythonVersions = settings.get("pythonVersions", null)
if (!pythonVersions) {
throw new Exception("Need Python versions to test. e.g.: `runTests(pythonVersions: 'py27,py34')`")
}
if (!dockerVersions) {
throw new Exception("Need Docker versions to test. e.g.: `runTests(dockerVersions: 'all')`")
}
{ ->
wrappedNode(label: "ubuntu && !zfs", cleanWorkspace: true) {
stage("test python=${pythonVersions} / docker=${dockerVersions}") {
checkout(scm)
def storageDriver = sh(script: 'docker info | awk -F \': \' \'$1 == "Storage Driver" { print $2; exit }\'', returnStdout: true).trim()
echo "Using local system's storage driver: ${storageDriver}"
sh """docker run \\
-t \\
--rm \\
--privileged \\
--volume="\$(pwd)/.git:/code/.git" \\
--volume="/var/run/docker.sock:/var/run/docker.sock" \\
-e "TAG=${image.id}" \\
-e "STORAGE_DRIVER=${storageDriver}" \\
-e "DOCKER_VERSIONS=${dockerVersions}" \\
-e "BUILD_NUMBER=\$BUILD_TAG" \\
-e "PY_TEST_VERSIONS=${pythonVersions}" \\
--entrypoint="script/ci" \\
${image.id} \\
--verbose
"""
}
}
}
}
buildImage()
// TODO: break this out into meaningful "DOCKER_VERSIONS" values instead of all
parallel(
failFast: true,
all_py27: runTests(pythonVersions: "py27", dockerVersions: "all"),
all_py34: runTests(pythonVersions: "py34", dockerVersions: "all"),
)

View file

@ -1,3 +1,46 @@
Aanand Prasad <aanand.prasad@gmail.com> (@aanand)
Ben Firshman <ben@firshman.co.uk> (@bfirsh)
Daniel Nephin <dnephin@gmail.com> (@dnephin)
# Compose maintainers file
#
# This file describes who runs the docker/compose project and how.
# This is a living document - if you see something out of date or missing, speak up!
#
# It is structured to be consumable by both humans and programs.
# To extract its contents programmatically, use any TOML-compliant parser.
#
# This file is compiled into the MAINTAINERS file in docker/opensource.
#
[Org]
[Org."Core maintainers"]
people = [
"aanand",
"bfirsh",
"dnephin",
"mnowster",
]
[people]
# A reference list of all people associated with the project.
# All other sections should refer to people by their canonical key
# in the people section.
# ADD YOURSELF HERE IN ALPHABETICAL ORDER
[people.aanand]
Name = "Aanand Prasad"
Email = "aanand.prasad@gmail.com"
GitHub = "aanand"
[people.bfirsh]
Name = "Ben Firshman"
Email = "ben@firshman.co.uk"
GitHub = "bfirsh"
[people.dnephin]
Name = "Daniel Nephin"
Email = "dnephin@gmail.com"
GitHub = "dnephin"
[people.mnowster]
Name = "Mazz Mosley"
Email = "mazz@houseofmnowster.com"
GitHub = "mnowster"

View file

@ -4,7 +4,11 @@ include requirements.txt
include requirements-dev.txt
include tox.ini
include *.md
include contrib/completion/bash/docker-compose
exclude README.md
include README.rst
include compose/config/*.json
include compose/GITSHA
recursive-include contrib/completion *
recursive-include tests *
global-exclude *.pyc
global-exclude *.pyo

View file

@ -1,45 +1,41 @@
Docker Compose
==============
[![Build Status](http://jenkins.dockerproject.com/buildStatus/icon?job=Compose Master)](http://jenkins.dockerproject.com/job/Compose%20Master/)
*(Previously known as Fig)*
![Docker Compose](logo.png?raw=true "Docker Compose Logo")
Compose is a tool for defining and running complex applications with Docker.
With Compose, you define a multi-container application in a single file, then
spin your application up in a single command which does everything that needs to
be done to get it running.
Compose is a tool for defining and running multi-container Docker applications.
With Compose, you use a Compose file to configure your application's services.
Then, using a single command, you create and start all the services
from your configuration. To learn more about all the features of Compose
see [the list of features](https://github.com/docker/docker.github.io/blob/master/compose/overview.md#features).
Compose is great for development environments, staging servers, and CI. We don't
recommend that you use it in production yet.
Compose is great for development, testing, and staging environments, as well as
CI workflows. You can learn more about each case in
[Common Use Cases](https://github.com/docker/docker.github.io/blob/master/compose/overview.md#common-use-cases).
Using Compose is basically a three-step process.
First, you define your app's environment with a `Dockerfile` so it can be
reproduced anywhere:
```Dockerfile
FROM python:2.7
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code
CMD python app.py
```
Next, you define the services that make up your app in `docker-compose.yml` so
1. Define your app's environment with a `Dockerfile` so it can be
reproduced anywhere.
2. Define the services that make up your app in `docker-compose.yml` so
they can be run together in an isolated environment:
3. Lastly, run `docker-compose up` and Compose will start and run your entire app.
```yaml
web:
build: .
links:
- db
ports:
- "8000:8000"
db:
image: postgres
```
A `docker-compose.yml` looks like this:
Lastly, run `docker-compose up` and Compose will start and run your entire app.
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
redis:
image: redis
For more information about the Compose file, see the
[Compose file reference](https://github.com/docker/docker.github.io/blob/master/compose/compose-file/compose-versioning.md)
Compose has commands for managing the whole lifecycle of your application:
@ -51,5 +47,19 @@ Compose has commands for managing the whole lifecycle of your application:
Installation and documentation
------------------------------
- Full documentation is available on [Docker's website](http://docs.docker.com/compose/).
- Hop into #docker-compose on Freenode if you have any questions.
- Full documentation is available on [Docker's website](https://docs.docker.com/compose/).
- If you have any questions, you can talk in real-time with other developers in the #docker-compose IRC channel on Freenode. [Click here to join using IRCCloud.](https://www.irccloud.com/invite?hostname=irc.freenode.net&channel=%23docker-compose)
- Code repository for Compose is on [Github](https://github.com/docker/compose)
- If you find any problems please fill out an [issue](https://github.com/docker/compose/issues/new)
Contributing
------------
[![Build Status](http://jenkins.dockerproject.org/buildStatus/icon?job=Compose%20Master)](http://jenkins.dockerproject.org/job/Compose%20Master/)
Want to help build Compose? Check out our [contributing documentation](https://github.com/docker/compose/blob/master/CONTRIBUTING.md).
Releasing
---------
Releases are built by maintainers, following an outline of the [release process](https://github.com/docker/compose/blob/master/project/RELEASE-PROCESS.md).

View file

@ -1,12 +1,23 @@
# Roadmap
## An even better tool for development environments
Compose is a great tool for development environments, but it could be even better. For example:
- It should be possible to define hostnames for containers which work from the host machine, e.g. “mywebcontainer.local”. This is needed by apps comprising multiple web services which generate links to one another (e.g. a frontend website and a separate admin webapp)
## More than just development environments
Over time we will extend Compose's remit to cover test, staging and production environments. This is not a simple task, and will take many incremental improvements such as:
Compose currently works really well in development, but we want to make the Compose file format better for test, staging, and production environments. To support these use cases, there will need to be improvements to the file format, improvements to the command-line tool, integrations with other tools, and perhaps new tools altogether.
- Composes brute-force “delete and recreate everything” approach is great for dev and testing, but it not sufficient for production environments. You should be able to define a "desired" state that Compose will intelligently converge to.
- It should be possible to partially modify the config file for different environments (dev/test/staging/prod), passing in e.g. custom ports or volume mount paths. ([#426](https://github.com/docker/fig/issues/426))
Some specific things we are considering:
- Compose currently will attempt to get your application into the correct state when running `up`, but it has a number of shortcomings:
- It should roll back to a known good state if it fails.
- It should allow a user to check the actions it is about to perform before running them.
- It should be possible to partially modify the config file for different environments (dev/test/staging/prod), passing in e.g. custom ports, volume mount paths, or volume drivers. ([#1377](https://github.com/docker/compose/issues/1377))
- Compose should recommend a technique for zero-downtime deploys.
- It should be possible to continuously attempt to keep an application in the correct state, instead of just performing `up` a single time.
## Integration with Swarm
@ -19,10 +30,3 @@ The current state of integration is documented in [SWARM.md](SWARM.md).
Compose works well for applications that are in a single repository and depend on services that are hosted on Docker Hub. If your application depends on another application within your organisation, Compose doesn't work as well.
There are several ideas about how this could work, such as [including external files](https://github.com/docker/fig/issues/318).
## An even better tool for development environments
Compose is a great tool for development environments, but it could be even better. For example:
- [Compose could watch your code and automatically kick off builds when something changes.](https://github.com/docker/fig/issues/184)
- It should be possible to define hostnames for containers which work from the host machine, e.g. “mywebcontainer.local”. This is needed by apps comprising multiple web services which generate links to one another (e.g. a frontend website and a separate admin webapp)

View file

@ -1,51 +1 @@
Docker Compose/Swarm integration
================================
Eventually, Compose and Swarm aim to have full integration, meaning you can point a Compose app at a Swarm cluster and have it all just work as if you were using a single Docker host.
However, the current extent of integration is minimal: Compose can create containers on a Swarm cluster, but the majority of Compose apps wont work out of the box unless all containers are scheduled on one host, defeating much of the purpose of using Swarm in the first place.
Still, Compose and Swarm can be useful in a “batch processing” scenario (where a large number of containers need to be spun up and down to do independent computation) or a “shared cluster” scenario (where multiple teams want to deploy apps on a cluster without worrying about where to put them).
A number of things need to happen before full integration is achieved, which are documented below.
Re-deploying containers with `docker-compose up`
------------------------------------------------
Repeated invocations of `docker-compose up` will not work reliably when used against a Swarm cluster because of an under-the-hood design problem; [this will be fixed](https://github.com/docker/fig/pull/972) in the next version of Compose. For now, containers must be completely removed and re-created:
$ docker-compose kill
$ docker-compose rm --force
$ docker-compose up
Links and networking
--------------------
The primary thing stopping multi-container apps from working seamlessly on Swarm is getting them to talk to one another: enabling private communication between containers on different hosts hasnt been solved in a non-hacky way.
Long-term, networking is [getting overhauled](https://github.com/docker/docker/issues/9983) in such a way that itll fit the multi-host model much better. For now, containers on different hosts cannot be linked. In the next version of Compose, linked services will be automatically scheduled on the same host; for now, this must be done manually (see “Co-scheduling containers” below).
`volumes_from` and `net: container`
-----------------------------------
For containers to share volumes or a network namespace, they must be scheduled on the same host - this is, after all, inherent to how both volumes and network namespaces work. In the next version of Compose, this co-scheduling will be automatic whenever `volumes_from` or `net: "container:..."` is specified; for now, containers which share volumes or a network namespace must be co-scheduled manually (see “Co-scheduling containers” below).
Co-scheduling containers
------------------------
For now, containers can be manually scheduled on the same host using Swarms [affinity filters](https://github.com/docker/swarm/blob/master/scheduler/filter/README.md#affinity-filter). Heres a simple example:
```yaml
web:
image: my-web-image
links: ["db"]
environment:
- "affinity:container==myproject_db_*"
db:
image: postgres
```
Here, we express an affinity filter on all web containers, saying that each one must run alongside a container whose name begins with `myproject_db_`.
- `myproject` is the common prefix Compose gives to all containers in your project, which is either generated from the name of the current directory or specified with `-p` or the `DOCKER_COMPOSE_PROJECT_NAME` environment variable.
- `*` is a wildcard, which works just like filename wildcards in a Unix shell.
This file has moved to: https://docs.docker.com/compose/swarm/

24
appveyor.yml Normal file
View file

@ -0,0 +1,24 @@
version: '{branch}-{build}'
install:
- "SET PATH=C:\\Python27-x64;C:\\Python27-x64\\Scripts;%PATH%"
- "python --version"
- "pip install tox==2.1.1 virtualenv==13.1.2"
# Build the binary after tests
build: false
test_script:
- "tox -e py27,py34 -- tests/unit"
- ps: ".\\script\\build\\windows.ps1"
artifacts:
- path: .\dist\docker-compose-Windows-x86_64.exe
name: "Compose Windows binary"
deploy:
- provider: Environment
name: master-builds
on:
branch: master

View file

@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .service import Service # noqa:flake8
__version__ = '1.1.0'
__version__ = '1.12.0dev'

6
compose/__main__.py Normal file
View file

@ -0,0 +1,6 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose.cli.main import main
main()

258
compose/bundle.py Normal file
View file

@ -0,0 +1,258 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import logging
import six
from docker.utils import split_command
from docker.utils.ports import split_port
from .cli.errors import UserError
from .config.serialize import denormalize_config
from .network import get_network_defs_for_service
from .service import format_environment
from .service import NoSuchImageError
from .service import parse_repository_tag
log = logging.getLogger(__name__)
SERVICE_KEYS = {
'working_dir': 'WorkingDir',
'user': 'User',
'labels': 'Labels',
}
IGNORED_KEYS = {'build'}
SUPPORTED_KEYS = {
'image',
'ports',
'expose',
'networks',
'command',
'environment',
'entrypoint',
} | set(SERVICE_KEYS)
VERSION = '0.1'
class NeedsPush(Exception):
def __init__(self, image_name):
self.image_name = image_name
class NeedsPull(Exception):
def __init__(self, image_name, service_name):
self.image_name = image_name
self.service_name = service_name
class MissingDigests(Exception):
def __init__(self, needs_push, needs_pull):
self.needs_push = needs_push
self.needs_pull = needs_pull
def serialize_bundle(config, image_digests):
return json.dumps(to_bundle(config, image_digests), indent=2, sort_keys=True)
def get_image_digests(project, allow_push=False):
digests = {}
needs_push = set()
needs_pull = set()
for service in project.services:
try:
digests[service.name] = get_image_digest(
service,
allow_push=allow_push,
)
except NeedsPush as e:
needs_push.add(e.image_name)
except NeedsPull as e:
needs_pull.add(e.service_name)
if needs_push or needs_pull:
raise MissingDigests(needs_push, needs_pull)
return digests
def get_image_digest(service, allow_push=False):
if 'image' not in service.options:
raise UserError(
"Service '{s.name}' doesn't define an image tag. An image name is "
"required to generate a proper image digest for the bundle. Specify "
"an image repo and tag with the 'image' option.".format(s=service))
_, _, separator = parse_repository_tag(service.options['image'])
# Compose file already uses a digest, no lookup required
if separator == '@':
return service.options['image']
try:
image = service.image()
except NoSuchImageError:
action = 'build' if 'build' in service.options else 'pull'
raise UserError(
"Image not found for service '{service}'. "
"You might need to run `docker-compose {action} {service}`."
.format(service=service.name, action=action))
if image['RepoDigests']:
# TODO: pick a digest based on the image tag if there are multiple
# digests
return image['RepoDigests'][0]
if 'build' not in service.options:
raise NeedsPull(service.image_name, service.name)
if not allow_push:
raise NeedsPush(service.image_name)
return push_image(service)
def push_image(service):
try:
digest = service.push()
except:
log.error(
"Failed to push image for service '{s.name}'. Please use an "
"image tag that can be pushed to a Docker "
"registry.".format(s=service))
raise
if not digest:
raise ValueError("Failed to get digest for %s" % service.name)
repo, _, _ = parse_repository_tag(service.options['image'])
identifier = '{repo}@{digest}'.format(repo=repo, digest=digest)
# only do this if RepoDigests isn't already populated
image = service.image()
if not image['RepoDigests']:
# Pull by digest so that image['RepoDigests'] is populated for next time
# and we don't have to pull/push again
service.client.pull(identifier)
log.info("Stored digest for {}".format(service.image_name))
return identifier
def to_bundle(config, image_digests):
if config.networks:
log.warn("Unsupported top level key 'networks' - ignoring")
if config.volumes:
log.warn("Unsupported top level key 'volumes' - ignoring")
config = denormalize_config(config)
return {
'Version': VERSION,
'Services': {
name: convert_service_to_bundle(
name,
service_dict,
image_digests[name],
)
for name, service_dict in config['services'].items()
},
}
def convert_service_to_bundle(name, service_dict, image_digest):
container_config = {'Image': image_digest}
for key, value in service_dict.items():
if key in IGNORED_KEYS:
continue
if key not in SUPPORTED_KEYS:
log.warn("Unsupported key '{}' in services.{} - ignoring".format(key, name))
continue
if key == 'environment':
container_config['Env'] = format_environment({
envkey: envvalue for envkey, envvalue in value.items()
if envvalue
})
continue
if key in SERVICE_KEYS:
container_config[SERVICE_KEYS[key]] = value
continue
set_command_and_args(
container_config,
service_dict.get('entrypoint', []),
service_dict.get('command', []))
container_config['Networks'] = make_service_networks(name, service_dict)
ports = make_port_specs(service_dict)
if ports:
container_config['Ports'] = ports
return container_config
# See https://github.com/docker/swarmkit/blob/agent/exec/container/container.go#L95
def set_command_and_args(config, entrypoint, command):
if isinstance(entrypoint, six.string_types):
entrypoint = split_command(entrypoint)
if isinstance(command, six.string_types):
command = split_command(command)
if entrypoint:
config['Command'] = entrypoint + command
return
if command:
config['Args'] = command
def make_service_networks(name, service_dict):
networks = []
for network_name, network_def in get_network_defs_for_service(service_dict).items():
for key in network_def.keys():
log.warn(
"Unsupported key '{}' in services.{}.networks.{} - ignoring"
.format(key, name, network_name))
networks.append(network_name)
return networks
def make_port_specs(service_dict):
ports = []
internal_ports = [
internal_port
for port_def in service_dict.get('ports', [])
for internal_port in split_port(port_def)[0]
]
internal_ports += service_dict.get('expose', [])
for internal_port in internal_ports:
spec = make_port_spec(internal_port)
if spec not in ports:
ports.append(spec)
return ports
def make_port_spec(value):
components = six.text_type(value).partition('/')
return {
'Protocol': components[2] or 'tcp',
'Port': int(components[0]),
}

View file

@ -0,0 +1,37 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import subprocess
import sys
# Attempt to detect https://github.com/docker/compose/issues/4344
try:
# We don't try importing pip because it messes with package imports
# on some Linux distros (Ubuntu, Fedora)
# https://github.com/docker/compose/issues/4425
# https://github.com/docker/compose/issues/4481
# https://github.com/pypa/pip/blob/master/pip/_vendor/__init__.py
s_cmd = subprocess.Popen(
['pip', 'freeze'], stderr=subprocess.PIPE, stdout=subprocess.PIPE
)
packages = s_cmd.communicate()[0].splitlines()
dockerpy_installed = len(
list(filter(lambda p: p.startswith(b'docker-py=='), packages))
) > 0
if dockerpy_installed:
from .colors import red
print(
red('ERROR:'),
"Dependency conflict: an older version of the 'docker-py' package "
"is polluting the namespace. "
"Run the following command to remedy the issue:\n"
"pip uninstall docker docker-py; pip install docker",
file=sys.stderr
)
sys.exit(1)
except OSError:
# pip command is not available, which indicates it's probably the binary
# distribution of Compose which is not affected
pass

View file

@ -1,4 +1,8 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import colorama
NAMES = [
'grey',
'red',
@ -29,6 +33,7 @@ def make_color_fn(code):
return lambda s: ansi_color(code, s)
colorama.init(strip=False)
for (name, code) in get_pairs():
globals()[name] = make_color_fn(code)

View file

@ -1,133 +1,132 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from requests.exceptions import ConnectionError, SSLError
from __future__ import unicode_literals
import logging
import os
import re
import ssl
import six
from .. import config
from ..project import Project
from ..service import ConfigError
from .docopt_command import DocoptCommand
from .utils import call_silently, is_mac, is_ubuntu
from .docker_client import docker_client
from . import verbose_proxy
from . import errors
from .. import __version__
from . import verbose_proxy
from .. import config
from ..config.environment import Environment
from ..const import API_VERSIONS
from ..project import Project
from .docker_client import docker_client
from .docker_client import tls_config_from_options
from .utils import get_version_info
log = logging.getLogger(__name__)
class Command(DocoptCommand):
base_dir = '.'
def project_from_options(project_dir, options):
environment = Environment.from_env_file(project_dir)
host = options.get('--host')
if host is not None:
host = host.lstrip('=')
return get_project(
project_dir,
get_config_path_from_options(project_dir, options, environment),
project_name=options.get('--project-name'),
verbose=options.get('--verbose'),
host=host,
tls_config=tls_config_from_options(options),
environment=environment
)
def dispatch(self, *args, **kwargs):
try:
super(Command, self).dispatch(*args, **kwargs)
except SSLError as e:
raise errors.UserError('SSL error: %s' % e)
except ConnectionError:
if call_silently(['which', 'docker']) != 0:
if is_mac():
raise errors.DockerNotFoundMac()
elif is_ubuntu():
raise errors.DockerNotFoundUbuntu()
else:
raise errors.DockerNotFoundGeneric()
elif call_silently(['which', 'boot2docker']) == 0:
raise errors.ConnectionErrorBoot2Docker()
else:
raise errors.ConnectionErrorGeneric(self.get_client().base_url)
def perform_command(self, options, handler, command_options):
if options['COMMAND'] == 'help':
# Skip looking up the compose file.
handler(None, command_options)
return
def get_config_from_options(base_dir, options):
environment = Environment.from_env_file(base_dir)
config_path = get_config_path_from_options(
base_dir, options, environment
)
return config.load(
config.find(base_dir, config_path, environment)
)
if 'FIG_FILE' in os.environ:
log.warn('The FIG_FILE environment variable is deprecated.')
log.warn('Please use COMPOSE_FILE instead.')
explicit_config_path = options.get('--file') or os.environ.get('COMPOSE_FILE') or os.environ.get('FIG_FILE')
project = self.get_project(
self.get_config_path(explicit_config_path),
project_name=options.get('--project-name'),
verbose=options.get('--verbose'))
def get_config_path_from_options(base_dir, options, environment):
file_option = options.get('--file')
if file_option:
return file_option
handler(project, command_options)
config_files = environment.get('COMPOSE_FILE')
if config_files:
return config_files.split(os.pathsep)
return None
def get_client(self, verbose=False):
client = docker_client()
if verbose:
version_info = six.iteritems(client.version())
log.info("Compose version %s", __version__)
log.info("Docker base_url: %s", client.base_url)
log.info("Docker version: %s",
", ".join("%s=%s" % item for item in version_info))
return verbose_proxy.VerboseProxy('docker', client)
return client
def get_project(self, config_path, project_name=None, verbose=False):
try:
return Project.from_dicts(
self.get_project_name(config_path, project_name),
config.load(config_path),
self.get_client(verbose=verbose))
except ConfigError as e:
raise errors.UserError(six.text_type(e))
def get_tls_version(environment):
compose_tls_version = environment.get('COMPOSE_TLS_VERSION', None)
if not compose_tls_version:
return None
def get_project_name(self, config_path, project_name=None):
def normalize_name(name):
return re.sub(r'[^a-z0-9]', '', name.lower())
tls_attr_name = "PROTOCOL_{}".format(compose_tls_version)
if not hasattr(ssl, tls_attr_name):
log.warn(
'The "{}" protocol is unavailable. You may need to update your '
'version of Python or OpenSSL. Falling back to TLSv1 (default).'
.format(compose_tls_version)
)
return None
if 'FIG_PROJECT_NAME' in os.environ:
log.warn('The FIG_PROJECT_NAME environment variable is deprecated.')
log.warn('Please use COMPOSE_PROJECT_NAME instead.')
return getattr(ssl, tls_attr_name)
project_name = project_name or os.environ.get('COMPOSE_PROJECT_NAME') or os.environ.get('FIG_PROJECT_NAME')
if project_name is not None:
return normalize_name(project_name)
project = os.path.basename(os.path.dirname(os.path.abspath(config_path)))
if project:
return normalize_name(project)
def get_client(environment, verbose=False, version=None, tls_config=None, host=None,
tls_version=None):
return 'default'
client = docker_client(
version=version, tls_config=tls_config, host=host,
environment=environment, tls_version=get_tls_version(environment)
)
if verbose:
version_info = six.iteritems(client.version())
log.info(get_version_info('full'))
log.info("Docker base_url: %s", client.base_url)
log.info("Docker version: %s",
", ".join("%s=%s" % item for item in version_info))
return verbose_proxy.VerboseProxy('docker', client)
return client
def get_config_path(self, file_path=None):
if file_path:
return os.path.join(self.base_dir, file_path)
supported_filenames = [
'docker-compose.yml',
'docker-compose.yaml',
'fig.yml',
'fig.yaml',
]
def get_project(project_dir, config_path=None, project_name=None, verbose=False,
host=None, tls_config=None, environment=None):
if not environment:
environment = Environment.from_env_file(project_dir)
config_details = config.find(project_dir, config_path, environment)
project_name = get_project_name(
config_details.working_dir, project_name, environment
)
config_data = config.load(config_details)
def expand(filename):
return os.path.join(self.base_dir, filename)
api_version = environment.get(
'COMPOSE_API_VERSION',
API_VERSIONS[config_data.version])
candidates = [filename for filename in supported_filenames if os.path.exists(expand(filename))]
client = get_client(
verbose=verbose, version=api_version, tls_config=tls_config,
host=host, environment=environment
)
if len(candidates) == 0:
raise errors.ComposeFileNotFound(supported_filenames)
with errors.handle_connection_errors(client):
return Project.from_config(project_name, config_data, client)
winner = candidates[0]
if len(candidates) > 1:
log.warning("Found multiple config files with supported names: %s", ", ".join(candidates))
log.warning("Using %s\n", winner)
def get_project_name(working_dir, project_name=None, environment=None):
def normalize_name(name):
return re.sub(r'[^a-z0-9]', '', name.lower())
if winner == 'docker-compose.yaml':
log.warning("Please be aware that .yml is the expected extension "
"in most cases, and using .yaml can cause compatibility "
"issues in future.\n")
if not environment:
environment = Environment.from_env_file(working_dir)
project_name = project_name or environment.get('COMPOSE_PROJECT_NAME')
if project_name:
return normalize_name(project_name)
if winner.startswith("fig."):
log.warning("%s is deprecated and will not be supported in future. "
"Please rename your config file to docker-compose.yml\n" % winner)
project = os.path.basename(os.path.abspath(working_dir))
if project:
return normalize_name(project)
return expand(winner)
return 'default'

View file

@ -1,35 +1,74 @@
from docker import Client
from docker import tls
import ssl
import os
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from docker import APIClient
from docker.errors import TLSParameterError
from docker.tls import TLSConfig
from docker.utils import kwargs_from_env
from ..const import HTTP_TIMEOUT
from .errors import UserError
from .utils import generate_user_agent
from .utils import unquote_path
log = logging.getLogger(__name__)
def docker_client():
def tls_config_from_options(options):
tls = options.get('--tls', False)
ca_cert = unquote_path(options.get('--tlscacert'))
cert = unquote_path(options.get('--tlscert'))
key = unquote_path(options.get('--tlskey'))
verify = options.get('--tlsverify')
skip_hostname_check = options.get('--skip-hostname-check', False)
advanced_opts = any([ca_cert, cert, key, verify])
if tls is True and not advanced_opts:
return True
elif advanced_opts: # --tls is a noop
client_cert = None
if cert or key:
client_cert = (cert, key)
return TLSConfig(
client_cert=client_cert, verify=verify, ca_cert=ca_cert,
assert_hostname=False if skip_hostname_check else None
)
return None
def docker_client(environment, version=None, tls_config=None, host=None,
tls_version=None):
"""
Returns a docker-py client configured using environment variables
according to the same logic as the official Docker client.
"""
cert_path = os.environ.get('DOCKER_CERT_PATH', '')
if cert_path == '':
cert_path = os.path.join(os.environ.get('HOME', ''), '.docker')
try:
kwargs = kwargs_from_env(environment=environment, ssl_version=tls_version)
except TLSParameterError:
raise UserError(
"TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY "
"and DOCKER_CERT_PATH are set correctly.\n"
"You might need to run `eval \"$(docker-machine env default)\"`")
base_url = os.environ.get('DOCKER_HOST')
tls_config = None
if host:
kwargs['base_url'] = host
if tls_config:
kwargs['tls'] = tls_config
if os.environ.get('DOCKER_TLS_VERIFY', '') != '':
parts = base_url.split('://', 1)
base_url = '%s://%s' % ('https', parts[1])
if version:
kwargs['version'] = version
client_cert = (os.path.join(cert_path, 'cert.pem'), os.path.join(cert_path, 'key.pem'))
ca_cert = os.path.join(cert_path, 'ca.pem')
timeout = environment.get('COMPOSE_HTTP_TIMEOUT')
if timeout:
kwargs['timeout'] = int(timeout)
else:
kwargs['timeout'] = HTTP_TIMEOUT
tls_config = tls.TLSConfig(
ssl_version=ssl.PROTOCOL_TLSv1,
verify=True,
assert_hostname=False,
client_cert=client_cert,
ca_cert=ca_cert,
)
kwargs['user_agent'] = generate_user_agent()
timeout = int(os.environ.get('DOCKER_CLIENT_TIMEOUT', 60))
return Client(base_url=base_url, tls=tls_config, version='1.15', timeout=timeout)
return APIClient(**kwargs)

View file

@ -1,9 +1,10 @@
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
from __future__ import unicode_literals
from inspect import getdoc
from docopt import docopt, DocoptExit
from docopt import docopt
from docopt import DocoptExit
def docopt_full_help(docstring, *args, **kwargs):
@ -13,30 +14,21 @@ def docopt_full_help(docstring, *args, **kwargs):
raise SystemExit(docstring)
class DocoptCommand(object):
def docopt_options(self):
return {'options_first': True}
class DocoptDispatcher(object):
def sys_dispatch(self):
self.dispatch(sys.argv[1:], None)
def __init__(self, command_class, options):
self.command_class = command_class
self.options = options
def dispatch(self, argv, global_options):
self.perform_command(*self.parse(argv, global_options))
def perform_command(self, options, handler, command_options):
handler(command_options)
def parse(self, argv, global_options):
options = docopt_full_help(getdoc(self), argv, **self.docopt_options())
def parse(self, argv):
command_help = getdoc(self.command_class)
options = docopt_full_help(command_help, argv, **self.options)
command = options['COMMAND']
if command is None:
raise SystemExit(getdoc(self))
raise SystemExit(command_help)
if not hasattr(self, command):
raise NoSuchCommand(command, self)
handler = getattr(self, command)
handler = get_handler(self.command_class, command)
docstring = getdoc(handler)
if docstring is None:
@ -46,6 +38,19 @@ class DocoptCommand(object):
return options, handler, command_options
def get_handler(command_class, command):
command = command.replace('-', '_')
# we certainly want to have "exec" command, since that's what docker client has
# but in python exec is a keyword
if command == "exec":
command = "exec_command"
if not hasattr(command_class, command):
raise NoSuchCommand(command, command_class)
return getattr(command_class, command)
class NoSuchCommand(Exception):
def __init__(self, command, supercommand):
super(NoSuchCommand, self).__init__("No such command: %s" % command)

View file

@ -1,8 +1,30 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
import logging
import socket
from distutils.spawn import find_executable
from textwrap import dedent
from docker.errors import APIError
from requests.exceptions import ConnectionError as RequestsConnectionError
from requests.exceptions import ReadTimeout
from requests.exceptions import SSLError
from requests.packages.urllib3.exceptions import ReadTimeoutError
from ..const import API_VERSION_TO_ENGINE_VERSION
from .utils import is_docker_for_mac_installed
from .utils import is_mac
from .utils import is_ubuntu
from .utils import is_windows
log = logging.getLogger(__name__)
class UserError(Exception):
def __init__(self, msg):
self.msg = dedent(msg).strip()
@ -12,53 +34,104 @@ class UserError(Exception):
__str__ = __unicode__
class DockerNotFoundMac(UserError):
def __init__(self):
super(DockerNotFoundMac, self).__init__("""
Couldn't connect to Docker daemon. You might need to install docker-osx:
https://github.com/noplay/docker-osx
""")
class ConnectionError(Exception):
pass
class DockerNotFoundUbuntu(UserError):
def __init__(self):
super(DockerNotFoundUbuntu, self).__init__("""
Couldn't connect to Docker daemon. You might need to install Docker:
http://docs.docker.io/en/latest/installation/ubuntulinux/
""")
@contextlib.contextmanager
def handle_connection_errors(client):
try:
yield
except SSLError as e:
log.error('SSL error: %s' % e)
raise ConnectionError()
except RequestsConnectionError as e:
if e.args and isinstance(e.args[0], ReadTimeoutError):
log_timeout_error(client.timeout)
raise ConnectionError()
exit_with_error(get_conn_error_message(client.base_url))
except APIError as e:
log_api_error(e, client.api_version)
raise ConnectionError()
except (ReadTimeout, socket.timeout) as e:
log_timeout_error(client.timeout)
raise ConnectionError()
class DockerNotFoundGeneric(UserError):
def __init__(self):
super(DockerNotFoundGeneric, self).__init__("""
Couldn't connect to Docker daemon. You might need to install Docker:
http://docs.docker.io/en/latest/installation/
""")
def log_timeout_error(timeout):
log.error(
"An HTTP request took too long to complete. Retry with --verbose to "
"obtain debug information.\n"
"If you encounter this issue regularly because of slow network "
"conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher "
"value (current value: %s)." % timeout)
class ConnectionErrorBoot2Docker(UserError):
def __init__(self):
super(ConnectionErrorBoot2Docker, self).__init__("""
Couldn't connect to Docker daemon - you might need to run `boot2docker up`.
""")
def log_api_error(e, client_version):
if b'client is newer than server' not in e.explanation:
log.error(e.explanation)
return
version = API_VERSION_TO_ENGINE_VERSION.get(client_version)
if not version:
# They've set a custom API version
log.error(e.explanation)
return
log.error(
"The Docker Engine version is less than the minimum required by "
"Compose. Your current project requires a Docker Engine of "
"version {version} or greater.".format(version=version))
class ConnectionErrorGeneric(UserError):
def __init__(self, url):
super(ConnectionErrorGeneric, self).__init__("""
Couldn't connect to Docker daemon at %s - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
""" % url)
def exit_with_error(msg):
log.error(dedent(msg).strip())
raise ConnectionError()
class ComposeFileNotFound(UserError):
def __init__(self, supported_filenames):
super(ComposeFileNotFound, self).__init__("""
Can't find a suitable configuration file. Are you in the right directory?
def get_conn_error_message(url):
if find_executable('docker') is None:
return docker_not_found_msg("Couldn't connect to Docker daemon.")
if is_docker_for_mac_installed():
return conn_error_docker_for_mac
if find_executable('docker-machine') is not None:
return conn_error_docker_machine
return conn_error_generic.format(url=url)
Supported filenames: %s
""" % ", ".join(supported_filenames))
def docker_not_found_msg(problem):
return "{} You might need to install Docker:\n\n{}".format(
problem, docker_install_url())
def docker_install_url():
if is_mac():
return docker_install_url_mac
elif is_ubuntu():
return docker_install_url_ubuntu
elif is_windows():
return docker_install_url_windows
else:
return docker_install_url_generic
docker_install_url_mac = "https://docs.docker.com/engine/installation/mac/"
docker_install_url_ubuntu = "https://docs.docker.com/engine/installation/ubuntulinux/"
docker_install_url_windows = "https://docs.docker.com/engine/installation/windows/"
docker_install_url_generic = "https://docs.docker.com/engine/installation/"
conn_error_docker_machine = """
Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
"""
conn_error_docker_for_mac = """
Couldn't connect to Docker daemon. You might need to start Docker for Mac.
"""
conn_error_generic = """
Couldn't connect to Docker daemon at {url} - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
"""

View file

@ -1,18 +1,25 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
import six
import texttable
from compose.cli import colors
def get_tty_width():
tty_size = os.popen('stty size', 'r').read().split()
if len(tty_size) != 2:
return 80
return 0
_, width = tty_size
return int(width)
class Formatter(object):
"""Format tabular data for printing."""
def table(self, headers, rows):
table = texttable.Texttable(max_width=get_tty_width())
table.set_cols_dtype(['t' for h in headers])
@ -21,3 +28,24 @@ class Formatter(object):
table.set_chars(['-', '|', '+', '-'])
return table.draw()
class ConsoleWarningFormatter(logging.Formatter):
"""A logging.Formatter which prints WARNING and ERROR messages with
a prefix of the log level colored appropriate for the log level.
"""
def get_level_message(self, record):
separator = ': '
if record.levelno == logging.WARNING:
return colors.yellow(record.levelname) + separator
if record.levelno == logging.ERROR:
return colors.red(record.levelname) + separator
return ''
def format(self, record):
if isinstance(record.msg, six.binary_type):
record.msg = record.msg.decode('utf-8')
message = super(ConsoleWarningFormatter, self).format(record)
return '{0}{1}'.format(self.get_level_message(record), message)

View file

@ -1,82 +1,237 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
from collections import namedtuple
from itertools import cycle
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
from .multiplexer import Multiplexer, STOP
from . import colors
from .utils import split_buffer
from compose import utils
from compose.cli.signals import ShutdownException
from compose.utils import split_buffer
class LogPresenter(object):
def __init__(self, prefix_width, color_func):
self.prefix_width = prefix_width
self.color_func = color_func
def present(self, container, line):
prefix = container.name_without_project.ljust(self.prefix_width)
return '{prefix} {line}'.format(
prefix=self.color_func(prefix + ' |'),
line=line)
def build_log_presenters(service_names, monochrome):
"""Return an iterable of functions.
Each function can be used to format the logs output of a container.
"""
prefix_width = max_name_width(service_names)
def no_color(text):
return text
for color_func in cycle([no_color] if monochrome else colors.rainbow()):
yield LogPresenter(prefix_width, color_func)
def max_name_width(service_names, max_index_width=3):
"""Calculate the maximum width of container names so we can make the log
prefixes line up like so:
db_1 | Listening
web_1 | Listening
"""
return max(len(name) for name in service_names) + max_index_width
class LogPrinter(object):
def __init__(self, containers, attach_params=None, output=sys.stdout, monochrome=False):
"""Print logs from many containers to a single output stream."""
def __init__(self,
containers,
presenters,
event_stream,
output=sys.stdout,
cascade_stop=False,
log_args=None):
self.containers = containers
self.attach_params = attach_params or {}
self.prefix_width = self._calculate_prefix_width(containers)
self.generators = self._make_log_generators(monochrome)
self.output = output
self.presenters = presenters
self.event_stream = event_stream
self.output = utils.get_output_stream(output)
self.cascade_stop = cascade_stop
self.log_args = log_args or {}
def run(self):
mux = Multiplexer(self.generators)
for line in mux.loop():
if not self.containers:
return
queue = Queue()
thread_args = queue, self.log_args
thread_map = build_thread_map(self.containers, self.presenters, thread_args)
start_producer_thread((
thread_map,
self.event_stream,
self.presenters,
thread_args))
for line in consume_queue(queue, self.cascade_stop):
remove_stopped_threads(thread_map)
if not line:
if not thread_map:
# There are no running containers left to tail, so exit
return
# We got an empty line because of a timeout, but there are still
# active containers to tail, so continue
continue
self.output.write(line)
self.output.flush()
def _calculate_prefix_width(self, containers):
"""
Calculate the maximum width of container names so we can make the log
prefixes line up like so:
db_1 | Listening
web_1 | Listening
"""
prefix_width = 0
for container in containers:
prefix_width = max(prefix_width, len(container.name_without_project))
return prefix_width
def remove_stopped_threads(thread_map):
for container_id, tailer_thread in list(thread_map.items()):
if not tailer_thread.is_alive():
thread_map.pop(container_id, None)
def _make_log_generators(self, monochrome):
color_fns = cycle(colors.rainbow())
generators = []
def no_color(text):
return text
def build_thread(container, presenter, queue, log_args):
tailer = Thread(
target=tail_container_logs,
args=(container, presenter, queue, log_args))
tailer.daemon = True
tailer.start()
return tailer
for container in self.containers:
if monochrome:
color_fn = no_color
else:
color_fn = next(color_fns)
generators.append(self._make_log_generator(container, color_fn))
return generators
def build_thread_map(initial_containers, presenters, thread_args):
return {
container.id: build_thread(container, next(presenters), *thread_args)
for container in initial_containers
}
def _make_log_generator(self, container, color_fn):
prefix = color_fn(self._generate_prefix(container)).encode('utf-8')
# Attach to container before log printer starts running
line_generator = split_buffer(self._attach(container), '\n')
for line in line_generator:
yield prefix + line
class QueueItem(namedtuple('_QueueItem', 'item is_stop exc')):
@classmethod
def new(cls, item):
return cls(item, None, None)
@classmethod
def exception(cls, exc):
return cls(None, None, exc)
@classmethod
def stop(cls):
return cls(None, True, None)
def tail_container_logs(container, presenter, queue, log_args):
generator = get_log_generator(container)
try:
for item in generator(container, log_args):
queue.put(QueueItem.new(presenter.present(container, item)))
except Exception as e:
queue.put(QueueItem.exception(e))
return
if log_args.get('follow'):
queue.put(QueueItem.new(presenter.color_func(wait_on_exit(container))))
queue.put(QueueItem.stop())
def get_log_generator(container):
if container.has_api_logs:
return build_log_generator
return build_no_log_generator
def build_no_log_generator(container, log_args):
"""Return a generator that prints a warning about logs and waits for
container to exit.
"""
yield "WARNING: no logs are available with the '{}' log driver\n".format(
container.log_driver)
def build_log_generator(container, log_args):
# if the container doesn't have a log_stream we need to attach to container
# before log printer starts running
if container.log_stream is None:
stream = container.logs(stdout=True, stderr=True, stream=True, **log_args)
else:
stream = container.log_stream
return split_buffer(stream)
def wait_on_exit(container):
try:
exit_code = container.wait()
yield color_fn("%s exited with code %s\n" % (container.name, exit_code))
yield STOP
return "%s exited with code %s\n" % (container.name, exit_code)
except APIError as e:
return "Unexpected API error for %s (HTTP code %s)\nResponse body:\n%s\n" % (
container.name, e.response.status_code,
e.response.text or '[empty]'
)
def _generate_prefix(self, container):
"""
Generate the prefix for a log line without colour
"""
name = container.name_without_project
padding = ' ' * (self.prefix_width - len(name))
return ''.join([name, padding, ' | '])
def _attach(self, container):
params = {
'stdout': True,
'stderr': True,
'stream': True,
}
params.update(self.attach_params)
params = dict((name, 1 if value else 0) for (name, value) in list(params.items()))
return container.attach(**params)
def start_producer_thread(thread_args):
producer = Thread(target=watch_events, args=thread_args)
producer.daemon = True
producer.start()
def watch_events(thread_map, event_stream, presenters, thread_args):
for event in event_stream:
if event['action'] == 'stop':
thread_map.pop(event['id'], None)
if event['action'] != 'start':
continue
if event['id'] in thread_map:
if thread_map[event['id']].is_alive():
continue
# Container was stopped and started, we need a new thread
thread_map.pop(event['id'], None)
thread_map[event['id']] = build_thread(
event['container'],
next(presenters),
*thread_args)
def consume_queue(queue, cascade_stop):
"""Consume the queue by reading lines off of it and yielding them."""
while True:
try:
item = queue.get(timeout=0.1)
except Empty:
yield None
continue
# See https://github.com/docker/compose/issues/189
except thread.error:
raise ShutdownException()
if item.exc:
raise item.exc
if item.is_stop:
if cascade_stop:
raise StopIteration
else:
continue
yield item.item

File diff suppressed because it is too large Load diff

View file

@ -1,42 +0,0 @@
from __future__ import absolute_import
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty # Python 3.x
# Yield STOP from an input generator to stop the
# top-level loop without processing any more input.
STOP = object()
class Multiplexer(object):
def __init__(self, generators):
self.generators = generators
self.queue = Queue()
def loop(self):
self._init_readers()
while True:
try:
item = self.queue.get(timeout=0.1)
if item is STOP:
break
else:
yield item
except Empty:
pass
def _init_readers(self):
for generator in self.generators:
t = Thread(target=_enqueue_output, args=(generator, self.queue))
t.daemon = True
t.start()
def _enqueue_output(generator, queue):
for item in generator:
queue.put(item)

21
compose/cli/signals.py Normal file
View file

@ -0,0 +1,21 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import signal
class ShutdownException(Exception):
pass
def shutdown(signal, frame):
raise ShutdownException()
def set_signal_handler(handler):
signal.signal(signal.SIGINT, handler)
signal.signal(signal.SIGTERM, handler)
def set_signal_handler_to_shutdown():
set_signal_handler(shutdown)

View file

@ -1,10 +1,24 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
import datetime
from __future__ import unicode_literals
import os
import subprocess
import platform
import ssl
import subprocess
import sys
import docker
import compose
from ..const import IS_WINDOWS_PLATFORM
# WindowsError is not defined on non-win32 platforms. Avoid runtime errors by
# defining it as OSError (its parent class) if missing.
try:
WindowsError
except NameError:
WindowsError = OSError
def yesno(prompt, default=None):
@ -17,7 +31,7 @@ def yesno(prompt, default=None):
Unrecognised input (anything other than "y", "n", "yes",
"no" or "") will return None.
"""
answer = raw_input(prompt).strip().lower()
answer = input(prompt).strip().lower()
if answer == "y" or answer == "yes":
return True
@ -29,62 +43,14 @@ def yesno(prompt, default=None):
return None
# http://stackoverflow.com/a/5164027
def prettydate(d):
diff = datetime.datetime.utcnow() - d
s = diff.seconds
if diff.days > 7 or diff.days < 0:
return d.strftime('%d %b %y')
elif diff.days == 1:
return '1 day ago'
elif diff.days > 1:
return '{0} days ago'.format(diff.days)
elif s <= 1:
return 'just now'
elif s < 60:
return '{0} seconds ago'.format(s)
elif s < 120:
return '1 minute ago'
elif s < 3600:
return '{0} minutes ago'.format(s / 60)
elif s < 7200:
return '1 hour ago'
else:
return '{0} hours ago'.format(s / 3600)
def mkdir(path, permissions=0o700):
if not os.path.exists(path):
os.mkdir(path)
os.chmod(path, permissions)
return path
def split_buffer(reader, separator):
def input(prompt):
"""
Given a generator which yields strings and a separator string,
joins all input, splits on the separator and yields each chunk.
Unlike string.split(), each chunk includes the trailing
separator, except for the last one if none was found on the end
of the input.
Version of input (raw_input in Python 2) which forces a flush of sys.stdout
to avoid problems where the prompt fails to appear due to line buffering
"""
buffered = str('')
separator = str(separator)
for data in reader:
buffered += data
while True:
index = buffered.find(separator)
if index == -1:
break
yield buffered[:index + 1]
buffered = buffered[index + 1:]
if len(buffered) > 0:
yield buffered
sys.stdout.write(prompt)
sys.stdout.flush()
return sys.stdin.readline().rstrip('\n')
def call_silently(*args, **kwargs):
@ -92,7 +58,12 @@ def call_silently(*args, **kwargs):
Like subprocess.call(), but redirects stdout and stderr to /dev/null.
"""
with open(os.devnull, 'w') as shutup:
return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs)
try:
return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs)
except WindowsError:
# On Windows, subprocess.call() can still raise exceptions. Normalize
# to POSIXy behaviour by returning a nonzero exit code.
return 1
def is_mac():
@ -101,3 +72,66 @@ def is_mac():
def is_ubuntu():
return platform.system() == 'Linux' and platform.linux_distribution()[0] == 'Ubuntu'
def is_windows():
return IS_WINDOWS_PLATFORM
def get_version_info(scope):
versioninfo = 'docker-compose version {}, build {}'.format(
compose.__version__,
get_build_version())
if scope == 'compose':
return versioninfo
if scope == 'full':
return (
"{}\n"
"docker-py version: {}\n"
"{} version: {}\n"
"OpenSSL version: {}"
).format(
versioninfo,
docker.version,
platform.python_implementation(),
platform.python_version(),
ssl.OPENSSL_VERSION)
raise ValueError("{} is not a valid version scope".format(scope))
def get_build_version():
filename = os.path.join(os.path.dirname(compose.__file__), 'GITSHA')
if not os.path.exists(filename):
return 'unknown'
with open(filename) as fh:
return fh.read().strip()
def is_docker_for_mac_installed():
return is_mac() and os.path.isdir('/Applications/Docker.app')
def generate_user_agent():
parts = [
"docker-compose/{}".format(compose.__version__),
"docker-py/{}".format(docker.__version__),
]
try:
p_system = platform.system()
p_release = platform.release()
except IOError:
pass
else:
parts.append("{}/{}".format(p_system, p_release))
return " ".join(parts)
def unquote_path(s):
if not s:
return s
if s[0] == '"' and s[-1] == '"':
return s[1:-1]
return s

View file

@ -1,8 +1,10 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
from itertools import chain
import logging
import pprint
from itertools import chain
import six

View file

@ -1,388 +0,0 @@
import os
import yaml
import six
DOCKER_CONFIG_KEYS = [
'cap_add',
'cap_drop',
'cpu_shares',
'command',
'detach',
'dns',
'dns_search',
'domainname',
'entrypoint',
'env_file',
'environment',
'hostname',
'image',
'links',
'mem_limit',
'net',
'ports',
'privileged',
'restart',
'stdin_open',
'tty',
'user',
'volumes',
'volumes_from',
'working_dir',
]
ALLOWED_KEYS = DOCKER_CONFIG_KEYS + [
'build',
'expose',
'external_links',
'name',
]
DOCKER_CONFIG_HINTS = {
'cpu_share' : 'cpu_shares',
'link' : 'links',
'port' : 'ports',
'privilege' : 'privileged',
'priviliged': 'privileged',
'privilige' : 'privileged',
'volume' : 'volumes',
'workdir' : 'working_dir',
}
def load(filename):
working_dir = os.path.dirname(filename)
return from_dictionary(load_yaml(filename), working_dir=working_dir, filename=filename)
def from_dictionary(dictionary, working_dir=None, filename=None):
service_dicts = []
for service_name, service_dict in list(dictionary.items()):
if not isinstance(service_dict, dict):
raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.' % service_name)
loader = ServiceLoader(working_dir=working_dir, filename=filename)
service_dict = loader.make_service_dict(service_name, service_dict)
service_dicts.append(service_dict)
return service_dicts
def make_service_dict(name, service_dict, working_dir=None):
return ServiceLoader(working_dir=working_dir).make_service_dict(name, service_dict)
class ServiceLoader(object):
def __init__(self, working_dir, filename=None, already_seen=None):
self.working_dir = working_dir
self.filename = filename
self.already_seen = already_seen or []
def make_service_dict(self, name, service_dict):
if self.signature(name) in self.already_seen:
raise CircularReference(self.already_seen)
service_dict = service_dict.copy()
service_dict['name'] = name
service_dict = resolve_environment(service_dict, working_dir=self.working_dir)
service_dict = self.resolve_extends(service_dict)
return process_container_options(service_dict, working_dir=self.working_dir)
def resolve_extends(self, service_dict):
if 'extends' not in service_dict:
return service_dict
extends_options = process_extends_options(service_dict['name'], service_dict['extends'])
if self.working_dir is None:
raise Exception("No working_dir passed to ServiceLoader()")
other_config_path = expand_path(self.working_dir, extends_options['file'])
other_working_dir = os.path.dirname(other_config_path)
other_already_seen = self.already_seen + [self.signature(service_dict['name'])]
other_loader = ServiceLoader(
working_dir=other_working_dir,
filename=other_config_path,
already_seen=other_already_seen,
)
other_config = load_yaml(other_config_path)
other_service_dict = other_config[extends_options['service']]
other_service_dict = other_loader.make_service_dict(
service_dict['name'],
other_service_dict,
)
validate_extended_service_dict(
other_service_dict,
filename=other_config_path,
service=extends_options['service'],
)
return merge_service_dicts(other_service_dict, service_dict)
def signature(self, name):
return (self.filename, name)
def process_extends_options(service_name, extends_options):
error_prefix = "Invalid 'extends' configuration for %s:" % service_name
if not isinstance(extends_options, dict):
raise ConfigurationError("%s must be a dictionary" % error_prefix)
if 'service' not in extends_options:
raise ConfigurationError(
"%s you need to specify a service, e.g. 'service: web'" % error_prefix
)
for k, _ in extends_options.items():
if k not in ['file', 'service']:
raise ConfigurationError(
"%s unsupported configuration option '%s'" % (error_prefix, k)
)
return extends_options
def validate_extended_service_dict(service_dict, filename, service):
error_prefix = "Cannot extend service '%s' in %s:" % (service, filename)
if 'links' in service_dict:
raise ConfigurationError("%s services with 'links' cannot be extended" % error_prefix)
if 'volumes_from' in service_dict:
raise ConfigurationError("%s services with 'volumes_from' cannot be extended" % error_prefix)
if 'net' in service_dict:
if get_service_name_from_net(service_dict['net']) is not None:
raise ConfigurationError("%s services with 'net: container' cannot be extended" % error_prefix)
def process_container_options(service_dict, working_dir=None):
for k in service_dict:
if k not in ALLOWED_KEYS:
msg = "Unsupported config option for %s service: '%s'" % (service_dict['name'], k)
if k in DOCKER_CONFIG_HINTS:
msg += " (did you mean '%s'?)" % DOCKER_CONFIG_HINTS[k]
raise ConfigurationError(msg)
service_dict = service_dict.copy()
if 'volumes' in service_dict:
service_dict['volumes'] = resolve_host_paths(service_dict['volumes'], working_dir=working_dir)
return service_dict
def merge_service_dicts(base, override):
d = base.copy()
if 'environment' in base or 'environment' in override:
d['environment'] = merge_environment(
base.get('environment'),
override.get('environment'),
)
if 'volumes' in base or 'volumes' in override:
d['volumes'] = merge_volumes(
base.get('volumes'),
override.get('volumes'),
)
for k in ALLOWED_KEYS:
if k not in ['environment', 'volumes']:
if k in override:
d[k] = override[k]
return d
def merge_environment(base, override):
env = parse_environment(base)
env.update(parse_environment(override))
return env
def parse_links(links):
return dict(parse_link(l) for l in links)
def parse_link(link):
if ':' in link:
source, alias = link.split(':', 1)
return (alias, source)
else:
return (link, link)
def get_env_files(options, working_dir=None):
if 'env_file' not in options:
return {}
if working_dir is None:
raise Exception("No working_dir passed to get_env_files()")
env_files = options.get('env_file', [])
if not isinstance(env_files, list):
env_files = [env_files]
return [expand_path(working_dir, path) for path in env_files]
def resolve_environment(service_dict, working_dir=None):
service_dict = service_dict.copy()
if 'environment' not in service_dict and 'env_file' not in service_dict:
return service_dict
env = {}
if 'env_file' in service_dict:
for f in get_env_files(service_dict, working_dir=working_dir):
env.update(env_vars_from_file(f))
del service_dict['env_file']
env.update(parse_environment(service_dict.get('environment')))
env = dict(resolve_env_var(k, v) for k, v in six.iteritems(env))
service_dict['environment'] = env
return service_dict
def parse_environment(environment):
if not environment:
return {}
if isinstance(environment, list):
return dict(split_env(e) for e in environment)
if isinstance(environment, dict):
return environment
raise ConfigurationError(
"environment \"%s\" must be a list or mapping," %
environment
)
def split_env(env):
if '=' in env:
return env.split('=', 1)
else:
return env, None
def resolve_env_var(key, val):
if val is not None:
return key, val
elif key in os.environ:
return key, os.environ[key]
else:
return key, ''
def env_vars_from_file(filename):
"""
Read in a line delimited file of environment variables.
"""
if not os.path.exists(filename):
raise ConfigurationError("Couldn't find env file: %s" % filename)
env = {}
for line in open(filename, 'r'):
line = line.strip()
if line and not line.startswith('#'):
k, v = split_env(line)
env[k] = v
return env
def resolve_host_paths(volumes, working_dir=None):
if working_dir is None:
raise Exception("No working_dir passed to resolve_host_paths()")
return [resolve_host_path(v, working_dir) for v in volumes]
def resolve_host_path(volume, working_dir):
container_path, host_path = split_volume(volume)
if host_path is not None:
return "%s:%s" % (expand_path(working_dir, host_path), container_path)
else:
return container_path
def merge_volumes(base, override):
d = dict_from_volumes(base)
d.update(dict_from_volumes(override))
return volumes_from_dict(d)
def dict_from_volumes(volumes):
if volumes:
return dict(split_volume(v) for v in volumes)
else:
return {}
def volumes_from_dict(d):
return [join_volume(v) for v in d.items()]
def split_volume(string):
if ':' in string:
(host, container) = string.split(':', 1)
return (container, host)
else:
return (string, None)
def join_volume(pair):
(container, host) = pair
if host is None:
return container
else:
return ":".join((host, container))
def expand_path(working_dir, path):
return os.path.abspath(os.path.join(working_dir, path))
def get_service_name_from_net(net_config):
if not net_config:
return
if not net_config.startswith('container:'):
return
_, net_name = net_config.split(':', 1)
return net_name
def load_yaml(filename):
try:
with open(filename, 'r') as fh:
return yaml.safe_load(fh)
except IOError as e:
raise ConfigurationError(six.text_type(e))
class ConfigurationError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class CircularReference(ConfigurationError):
def __init__(self, trail):
self.trail = trail
@property
def msg(self):
lines = [
"{} in {}".format(service_name, filename)
for (filename, service_name) in self.trail
]
return "Circular reference:\n {}".format("\n extends ".join(lines))

View file

@ -0,0 +1,11 @@
# flake8: noqa
from __future__ import absolute_import
from __future__ import unicode_literals
from . import environment
from .config import ConfigurationError
from .config import DOCKER_CONFIG_KEYS
from .config import find
from .config import load
from .config import merge_environment
from .config import parse_environment

1123
compose/config/config.py Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,188 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "config_schema_v1.json",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"type": "object",
"properties": {
"build": {"type": "string"},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"container_name": {"type": "string"},
"cpu_shares": {"type": ["number", "string"]},
"cpu_quota": {"type": ["number", "string"]},
"cpuset": {"type": "string"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"dockerfile": {"type": "string"},
"domainname": {"type": "string"},
"entrypoint": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "expose"
},
"uniqueItems": true
},
"extends": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"service": {"type": "string"},
"file": {"type": "string"}
},
"required": ["service"],
"additionalProperties": false
}
]
},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"hostname": {"type": "string"},
"image": {"type": "string"},
"ipc": {"type": "string"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"log_driver": {"type": "string"},
"log_opt": {"type": "object"},
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]},
"mem_swappiness": {"type": "integer"},
"net": {"type": "string"},
"pid": {"type": ["string", "null"]},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "ports"
},
"uniqueItems": true
},
"privileged": {"type": "boolean"},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"stdin_open": {"type": "boolean"},
"stop_signal": {"type": "string"},
"tty": {"type": "boolean"},
"ulimits": {
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"oneOf": [
{"type": "integer"},
{
"type":"object",
"properties": {
"hard": {"type": "integer"},
"soft": {"type": "integer"}
},
"required": ["soft", "hard"],
"additionalProperties": false
}
]
}
}
},
"user": {"type": "string"},
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"volume_driver": {"type": "string"},
"volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"working_dir": {"type": "string"}
},
"dependencies": {
"memswap_limit": ["mem_limit"]
},
"additionalProperties": false
},
"string_or_list": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_of_strings"}
]
},
"list_of_strings": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"list_or_dict": {
"oneOf": [
{
"type": "object",
"patternProperties": {
".+": {
"type": ["string", "number", "null"]
}
},
"additionalProperties": false
},
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"service": {
"id": "#/definitions/constraints/service",
"anyOf": [
{
"required": ["build"],
"not": {"required": ["image"]}
},
{
"required": ["image"],
"not": {"anyOf": [
{"required": ["build"]},
{"required": ["dockerfile"]}
]}
}
]
}
}
}
}

View file

@ -0,0 +1,329 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "config_schema_v2.0.json",
"type": "object",
"properties": {
"version": {
"type": "string"
},
"services": {
"id": "#/properties/services",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false
},
"networks": {
"id": "#/properties/networks",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/network"
}
}
},
"volumes": {
"id": "#/properties/volumes",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/volume"
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"type": "object",
"properties": {
"build": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}
]
},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"container_name": {"type": "string"},
"cpu_shares": {"type": ["number", "string"]},
"cpu_quota": {"type": ["number", "string"]},
"cpuset": {"type": "string"},
"depends_on": {"$ref": "#/definitions/list_of_strings"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"domainname": {"type": "string"},
"entrypoint": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "expose"
},
"uniqueItems": true
},
"extends": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"service": {"type": "string"},
"file": {"type": "string"}
},
"required": ["service"],
"additionalProperties": false
}
]
},
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"hostname": {"type": "string"},
"image": {"type": "string"},
"ipc": {"type": "string"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"logging": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"options": {"type": "object"}
},
"additionalProperties": false
},
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]},
"mem_swappiness": {"type": "integer"},
"network_mode": {"type": "string"},
"networks": {
"oneOf": [
{"$ref": "#/definitions/list_of_strings"},
{
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"oneOf": [
{
"type": "object",
"properties": {
"aliases": {"$ref": "#/definitions/list_of_strings"},
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"}
},
"additionalProperties": false
},
{"type": "null"}
]
}
},
"additionalProperties": false
}
]
},
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
"group_add": {
"type": "array",
"items": {
"type": ["string", "number"]
},
"uniqueItems": true
},
"pid": {"type": ["string", "null"]},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "ports"
},
"uniqueItems": true
},
"privileged": {"type": "boolean"},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"stdin_open": {"type": "boolean"},
"stop_grace_period": {"type": "string", "format": "duration"},
"stop_signal": {"type": "string"},
"tmpfs": {"$ref": "#/definitions/string_or_list"},
"tty": {"type": "boolean"},
"ulimits": {
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"oneOf": [
{"type": "integer"},
{
"type":"object",
"properties": {
"hard": {"type": "integer"},
"soft": {"type": "integer"}
},
"required": ["soft", "hard"],
"additionalProperties": false
}
]
}
}
},
"user": {"type": "string"},
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"volume_driver": {"type": "string"},
"volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"working_dir": {"type": "string"}
},
"dependencies": {
"memswap_limit": ["mem_limit"]
},
"additionalProperties": false
},
"network": {
"id": "#/definitions/network",
"type": "object",
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"ipam": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"config": {
"type": "array"
}
},
"additionalProperties": false
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"internal": {"type": "boolean"}
},
"additionalProperties": false
},
"volume": {
"id": "#/definitions/volume",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"string_or_list": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_of_strings"}
]
},
"list_of_strings": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"list_or_dict": {
"oneOf": [
{
"type": "object",
"patternProperties": {
".+": {
"type": ["string", "number", "null"]
}
},
"additionalProperties": false
},
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"service": {
"id": "#/definitions/constraints/service",
"anyOf": [
{"required": ["build"]},
{"required": ["image"]}
],
"properties": {
"build": {
"required": ["context"]
}
}
}
}
}
}

View file

@ -0,0 +1,376 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "config_schema_v2.1.json",
"type": "object",
"properties": {
"version": {
"type": "string"
},
"services": {
"id": "#/properties/services",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false
},
"networks": {
"id": "#/properties/networks",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/network"
}
}
},
"volumes": {
"id": "#/properties/volumes",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/volume"
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"type": "object",
"properties": {
"build": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}
]
},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"container_name": {"type": "string"},
"cpu_shares": {"type": ["number", "string"]},
"cpu_quota": {"type": ["number", "string"]},
"cpuset": {"type": "string"},
"depends_on": {
"oneOf": [
{"$ref": "#/definitions/list_of_strings"},
{
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"additionalProperties": false,
"properties": {
"condition": {
"type": "string",
"enum": ["service_started", "service_healthy"]
}
},
"required": ["condition"]
}
}
}
]
},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"domainname": {"type": "string"},
"entrypoint": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "expose"
},
"uniqueItems": true
},
"extends": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"service": {"type": "string"},
"file": {"type": "string"}
},
"required": ["service"],
"additionalProperties": false
}
]
},
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"healthcheck": {"$ref": "#/definitions/healthcheck"},
"hostname": {"type": "string"},
"image": {"type": "string"},
"ipc": {"type": "string"},
"isolation": {"type": "string"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"logging": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"options": {"type": "object"}
},
"additionalProperties": false
},
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]},
"mem_swappiness": {"type": "integer"},
"network_mode": {"type": "string"},
"networks": {
"oneOf": [
{"$ref": "#/definitions/list_of_strings"},
{
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"oneOf": [
{
"type": "object",
"properties": {
"aliases": {"$ref": "#/definitions/list_of_strings"},
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"},
"link_local_ips": {"$ref": "#/definitions/list_of_strings"}
},
"additionalProperties": false
},
{"type": "null"}
]
}
},
"additionalProperties": false
}
]
},
"oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
"group_add": {
"type": "array",
"items": {
"type": ["string", "number"]
},
"uniqueItems": true
},
"pid": {"type": ["string", "null"]},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "ports"
},
"uniqueItems": true
},
"privileged": {"type": "boolean"},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"sysctls": {"$ref": "#/definitions/list_or_dict"},
"stdin_open": {"type": "boolean"},
"stop_grace_period": {"type": "string", "format": "duration"},
"stop_signal": {"type": "string"},
"tmpfs": {"$ref": "#/definitions/string_or_list"},
"tty": {"type": "boolean"},
"ulimits": {
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"oneOf": [
{"type": "integer"},
{
"type":"object",
"properties": {
"hard": {"type": "integer"},
"soft": {"type": "integer"}
},
"required": ["soft", "hard"],
"additionalProperties": false
}
]
}
}
},
"user": {"type": "string"},
"userns_mode": {"type": "string"},
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"volume_driver": {"type": "string"},
"volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"working_dir": {"type": "string"}
},
"dependencies": {
"memswap_limit": ["mem_limit"]
},
"additionalProperties": false
},
"healthcheck": {
"id": "#/definitions/healthcheck",
"type": "object",
"additionalProperties": false,
"properties": {
"disable": {"type": "boolean"},
"interval": {"type": "string"},
"retries": {"type": "number"},
"test": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"timeout": {"type": "string"}
}
},
"network": {
"id": "#/definitions/network",
"type": "object",
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"ipam": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"config": {
"type": "array"
}
},
"additionalProperties": false
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"internal": {"type": "boolean"},
"enable_ipv6": {"type": "boolean"},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"volume": {
"id": "#/definitions/volume",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"string_or_list": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_of_strings"}
]
},
"list_of_strings": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"list_or_dict": {
"oneOf": [
{
"type": "object",
"patternProperties": {
".+": {
"type": ["string", "number", "null"]
}
},
"additionalProperties": false
},
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"service": {
"id": "#/definitions/constraints/service",
"anyOf": [
{"required": ["build"]},
{"required": ["image"]}
],
"properties": {
"build": {
"required": ["context"]
}
}
}
}
}
}

View file

@ -0,0 +1,383 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "config_schema_v3.0.json",
"type": "object",
"required": ["version"],
"properties": {
"version": {
"type": "string"
},
"services": {
"id": "#/properties/services",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false
},
"networks": {
"id": "#/properties/networks",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/network"
}
}
},
"volumes": {
"id": "#/properties/volumes",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/volume"
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"type": "object",
"properties": {
"deploy": {"$ref": "#/definitions/deployment"},
"build": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}
]
},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"container_name": {"type": "string"},
"depends_on": {"$ref": "#/definitions/list_of_strings"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"domainname": {"type": "string"},
"entrypoint": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "expose"
},
"uniqueItems": true
},
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"healthcheck": {"$ref": "#/definitions/healthcheck"},
"hostname": {"type": "string"},
"image": {"type": "string"},
"ipc": {"type": "string"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"logging": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"options": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number", "null"]}
}
}
},
"additionalProperties": false
},
"mac_address": {"type": "string"},
"network_mode": {"type": "string"},
"networks": {
"oneOf": [
{"$ref": "#/definitions/list_of_strings"},
{
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"oneOf": [
{
"type": "object",
"properties": {
"aliases": {"$ref": "#/definitions/list_of_strings"},
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"}
},
"additionalProperties": false
},
{"type": "null"}
]
}
},
"additionalProperties": false
}
]
},
"pid": {"type": ["string", "null"]},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "ports"
},
"uniqueItems": true
},
"privileged": {"type": "boolean"},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"sysctls": {"$ref": "#/definitions/list_or_dict"},
"stdin_open": {"type": "boolean"},
"stop_grace_period": {"type": "string", "format": "duration"},
"stop_signal": {"type": "string"},
"tmpfs": {"$ref": "#/definitions/string_or_list"},
"tty": {"type": "boolean"},
"ulimits": {
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"oneOf": [
{"type": "integer"},
{
"type":"object",
"properties": {
"hard": {"type": "integer"},
"soft": {"type": "integer"}
},
"required": ["soft", "hard"],
"additionalProperties": false
}
]
}
}
},
"user": {"type": "string"},
"userns_mode": {"type": "string"},
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"working_dir": {"type": "string"}
},
"additionalProperties": false
},
"healthcheck": {
"id": "#/definitions/healthcheck",
"type": "object",
"additionalProperties": false,
"properties": {
"disable": {"type": "boolean"},
"interval": {"type": "string"},
"retries": {"type": "number"},
"test": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"timeout": {"type": "string"}
}
},
"deployment": {
"id": "#/definitions/deployment",
"type": ["object", "null"],
"properties": {
"mode": {"type": "string"},
"replicas": {"type": "integer"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"update_config": {
"type": "object",
"properties": {
"parallelism": {"type": "integer"},
"delay": {"type": "string", "format": "duration"},
"failure_action": {"type": "string"},
"monitor": {"type": "string", "format": "duration"},
"max_failure_ratio": {"type": "number"}
},
"additionalProperties": false
},
"resources": {
"type": "object",
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"restart_policy": {
"type": "object",
"properties": {
"condition": {"type": "string"},
"delay": {"type": "string", "format": "duration"},
"max_attempts": {"type": "integer"},
"window": {"type": "string", "format": "duration"}
},
"additionalProperties": false
},
"placement": {
"type": "object",
"properties": {
"constraints": {"type": "array", "items": {"type": "string"}}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"resource": {
"id": "#/definitions/resource",
"type": "object",
"properties": {
"cpus": {"type": "string"},
"memory": {"type": "string"}
},
"additionalProperties": false
},
"network": {
"id": "#/definitions/network",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"ipam": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"config": {
"type": "array",
"items": {
"type": "object",
"properties": {
"subnet": {"type": "string"}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"internal": {"type": "boolean"},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"volume": {
"id": "#/definitions/volume",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"string_or_list": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_of_strings"}
]
},
"list_of_strings": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"list_or_dict": {
"oneOf": [
{
"type": "object",
"patternProperties": {
".+": {
"type": ["string", "number", "null"]
}
},
"additionalProperties": false
},
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"service": {
"id": "#/definitions/constraints/service",
"anyOf": [
{"required": ["build"]},
{"required": ["image"]}
],
"properties": {
"build": {
"required": ["context"]
}
}
}
}
}
}

View file

@ -0,0 +1,428 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "config_schema_v3.1.json",
"type": "object",
"required": ["version"],
"properties": {
"version": {
"type": "string"
},
"services": {
"id": "#/properties/services",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false
},
"networks": {
"id": "#/properties/networks",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/network"
}
}
},
"volumes": {
"id": "#/properties/volumes",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/volume"
}
},
"additionalProperties": false
},
"secrets": {
"id": "#/properties/secrets",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/secret"
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"definitions": {
"service": {
"id": "#/definitions/service",
"type": "object",
"properties": {
"deploy": {"$ref": "#/definitions/deployment"},
"build": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}
]
},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"container_name": {"type": "string"},
"depends_on": {"$ref": "#/definitions/list_of_strings"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"},
"dns_search": {"$ref": "#/definitions/string_or_list"},
"domainname": {"type": "string"},
"entrypoint": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"env_file": {"$ref": "#/definitions/string_or_list"},
"environment": {"$ref": "#/definitions/list_or_dict"},
"expose": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "expose"
},
"uniqueItems": true
},
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"healthcheck": {"$ref": "#/definitions/healthcheck"},
"hostname": {"type": "string"},
"image": {"type": "string"},
"ipc": {"type": "string"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"logging": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"options": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number", "null"]}
}
}
},
"additionalProperties": false
},
"mac_address": {"type": "string"},
"network_mode": {"type": "string"},
"networks": {
"oneOf": [
{"$ref": "#/definitions/list_of_strings"},
{
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"oneOf": [
{
"type": "object",
"properties": {
"aliases": {"$ref": "#/definitions/list_of_strings"},
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"}
},
"additionalProperties": false
},
{"type": "null"}
]
}
},
"additionalProperties": false
}
]
},
"pid": {"type": ["string", "null"]},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"],
"format": "ports"
},
"uniqueItems": true
},
"privileged": {"type": "boolean"},
"read_only": {"type": "boolean"},
"restart": {"type": "string"},
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"shm_size": {"type": ["number", "string"]},
"secrets": {
"type": "array",
"items": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"properties": {
"source": {"type": "string"},
"target": {"type": "string"},
"uid": {"type": "string"},
"gid": {"type": "string"},
"mode": {"type": "number"}
}
}
]
}
},
"sysctls": {"$ref": "#/definitions/list_or_dict"},
"stdin_open": {"type": "boolean"},
"stop_grace_period": {"type": "string", "format": "duration"},
"stop_signal": {"type": "string"},
"tmpfs": {"$ref": "#/definitions/string_or_list"},
"tty": {"type": "boolean"},
"ulimits": {
"type": "object",
"patternProperties": {
"^[a-z]+$": {
"oneOf": [
{"type": "integer"},
{
"type":"object",
"properties": {
"hard": {"type": "integer"},
"soft": {"type": "integer"}
},
"required": ["soft", "hard"],
"additionalProperties": false
}
]
}
}
},
"user": {"type": "string"},
"userns_mode": {"type": "string"},
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"working_dir": {"type": "string"}
},
"additionalProperties": false
},
"healthcheck": {
"id": "#/definitions/healthcheck",
"type": "object",
"additionalProperties": false,
"properties": {
"disable": {"type": "boolean"},
"interval": {"type": "string"},
"retries": {"type": "number"},
"test": {
"oneOf": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}}
]
},
"timeout": {"type": "string"}
}
},
"deployment": {
"id": "#/definitions/deployment",
"type": ["object", "null"],
"properties": {
"mode": {"type": "string"},
"replicas": {"type": "integer"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"update_config": {
"type": "object",
"properties": {
"parallelism": {"type": "integer"},
"delay": {"type": "string", "format": "duration"},
"failure_action": {"type": "string"},
"monitor": {"type": "string", "format": "duration"},
"max_failure_ratio": {"type": "number"}
},
"additionalProperties": false
},
"resources": {
"type": "object",
"properties": {
"limits": {"$ref": "#/definitions/resource"},
"reservations": {"$ref": "#/definitions/resource"}
}
},
"restart_policy": {
"type": "object",
"properties": {
"condition": {"type": "string"},
"delay": {"type": "string", "format": "duration"},
"max_attempts": {"type": "integer"},
"window": {"type": "string", "format": "duration"}
},
"additionalProperties": false
},
"placement": {
"type": "object",
"properties": {
"constraints": {"type": "array", "items": {"type": "string"}}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"resource": {
"id": "#/definitions/resource",
"type": "object",
"properties": {
"cpus": {"type": "string"},
"memory": {"type": "string"}
},
"additionalProperties": false
},
"network": {
"id": "#/definitions/network",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"ipam": {
"type": "object",
"properties": {
"driver": {"type": "string"},
"config": {
"type": "array",
"items": {
"type": "object",
"properties": {
"subnet": {"type": "string"}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"internal": {"type": "boolean"},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"volume": {
"id": "#/definitions/volume",
"type": ["object", "null"],
"properties": {
"driver": {"type": "string"},
"driver_opts": {
"type": "object",
"patternProperties": {
"^.+$": {"type": ["string", "number"]}
}
},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"secret": {
"id": "#/definitions/secret",
"type": "object",
"properties": {
"file": {"type": "string"},
"external": {
"type": ["boolean", "object"],
"properties": {
"name": {"type": "string"}
}
},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
},
"string_or_list": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_of_strings"}
]
},
"list_of_strings": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"list_or_dict": {
"oneOf": [
{
"type": "object",
"patternProperties": {
".+": {
"type": ["string", "number", "null"]
}
},
"additionalProperties": false
},
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"service": {
"id": "#/definitions/constraints/service",
"anyOf": [
{"required": ["build"]},
{"required": ["image"]}
],
"properties": {
"build": {
"required": ["context"]
}
}
}
}
}
}

View file

@ -0,0 +1,120 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import logging
import os
import six
from ..const import IS_WINDOWS_PLATFORM
from .errors import ConfigurationError
log = logging.getLogger(__name__)
def split_env(env):
if isinstance(env, six.binary_type):
env = env.decode('utf-8', 'replace')
if '=' in env:
return env.split('=', 1)
else:
return env, None
def env_vars_from_file(filename):
"""
Read in a line delimited file of environment variables.
"""
if not os.path.exists(filename):
raise ConfigurationError("Couldn't find env file: %s" % filename)
elif not os.path.isfile(filename):
raise ConfigurationError("%s is not a file." % (filename))
env = {}
with contextlib.closing(codecs.open(filename, 'r', 'utf-8')) as fileobj:
for line in fileobj:
line = line.strip()
if line and not line.startswith('#'):
k, v = split_env(line)
env[k] = v
return env
class Environment(dict):
def __init__(self, *args, **kwargs):
super(Environment, self).__init__(*args, **kwargs)
self.missing_keys = []
@classmethod
def from_env_file(cls, base_dir):
def _initialize():
result = cls()
if base_dir is None:
return result
env_file_path = os.path.join(base_dir, '.env')
try:
return cls(env_vars_from_file(env_file_path))
except ConfigurationError:
pass
return result
instance = _initialize()
instance.update(os.environ)
return instance
@classmethod
def from_command_line(cls, parsed_env_opts):
result = cls()
for k, v in parsed_env_opts.items():
# Values from the command line take priority, unless they're unset
# in which case they take the value from the system's environment
if v is None and k in os.environ:
result[k] = os.environ[k]
else:
result[k] = v
return result
def __getitem__(self, key):
try:
return super(Environment, self).__getitem__(key)
except KeyError:
if IS_WINDOWS_PLATFORM:
try:
return super(Environment, self).__getitem__(key.upper())
except KeyError:
pass
if key not in self.missing_keys:
log.warn(
"The {} variable is not set. Defaulting to a blank string."
.format(key)
)
self.missing_keys.append(key)
return ""
def __contains__(self, key):
result = super(Environment, self).__contains__(key)
if IS_WINDOWS_PLATFORM:
return (
result or super(Environment, self).__contains__(key.upper())
)
return result
def get(self, key, *args, **kwargs):
if IS_WINDOWS_PLATFORM:
return super(Environment, self).get(
key,
super(Environment, self).get(key.upper(), *args, **kwargs)
)
return super(Environment, self).get(key, *args, **kwargs)
def get_boolean(self, key):
# Convert a value to a boolean using "common sense" rules.
# Unset, empty, "0" and "false" (i-case) yield False.
# All other values yield True.
value = self.get(key)
if not value:
return False
if value.lower() in ['0', 'false']:
return False
return True

46
compose/config/errors.py Normal file
View file

@ -0,0 +1,46 @@
from __future__ import absolute_import
from __future__ import unicode_literals
VERSION_EXPLANATION = (
'You might be seeing this error because you\'re using the wrong Compose file version. '
'Either specify a supported version ("2.0", "2.1", "3.0") and place your '
'service definitions under the `services` key, or omit the `version` key '
'and place your service definitions at the root of the file to use '
'version 1.\nFor more on the Compose file format versions, see '
'https://docs.docker.com/compose/compose-file/')
class ConfigurationError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class DependencyError(ConfigurationError):
pass
class CircularReference(ConfigurationError):
def __init__(self, trail):
self.trail = trail
@property
def msg(self):
lines = [
"{} in {}".format(service_name, filename)
for (filename, service_name) in self.trail
]
return "Circular reference:\n {}".format("\n extends ".join(lines))
class ComposeFileNotFound(ConfigurationError):
def __init__(self, supported_filenames):
super(ComposeFileNotFound, self).__init__("""
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: %s
""" % ", ".join(supported_filenames))

View file

@ -0,0 +1,103 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from string import Template
import six
from .errors import ConfigurationError
from compose.const import COMPOSEFILE_V1 as V1
from compose.const import COMPOSEFILE_V2_0 as V2_0
log = logging.getLogger(__name__)
class Interpolator(object):
def __init__(self, templater, mapping):
self.templater = templater
self.mapping = mapping
def interpolate(self, string):
try:
return self.templater(string).substitute(self.mapping)
except ValueError:
raise InvalidInterpolation(string)
def interpolate_environment_variables(version, config, section, environment):
if version in (V2_0, V1):
interpolator = Interpolator(Template, environment)
else:
interpolator = Interpolator(TemplateWithDefaults, environment)
def process_item(name, config_dict):
return dict(
(key, interpolate_value(name, key, val, section, interpolator))
for key, val in (config_dict or {}).items()
)
return dict(
(name, process_item(name, config_dict or {}))
for name, config_dict in config.items()
)
def interpolate_value(name, config_key, value, section, interpolator):
try:
return recursive_interpolate(value, interpolator)
except InvalidInterpolation as e:
raise ConfigurationError(
'Invalid interpolation format for "{config_key}" option '
'in {section} "{name}": "{string}"'.format(
config_key=config_key,
name=name,
section=section,
string=e.string))
def recursive_interpolate(obj, interpolator):
if isinstance(obj, six.string_types):
return interpolator.interpolate(obj)
if isinstance(obj, dict):
return dict(
(key, recursive_interpolate(val, interpolator))
for (key, val) in obj.items()
)
if isinstance(obj, list):
return [recursive_interpolate(val, interpolator) for val in obj]
return obj
class TemplateWithDefaults(Template):
idpattern = r'[_a-z][_a-z0-9]*(?::?-[^}]+)?'
# Modified from python2.7/string.py
def substitute(self, mapping):
# Helper function for .sub()
def convert(mo):
# Check the most common path first.
named = mo.group('named') or mo.group('braced')
if named is not None:
if ':-' in named:
var, _, default = named.partition(':-')
return mapping.get(var) or default
if '-' in named:
var, _, default = named.partition('-')
return mapping.get(var, default)
val = mapping[named]
return '%s' % (val,)
if mo.group('escaped') is not None:
return self.delimiter
if mo.group('invalid') is not None:
self._invalid(mo)
raise ValueError('Unrecognized named group in pattern',
self.pattern)
return self.pattern.sub(convert, self.template)
class InvalidInterpolation(Exception):
def __init__(self, string):
self.string = string

108
compose/config/serialize.py Normal file
View file

@ -0,0 +1,108 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import six
import yaml
from compose.config import types
from compose.config.config import V1
from compose.config.config import V2_1
def serialize_config_type(dumper, data):
representer = dumper.represent_str if six.PY3 else dumper.represent_unicode
return representer(data.repr())
yaml.SafeDumper.add_representer(types.VolumeFromSpec, serialize_config_type)
yaml.SafeDumper.add_representer(types.VolumeSpec, serialize_config_type)
def denormalize_config(config):
denormalized_services = [
denormalize_service_dict(service_dict, config.version)
for service_dict in config.services
]
services = {
service_dict.pop('name'): service_dict
for service_dict in denormalized_services
}
networks = config.networks.copy()
for net_name, net_conf in networks.items():
if 'external_name' in net_conf:
del net_conf['external_name']
volumes = config.volumes.copy()
for vol_name, vol_conf in volumes.items():
if 'external_name' in vol_conf:
del vol_conf['external_name']
version = config.version
if version == V1:
version = V2_1
return {
'version': version,
'services': services,
'networks': networks,
'volumes': volumes,
}
def serialize_config(config):
return yaml.safe_dump(
denormalize_config(config),
default_flow_style=False,
indent=2,
width=80)
def serialize_ns_time_value(value):
result = (value, 'ns')
table = [
(1000., 'us'),
(1000., 'ms'),
(1000., 's'),
(60., 'm'),
(60., 'h')
]
for stage in table:
tmp = value / stage[0]
if tmp == int(value / stage[0]):
value = tmp
result = (int(value), stage[1])
else:
break
return '{0}{1}'.format(*result)
def denormalize_service_dict(service_dict, version):
service_dict = service_dict.copy()
if 'restart' in service_dict:
service_dict['restart'] = types.serialize_restart_spec(
service_dict['restart']
)
if version == V1 and 'network_mode' not in service_dict:
service_dict['network_mode'] = 'bridge'
if 'depends_on' in service_dict and version != V2_1:
service_dict['depends_on'] = sorted([
svc for svc in service_dict['depends_on'].keys()
])
if 'healthcheck' in service_dict:
if 'interval' in service_dict['healthcheck']:
service_dict['healthcheck']['interval'] = serialize_ns_time_value(
service_dict['healthcheck']['interval']
)
if 'timeout' in service_dict['healthcheck']:
service_dict['healthcheck']['timeout'] = serialize_ns_time_value(
service_dict['healthcheck']['timeout']
)
if 'secrets' in service_dict:
service_dict['secrets'] = map(lambda s: s.repr(), service_dict['secrets'])
return service_dict

View file

@ -0,0 +1,72 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose.config.errors import DependencyError
def get_service_name_from_network_mode(network_mode):
return get_source_name_from_network_mode(network_mode, 'service')
def get_container_name_from_network_mode(network_mode):
return get_source_name_from_network_mode(network_mode, 'container')
def get_source_name_from_network_mode(network_mode, source_type):
if not network_mode:
return
if not network_mode.startswith(source_type+':'):
return
_, net_name = network_mode.split(':', 1)
return net_name
def get_service_names(links):
return [link.split(':')[0] for link in links]
def get_service_names_from_volumes_from(volumes_from):
return [volume_from.source for volume_from in volumes_from]
def get_service_dependents(service_dict, services):
name = service_dict['name']
return [
service for service in services
if (name in get_service_names(service.get('links', [])) or
name in get_service_names_from_volumes_from(service.get('volumes_from', [])) or
name == get_service_name_from_network_mode(service.get('network_mode')) or
name in service.get('depends_on', []))
]
def sort_service_dicts(services):
# Topological sort (Cormen/Tarjan algorithm).
unmarked = services[:]
temporary_marked = set()
sorted_services = []
def visit(n):
if n['name'] in temporary_marked:
if n['name'] in get_service_names(n.get('links', [])):
raise DependencyError('A service can not link to itself: %s' % n['name'])
if n['name'] in n.get('volumes_from', []):
raise DependencyError('A service can not mount itself as volume: %s' % n['name'])
if n['name'] in n.get('depends_on', []):
raise DependencyError('A service can not depend on itself: %s' % n['name'])
raise DependencyError('Circular dependency between %s' % ' and '.join(temporary_marked))
if n in unmarked:
temporary_marked.add(n['name'])
for m in get_service_dependents(n, services):
visit(m)
temporary_marked.remove(n['name'])
unmarked.remove(n)
sorted_services.insert(0, n)
while unmarked:
visit(unmarked[-1])
return sorted_services

260
compose/config/types.py Normal file
View file

@ -0,0 +1,260 @@
"""
Types for objects parsed from the configuration.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re
from collections import namedtuple
import six
from ..const import COMPOSEFILE_V1 as V1
from .errors import ConfigurationError
from compose.const import IS_WINDOWS_PLATFORM
from compose.utils import splitdrive
win32_root_path_pattern = re.compile(r'^[A-Za-z]\:\\.*')
class VolumeFromSpec(namedtuple('_VolumeFromSpec', 'source mode type')):
# TODO: drop service_names arg when v1 is removed
@classmethod
def parse(cls, volume_from_config, service_names, version):
func = cls.parse_v1 if version == V1 else cls.parse_v2
return func(service_names, volume_from_config)
@classmethod
def parse_v1(cls, service_names, volume_from_config):
parts = volume_from_config.split(':')
if len(parts) > 2:
raise ConfigurationError(
"volume_from {} has incorrect format, should be "
"service[:mode]".format(volume_from_config))
if len(parts) == 1:
source = parts[0]
mode = 'rw'
else:
source, mode = parts
type = 'service' if source in service_names else 'container'
return cls(source, mode, type)
@classmethod
def parse_v2(cls, service_names, volume_from_config):
parts = volume_from_config.split(':')
if len(parts) > 3:
raise ConfigurationError(
"volume_from {} has incorrect format, should be one of "
"'<service name>[:<mode>]' or "
"'container:<container name>[:<mode>]'".format(volume_from_config))
if len(parts) == 1:
source = parts[0]
return cls(source, 'rw', 'service')
if len(parts) == 2:
if parts[0] == 'container':
type, source = parts
return cls(source, 'rw', type)
source, mode = parts
return cls(source, mode, 'service')
if len(parts) == 3:
type, source, mode = parts
if type not in ('service', 'container'):
raise ConfigurationError(
"Unknown volumes_from type '{}' in '{}'".format(
type,
volume_from_config))
return cls(source, mode, type)
def repr(self):
return '{v.type}:{v.source}:{v.mode}'.format(v=self)
def parse_restart_spec(restart_config):
if not restart_config:
return None
parts = restart_config.split(':')
if len(parts) > 2:
raise ConfigurationError(
"Restart %s has incorrect format, should be "
"mode[:max_retry]" % restart_config)
if len(parts) == 2:
name, max_retry_count = parts
else:
name, = parts
max_retry_count = 0
return {'Name': name, 'MaximumRetryCount': int(max_retry_count)}
def serialize_restart_spec(restart_spec):
if not restart_spec:
return ''
parts = [restart_spec['Name']]
if restart_spec['MaximumRetryCount']:
parts.append(six.text_type(restart_spec['MaximumRetryCount']))
return ':'.join(parts)
def parse_extra_hosts(extra_hosts_config):
if not extra_hosts_config:
return {}
if isinstance(extra_hosts_config, dict):
return dict(extra_hosts_config)
if isinstance(extra_hosts_config, list):
extra_hosts_dict = {}
for extra_hosts_line in extra_hosts_config:
# TODO: validate string contains ':' ?
host, ip = extra_hosts_line.split(':', 1)
extra_hosts_dict[host.strip()] = ip.strip()
return extra_hosts_dict
def normalize_path_for_engine(path):
"""Windows paths, c:\my\path\shiny, need to be changed to be compatible with
the Engine. Volume paths are expected to be linux style /c/my/path/shiny/
"""
drive, tail = splitdrive(path)
if drive:
path = '/' + drive.lower().rstrip(':') + tail
return path.replace('\\', '/')
class VolumeSpec(namedtuple('_VolumeSpec', 'external internal mode')):
@classmethod
def _parse_unix(cls, volume_config):
parts = volume_config.split(':')
if len(parts) > 3:
raise ConfigurationError(
"Volume %s has incorrect format, should be "
"external:internal[:mode]" % volume_config)
if len(parts) == 1:
external = None
internal = os.path.normpath(parts[0])
else:
external = os.path.normpath(parts[0])
internal = os.path.normpath(parts[1])
mode = 'rw'
if len(parts) == 3:
mode = parts[2]
return cls(external, internal, mode)
@classmethod
def _parse_win32(cls, volume_config, normalize):
# relative paths in windows expand to include the drive, eg C:\
# so we join the first 2 parts back together to count as one
mode = 'rw'
def separate_next_section(volume_config):
drive, tail = splitdrive(volume_config)
parts = tail.split(':', 1)
if drive:
parts[0] = drive + parts[0]
return parts
parts = separate_next_section(volume_config)
if len(parts) == 1:
internal = parts[0]
external = None
else:
external = parts[0]
parts = separate_next_section(parts[1])
external = os.path.normpath(external)
internal = parts[0]
if len(parts) > 1:
if ':' in parts[1]:
raise ConfigurationError(
"Volume %s has incorrect format, should be "
"external:internal[:mode]" % volume_config
)
mode = parts[1]
if normalize:
external = normalize_path_for_engine(external) if external else None
return cls(external, internal, mode)
@classmethod
def parse(cls, volume_config, normalize=False):
"""Parse a volume_config path and split it into external:internal[:mode]
parts to be returned as a valid VolumeSpec.
"""
if IS_WINDOWS_PLATFORM:
return cls._parse_win32(volume_config, normalize)
else:
return cls._parse_unix(volume_config)
def repr(self):
external = self.external + ':' if self.external else ''
return '{ext}{v.internal}:{v.mode}'.format(ext=external, v=self)
@property
def is_named_volume(self):
res = self.external and not self.external.startswith(('.', '/', '~'))
if not IS_WINDOWS_PLATFORM:
return res
return (
res and not self.external.startswith('\\') and
not win32_root_path_pattern.match(self.external)
)
class ServiceLink(namedtuple('_ServiceLink', 'target alias')):
@classmethod
def parse(cls, link_spec):
target, _, alias = link_spec.partition(':')
if not alias:
alias = target
return cls(target, alias)
def repr(self):
if self.target == self.alias:
return self.target
return '{s.target}:{s.alias}'.format(s=self)
@property
def merge_field(self):
return self.alias
class ServiceSecret(namedtuple('_ServiceSecret', 'source target uid gid mode')):
@classmethod
def parse(cls, spec):
if isinstance(spec, six.string_types):
return cls(spec, None, None, None, None)
return cls(
spec.get('source'),
spec.get('target'),
spec.get('uid'),
spec.get('gid'),
spec.get('mode'),
)
@property
def merge_field(self):
return self.source
def repr(self):
return dict(
[(k, v) for k, v in self._asdict().items() if v is not None]
)

View file

@ -0,0 +1,423 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import logging
import os
import re
import sys
import six
from docker.utils.ports import split_port
from jsonschema import Draft4Validator
from jsonschema import FormatChecker
from jsonschema import RefResolver
from jsonschema import ValidationError
from ..const import COMPOSEFILE_V1 as V1
from .errors import ConfigurationError
from .errors import VERSION_EXPLANATION
from .sort_services import get_service_name_from_network_mode
log = logging.getLogger(__name__)
DOCKER_CONFIG_HINTS = {
'cpu_share': 'cpu_shares',
'add_host': 'extra_hosts',
'hosts': 'extra_hosts',
'extra_host': 'extra_hosts',
'device': 'devices',
'link': 'links',
'memory_swap': 'memswap_limit',
'port': 'ports',
'privilege': 'privileged',
'priviliged': 'privileged',
'privilige': 'privileged',
'volume': 'volumes',
'workdir': 'working_dir',
}
VALID_NAME_CHARS = '[a-zA-Z0-9\._\-]'
VALID_EXPOSE_FORMAT = r'^\d+(\-\d+)?(\/[a-zA-Z]+)?$'
@FormatChecker.cls_checks(format="ports", raises=ValidationError)
def format_ports(instance):
try:
split_port(instance)
except ValueError as e:
raise ValidationError(six.text_type(e))
return True
@FormatChecker.cls_checks(format="expose", raises=ValidationError)
def format_expose(instance):
if isinstance(instance, six.string_types):
if not re.match(VALID_EXPOSE_FORMAT, instance):
raise ValidationError(
"should be of the format 'PORT[/PROTOCOL]'")
return True
def match_named_volumes(service_dict, project_volumes):
service_volumes = service_dict.get('volumes', [])
for volume_spec in service_volumes:
if volume_spec.is_named_volume and volume_spec.external not in project_volumes:
raise ConfigurationError(
'Named volume "{0}" is used in service "{1}" but no'
' declaration was found in the volumes section.'.format(
volume_spec.repr(), service_dict.get('name')
)
)
def python_type_to_yaml_type(type_):
type_name = type(type_).__name__
return {
'dict': 'mapping',
'list': 'array',
'int': 'number',
'float': 'number',
'bool': 'boolean',
'unicode': 'string',
'str': 'string',
'bytes': 'string',
}.get(type_name, type_name)
def validate_config_section(filename, config, section):
"""Validate the structure of a configuration section. This must be done
before interpolation so it's separate from schema validation.
"""
if not isinstance(config, dict):
raise ConfigurationError(
"In file '{filename}', {section} must be a mapping, not "
"{type}.".format(
filename=filename,
section=section,
type=anglicize_json_type(python_type_to_yaml_type(config))))
for key, value in config.items():
if not isinstance(key, six.string_types):
raise ConfigurationError(
"In file '{filename}', the {section} name {name} must be a "
"quoted string, i.e. '{name}'.".format(
filename=filename,
section=section,
name=key))
if not isinstance(value, (dict, type(None))):
raise ConfigurationError(
"In file '{filename}', {section} '{name}' must be a mapping not "
"{type}.".format(
filename=filename,
section=section,
name=key,
type=anglicize_json_type(python_type_to_yaml_type(value))))
def validate_top_level_object(config_file):
if not isinstance(config_file.config, dict):
raise ConfigurationError(
"Top level object in '{}' needs to be an object not '{}'.".format(
config_file.filename,
type(config_file.config)))
def validate_ulimits(service_config):
ulimit_config = service_config.config.get('ulimits', {})
for limit_name, soft_hard_values in six.iteritems(ulimit_config):
if isinstance(soft_hard_values, dict):
if not soft_hard_values['soft'] <= soft_hard_values['hard']:
raise ConfigurationError(
"Service '{s.name}' has invalid ulimit '{ulimit}'. "
"'soft' value can not be greater than 'hard' value ".format(
s=service_config,
ulimit=ulimit_config))
def validate_extends_file_path(service_name, extends_options, filename):
"""
The service to be extended must either be defined in the config key 'file',
or within 'filename'.
"""
error_prefix = "Invalid 'extends' configuration for %s:" % service_name
if 'file' not in extends_options and filename is None:
raise ConfigurationError(
"%s you need to specify a 'file', e.g. 'file: something.yml'" % error_prefix
)
def validate_network_mode(service_config, service_names):
network_mode = service_config.config.get('network_mode')
if not network_mode:
return
if 'networks' in service_config.config:
raise ConfigurationError("'network_mode' and 'networks' cannot be combined")
dependency = get_service_name_from_network_mode(network_mode)
if not dependency:
return
if dependency not in service_names:
raise ConfigurationError(
"Service '{s.name}' uses the network stack of service '{dep}' which "
"is undefined.".format(s=service_config, dep=dependency))
def validate_links(service_config, service_names):
for link in service_config.config.get('links', []):
if link.split(':')[0] not in service_names:
raise ConfigurationError(
"Service '{s.name}' has a link to service '{link}' which is "
"undefined.".format(s=service_config, link=link))
def validate_depends_on(service_config, service_names):
deps = service_config.config.get('depends_on', {})
for dependency in deps.keys():
if dependency not in service_names:
raise ConfigurationError(
"Service '{s.name}' depends on service '{dep}' which is "
"undefined.".format(s=service_config, dep=dependency)
)
def get_unsupported_config_msg(path, error_key):
msg = "Unsupported config option for {}: '{}'".format(path_string(path), error_key)
if error_key in DOCKER_CONFIG_HINTS:
msg += " (did you mean '{}'?)".format(DOCKER_CONFIG_HINTS[error_key])
return msg
def anglicize_json_type(json_type):
if json_type.startswith(('a', 'e', 'i', 'o', 'u')):
return 'an ' + json_type
return 'a ' + json_type
def is_service_dict_schema(schema_id):
return schema_id in ('config_schema_v1.json', '#/properties/services')
def handle_error_for_schema_with_id(error, path):
schema_id = error.schema['id']
if is_service_dict_schema(schema_id) and error.validator == 'additionalProperties':
return "Invalid service name '{}' - only {} characters are allowed".format(
# The service_name is the key to the json object
list(error.instance)[0],
VALID_NAME_CHARS)
if error.validator == 'additionalProperties':
if schema_id == '#/definitions/service':
invalid_config_key = parse_key_from_error_msg(error)
return get_unsupported_config_msg(path, invalid_config_key)
if not error.path:
return '{}\n\n{}'.format(error.message, VERSION_EXPLANATION)
def handle_generic_error(error, path):
msg_format = None
error_msg = error.message
if error.validator == 'oneOf':
msg_format = "{path} {msg}"
config_key, error_msg = _parse_oneof_validator(error)
if config_key:
path.append(config_key)
elif error.validator == 'type':
msg_format = "{path} contains an invalid type, it should be {msg}"
error_msg = _parse_valid_types_from_validator(error.validator_value)
elif error.validator == 'required':
error_msg = ", ".join(error.validator_value)
msg_format = "{path} is invalid, {msg} is required."
elif error.validator == 'dependencies':
config_key = list(error.validator_value.keys())[0]
required_keys = ",".join(error.validator_value[config_key])
msg_format = "{path} is invalid: {msg}"
path.append(config_key)
error_msg = "when defining '{}' you must set '{}' as well".format(
config_key,
required_keys)
elif error.cause:
error_msg = six.text_type(error.cause)
msg_format = "{path} is invalid: {msg}"
elif error.path:
msg_format = "{path} value {msg}"
if msg_format:
return msg_format.format(path=path_string(path), msg=error_msg)
return error.message
def parse_key_from_error_msg(error):
return error.message.split("'")[1]
def path_string(path):
return ".".join(c for c in path if isinstance(c, six.string_types))
def _parse_valid_types_from_validator(validator):
"""A validator value can be either an array of valid types or a string of
a valid type. Parse the valid types and prefix with the correct article.
"""
if not isinstance(validator, list):
return anglicize_json_type(validator)
if len(validator) == 1:
return anglicize_json_type(validator[0])
return "{}, or {}".format(
", ".join([anglicize_json_type(validator[0])] + validator[1:-1]),
anglicize_json_type(validator[-1]))
def _parse_oneof_validator(error):
"""oneOf has multiple schemas, so we need to reason about which schema, sub
schema or constraint the validation is failing on.
Inspecting the context value of a ValidationError gives us information about
which sub schema failed and which kind of error it is.
"""
types = []
for context in error.context:
if context.validator == 'oneOf':
_, error_msg = _parse_oneof_validator(context)
return path_string(context.path), error_msg
if context.validator == 'required':
return (None, context.message)
if context.validator == 'additionalProperties':
invalid_config_key = parse_key_from_error_msg(context)
return (None, "contains unsupported option: '{}'".format(invalid_config_key))
if context.path:
return (
path_string(context.path),
"contains {}, which is an invalid type, it should be {}".format(
json.dumps(context.instance),
_parse_valid_types_from_validator(context.validator_value)),
)
if context.validator == 'uniqueItems':
return (
None,
"contains non unique items, please remove duplicates from {}".format(
context.instance),
)
if context.validator == 'type':
types.append(context.validator_value)
valid_types = _parse_valid_types_from_validator(types)
return (None, "contains an invalid type, it should be {}".format(valid_types))
def process_service_constraint_errors(error, service_name, version):
if version == V1:
if 'image' in error.instance and 'build' in error.instance:
return (
"Service {} has both an image and build path specified. "
"A service can either be built to image or use an existing "
"image, not both.".format(service_name))
if 'image' in error.instance and 'dockerfile' in error.instance:
return (
"Service {} has both an image and alternate Dockerfile. "
"A service can either be built to image or use an existing "
"image, not both.".format(service_name))
if 'image' not in error.instance and 'build' not in error.instance:
return (
"Service {} has neither an image nor a build context specified. "
"At least one must be provided.".format(service_name))
def process_config_schema_errors(error):
path = list(error.path)
if 'id' in error.schema:
error_msg = handle_error_for_schema_with_id(error, path)
if error_msg:
return error_msg
return handle_generic_error(error, path)
def validate_against_config_schema(config_file):
schema = load_jsonschema(config_file.version)
format_checker = FormatChecker(["ports", "expose"])
validator = Draft4Validator(
schema,
resolver=RefResolver(get_resolver_path(), schema),
format_checker=format_checker)
handle_errors(
validator.iter_errors(config_file.config),
process_config_schema_errors,
config_file.filename)
def validate_service_constraints(config, service_name, version):
def handler(errors):
return process_service_constraint_errors(errors, service_name, version)
schema = load_jsonschema(version)
validator = Draft4Validator(schema['definitions']['constraints']['service'])
handle_errors(validator.iter_errors(config), handler, None)
def get_schema_path():
return os.path.dirname(os.path.abspath(__file__))
def load_jsonschema(version):
filename = os.path.join(
get_schema_path(),
"config_schema_v{0}.json".format(version))
with open(filename, "r") as fh:
return json.load(fh)
def get_resolver_path():
schema_path = get_schema_path()
if sys.platform == "win32":
scheme = "///"
# TODO: why is this necessary?
schema_path = schema_path.replace('\\', '/')
else:
scheme = "//"
return "file:{}{}/".format(scheme, schema_path)
def handle_errors(errors, format_error_func, filename):
"""jsonschema returns an error tree full of information to explain what has
gone wrong. Process each error and pull out relevant information and re-write
helpful error messages that are relevant.
"""
errors = list(sorted(errors, key=str))
if not errors:
return
error_msg = '\n'.join(format_error_func(error) for error in errors)
raise ConfigurationError(
"The Compose file{file_msg} is invalid because:\n{error_msg}".format(
file_msg=" '{}'".format(filename) if filename else "",
error_msg=error_msg))

41
compose/const.py Normal file
View file

@ -0,0 +1,41 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
DEFAULT_TIMEOUT = 10
HTTP_TIMEOUT = 60
IMAGE_EVENTS = ['delete', 'import', 'load', 'pull', 'push', 'save', 'tag', 'untag']
IS_WINDOWS_PLATFORM = (sys.platform == "win32")
LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number'
LABEL_ONE_OFF = 'com.docker.compose.oneoff'
LABEL_PROJECT = 'com.docker.compose.project'
LABEL_SERVICE = 'com.docker.compose.service'
LABEL_NETWORK = 'com.docker.compose.network'
LABEL_VERSION = 'com.docker.compose.version'
LABEL_VOLUME = 'com.docker.compose.volume'
LABEL_CONFIG_HASH = 'com.docker.compose.config-hash'
SECRETS_PATH = '/run/secrets'
COMPOSEFILE_V1 = '1'
COMPOSEFILE_V2_0 = '2.0'
COMPOSEFILE_V2_1 = '2.1'
COMPOSEFILE_V3_0 = '3.0'
COMPOSEFILE_V3_1 = '3.1'
API_VERSIONS = {
COMPOSEFILE_V1: '1.21',
COMPOSEFILE_V2_0: '1.22',
COMPOSEFILE_V2_1: '1.24',
COMPOSEFILE_V3_0: '1.25',
COMPOSEFILE_V3_1: '1.25',
}
API_VERSION_TO_ENGINE_VERSION = {
API_VERSIONS[COMPOSEFILE_V1]: '1.9.0',
API_VERSIONS[COMPOSEFILE_V2_0]: '1.10.0',
API_VERSIONS[COMPOSEFILE_V2_1]: '1.12.0',
API_VERSIONS[COMPOSEFILE_V3_0]: '1.13.0',
API_VERSIONS[COMPOSEFILE_V3_1]: '1.13.0',
}

View file

@ -1,8 +1,13 @@
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import unicode_literals
from functools import reduce
import six
from functools import reduce
from .const import LABEL_CONTAINER_NUMBER
from .const import LABEL_PROJECT
from .const import LABEL_SERVICE
class Container(object):
@ -14,22 +19,27 @@ class Container(object):
self.client = client
self.dictionary = dictionary
self.has_been_inspected = has_been_inspected
self.log_stream = None
@classmethod
def from_ps(cls, client, dictionary, **kwargs):
"""
Construct a container object from the output of GET /containers/json.
"""
name = get_container_name(dictionary)
if name is None:
return None
new_dictionary = {
'Id': dictionary['Id'],
'Image': dictionary['Image'],
'Name': '/' + get_container_name(dictionary),
'Name': '/' + name,
}
return cls(client, new_dictionary, **kwargs)
@classmethod
def from_id(cls, client, id):
return cls(client, client.inspect_container(id))
return cls(client, client.inspect_container(id), has_been_inspected=True)
@classmethod
def create(cls, client, **options):
@ -44,24 +54,38 @@ class Container(object):
def image(self):
return self.dictionary['Image']
@property
def image_config(self):
return self.client.inspect_image(self.image)
@property
def short_id(self):
return self.id[:10]
return self.id[:12]
@property
def name(self):
return self.dictionary['Name'][1:]
@property
def service(self):
return self.labels.get(LABEL_SERVICE)
@property
def name_without_project(self):
return '_'.join(self.dictionary['Name'].split('_')[1:])
project = self.labels.get(LABEL_PROJECT)
if self.name.startswith('{0}_{1}'.format(project, self.service)):
return '{0}_{1}'.format(self.service, self.number)
else:
return self.name
@property
def number(self):
try:
return int(self.name.split('_')[-1])
except ValueError:
return None
number = self.labels.get(LABEL_CONTAINER_NUMBER)
if not number:
raise ValueError("Container {0} does not have a {1} label".format(
self.short_id, LABEL_CONTAINER_NUMBER))
return int(number)
@property
def ports(self):
@ -79,8 +103,24 @@ class Container(object):
return ', '.join(format_port(*item)
for item in sorted(six.iteritems(self.ports)))
@property
def labels(self):
return self.get('Config.Labels') or {}
@property
def stop_signal(self):
return self.get('Config.StopSignal')
@property
def log_config(self):
return self.get('HostConfig.LogConfig') or None
@property
def human_readable_state(self):
if self.is_paused:
return 'Paused'
if self.is_restarting:
return 'Restarting'
if self.is_running:
return 'Ghost' if self.get('State.Ghost') else 'Up'
else:
@ -94,12 +134,44 @@ class Container(object):
@property
def environment(self):
return dict(var.split("=", 1) for var in self.get('Config.Env') or [])
def parse_env(var):
if '=' in var:
return var.split("=", 1)
return var, None
return dict(parse_env(var) for var in self.get('Config.Env') or [])
@property
def exit_code(self):
return self.get('State.ExitCode')
@property
def is_running(self):
return self.get('State.Running')
@property
def is_restarting(self):
return self.get('State.Restarting')
@property
def is_paused(self):
return self.get('State.Paused')
@property
def log_driver(self):
return self.get('HostConfig.LogConfig.Type')
@property
def has_api_logs(self):
log_type = self.log_driver
return not log_type or log_type in ('json-file', 'journald')
def attach_log_stream(self):
"""A log stream can only be attached if the container uses a json-file
log driver.
"""
if self.has_api_logs:
self.log_stream = self.attach(stdout=True, stderr=True, stream=True)
def get(self, key):
"""Return a value from the container or None if the value is not set.
@ -117,21 +189,48 @@ class Container(object):
port = self.ports.get("%s/%s" % (port, protocol))
return "{HostIp}:{HostPort}".format(**port[0]) if port else None
def get_mount(self, mount_dest):
for mount in self.get('Mounts'):
if mount['Destination'] == mount_dest:
return mount
return None
def start(self, **options):
return self.client.start(self.id, **options)
def stop(self, **options):
return self.client.stop(self.id, **options)
def pause(self, **options):
return self.client.pause(self.id, **options)
def unpause(self, **options):
return self.client.unpause(self.id, **options)
def kill(self, **options):
return self.client.kill(self.id, **options)
def restart(self):
return self.client.restart(self.id)
def restart(self, **options):
return self.client.restart(self.id, **options)
def remove(self, **options):
return self.client.remove_container(self.id, **options)
def create_exec(self, command, **options):
return self.client.exec_create(self.id, command, **options)
def start_exec(self, exec_id, **options):
return self.client.exec_start(exec_id, **options)
def rename_to_tmp_name(self):
"""Rename the container to a hopefully unique temporary container name
by prepending the short id.
"""
self.client.rename(
self.id,
'%s_%s' % (self.short_id, self.name)
)
def inspect_if_not_inspected(self):
if not self.has_been_inspected:
self.inspect()
@ -147,29 +246,20 @@ class Container(object):
self.has_been_inspected = True
return self.dictionary
def links(self):
links = []
for container in self.client.containers():
for name in container['Names']:
bits = name.split('/')
if len(bits) > 2 and bits[1] == self.name:
links.append(bits[2])
return links
def attach(self, *args, **kwargs):
return self.client.attach(self.id, *args, **kwargs)
def attach_socket(self, **kwargs):
return self.client.attach_socket(self.id, **kwargs)
def __repr__(self):
return '<Container: %s>' % self.name
return '<Container: %s (%s)>' % (self.name, self.id[:6])
def __eq__(self, other):
if type(self) != type(other):
return False
return self.id == other.id
def __hash__(self):
return self.id.__hash__()
def get_container_name(container):
if not container.get('Name') and not container.get('Names'):

33
compose/errors.py Normal file
View file

@ -0,0 +1,33 @@
from __future__ import absolute_import
from __future__ import unicode_literals
class OperationFailedError(Exception):
def __init__(self, reason):
self.msg = reason
class StreamParseError(RuntimeError):
def __init__(self, reason):
self.msg = reason
class HealthCheckException(Exception):
def __init__(self, reason):
self.msg = reason
class HealthCheckFailed(HealthCheckException):
def __init__(self, container_id):
super(HealthCheckFailed, self).__init__(
'Container "{}" is unhealthy.'.format(container_id)
)
class NoHealthCheckConfigured(HealthCheckException):
def __init__(self, service_name):
super(NoHealthCheckConfigured, self).__init__(
'Service "{}" is missing a healthcheck configuration'.format(
service_name
)
)

231
compose/network.py Normal file
View file

@ -0,0 +1,231 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from docker.errors import NotFound
from docker.types import IPAMConfig
from docker.types import IPAMPool
from docker.utils import version_gte
from docker.utils import version_lt
from .config import ConfigurationError
from .const import LABEL_NETWORK
from .const import LABEL_PROJECT
log = logging.getLogger(__name__)
OPTS_EXCEPTIONS = [
'com.docker.network.driver.overlay.vxlanid_list',
]
class Network(object):
def __init__(self, client, project, name, driver=None, driver_opts=None,
ipam=None, external_name=None, internal=False, enable_ipv6=False,
labels=None):
self.client = client
self.project = project
self.name = name
self.driver = driver
self.driver_opts = driver_opts
self.ipam = create_ipam_config_from_dict(ipam)
self.external_name = external_name
self.internal = internal
self.enable_ipv6 = enable_ipv6
self.labels = labels
def ensure(self):
if self.external_name:
try:
self.inspect()
log.debug(
'Network {0} declared as external. No new '
'network will be created.'.format(self.name)
)
except NotFound:
raise ConfigurationError(
'Network {name} declared as external, but could'
' not be found. Please create the network manually'
' using `{command} {name}` and try again.'.format(
name=self.external_name,
command='docker network create'
)
)
return
try:
data = self.inspect()
check_remote_network_config(data, self)
except NotFound:
driver_name = 'the default driver'
if self.driver:
driver_name = 'driver "{}"'.format(self.driver)
log.info(
'Creating network "{}" with {}'
.format(self.full_name, driver_name)
)
self.client.create_network(
name=self.full_name,
driver=self.driver,
options=self.driver_opts,
ipam=self.ipam,
internal=self.internal,
enable_ipv6=self.enable_ipv6,
labels=self._labels,
attachable=version_gte(self.client._version, '1.24') or None,
)
def remove(self):
if self.external_name:
log.info("Network %s is external, skipping", self.full_name)
return
log.info("Removing network {}".format(self.full_name))
self.client.remove_network(self.full_name)
def inspect(self):
return self.client.inspect_network(self.full_name)
@property
def full_name(self):
if self.external_name:
return self.external_name
return '{0}_{1}'.format(self.project, self.name)
@property
def _labels(self):
if version_lt(self.client._version, '1.23'):
return None
labels = self.labels.copy() if self.labels else {}
labels.update({
LABEL_PROJECT: self.project,
LABEL_NETWORK: self.name,
})
return labels
def create_ipam_config_from_dict(ipam_dict):
if not ipam_dict:
return None
return IPAMConfig(
driver=ipam_dict.get('driver'),
pool_configs=[
IPAMPool(
subnet=config.get('subnet'),
iprange=config.get('ip_range'),
gateway=config.get('gateway'),
aux_addresses=config.get('aux_addresses'),
)
for config in ipam_dict.get('config', [])
],
)
def check_remote_network_config(remote, local):
if local.driver and remote.get('Driver') != local.driver:
raise ConfigurationError(
'Network "{}" needs to be recreated - driver has changed'
.format(local.full_name)
)
local_opts = local.driver_opts or {}
remote_opts = remote.get('Options') or {}
for k in set.union(set(remote_opts.keys()), set(local_opts.keys())):
if k in OPTS_EXCEPTIONS:
continue
if remote_opts.get(k) != local_opts.get(k):
raise ConfigurationError(
'Network "{}" needs to be recreated - options have changed'
.format(local.full_name)
)
def build_networks(name, config_data, client):
network_config = config_data.networks or {}
networks = {
network_name: Network(
client=client, project=name, name=network_name,
driver=data.get('driver'),
driver_opts=data.get('driver_opts'),
ipam=data.get('ipam'),
external_name=data.get('external_name'),
internal=data.get('internal'),
enable_ipv6=data.get('enable_ipv6'),
labels=data.get('labels'),
)
for network_name, data in network_config.items()
}
if 'default' not in networks:
networks['default'] = Network(client, name, 'default')
return networks
class ProjectNetworks(object):
def __init__(self, networks, use_networking):
self.networks = networks or {}
self.use_networking = use_networking
@classmethod
def from_services(cls, services, networks, use_networking):
service_networks = {
network: networks.get(network)
for service in services
for network in get_network_names_for_service(service)
}
unused = set(networks) - set(service_networks) - {'default'}
if unused:
log.warn(
"Some networks were defined but are not used by any service: "
"{}".format(", ".join(unused)))
return cls(service_networks, use_networking)
def remove(self):
if not self.use_networking:
return
for network in self.networks.values():
try:
network.remove()
except NotFound:
log.warn("Network %s not found.", network.full_name)
def initialize(self):
if not self.use_networking:
return
for network in self.networks.values():
network.ensure()
def get_network_defs_for_service(service_dict):
if 'network_mode' in service_dict:
return {}
networks = service_dict.get('networks', {'default': None})
return dict(
(net, (config or {}))
for net, config in networks.items()
)
def get_network_names_for_service(service_dict):
return get_network_defs_for_service(service_dict).keys()
def get_networks(service_dict, network_definitions):
networks = {}
for name, netdef in get_network_defs_for_service(service_dict).items():
network = network_definitions.get(name)
if network:
networks[network.full_name] = netdef
else:
raise ConfigurationError(
'Service "{}" uses an undefined network "{}"'
.format(service_dict['name'], name))
return networks

259
compose/parallel.py Normal file
View file

@ -0,0 +1,259 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import operator
import sys
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
from compose.cli.signals import ShutdownException
from compose.errors import HealthCheckFailed
from compose.errors import NoHealthCheckConfigured
from compose.errors import OperationFailedError
from compose.utils import get_output_stream
log = logging.getLogger(__name__)
STOP = object()
def parallel_execute(objects, func, get_name, msg, get_deps=None):
"""Runs func on objects in parallel while ensuring that func is
ran on object only after it is ran on all its dependencies.
get_deps called on object must return a collection with its dependencies.
get_name called on object must return its name.
"""
objects = list(objects)
stream = get_output_stream(sys.stderr)
writer = ParallelStreamWriter(stream, msg)
for obj in objects:
writer.initialize(get_name(obj))
events = parallel_execute_iter(objects, func, get_deps)
errors = {}
results = []
error_to_reraise = None
for obj, result, exception in events:
if exception is None:
writer.write(get_name(obj), 'done')
results.append(result)
elif isinstance(exception, APIError):
errors[get_name(obj)] = exception.explanation
writer.write(get_name(obj), 'error')
elif isinstance(exception, (OperationFailedError, HealthCheckFailed, NoHealthCheckConfigured)):
errors[get_name(obj)] = exception.msg
writer.write(get_name(obj), 'error')
elif isinstance(exception, UpstreamError):
writer.write(get_name(obj), 'error')
else:
errors[get_name(obj)] = exception
error_to_reraise = exception
for obj_name, error in errors.items():
stream.write("\nERROR: for {} {}\n".format(obj_name, error))
if error_to_reraise:
raise error_to_reraise
return results, errors
def _no_deps(x):
return []
class State(object):
"""
Holds the state of a partially-complete parallel operation.
state.started: objects being processed
state.finished: objects which have been processed
state.failed: objects which either failed or whose dependencies failed
"""
def __init__(self, objects):
self.objects = objects
self.started = set()
self.finished = set()
self.failed = set()
def is_done(self):
return len(self.finished) + len(self.failed) >= len(self.objects)
def pending(self):
return set(self.objects) - self.started - self.finished - self.failed
def parallel_execute_iter(objects, func, get_deps):
"""
Runs func on objects in parallel while ensuring that func is
ran on object only after it is ran on all its dependencies.
Returns an iterator of tuples which look like:
# if func returned normally when run on object
(object, result, None)
# if func raised an exception when run on object
(object, None, exception)
# if func raised an exception when run on one of object's dependencies
(object, None, UpstreamError())
"""
if get_deps is None:
get_deps = _no_deps
results = Queue()
state = State(objects)
while True:
feed_queue(objects, func, get_deps, results, state)
try:
event = results.get(timeout=0.1)
except Empty:
continue
# See https://github.com/docker/compose/issues/189
except thread.error:
raise ShutdownException()
if event is STOP:
break
obj, _, exception = event
if exception is None:
log.debug('Finished processing: {}'.format(obj))
state.finished.add(obj)
else:
log.debug('Failed: {}'.format(obj))
state.failed.add(obj)
yield event
def producer(obj, func, results):
"""
The entry point for a producer thread which runs func on a single object.
Places a tuple on the results queue once func has either returned or raised.
"""
try:
result = func(obj)
results.put((obj, result, None))
except Exception as e:
results.put((obj, None, e))
def feed_queue(objects, func, get_deps, results, state):
"""
Starts producer threads for any objects which are ready to be processed
(i.e. they have no dependencies which haven't been successfully processed).
Shortcuts any objects whose dependencies have failed and places an
(object, None, UpstreamError()) tuple on the results queue.
"""
pending = state.pending()
log.debug('Pending: {}'.format(pending))
for obj in pending:
deps = get_deps(obj)
try:
if any(dep[0] in state.failed for dep in deps):
log.debug('{} has upstream errors - not processing'.format(obj))
results.put((obj, None, UpstreamError()))
state.failed.add(obj)
elif all(
dep not in objects or (
dep in state.finished and (not ready_check or ready_check(dep))
) for dep, ready_check in deps
):
log.debug('Starting producer thread for {}'.format(obj))
t = Thread(target=producer, args=(obj, func, results))
t.daemon = True
t.start()
state.started.add(obj)
except (HealthCheckFailed, NoHealthCheckConfigured) as e:
log.debug(
'Healthcheck for service(s) upstream of {} failed - '
'not processing'.format(obj)
)
results.put((obj, None, e))
if state.is_done():
results.put(STOP)
class UpstreamError(Exception):
pass
class ParallelStreamWriter(object):
"""Write out messages for operations happening in parallel.
Each operation has it's own line, and ANSI code characters are used
to jump to the correct line, and write over the line.
"""
def __init__(self, stream, msg):
self.stream = stream
self.msg = msg
self.lines = []
def initialize(self, obj_index):
if self.msg is None:
return
self.lines.append(obj_index)
self.stream.write("{} {} ... \r\n".format(self.msg, obj_index))
self.stream.flush()
def write(self, obj_index, status):
if self.msg is None:
return
position = self.lines.index(obj_index)
diff = len(self.lines) - position
# move up
self.stream.write("%c[%dA" % (27, diff))
# erase
self.stream.write("%c[2K\r" % 27)
self.stream.write("{} {} ... {}\r".format(self.msg, obj_index, status))
# move back down
self.stream.write("%c[%dB" % (27, diff))
self.stream.flush()
def parallel_operation(containers, operation, options, message):
parallel_execute(
containers,
operator.methodcaller(operation, **options),
operator.attrgetter('name'),
message)
def parallel_remove(containers, options):
stopped_containers = [c for c in containers if not c.is_running]
parallel_operation(stopped_containers, 'remove', options, 'Removing')
def parallel_start(containers, options):
parallel_operation(containers, 'start', options, 'Starting')
def parallel_pause(containers, options):
parallel_operation(containers, 'pause', options, 'Pausing')
def parallel_unpause(containers, options):
parallel_operation(containers, 'unpause', options, 'Unpausing')
def parallel_kill(containers, options):
parallel_operation(containers, 'kill', options, 'Killing')

View file

@ -1,6 +1,7 @@
import json
import os
import codecs
from __future__ import absolute_import
from __future__ import unicode_literals
from compose import utils
class StreamOutputError(Exception):
@ -8,35 +9,41 @@ class StreamOutputError(Exception):
def stream_output(output, stream):
is_terminal = hasattr(stream, 'fileno') and os.isatty(stream.fileno())
stream = codecs.getwriter('utf-8')(stream)
is_terminal = hasattr(stream, 'isatty') and stream.isatty()
stream = utils.get_output_stream(stream)
all_events = []
lines = {}
diff = 0
for chunk in output:
event = json.loads(chunk)
for event in utils.json_stream(output):
all_events.append(event)
is_progress_event = 'progress' in event or 'progressDetail' in event
if 'progress' in event or 'progressDetail' in event:
image_id = event.get('id')
if not image_id:
continue
if not is_progress_event:
print_output_event(event, stream, is_terminal)
stream.flush()
continue
if image_id in lines:
diff = len(lines) - lines[image_id]
else:
lines[image_id] = len(lines)
stream.write("\n")
diff = 0
if not is_terminal:
continue
if is_terminal:
# move cursor up `diff` rows
stream.write("%c[%dA" % (27, diff))
# if it's a progress event and we have a terminal, then display the progress bars
image_id = event.get('id')
if not image_id:
continue
if image_id not in lines:
lines[image_id] = len(lines)
stream.write("\n")
diff = len(lines) - lines[image_id]
# move cursor up `diff` rows
stream.write("%c[%dA" % (27, diff))
print_output_event(event, stream, is_terminal)
if 'id' in event and is_terminal:
if 'id' in event:
# move cursor back down
stream.write("%c[%dB" % (27, diff))
@ -55,7 +62,6 @@ def print_output_event(event, stream, is_terminal):
# erase current line
stream.write("%c[2K\r" % 27)
terminator = "\r"
pass
elif 'progressDetail' in event:
return
@ -74,8 +80,9 @@ def print_output_event(event, stream, is_terminal):
stream.write("%s %s%s" % (status, event['progress'], terminator))
elif 'progressDetail' in event:
detail = event['progressDetail']
if 'current' in detail:
percentage = float(detail['current']) / float(detail['total']) * 100
total = detail.get('total')
if 'current' in detail and total:
percentage = float(detail['current']) / float(total) * 100
stream.write('%s (%.1f%%)%s' % (status, percentage, terminator))
else:
stream.write('%s%s' % (status, terminator))
@ -83,3 +90,22 @@ def print_output_event(event, stream, is_terminal):
stream.write("%s%s" % (event['stream'], terminator))
else:
stream.write("%s%s\n" % (status, terminator))
def get_digest_from_pull(events):
for event in events:
status = event.get('status')
if not status or 'Digest' not in status:
continue
_, digest = status.split(':', 1)
return digest.strip()
return None
def get_digest_from_push(events):
for event in events:
digest = event.get('aux', {}).get('Digest')
if digest:
return digest
return None

View file

@ -1,80 +1,134 @@
from __future__ import unicode_literals
from __future__ import absolute_import
import logging
from __future__ import unicode_literals
import datetime
import logging
import operator
from functools import reduce
from .config import get_service_name_from_net, ConfigurationError
from .service import Service
from .container import Container
import enum
from docker.errors import APIError
from . import parallel
from .config import ConfigurationError
from .config.config import V1
from .config.sort_services import get_container_name_from_network_mode
from .config.sort_services import get_service_name_from_network_mode
from .const import IMAGE_EVENTS
from .const import LABEL_ONE_OFF
from .const import LABEL_PROJECT
from .const import LABEL_SERVICE
from .container import Container
from .network import build_networks
from .network import get_networks
from .network import ProjectNetworks
from .service import BuildAction
from .service import ContainerNetworkMode
from .service import ConvergenceStrategy
from .service import NetworkMode
from .service import Service
from .service import ServiceNetworkMode
from .utils import microseconds_from_time_nano
from .volume import ProjectVolumes
log = logging.getLogger(__name__)
def sort_service_dicts(services):
# Topological sort (Cormen/Tarjan algorithm).
unmarked = services[:]
temporary_marked = set()
sorted_services = []
@enum.unique
class OneOffFilter(enum.Enum):
include = 0
exclude = 1
only = 2
def get_service_names(links):
return [link.split(':')[0] for link in links]
def get_service_dependents(service_dict, services):
name = service_dict['name']
return [
service for service in services
if (name in get_service_names(service.get('links', [])) or
name in service.get('volumes_from', []) or
name == get_service_name_from_net(service.get('net')))
]
def visit(n):
if n['name'] in temporary_marked:
if n['name'] in get_service_names(n.get('links', [])):
raise DependencyError('A service can not link to itself: %s' % n['name'])
if n['name'] in n.get('volumes_from', []):
raise DependencyError('A service can not mount itself as volume: %s' % n['name'])
else:
raise DependencyError('Circular import between %s' % ' and '.join(temporary_marked))
if n in unmarked:
temporary_marked.add(n['name'])
for m in get_service_dependents(n, services):
visit(m)
temporary_marked.remove(n['name'])
unmarked.remove(n)
sorted_services.insert(0, n)
while unmarked:
visit(unmarked[-1])
return sorted_services
@classmethod
def update_labels(cls, value, labels):
if value == cls.only:
labels.append('{0}={1}'.format(LABEL_ONE_OFF, "True"))
elif value == cls.exclude:
labels.append('{0}={1}'.format(LABEL_ONE_OFF, "False"))
elif value == cls.include:
pass
else:
raise ValueError("Invalid value for one_off: {}".format(repr(value)))
class Project(object):
"""
A collection of services.
"""
def __init__(self, name, services, client):
def __init__(self, name, services, client, networks=None, volumes=None):
self.name = name
self.services = services
self.client = client
self.volumes = volumes or ProjectVolumes({})
self.networks = networks or ProjectNetworks({}, False)
def labels(self, one_off=OneOffFilter.exclude):
labels = ['{0}={1}'.format(LABEL_PROJECT, self.name)]
OneOffFilter.update_labels(one_off, labels)
return labels
@classmethod
def from_dicts(cls, name, service_dicts, client):
def from_config(cls, name, config_data, client):
"""
Construct a ServiceCollection from a list of dicts representing services.
Construct a Project from a config.Config object.
"""
project = cls(name, [], client)
for service_dict in sort_service_dicts(service_dicts):
links = project.get_links(service_dict)
volumes_from = project.get_volumes_from(service_dict)
net = project.get_net(service_dict)
use_networking = (config_data.version and config_data.version != V1)
networks = build_networks(name, config_data, client)
project_networks = ProjectNetworks.from_services(
config_data.services,
networks,
use_networking)
volumes = ProjectVolumes.from_config(name, config_data, client)
project = cls(name, [], client, project_networks, volumes)
for service_dict in config_data.services:
service_dict = dict(service_dict)
if use_networking:
service_networks = get_networks(service_dict, networks)
else:
service_networks = {}
service_dict.pop('networks', None)
links = project.get_links(service_dict)
network_mode = project.get_network_mode(
service_dict, list(service_networks.keys())
)
volumes_from = get_volumes_from(project, service_dict)
if config_data.version != V1:
service_dict['volumes'] = [
volumes.namespace_spec(volume_spec)
for volume_spec in service_dict.get('volumes', [])
]
secrets = get_secrets(
service_dict['name'],
service_dict.pop('secrets', None) or [],
config_data.secrets)
project.services.append(
Service(
service_dict.pop('name'),
client=client,
project=name,
use_networking=use_networking,
networks=service_networks,
links=links,
network_mode=network_mode,
volumes_from=volumes_from,
secrets=secrets,
**service_dict)
)
project.services.append(Service(client=client, project=name, links=links, net=net,
volumes_from=volumes_from, **service_dict))
return project
@property
def service_names(self):
return [service.name for service in self.services]
def get_service(self, name):
"""
Retrieve a service by name. Raises NoSuchService
@ -86,6 +140,16 @@ class Project(object):
raise NoSuchService(name)
def validate_service_names(self, service_names):
"""
Validate that the given list of service names only contains valid
services. Raises NoSuchService if one of the names is invalid.
"""
valid_names = self.service_names
for name in service_names:
if name not in valid_names:
raise NoSuchService(name)
def get_services(self, service_names=None, include_deps=False):
"""
Returns a list of this project's services filtered
@ -101,20 +165,24 @@ class Project(object):
Raises NoSuchService if any of the named services do not exist.
"""
if service_names is None or len(service_names) == 0:
return self.get_services(
service_names=[s.name for s in self.services],
include_deps=include_deps
)
else:
unsorted = [self.get_service(name) for name in service_names]
services = [s for s in self.services if s in unsorted]
service_names = self.service_names
if include_deps:
services = reduce(self._inject_deps, services, [])
unsorted = [self.get_service(name) for name in service_names]
services = [s for s in self.services if s in unsorted]
uniques = []
[uniques.append(s) for s in services if s not in uniques]
return uniques
if include_deps:
services = reduce(self._inject_deps, services, [])
uniques = []
[uniques.append(s) for s in services if s not in uniques]
return uniques
def get_services_without_duplicate(self, service_names=None, include_deps=False):
services = self.get_services(service_names, include_deps)
for service in services:
service.remove_duplicate_containers()
return services
def get_links(self, service_dict):
links = []
@ -127,114 +195,321 @@ class Project(object):
try:
links.append((self.get_service(service_name), link_name))
except NoSuchService:
raise ConfigurationError('Service "%s" has a link to service "%s" which does not exist.' % (service_dict['name'], service_name))
raise ConfigurationError(
'Service "%s" has a link to service "%s" which does not '
'exist.' % (service_dict['name'], service_name))
del service_dict['links']
return links
def get_volumes_from(self, service_dict):
volumes_from = []
if 'volumes_from' in service_dict:
for volume_name in service_dict.get('volumes_from', []):
try:
service = self.get_service(volume_name)
volumes_from.append(service)
except NoSuchService:
try:
container = Container.from_id(self.client, volume_name)
volumes_from.append(container)
except APIError:
raise ConfigurationError('Service "%s" mounts volumes from "%s", which is not the name of a service or container.' % (service_dict['name'], volume_name))
del service_dict['volumes_from']
return volumes_from
def get_network_mode(self, service_dict, networks):
network_mode = service_dict.pop('network_mode', None)
if not network_mode:
if self.networks.use_networking:
return NetworkMode(networks[0]) if networks else NetworkMode('none')
return NetworkMode(None)
def get_net(self, service_dict):
if 'net' in service_dict:
net_name = get_service_name_from_net(service_dict.get('net'))
service_name = get_service_name_from_network_mode(network_mode)
if service_name:
return ServiceNetworkMode(self.get_service(service_name))
if net_name:
try:
net = self.get_service(net_name)
except NoSuchService:
try:
net = Container.from_id(self.client, net_name)
except APIError:
raise ConfigurationError('Serivce "%s" is trying to use the network of "%s", which is not the name of a service or container.' % (service_dict['name'], net_name))
else:
net = service_dict['net']
container_name = get_container_name_from_network_mode(network_mode)
if container_name:
try:
return ContainerNetworkMode(Container.from_id(self.client, container_name))
except APIError:
raise ConfigurationError(
"Service '{name}' uses the network stack of container '{dep}' which "
"does not exist.".format(name=service_dict['name'], dep=container_name))
del service_dict['net']
else:
net = 'bridge'
return net
return NetworkMode(network_mode)
def start(self, service_names=None, **options):
for service in self.get_services(service_names):
service.start(**options)
containers = []
def stop(self, service_names=None, **options):
for service in reversed(self.get_services(service_names)):
service.stop(**options)
def start_service(service):
service_containers = service.start(quiet=True, **options)
containers.extend(service_containers)
services = self.get_services(service_names)
def get_deps(service):
return {
(self.get_service(dep), config)
for dep, config in service.get_dependency_configs().items()
}
parallel.parallel_execute(
services,
start_service,
operator.attrgetter('name'),
'Starting',
get_deps)
return containers
def stop(self, service_names=None, one_off=OneOffFilter.exclude, **options):
containers = self.containers(service_names, one_off=one_off)
def get_deps(container):
# actually returning inversed dependencies
return {(other, None) for other in containers
if container.service in
self.get_service(other.service).get_dependency_names()}
parallel.parallel_execute(
containers,
self.build_container_operation_with_timeout_func('stop', options),
operator.attrgetter('name'),
'Stopping',
get_deps)
def pause(self, service_names=None, **options):
containers = self.containers(service_names)
parallel.parallel_pause(reversed(containers), options)
return containers
def unpause(self, service_names=None, **options):
containers = self.containers(service_names)
parallel.parallel_unpause(containers, options)
return containers
def kill(self, service_names=None, **options):
for service in reversed(self.get_services(service_names)):
service.kill(**options)
parallel.parallel_kill(self.containers(service_names), options)
def remove_stopped(self, service_names=None, one_off=OneOffFilter.exclude, **options):
parallel.parallel_remove(self.containers(
service_names, stopped=True, one_off=one_off
), options)
def down(self, remove_image_type, include_volumes, remove_orphans=False):
self.stop(one_off=OneOffFilter.include)
self.find_orphan_containers(remove_orphans)
self.remove_stopped(v=include_volumes, one_off=OneOffFilter.include)
self.networks.remove()
if include_volumes:
self.volumes.remove()
self.remove_images(remove_image_type)
def remove_images(self, remove_image_type):
for service in self.get_services():
service.remove_image(remove_image_type)
def restart(self, service_names=None, **options):
for service in self.get_services(service_names):
service.restart(**options)
containers = self.containers(service_names, stopped=True)
def build(self, service_names=None, no_cache=False):
parallel.parallel_execute(
containers,
self.build_container_operation_with_timeout_func('restart', options),
operator.attrgetter('name'),
'Restarting')
return containers
def build(self, service_names=None, no_cache=False, pull=False, force_rm=False):
for service in self.get_services(service_names):
if service.can_be_built():
service.build(no_cache)
service.build(no_cache, pull, force_rm)
else:
log.info('%s uses an image, skipping' % service.name)
def create(
self,
service_names=None,
strategy=ConvergenceStrategy.changed,
do_build=BuildAction.none,
):
services = self.get_services_without_duplicate(service_names, include_deps=True)
for svc in services:
svc.ensure_image_exists(do_build=do_build)
plans = self._get_convergence_plans(services, strategy)
for service in services:
service.execute_convergence_plan(
plans[service.name],
detached=True,
start=False)
def events(self, service_names=None):
def build_container_event(event, container):
time = datetime.datetime.fromtimestamp(event['time'])
time = time.replace(
microsecond=microseconds_from_time_nano(event['timeNano']))
return {
'time': time,
'type': 'container',
'action': event['status'],
'id': container.id,
'service': container.service,
'attributes': {
'name': container.name,
'image': event['from'],
},
'container': container,
}
service_names = set(service_names or self.service_names)
for event in self.client.events(
filters={'label': self.labels()},
decode=True
):
# The first part of this condition is a guard against some events
# broadcasted by swarm that don't have a status field.
# See https://github.com/docker/compose/issues/3316
if 'status' not in event or event['status'] in IMAGE_EVENTS:
# We don't receive any image events because labels aren't applied
# to images
continue
# TODO: get labels from the API v1.22 , see github issue 2618
try:
# this can fail if the container has been removed
container = Container.from_id(self.client, event['id'])
except APIError:
continue
if container.service not in service_names:
continue
yield build_container_event(event, container)
def up(self,
service_names=None,
start_deps=True,
recreate=True,
insecure_registry=False,
detach=False,
do_build=True):
running_containers = []
for service in self.get_services(service_names, include_deps=start_deps):
if recreate:
for (_, container) in service.recreate_containers(
insecure_registry=insecure_registry,
detach=detach,
do_build=do_build):
running_containers.append(container)
strategy=ConvergenceStrategy.changed,
do_build=BuildAction.none,
timeout=None,
detached=False,
remove_orphans=False):
warn_for_swarm_mode(self.client)
self.initialize()
self.find_orphan_containers(remove_orphans)
services = self.get_services_without_duplicate(
service_names,
include_deps=start_deps)
for svc in services:
svc.ensure_image_exists(do_build=do_build)
plans = self._get_convergence_plans(services, strategy)
def do(service):
return service.execute_convergence_plan(
plans[service.name],
timeout=timeout,
detached=detached
)
def get_deps(service):
return {
(self.get_service(dep), config)
for dep, config in service.get_dependency_configs().items()
}
results, errors = parallel.parallel_execute(
services,
do,
operator.attrgetter('name'),
None,
get_deps
)
if errors:
raise ProjectError(
'Encountered errors while bringing up the project.'
)
return [
container
for svc_containers in results
if svc_containers is not None
for container in svc_containers
]
def initialize(self):
self.networks.initialize()
self.volumes.initialize()
def _get_convergence_plans(self, services, strategy):
plans = {}
for service in services:
updated_dependencies = [
name
for name in service.get_dependency_names()
if name in plans and
plans[name].action in ('recreate', 'create')
]
if updated_dependencies and strategy.allows_recreate:
log.debug('%s has upstream changes (%s)',
service.name,
", ".join(updated_dependencies))
plan = service.convergence_plan(ConvergenceStrategy.always)
else:
for container in service.start_or_create_containers(
insecure_registry=insecure_registry,
detach=detach,
do_build=do_build):
running_containers.append(container)
plan = service.convergence_plan(strategy)
return running_containers
plans[service.name] = plan
def pull(self, service_names=None, insecure_registry=False):
for service in self.get_services(service_names, include_deps=True):
service.pull(insecure_registry=insecure_registry)
return plans
def remove_stopped(self, service_names=None, **options):
for service in self.get_services(service_names):
service.remove_stopped(**options)
def pull(self, service_names=None, ignore_pull_failures=False):
for service in self.get_services(service_names, include_deps=False):
service.pull(ignore_pull_failures)
def containers(self, service_names=None, stopped=False, one_off=False):
return [Container.from_ps(self.client, container)
for container in self.client.containers(all=stopped)
for service in self.get_services(service_names)
if service.has_container(container, one_off=one_off)]
def push(self, service_names=None, ignore_push_failures=False):
for service in self.get_services(service_names, include_deps=False):
service.push(ignore_push_failures)
def _labeled_containers(self, stopped=False, one_off=OneOffFilter.exclude):
return list(filter(None, [
Container.from_ps(self.client, container)
for container in self.client.containers(
all=stopped,
filters={'label': self.labels(one_off=one_off)})])
)
def containers(self, service_names=None, stopped=False, one_off=OneOffFilter.exclude):
if service_names:
self.validate_service_names(service_names)
else:
service_names = self.service_names
containers = self._labeled_containers(stopped, one_off)
def matches_service_names(container):
return container.labels.get(LABEL_SERVICE) in service_names
return [c for c in containers if matches_service_names(c)]
def find_orphan_containers(self, remove_orphans):
def _find():
containers = self._labeled_containers()
for ctnr in containers:
service_name = ctnr.labels.get(LABEL_SERVICE)
if service_name not in self.service_names:
yield ctnr
orphans = list(_find())
if not orphans:
return
if remove_orphans:
for ctnr in orphans:
log.info('Removing orphan container "{0}"'.format(ctnr.name))
ctnr.kill()
ctnr.remove(force=True)
else:
log.warning(
'Found orphan containers ({0}) for this project. If '
'you removed or renamed this service in your compose '
'file, you can run this command with the '
'--remove-orphans flag to clean it up.'.format(
', '.join(["{}".format(ctnr.name) for ctnr in orphans])
)
)
def _inject_deps(self, acc, service):
net_name = service.get_net_name()
dep_names = (service.get_linked_names() +
service.get_volumes_from_names() +
([net_name] if net_name else []))
dep_names = service.get_dependency_names()
if len(dep_names) > 0:
dep_services = self.get_services(
@ -247,6 +522,85 @@ class Project(object):
dep_services.append(service)
return acc + dep_services
def build_container_operation_with_timeout_func(self, operation, options):
def container_operation_with_timeout(container):
if options.get('timeout') is None:
service = self.get_service(container.service)
options['timeout'] = service.stop_timeout(None)
return getattr(container, operation)(**options)
return container_operation_with_timeout
def get_volumes_from(project, service_dict):
volumes_from = service_dict.pop('volumes_from', None)
if not volumes_from:
return []
def build_volume_from(spec):
if spec.type == 'service':
try:
return spec._replace(source=project.get_service(spec.source))
except NoSuchService:
pass
if spec.type == 'container':
try:
container = Container.from_id(project.client, spec.source)
return spec._replace(source=container)
except APIError:
pass
raise ConfigurationError(
"Service \"{}\" mounts volumes from \"{}\", which is not the name "
"of a service or container.".format(
service_dict['name'],
spec.source))
return [build_volume_from(vf) for vf in volumes_from]
def get_secrets(service, service_secrets, secret_defs):
secrets = []
for secret in service_secrets:
secret_def = secret_defs.get(secret.source)
if not secret_def:
raise ConfigurationError(
"Service \"{service}\" uses an undefined secret \"{secret}\" "
.format(service=service, secret=secret.source))
if secret_def.get('external_name'):
log.warn("Service \"{service}\" uses secret \"{secret}\" which is external. "
"External secrets are not available to containers created by "
"docker-compose.".format(service=service, secret=secret.source))
continue
if secret.uid or secret.gid or secret.mode:
log.warn("Service \"{service}\" uses secret \"{secret}\" with uid, "
"gid, or mode. These fields are not supported by this "
"implementation of the Compose file".format(
service=service, secret=secret.source))
secrets.append({'secret': secret, 'file': secret_def.get('file')})
return secrets
def warn_for_swarm_mode(client):
info = client.info()
if info.get('Swarm', {}).get('LocalNodeState') == 'active':
if info.get('ServerVersion', '').startswith('ucp'):
# UCP does multi-node scheduling with traditional Compose files.
return
log.warn(
"The Docker Engine you're using is running in swarm mode.\n\n"
"Compose does not use swarm mode to deploy services to multiple nodes in a swarm. "
"All containers will be scheduled on the current node.\n\n"
"To deploy your application across the swarm, "
"use `docker stack deploy`.\n"
)
class NoSuchService(Exception):
def __init__(self, name):
@ -257,5 +611,6 @@ class NoSuchService(Exception):
return self.msg
class DependencyError(ConfigurationError):
pass
class ProjectError(Exception):
def __init__(self, msg):
self.msg = msg

File diff suppressed because it is too large Load diff

0
compose/state.py Normal file
View file

96
compose/timeparse.py Normal file
View file

@ -0,0 +1,96 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
timeparse.py
(c) Will Roberts <wildwilhelm@gmail.com> 1 February, 2014
This is a vendored and modified copy of:
github.com/wroberts/pytimeparse @ cc0550d
It has been modified to mimic the behaviour of
https://golang.org/pkg/time/#ParseDuration
'''
# MIT LICENSE
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
from __future__ import unicode_literals
import re
HOURS = r'(?P<hours>[\d.]+)h'
MINS = r'(?P<mins>[\d.]+)m'
SECS = r'(?P<secs>[\d.]+)s'
MILLI = r'(?P<milli>[\d.]+)ms'
MICRO = r'(?P<micro>[\d.]+)(?:us|µs)'
NANO = r'(?P<nano>[\d.]+)ns'
def opt(x):
return r'(?:{x})?'.format(x=x)
TIMEFORMAT = r'{HOURS}{MINS}{SECS}{MILLI}{MICRO}{NANO}'.format(
HOURS=opt(HOURS),
MINS=opt(MINS),
SECS=opt(SECS),
MILLI=opt(MILLI),
MICRO=opt(MICRO),
NANO=opt(NANO),
)
MULTIPLIERS = dict([
('hours', 60 * 60),
('mins', 60),
('secs', 1),
('milli', 1.0 / 1000),
('micro', 1.0 / 1000.0 / 1000),
('nano', 1.0 / 1000.0 / 1000.0 / 1000.0),
])
def timeparse(sval):
"""Parse a time expression, returning it as a number of seconds. If
possible, the return value will be an `int`; if this is not
possible, the return will be a `float`. Returns `None` if a time
expression cannot be parsed from the given string.
Arguments:
- `sval`: the string value to parse
>>> timeparse('1m24s')
84
>>> timeparse('1.2 minutes')
72
>>> timeparse('1.2 seconds')
1.2
"""
match = re.match(r'\s*' + TIMEFORMAT + r'\s*$', sval, re.I)
if not match or not match.group(0).strip():
return
mdict = match.groupdict()
return sum(
MULTIPLIERS[k] * cast(v) for (k, v) in mdict.items() if v is not None)
def cast(value):
return int(value, 10) if value.isdigit() else float(value)

135
compose/utils.py Normal file
View file

@ -0,0 +1,135 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import hashlib
import json
import json.decoder
import logging
import ntpath
import six
from .errors import StreamParseError
from .timeparse import timeparse
json_decoder = json.JSONDecoder()
log = logging.getLogger(__name__)
def get_output_stream(stream):
if six.PY3:
return stream
return codecs.getwriter('utf-8')(stream)
def stream_as_text(stream):
"""Given a stream of bytes or text, if any of the items in the stream
are bytes convert them to text.
This function can be removed once docker-py returns text streams instead
of byte streams.
"""
for data in stream:
if not isinstance(data, six.text_type):
data = data.decode('utf-8', 'replace')
yield data
def line_splitter(buffer, separator=u'\n'):
index = buffer.find(six.text_type(separator))
if index == -1:
return None
return buffer[:index + 1], buffer[index + 1:]
def split_buffer(stream, splitter=None, decoder=lambda a: a):
"""Given a generator which yields strings and a splitter function,
joins all input, splits on the separator and yields each chunk.
Unlike string.split(), each chunk includes the trailing
separator, except for the last one if none was found on the end
of the input.
"""
splitter = splitter or line_splitter
buffered = six.text_type('')
for data in stream_as_text(stream):
buffered += data
while True:
buffer_split = splitter(buffered)
if buffer_split is None:
break
item, buffered = buffer_split
yield item
if buffered:
try:
yield decoder(buffered)
except Exception as e:
log.error(
'Compose tried decoding the following data chunk, but failed:'
'\n%s' % repr(buffered)
)
raise StreamParseError(e)
def json_splitter(buffer):
"""Attempt to parse a json object from a buffer. If there is at least one
object, return it and the rest of the buffer, otherwise return None.
"""
buffer = buffer.strip()
try:
obj, index = json_decoder.raw_decode(buffer)
rest = buffer[json.decoder.WHITESPACE.match(buffer, index).end():]
return obj, rest
except ValueError:
return None
def json_stream(stream):
"""Given a stream of text, return a stream of json objects.
This handles streams which are inconsistently buffered (some entries may
be newline delimited, and others are not).
"""
return split_buffer(stream, json_splitter, json_decoder.decode)
def json_hash(obj):
dump = json.dumps(obj, sort_keys=True, separators=(',', ':'))
h = hashlib.sha256()
h.update(dump.encode('utf8'))
return h.hexdigest()
def microseconds_from_time_nano(time_nano):
return int(time_nano % 1000000000 / 1000)
def nanoseconds_from_time_seconds(time_seconds):
return time_seconds * 1000000000
def parse_seconds_float(value):
return timeparse(value or '')
def parse_nanoseconds_int(value):
parsed = timeparse(value or '')
if parsed is None:
return None
return int(parsed * 1000000000)
def build_string_dict(source_dict):
return dict((k, str(v if v is not None else '')) for k, v in source_dict.items())
def splitdrive(path):
if len(path) == 0:
return ('', '')
if path[0] in ['.', '\\', '/', '~']:
return ('', path)
return ntpath.splitdrive(path)

151
compose/volume.py Normal file
View file

@ -0,0 +1,151 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from docker.errors import NotFound
from docker.utils import version_lt
from .config import ConfigurationError
from .const import LABEL_PROJECT
from .const import LABEL_VOLUME
log = logging.getLogger(__name__)
class Volume(object):
def __init__(self, client, project, name, driver=None, driver_opts=None,
external_name=None, labels=None):
self.client = client
self.project = project
self.name = name
self.driver = driver
self.driver_opts = driver_opts
self.external_name = external_name
self.labels = labels
def create(self):
return self.client.create_volume(
self.full_name, self.driver, self.driver_opts, labels=self._labels
)
def remove(self):
if self.external:
log.info("Volume %s is external, skipping", self.full_name)
return
log.info("Removing volume %s", self.full_name)
return self.client.remove_volume(self.full_name)
def inspect(self):
return self.client.inspect_volume(self.full_name)
def exists(self):
try:
self.inspect()
except NotFound:
return False
return True
@property
def external(self):
return bool(self.external_name)
@property
def full_name(self):
if self.external_name:
return self.external_name
return '{0}_{1}'.format(self.project, self.name)
@property
def _labels(self):
if version_lt(self.client._version, '1.23'):
return None
labels = self.labels.copy() if self.labels else {}
labels.update({
LABEL_PROJECT: self.project,
LABEL_VOLUME: self.name,
})
return labels
class ProjectVolumes(object):
def __init__(self, volumes):
self.volumes = volumes
@classmethod
def from_config(cls, name, config_data, client):
config_volumes = config_data.volumes or {}
volumes = {
vol_name: Volume(
client=client,
project=name,
name=vol_name,
driver=data.get('driver'),
driver_opts=data.get('driver_opts'),
external_name=data.get('external_name'),
labels=data.get('labels')
)
for vol_name, data in config_volumes.items()
}
return cls(volumes)
def remove(self):
for volume in self.volumes.values():
try:
volume.remove()
except NotFound:
log.warn("Volume %s not found.", volume.full_name)
def initialize(self):
try:
for volume in self.volumes.values():
volume_exists = volume.exists()
if volume.external:
log.debug(
'Volume {0} declared as external. No new '
'volume will be created.'.format(volume.name)
)
if not volume_exists:
raise ConfigurationError(
'Volume {name} declared as external, but could'
' not be found. Please create the volume manually'
' using `{command}{name}` and try again.'.format(
name=volume.full_name,
command='docker volume create --name='
)
)
continue
if not volume_exists:
log.info(
'Creating volume "{0}" with {1} driver'.format(
volume.full_name, volume.driver or 'default'
)
)
volume.create()
else:
driver = volume.inspect()['Driver']
if volume.driver is not None and driver != volume.driver:
raise ConfigurationError(
'Configuration for volume {0} specifies driver '
'{1}, but a volume with the same name uses a '
'different driver ({3}). If you wish to use the '
'new configuration, please remove the existing '
'volume "{2}" first:\n'
'$ docker volume rm {2}'.format(
volume.name, volume.driver, volume.full_name,
volume.inspect()['Driver']
)
)
except NotFound:
raise ConfigurationError(
'Volume %s specifies nonexistent driver %s' % (volume.name, volume.driver)
)
def namespace_spec(self, volume_spec):
if not volume_spec.is_named_volume:
return volume_spec
volume = self.volumes[volume_spec.external]
return volume_spec._replace(external=volume.full_name)

View file

@ -17,94 +17,145 @@
# . ~/.docker-compose-completion.sh
# For compatibility reasons, Compose and therefore its completion supports several
# stack compositon files as listed here, in descending priority.
# Support for these filenames might be dropped in some future version.
__docker-compose_compose_file() {
local file
for file in docker-compose.y{,a}ml fig.y{,a}ml ; do
[ -e $file ] && {
echo $file
return
}
done
echo docker-compose.yml
__docker_compose_q() {
docker-compose 2>/dev/null $daemon_options "$@"
}
# Transforms a multiline list of strings into a single line string
# with the words separated by "|".
__docker_compose_to_alternatives() {
local parts=( $1 )
local IFS='|'
echo "${parts[*]}"
}
# Transforms a multiline list of options into an extglob pattern
# suitable for use in case statements.
__docker_compose_to_extglob() {
local extglob=$( __docker_compose_to_alternatives "$1" )
echo "@($extglob)"
}
# suppress trailing whitespace
__docker_compose_nospace() {
# compopt is not available in ancient bash versions
type compopt &>/dev/null && compopt -o nospace
}
# Extracts all service names from the compose file.
___docker-compose_all_services_in_compose_file() {
awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null
___docker_compose_all_services_in_compose_file() {
__docker_compose_q config --services
}
# All services, even those without an existing container
__docker-compose_services_all() {
COMPREPLY=( $(compgen -W "$(___docker-compose_all_services_in_compose_file)" -- "$cur") )
__docker_compose_services_all() {
COMPREPLY=( $(compgen -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") )
}
# All services that have an entry with the given key in their compose_file section
___docker-compose_services_with_key() {
# flatten sections to one line, then filter lines containing the key and return section name.
awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" | awk -F: -v key=": +$1:" '$0 ~ key {print $1}'
___docker_compose_services_with_key() {
# flatten sections under "services" to one line, then filter lines containing the key and return section name
__docker_compose_q config \
| sed -n -e '/^services:/,/^[^ ]/p' \
| sed -n 's/^ //p' \
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
| awk -F: -v key=": +$1:" '$0 ~ key {print $1}'
}
# All services that are defined by a Dockerfile reference
__docker-compose_services_from_build() {
COMPREPLY=( $(compgen -W "$(___docker-compose_services_with_key build)" -- "$cur") )
__docker_compose_services_from_build() {
COMPREPLY=( $(compgen -W "$(___docker_compose_services_with_key build)" -- "$cur") )
}
# All services that are defined by an image
__docker-compose_services_from_image() {
COMPREPLY=( $(compgen -W "$(___docker-compose_services_with_key image)" -- "$cur") )
__docker_compose_services_from_image() {
COMPREPLY=( $(compgen -W "$(___docker_compose_services_with_key image)" -- "$cur") )
}
# The services for which containers have been created, optionally filtered
# by a boolean expression passed in as argument.
__docker-compose_services_with() {
__docker_compose_services_with() {
local containers names
containers="$(docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"
names=( $(docker 2>/dev/null inspect --format "{{if ${1:-true}}} {{ .Name }} {{end}}" $containers) )
names=( ${names[@]%_*} ) # strip trailing numbers
names=( ${names[@]#*_} ) # strip project name
COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") )
containers="$(__docker_compose_q ps -q)"
names=$(docker 2>/dev/null inspect -f "{{if ${1:-true}}}{{range \$k, \$v := .Config.Labels}}{{if eq \$k \"com.docker.compose.service\"}}{{\$v}}{{end}}{{end}}{{end}}" $containers)
COMPREPLY=( $(compgen -W "$names" -- "$cur") )
}
# The services for which at least one paused container exists
__docker_compose_services_paused() {
__docker_compose_services_with '.State.Paused'
}
# The services for which at least one running container exists
__docker-compose_services_running() {
__docker-compose_services_with '.State.Running'
__docker_compose_services_running() {
__docker_compose_services_with '.State.Running'
}
# The services for which at least one stopped container exists
__docker-compose_services_stopped() {
__docker-compose_services_with 'not .State.Running'
__docker_compose_services_stopped() {
__docker_compose_services_with 'not .State.Running'
}
_docker-compose_build() {
_docker_compose_build() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--no-cache" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--force-rm --help --no-cache --pull" -- "$cur" ) )
;;
*)
__docker-compose_services_from_build
__docker_compose_services_from_build
;;
esac
}
_docker-compose_docker-compose() {
_docker_compose_bundle() {
case "$prev" in
--file|-f)
_filedir y?(a)ml
--output|-o)
_filedir
return
;;
--project-name|-p)
esac
COMPREPLY=( $( compgen -W "--push-images --help --output -o" -- "$cur" ) )
}
_docker_compose_config() {
COMPREPLY=( $( compgen -W "--help --quiet -q --services" -- "$cur" ) )
}
_docker_compose_create() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--force-recreate --help --no-build --no-recreate" -- "$cur" ) )
;;
*)
__docker_compose_services_all
;;
esac
}
_docker_compose_docker_compose() {
case "$prev" in
--tlscacert|--tlscert|--tlskey)
_filedir
return
;;
--file|-f)
_filedir "y?(a)ml"
return
;;
$(__docker_compose_to_extglob "$daemon_options_with_args") )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help -h --verbose --version --file -f --project-name -p" -- "$cur" ) )
COMPREPLY=( $( compgen -W "$daemon_boolean_options $daemon_options_with_args --help -h --verbose --version -v" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
@ -113,12 +164,64 @@ _docker-compose_docker-compose() {
}
_docker-compose_help() {
_docker_compose_down() {
case "$prev" in
--rmi)
COMPREPLY=( $( compgen -W "all local" -- "$cur" ) )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help --rmi --volumes -v --remove-orphans" -- "$cur" ) )
;;
esac
}
_docker_compose_events() {
case "$prev" in
--json)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help --json" -- "$cur" ) )
;;
*)
__docker_compose_services_all
;;
esac
}
_docker_compose_exec() {
case "$prev" in
--index|--user)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-d --help --index --privileged -T --user" -- "$cur" ) )
;;
*)
__docker_compose_services_running
;;
esac
}
_docker_compose_help() {
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
}
_docker-compose_kill() {
_docker_compose_kill() {
case "$prev" in
-s)
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
@ -128,28 +231,46 @@ _docker-compose_kill() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-s" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help -s" -- "$cur" ) )
;;
*)
__docker-compose_services_running
__docker_compose_services_running
;;
esac
}
_docker-compose_logs() {
_docker_compose_logs() {
case "$prev" in
--tail)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--no-color" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--follow -f --help --no-color --tail --timestamps -t" -- "$cur" ) )
;;
*)
__docker-compose_services_all
__docker_compose_services_all
;;
esac
}
_docker-compose_port() {
_docker_compose_pause() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_compose_services_running
;;
esac
}
_docker_compose_port() {
case "$prev" in
--protocol)
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
@ -162,182 +283,276 @@ _docker-compose_port() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--protocol --index" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --index --protocol" -- "$cur" ) )
;;
*)
__docker-compose_services_all
__docker_compose_services_all
;;
esac
}
_docker-compose_ps() {
_docker_compose_ps() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-q" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help -q" -- "$cur" ) )
;;
*)
__docker-compose_services_all
__docker_compose_services_all
;;
esac
}
_docker-compose_pull() {
_docker_compose_pull() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--allow-insecure-ssl" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures" -- "$cur" ) )
;;
*)
__docker-compose_services_from_image
__docker_compose_services_from_image
;;
esac
}
_docker-compose_restart() {
_docker_compose_push() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
;;
*)
__docker_compose_services_all
;;
esac
}
_docker_compose_restart() {
case "$prev" in
-t | --timeout)
--timeout|-t)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-t --timeout" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
;;
*)
__docker-compose_services_running
__docker_compose_services_running
;;
esac
}
_docker-compose_rm() {
_docker_compose_rm() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--force -f -v" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--force -f --help -v" -- "$cur" ) )
;;
*)
__docker-compose_services_stopped
__docker_compose_services_stopped
;;
esac
}
_docker-compose_run() {
_docker_compose_run() {
case "$prev" in
-e)
COMPREPLY=( $( compgen -e -- "$cur" ) )
compopt -o nospace
__docker_compose_nospace
return
;;
--entrypoint)
--entrypoint|--name|--user|-u|--workdir|-w)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--allow-insecure-ssl -d --entrypoint -e --no-deps --rm --service-ports -T" -- "$cur" ) )
COMPREPLY=( $( compgen -W "-d --entrypoint -e --help --name --no-deps --publish -p --rm --service-ports -T --user -u --workdir -w" -- "$cur" ) )
;;
*)
__docker-compose_services_all
__docker_compose_services_all
;;
esac
}
_docker-compose_scale() {
_docker_compose_scale() {
case "$prev" in
=)
COMPREPLY=("$cur")
return
;;
*)
COMPREPLY=( $(compgen -S "=" -W "$(___docker-compose_all_services_in_compose_file)" -- "$cur") )
compopt -o nospace
;;
esac
}
_docker-compose_start() {
__docker-compose_services_stopped
}
_docker-compose_stop() {
case "$prev" in
-t | --timeout)
--timeout|-t)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-t --timeout" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
;;
*)
__docker-compose_services_running
COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") )
__docker_compose_nospace
;;
esac
}
_docker-compose_up() {
_docker_compose_start() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_compose_services_stopped
;;
esac
}
_docker_compose_stop() {
case "$prev" in
-t | --timeout)
--timeout|-t)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--allow-insecure-ssl -d --no-build --no-color --no-deps --no-recreate -t --timeout" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
;;
*)
__docker-compose_services_all
__docker_compose_services_running
;;
esac
}
_docker-compose() {
_docker_compose_top() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_compose_services_running
;;
esac
}
_docker_compose_unpause() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_compose_services_paused
;;
esac
}
_docker_compose_up() {
case "$prev" in
--timeout|-t)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--abort-on-container-exit --build -d --force-recreate --help --no-build --no-color --no-deps --no-recreate --timeout -t --remove-orphans" -- "$cur" ) )
;;
*)
__docker_compose_services_all
;;
esac
}
_docker_compose_version() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
;;
esac
}
_docker_compose() {
local previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob
local commands=(
build
bundle
config
create
down
events
exec
help
kill
logs
pause
port
ps
pull
push
restart
rm
run
scale
start
stop
top
unpause
up
version
)
# options for the docker daemon that have to be passed to secondary calls to
# docker-compose executed by this script
local daemon_boolean_options="
--skip-hostname-check
--tls
--tlsverify
"
local daemon_options_with_args="
--file -f
--host -H
--project-name -p
--tlscacert
--tlscert
--tlskey
"
COMPREPLY=()
local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword
# search subcommand and invoke its handler.
# special treatment of some top-level options
local command='docker-compose'
local command='docker_compose'
local daemon_options=()
local counter=1
local compose_file compose_project
while [ $counter -lt $cword ]; do
case "${words[$counter]}" in
-f|--file)
(( counter++ ))
compose_file="${words[$counter]}"
$(__docker_compose_to_extglob "$daemon_boolean_options") )
local opt=${words[counter]}
daemon_options+=($opt)
;;
-p|--project-name)
(( counter++ ))
compose_project="${words[$counter]}"
$(__docker_compose_to_extglob "$daemon_options_with_args") )
local opt=${words[counter]}
local arg=${words[++counter]}
daemon_options+=($opt $arg)
;;
-*)
;;
@ -349,10 +564,11 @@ _docker-compose() {
(( counter++ ))
done
local completions_func=_docker-compose_${command}
local completions_func=_docker_compose_${command//-/_}
declare -F $completions_func >/dev/null && $completions_func
eval "$previous_extglob_setting"
return 0
}
complete -F _docker-compose docker-compose
complete -F _docker_compose docker-compose

View file

@ -0,0 +1,469 @@
#compdef docker-compose
# Description
# -----------
# zsh completion for docker-compose
# https://github.com/sdurrheimer/docker-compose-zsh-completion
# -------------------------------------------------------------------------
# Version
# -------
# 1.5.0
# -------------------------------------------------------------------------
# Authors
# -------
# * Steve Durrheimer <s.durrheimer@gmail.com>
# -------------------------------------------------------------------------
# Inspiration
# -----------
# * @albers docker-compose bash completion script
# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion
# -------------------------------------------------------------------------
__docker-compose_q() {
docker-compose 2>/dev/null $compose_options "$@"
}
# All services defined in docker-compose.yml
__docker-compose_all_services_in_compose_file() {
local already_selected
local -a services
already_selected=$(echo $words | tr " " "|")
__docker-compose_q config --services \
| grep -Ev "^(${already_selected})$"
}
# All services, even those without an existing container
__docker-compose_services_all() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
services=$(__docker-compose_all_services_in_compose_file)
_alternative "args:services:($services)" && ret=0
return ret
}
# All services that have an entry with the given key in their docker-compose.yml section
__docker-compose_services_with_key() {
local already_selected
local -a buildable
already_selected=$(echo $words | tr " " "|")
# flatten sections to one line, then filter lines containing the key and return section name.
__docker-compose_q config \
| sed -n -e '/^services:/,/^[^ ]/p' \
| sed -n 's/^ //p' \
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
| grep " \+$1:" \
| cut -d: -f1 \
| grep -Ev "^(${already_selected})$"
}
# All services that are defined by a Dockerfile reference
__docker-compose_services_from_build() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
buildable=$(__docker-compose_services_with_key build)
_alternative "args:buildable services:($buildable)" && ret=0
return ret
}
# All services that are defined by an image
__docker-compose_services_from_image() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
pullable=$(__docker-compose_services_with_key image)
_alternative "args:pullable services:($pullable)" && ret=0
return ret
}
__docker-compose_get_services() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local kind
declare -a running paused stopped lines args services
docker_status=$(docker ps > /dev/null 2>&1)
if [ $? -ne 0 ]; then
_message "Error! Docker is not running."
return 1
fi
kind=$1
shift
[[ $kind =~ (stopped|all) ]] && args=($args -a)
lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"})
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"})
# Parse header line to find columns
local i=1 j=1 k header=${lines[1]}
declare -A begin end
while (( j < ${#header} - 1 )); do
i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
begin[${header[$i,$((j-1))]}]=$i
end[${header[$i,$((j-1))]}]=$k
done
lines=(${lines[2,-1]})
# Container ID
local line s name
local -a names
for line in $lines; do
if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
for name in $names; do
s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}"
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
stopped=($stopped $s)
else
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
paused=($paused $s)
fi
running=($running $s)
fi
done
fi
done
[[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
[[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
[[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
return ret
}
__docker-compose_pausedservices() {
[[ $PREFIX = -* ]] && return 1
__docker-compose_get_services paused "$@"
}
__docker-compose_stoppedservices() {
[[ $PREFIX = -* ]] && return 1
__docker-compose_get_services stopped "$@"
}
__docker-compose_runningservices() {
[[ $PREFIX = -* ]] && return 1
__docker-compose_get_services running "$@"
}
__docker-compose_services() {
[[ $PREFIX = -* ]] && return 1
__docker-compose_get_services all "$@"
}
__docker-compose_caching_policy() {
oldp=( "$1"(Nmh+1) ) # 1 hour
(( $#oldp ))
}
__docker-compose_commands() {
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy __docker-compose_caching_policy
fi
if ( [[ ${+_docker_compose_subcommands} -eq 0 ]] || _cache_invalid docker_compose_subcommands) \
&& ! _retrieve_cache docker_compose_subcommands;
then
local -a lines
lines=(${(f)"$(_call_program commands docker-compose 2>&1)"})
_docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
(( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands
fi
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands
}
__docker-compose_subcommand() {
local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps
opts_help='(: -)--help[Print usage]'
opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]"
opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]"
opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]"
opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]"
opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ")
opts_no_color='--no-color[Produce monochrome output.]'
opts_no_deps="--no-deps[Don't start linked services.]"
integer ret=1
case "$words[1]" in
(build)
_arguments \
$opts_help \
'--force-rm[Always remove intermediate containers.]' \
'--no-cache[Do not use cache when building the image.]' \
'--pull[Always attempt to pull a newer version of the image.]' \
'*:services:__docker-compose_services_from_build' && ret=0
;;
(bundle)
_arguments \
$opts_help \
'--push-images[Automatically push images for any services which have a `build` option specified.]' \
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
;;
(config)
_arguments \
$opts_help \
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
'--services[Print the service names, one per line.]' && ret=0
;;
(create)
_arguments \
$opts_help \
$opts_force_recreate \
$opts_no_recreate \
$opts_no_build \
"(--no-build)--build[Build images before creating containers.]" \
'*:services:__docker-compose_services_all' && ret=0
;;
(down)
_arguments \
$opts_help \
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
$opts_remove_orphans && ret=0
;;
(events)
_arguments \
$opts_help \
'--json[Output events as a stream of json objects]' \
'*:services:__docker-compose_services_all' && ret=0
;;
(exec)
_arguments \
$opts_help \
'-d[Detached mode: Run command in the background.]' \
'--privileged[Give extended privileges to the process.]' \
'--user=[Run the command as this user.]:username:_users' \
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
'(-):running services:__docker-compose_runningservices' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
;;
(help)
_arguments ':subcommand:__docker-compose_commands' && ret=0
;;
(kill)
_arguments \
$opts_help \
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(logs)
_arguments \
$opts_help \
'(-f --follow)'{-f,--follow}'[Follow log output]' \
$opts_no_color \
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
'*:services:__docker-compose_services_all' && ret=0
;;
(pause)
_arguments \
$opts_help \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(port)
_arguments \
$opts_help \
'--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \
'--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
'1:running services:__docker-compose_runningservices' \
'2:port:_ports' && ret=0
;;
(ps)
_arguments \
$opts_help \
'-q[Only display IDs]' \
'*:services:__docker-compose_services_all' && ret=0
;;
(pull)
_arguments \
$opts_help \
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
'*:services:__docker-compose_services_from_image' && ret=0
;;
(push)
_arguments \
$opts_help \
'--ignore-push-failures[Push what it can and ignores images with push failures.]' \
'*:services:__docker-compose_services' && ret=0
;;
(rm)
_arguments \
$opts_help \
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
'-v[Remove any anonymous volumes attached to containers]' \
'*:stopped services:__docker-compose_stoppedservices' && ret=0
;;
(run)
_arguments \
$opts_help \
'-d[Detached mode: Run container in the background, print new container name.]' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'--name=[Assign a name to the container]:name: ' \
$opts_no_deps \
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
'--rm[Remove container after run. Ignored in detached mode.]' \
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
'(-):services:__docker-compose_services' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
;;
(scale)
_arguments \
$opts_help \
$opts_timeout \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(start)
_arguments \
$opts_help \
'*:stopped services:__docker-compose_stoppedservices' && ret=0
;;
(stop|restart)
_arguments \
$opts_help \
$opts_timeout \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(top)
_arguments \
$opts_help \
'*:running services:__docker-compose_runningservices' && ret=0
;;
(unpause)
_arguments \
$opts_help \
'*:paused services:__docker-compose_pausedservices' && ret=0
;;
(up)
_arguments \
$opts_help \
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \
$opts_no_color \
$opts_no_deps \
$opts_force_recreate \
$opts_no_recreate \
$opts_no_build \
"(--no-build)--build[Build images before starting containers.]" \
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
$opts_remove_orphans \
'*:services:__docker-compose_services_all' && ret=0
;;
(version)
_arguments \
$opts_help \
"--short[Shows only Compose's version number.]" && ret=0
;;
(*)
_message 'Unknown sub command' && ret=1
;;
esac
return ret
}
_docker-compose() {
# Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`.
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
if [[ $service != docker-compose ]]; then
_call_function - _$service
return
fi
local curcontext="$curcontext" state line
integer ret=1
typeset -A opt_args
local file_description
if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then
file_description="Specify an override docker-compose file (default: docker-compose.override.yml)"
else
file_description="Specify an alternate docker-compose file (default: docker-compose.yml)"
fi
_arguments -C \
'(- :)'{-h,--help}'[Get help]' \
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
'--verbose[Show more output]' \
'(- :)'{-v,--version}'[Print version and exit]' \
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
'--tls[Use TLS; implied by --tlsverify]' \
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
'--tlscert=[Path to TLS certificate file]:client cert path:' \
'--tlskey=[Path to TLS key file]:tls key path:' \
'--tlsverify[Use TLS and verify the remote]' \
"--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \
'(-): :->command' \
'(-)*:: :->option-or-argument' && ret=0
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
relevant_compose_flags=(
"--file" "-f"
"--host" "-H"
"--project-name" "-p"
"--tls"
"--tlscacert"
"--tlscert"
"--tlskey"
"--tlsverify"
"--skip-hostname-check"
)
relevant_docker_flags=(
"--host" "-H"
"--tls"
"--tlscacert"
"--tlscert"
"--tlskey"
"--tlsverify"
)
for k in "${(@k)opt_args}"; do
if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then
docker_options+=$k
if [[ -n "$opt_args[$k]" ]]; then
docker_options+=$opt_args[$k]
fi
fi
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
compose_options+=$k
if [[ -n "$opt_args[$k]" ]]; then
compose_options+=$opt_args[$k]
fi
fi
done
case $state in
(command)
__docker-compose_commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:docker-compose-$words[1]:
__docker-compose_subcommand && ret=0
;;
esac
return ret
}
_docker-compose "$@"

View file

@ -0,0 +1,173 @@
#!/usr/bin/env python
"""
Migrate a Compose file from the V1 format in Compose 1.5 to the V2 format
supported by Compose 1.6+
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import logging
import sys
import ruamel.yaml
from compose.config.types import VolumeSpec
log = logging.getLogger('migrate')
def migrate(content):
data = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)
service_names = data.keys()
for name, service in data.items():
warn_for_links(name, service)
warn_for_external_links(name, service)
rewrite_net(service, service_names)
rewrite_build(service)
rewrite_logging(service)
rewrite_volumes_from(service, service_names)
services = {name: data.pop(name) for name in data.keys()}
data['version'] = "2"
data['services'] = services
create_volumes_section(data)
return data
def warn_for_links(name, service):
links = service.get('links')
if links:
example_service = links[0].partition(':')[0]
log.warn(
"Service {name} has links, which no longer create environment "
"variables such as {example_service_upper}_PORT. "
"If you are using those in your application code, you should "
"instead connect directly to the hostname, e.g. "
"'{example_service}'."
.format(name=name, example_service=example_service,
example_service_upper=example_service.upper()))
def warn_for_external_links(name, service):
external_links = service.get('external_links')
if external_links:
log.warn(
"Service {name} has external_links: {ext}, which now work "
"slightly differently. In particular, two containers must be "
"connected to at least one network in common in order to "
"communicate, even if explicitly linked together.\n\n"
"Either connect the external container to your app's default "
"network, or connect both the external container and your "
"service's containers to a pre-existing network. See "
"https://docs.docker.com/compose/networking/ "
"for more on how to do this."
.format(name=name, ext=external_links))
def rewrite_net(service, service_names):
if 'net' in service:
network_mode = service.pop('net')
# "container:<service name>" is now "service:<service name>"
if network_mode.startswith('container:'):
name = network_mode.partition(':')[2]
if name in service_names:
network_mode = 'service:{}'.format(name)
service['network_mode'] = network_mode
def rewrite_build(service):
if 'dockerfile' in service:
service['build'] = {
'context': service.pop('build'),
'dockerfile': service.pop('dockerfile'),
}
def rewrite_logging(service):
if 'log_driver' in service:
service['logging'] = {'driver': service.pop('log_driver')}
if 'log_opt' in service:
service['logging']['options'] = service.pop('log_opt')
def rewrite_volumes_from(service, service_names):
for idx, volume_from in enumerate(service.get('volumes_from', [])):
if volume_from.split(':', 1)[0] not in service_names:
service['volumes_from'][idx] = 'container:%s' % volume_from
def create_volumes_section(data):
named_volumes = get_named_volumes(data['services'])
if named_volumes:
log.warn(
"Named volumes ({names}) must be explicitly declared. Creating a "
"'volumes' section with declarations.\n\n"
"For backwards-compatibility, they've been declared as external. "
"If you don't mind the volume names being prefixed with the "
"project name, you can remove the 'external' option from each one."
.format(names=', '.join(list(named_volumes))))
data['volumes'] = named_volumes
def get_named_volumes(services):
volume_specs = [
VolumeSpec.parse(volume)
for service in services.values()
for volume in service.get('volumes', [])
]
names = {
spec.external
for spec in volume_specs
if spec.is_named_volume
}
return {name: {'external': True} for name in names}
def write(stream, new_format, indent, width):
ruamel.yaml.dump(
new_format,
stream,
Dumper=ruamel.yaml.RoundTripDumper,
indent=indent,
width=width)
def parse_opts(args):
parser = argparse.ArgumentParser()
parser.add_argument("filename", help="Compose file filename.")
parser.add_argument("-i", "--in-place", action='store_true')
parser.add_argument(
"--indent", type=int, default=2,
help="Number of spaces used to indent the output yaml.")
parser.add_argument(
"--width", type=int, default=80,
help="Number of spaces used as the output width.")
return parser.parse_args()
def main(args):
logging.basicConfig(format='\033[33m%(levelname)s:\033[37m %(message)s\033[0m\n')
opts = parse_opts(args)
with open(opts.filename, 'r') as fh:
new_format = migrate(fh.read())
if opts.in_place:
output = open(opts.filename, 'w')
else:
output = sys.stdout
write(output, new_format, opts.indent, opts.width)
if __name__ == "__main__":
main(sys.argv)

56
docker-compose.spec Normal file
View file

@ -0,0 +1,56 @@
# -*- mode: python -*-
block_cipher = None
a = Analysis(['bin/docker-compose'],
pathex=['.'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
cipher=block_cipher)
pyz = PYZ(a.pure, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[
(
'compose/config/config_schema_v1.json',
'compose/config/config_schema_v1.json',
'DATA'
),
(
'compose/config/config_schema_v2.0.json',
'compose/config/config_schema_v2.0.json',
'DATA'
),
(
'compose/config/config_schema_v2.1.json',
'compose/config/config_schema_v2.1.json',
'DATA'
),
(
'compose/config/config_schema_v3.0.json',
'compose/config/config_schema_v3.0.json',
'DATA'
),
(
'compose/config/config_schema_v3.1.json',
'compose/config/config_schema_v3.1.json',
'DATA'
),
(
'compose/GITSHA',
'compose/GITSHA',
'DATA'
)
],
name='docker-compose',
debug=False,
strip=None,
upx=True,
console=True)

View file

@ -1,15 +0,0 @@
FROM docs/base:latest
MAINTAINER Sven Dowideit <SvenDowideit@docker.com> (@SvenDowideit)
# to get the git info for this repo
COPY . /src
# Reset the /docs dir so we can replace the theme meta with the new repo's git info
RUN git reset --hard
RUN grep "__version" /src/compose/__init__.py | sed "s/.*'\(.*\)'/\1/" > /docs/VERSION
COPY docs/* /docs/sources/compose/
COPY docs/mkdocs.yml /docs/mkdocs-compose.yml
# Then build everything together, ready for mkdocs
RUN /docs/build.sh

16
docs/README.md Normal file
View file

@ -0,0 +1,16 @@
# The docs have been moved!
The documentation for Compose has been merged into
[the general documentation repo](https://github.com/docker/docker.github.io).
The docs for Compose are now here:
https://github.com/docker/docker.github.io/tree/master/compose
Please submit pull requests for unpublished features on the `vnext-compose` branch (https://github.com/docker/docker.github.io/tree/vnext-compose).
If you submit a PR to this codebase that has a docs impact, create a second docs PR on `docker.github.io`. Use the docs PR template provided (coming soon - watch this space).
PRs for typos, additional information, etc. for already-published features should be labeled as `okay-to-publish` (we are still settling on a naming convention, will provide a label soon). You can submit these PRs either to `vnext-compose` or directly to `master` on `docker.github.io`
As always, the docs remain open-source and we appreciate your feedback and
pull requests!

View file

@ -1,181 +0,0 @@
page_title: Compose CLI reference
page_description: Compose CLI reference
page_keywords: fig, composition, compose, docker, orchestration, cli, reference
# CLI reference
Most Docker Compose commands are run against one or more services. If
the service is not specified, the command will apply to all services.
For full usage information, run `docker-compose [COMMAND] --help`.
## Commands
### build
Builds or rebuilds services.
Services are built once and then tagged as `project_service`, e.g.,
`composetest_db`. If you change a service's Dockerfile or the contents of its
build directory, run `docker-compose build` to rebuild it.
### help
Displays help and usage instructions for a command.
### kill
Forces running containers to stop by sending a `SIGKILL` signal. Optionally the
signal can be passed, for example:
$ docker-compose kill -s SIGINT
### logs
Displays log output from services.
### port
Prints the public port for a port binding
### ps
Lists containers.
### pull
Pulls service images.
### rm
Removes stopped service containers.
### run
Runs a one-off command on a service.
For example,
$ docker-compose run web python manage.py shell
will start the `web` service and then run `manage.py shell` in python.
Note that by default, linked services will also be started, unless they are
already running.
One-off commands are started in new containers with the same configuration as a
normal container for that service, so volumes, links, etc will all be created as
expected. When using `run`, there are two differences from bringing up a
container normally:
1. the command will be overridden with the one specified. So, if you run
`docker-compose run web bash`, the container's web command (which could default
to, e.g., `python app.py`) will be overridden to `bash`
2. by default no ports will be created in case they collide with already opened
ports.
Links are also created between one-off commands and the other containers which
are part of that service. So, for example, you could run:
$ docker-compose run db psql -h db -U docker
This would open up an interactive PostgreSQL shell for the linked `db` container
(which would get created or started as needed).
If you do not want linked containers to start when running the one-off command,
specify the `--no-deps` flag:
$ docker-compose run --no-deps web python manage.py shell
Similarly, if you do want the service's ports to be created and mapped to the
host, specify the `--service-ports` flag:
$ docker-compose run --service-ports web python manage.py shell
### scale
Sets the number of containers to run for a service.
Numbers are specified as arguments in the form `service=num`. For example:
$ docker-compose scale web=2 worker=3
### start
Starts existing containers for a service.
### stop
Stops running containers without removing them. They can be started again with
`docker-compose start`.
### up
Builds, (re)creates, starts, and attaches to containers for a service.
Linked services will be started, unless they are already running.
By default, `docker-compose up` will aggregate the output of each container and,
when it exits, all containers will be stopped. Running `docker-compose up -d`,
will start the containers in the background and leave them running.
By default, if there are existing containers for a service, `docker-compose up` will stop and recreate them (preserving mounted volumes with [volumes-from]), so that changes in `docker-compose.yml` are picked up. If you do not want containers stopped and recreated, use `docker-compose up --no-recreate`. This will still start any stopped containers, if needed.
[volumes-from]: http://docs.docker.io/en/latest/use/working_with_volumes/
## Options
### --verbose
Shows more output
### --version
Prints version and exits
### -f, --file FILE
Specifies an alternate Compose yaml file (default: `docker-compose.yml`)
### -p, --project-name NAME
Specifies an alternate project name (default: current directory name)
## Environment Variables
Several environment variables are available for you to configure Compose's behaviour.
Variables starting with `DOCKER_` are the same as those used to configure the
Docker command-line client. If you're using boot2docker, `$(boot2docker shellinit)`
will set them to their correct values.
### COMPOSE\_PROJECT\_NAME
Sets the project name, which is prepended to the name of every container started by Compose. Defaults to the `basename` of the current working directory.
### COMPOSE\_FILE
Sets the path to the `docker-compose.yml` to use. Defaults to `docker-compose.yml` in the current working directory.
### DOCKER\_HOST
Sets the URL of the docker daemon. As with the Docker client, defaults to `unix:///var/run/docker.sock`.
### DOCKER\_TLS\_VERIFY
When set to anything other than an empty string, enables TLS communication with
the daemon.
### DOCKER\_CERT\_PATH
Configures the path to the `ca.pem`, `cert.pem`, and `key.pem` files used for TLS verification. Defaults to `~/.docker`.
## Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -1,41 +0,0 @@
---
layout: default
title: Command Completion
---
Command Completion
==================
Compose comes with [command completion](http://en.wikipedia.org/wiki/Command-line_completion)
for the bash shell.
Installing Command Completion
-----------------------------
Make sure bash completion is installed. If you use a current Linux in a non-minimal installation, bash completion should be available.
On a Mac, install with `brew install bash-completion`
Place the completion script in `/etc/bash_completion.d/` (`/usr/local/etc/bash_completion.d/` on a Mac), using e.g.
curl -L https://raw.githubusercontent.com/docker/compose/1.1.0/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
Completion will be available upon next login.
Available completions
---------------------
Depending on what you typed on the command line so far, it will complete
- available docker-compose commands
- options that are available for a particular command
- service names that make sense in a given context (e.g. services with running or stopped instances or services based on images vs. services based on Dockerfiles). For `docker-compose scale`, completed service names will automatically have "=" appended.
- arguments for selected options, e.g. `docker-compose kill -s` will complete some signals like SIGHUP and SIGUSR1.
Enjoy working with Compose faster and with less typos!
## Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)

View file

@ -1,127 +0,0 @@
page_title: Quickstart Guide: Compose and Django
page_description: Getting started with Docker Compose and Django
page_keywords: documentation, docs, docker, compose, orchestration, containers,
django
## Getting started with Compose and Django
This Quick-start Guide will demonstrate how to use Compose to set up and run a
simple Django/PostgreSQL app. Before starting, you'll need to have
[Compose installed](install.md).
### Define the project
Start by setting up the three files you'll need to build the app. First, since
your app is going to run inside a Docker container containing all of its
dependencies, you'll need to define exactly what needs to be included in the
container. This is done using a file called `Dockerfile`. To begin with, the
Dockerfile consists of:
FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
This Dockerfile will define an image that is used to build a container that
includes your application and has Python installed alongside all of your Python
dependencies. For more information on how to write Dockerfiles, see the
[Docker user guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the [Dockerfile reference](http://docs.docker.com/reference/builder/).
Second, you'll define your Python dependencies in a file called
`requirements.txt`:
Django
psycopg2
Finally, this is all tied together with a file called `docker-compose.yml`. It
describes the services that comprise your app (here, a web server and database),
which Docker images they use, how they link together, what volumes will be
mounted inside the containers, and what ports they expose.
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db
See the [`docker-compose.yml` reference](yml.html) for more information on how
this file works.
### Build the project
You can now start a Django project with `docker-compose run`:
$ docker-compose run web django-admin.py startproject composeexample .
First, Compose will build an image for the `web` service using the `Dockerfile`.
It will then run `django-admin.py startproject composeexample .` inside a
container built using that image.
This will generate a Django app inside the current directory:
$ ls
Dockerfile docker-compose.yml composeexample manage.py requirements.txt
### Connect the database
Now you need to set up the database connection. Replace the `DATABASES = ...`
definition in `composeexample/settings.py` to read:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
}
}
These settings are determined by the
[postgres](https://registry.hub.docker.com/_/postgres/) Docker image specified
in the Dockerfile.
Then, run `docker-compose up`:
Recreating myapp_db_1...
Recreating myapp_web_1...
Attaching to myapp_db_1, myapp_web_1
myapp_db_1 |
myapp_db_1 | PostgreSQL stand-alone backend 9.1.11
myapp_db_1 | 2014-01-27 12:17:03 UTC LOG: database system is ready to accept connections
myapp_db_1 | 2014-01-27 12:17:03 UTC LOG: autovacuum launcher started
myapp_web_1 | Validating models...
myapp_web_1 |
myapp_web_1 | 0 errors found
myapp_web_1 | January 27, 2014 - 12:12:40
myapp_web_1 | Django version 1.6.1, using settings 'composeexample.settings'
myapp_web_1 | Starting development server at http://0.0.0.0:8000/
myapp_web_1 | Quit the server with CONTROL-C.
Your Django app should nw be running at port 8000 on your Docker daemon (if
you're using Boot2docker, `boot2docker ip` will tell you its address).
You can also run management commands with Docker. To set up your database, for
example, run `docker-compose up` and in another terminal run:
$ docker-compose run web python manage.py syncdb
## More Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -1,41 +0,0 @@
---
layout: default
title: Compose environment variables reference
---
Environment variables reference
===============================
**Note:** Environment variables are no longer the recommended method for connecting to linked services. Instead, you should use the link name (by default, the name of the linked service) as the hostname to connect to. See the [docker-compose.yml documentation](yml.md#links) for details.
Compose uses [Docker links] to expose services' containers to one another. Each linked container injects a set of environment variables, each of which begins with the uppercase name of the container.
To see what environment variables are available to a service, run `docker-compose run SERVICE env`.
<b><i>name</i>\_PORT</b><br>
Full URL, e.g. `DB_PORT=tcp://172.17.0.5:5432`
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i></b><br>
Full URL, e.g. `DB_PORT_5432_TCP=tcp://172.17.0.5:5432`
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_ADDR</b><br>
Container's IP address, e.g. `DB_PORT_5432_TCP_ADDR=172.17.0.5`
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_PORT</b><br>
Exposed port number, e.g. `DB_PORT_5432_TCP_PORT=5432`
<b><i>name</i>\_PORT\_<i>num</i>\_<i>protocol</i>\_PROTO</b><br>
Protocol (tcp or udp), e.g. `DB_PORT_5432_TCP_PROTO=tcp`
<b><i>name</i>\_NAME</b><br>
Fully qualified container name, e.g. `DB_1_NAME=/myapp_web_1/myapp_db_1`
[Docker links]: http://docs.docker.com/userguide/dockerlinks/
## Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose command line completion](completion.md)

View file

@ -1,193 +0,0 @@
page_title: Compose: Multi-container orchestration for Docker
page_description: Introduction and Overview of Compose
page_keywords: documentation, docs, docker, compose, orchestration, containers
# Docker Compose
Compose is a tool for defining and running complex applications with Docker.
With Compose, you define a multi-container application in a single file, then
spin your application up in a single command which does everything that needs to
be done to get it running.
Compose is great for development environments, staging servers, and CI. We don't
recommend that you use it in production yet.
Using Compose is basically a three-step process.
First, you define your app's environment with a `Dockerfile` so it can be
reproduced anywhere:
```Dockerfile
FROM python:2.7
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code
CMD python app.py
```
Next, you define the services that make up your app in `docker-compose.yml` so
they can be run together in an isolated environment:
```yaml
web:
build: .
links:
- db
ports:
- "8000:8000"
db:
image: postgres
```
Lastly, run `docker-compose up` and Compose will start and run your entire app.
Compose has commands for managing the whole lifecycle of your application:
* Start, stop and rebuild services
* View the status of running services
* Stream the log output of running services
* Run a one-off command on a service
## Compose documentation
- [Installing Compose](install.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)
## Quick start
Let's get started with a walkthrough of getting a simple Python web app running
on Compose. It assumes a little knowledge of Python, but the concepts
demonstrated here should be understandable even if you're not familiar with
Python.
### Installation and set-up
First, [install Docker and Compose](install.md).
Next, you'll want to make a directory for the project:
$ mkdir composetest
$ cd composetest
Inside this directory, create `app.py`, a simple web app that uses the Flask
framework and increments a value in Redis:
```python
from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello World! I have been seen %s times.' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
```
Next, define the Python dependencies in a file called `requirements.txt`:
flask
redis
### Create a Docker image
Now, create a Docker image containing all of your app's dependencies. You
specify how to build the image using a file called
[`Dockerfile`](http://docs.docker.com/reference/builder/):
FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
This tells Docker to include Python, your code, and your Python dependencies in
a Docker image. For more information on how to write Dockerfiles, see the
[Docker user
guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile)
and the
[Dockerfile reference](http://docs.docker.com/reference/builder/).
### Define services
Next, define a set of services using `docker-compose.yml`:
web:
build: .
command: python app.py
ports:
- "5000:5000"
volumes:
- .:/code
links:
- redis
redis:
image: redis
This defines two services:
- `web`, which is built from the `Dockerfile` in the current directory. It also
says to run the command `python app.py` inside the image, forward the exposed
port 5000 on the container to port 5000 on the host machine, connect up the
Redis service, and mount the current directory inside the container so we can
work on code without having to rebuild the image.
- `redis`, which uses the public image
[redis](https://registry.hub.docker.com/_/redis/), which gets pulled from the
Docker Hub registry.
### Build and run your app with Compose
Now, when you run `docker-compose up`, Compose will pull a Redis image, build an
image for your code, and start everything up:
$ docker-compose up
Pulling image redis...
Building web...
Starting composetest_redis_1...
Starting composetest_web_1...
redis_1 | [8] 02 Jan 18:43:35.576 # Server started, Redis version 2.8.3
web_1 | * Running on http://0.0.0.0:5000/
The web app should now be listening on port 5000 on your Docker daemon host (if
you're using Boot2docker, `boot2docker ip` will tell you its address).
If you want to run your services in the background, you can pass the `-d` flag
(for daemon mode) to `docker-compose up` and use `docker-compose ps` to see what
is currently running:
$ docker-compose up -d
Starting composetest_redis_1...
Starting composetest_web_1...
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------
composetest_redis_1 /usr/local/bin/run Up
composetest_web_1 /bin/sh -c python app.py Up 5000->5000/tcp
The `docker-compose run` command allows you to run one-off commands for your
services. For example, to see what environment variables are available to the
`web` service:
$ docker-compose run web env
See `docker-compose --help` to see other available commands.
If you started Compose with `docker-compose up -d`, you'll probably want to stop
your services once you've finished with them:
$ docker-compose stop
At this point, you have seen the basics of how Compose works.
- Next, try the quick start guide for [Django](django.md),
[Rails](rails.md), or [Wordpress](wordpress.md).
- See the reference guides for complete details on the [commands](cli.md), the
[configuration file](yml.md) and [environment variables](env.md).

View file

@ -1,43 +0,0 @@
page_title: Installing Compose
page_description: How to intall Docker Compose
page_keywords: compose, orchestration, install, installation, docker, documentation
## Installing Compose
To install Compose, you'll need to install Docker first. You'll then install
Compose with a `curl` command.
### Install Docker
First, install Docker version 1.3 or greater:
- [Instructions for Mac OS X](http://docs.docker.com/installation/mac/)
- [Instructions for Ubuntu](http://docs.docker.com/installation/ubuntulinux/)
- [Instructions for other systems](http://docs.docker.com/installation/)
### Install Compose
To install Compose, run the following commands:
curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Optionally, you can also install [command completion](completion.md) for the
bash shell.
Compose is available for OS X and 64-bit Linux. If you're on another platform,
Compose can also be installed as a Python package:
$ sudo pip install -U docker-compose
No further steps are required; Compose should now be successfully installed.
You can test the installation by running `docker-compose --version`.
## Compose documentation
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -1,10 +0,0 @@
- ['compose/index.md', 'User Guide', 'Docker Compose' ]
- ['compose/install.md', 'Installation', 'Docker Compose']
- ['compose/cli.md', 'Reference', 'Compose command line']
- ['compose/yml.md', 'Reference', 'Compose yml']
- ['compose/env.md', 'Reference', 'Compose ENV variables']
- ['compose/completion.md', 'Reference', 'Compose commandline completion']
- ['compose/django.md', 'Examples', 'Getting started with Compose and Django']
- ['compose/rails.md', 'Examples', 'Getting started with Compose and Rails']
- ['compose/wordpress.md', 'Examples', 'Getting started with Compose and Wordpress']

View file

@ -1,127 +0,0 @@
page_title: Quickstart Guide: Compose and Rails
page_description: Getting started with Docker Compose and Rails
page_keywords: documentation, docs, docker, compose, orchestration, containers,
rails
## Getting started with Compose and Rails
This Quickstart guide will show you how to use Compose to set up and run a Rails/PostgreSQL app. Before starting, you'll need to have [Compose installed](install.md).
### Define the project
Start by setting up the three files you'll need to build the app. First, since
your app is going to run inside a Docker container containing all of its
dependencies, you'll need to define exactly what needs to be included in the
container. This is done using a file called `Dockerfile`. To begin with, the
Dockerfile consists of:
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
RUN bundle install
ADD . /myapp
That'll put your application code inside an image that will build a container with Ruby, Bundler and all your dependencies inside it. For more information on how to write Dockerfiles, see the [Docker user guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the [Dockerfile reference](http://docs.docker.com/reference/builder/).
Next, create a bootstrap `Gemfile` which just loads Rails. It'll be overwritten in a moment by `rails new`.
source 'https://rubygems.org'
gem 'rails', '4.2.0'
Finally, `docker-compose.yml` is where the magic happens. This file describes the services that comprise your app (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration needed to link them together and expose the web app's port.
db:
image: postgres
ports:
- "5432"
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/myapp
ports:
- "3000:3000"
links:
- db
### Build the project
With those three files in place, you can now generate the Rails skeleton app
using `docker-compose run`:
$ docker-compose run web rails new . --force --database=postgresql --skip-bundle
First, Compose will build the image for the `web` service using the
`Dockerfile`. Then it'll run `rails new` inside a new container, using that
image. Once it's done, you should have generated a fresh app:
$ ls
Dockerfile app docker-compose.yml tmp
Gemfile bin lib vendor
Gemfile.lock config log
README.rdoc config.ru public
Rakefile db test
Uncomment the line in your new `Gemfile` which loads `therubyracer`, so you've
got a Javascript runtime:
gem 'therubyracer', platforms: :ruby
Now that you've got a new `Gemfile`, you need to build the image again. (This,
and changes to the Dockerfile itself, should be the only times you'll need to
rebuild.)
$ docker-compose build
### Connect the database
The app is now bootable, but you're not quite there yet. By default, Rails
expects a database to be running on `localhost` - so you need to point it at the
`db` container instead. You also need to change the database and username to
align with the defaults set by the `postgres` image.
Open up your newly-generated `database.yml` file. Replace its contents with the
following:
development: &default
adapter: postgresql
encoding: unicode
database: postgres
pool: 5
username: postgres
password:
host: db
test:
<<: *default
database: myapp_test
You can now boot the app with:
$ docker-compose up
If all's well, you should see some PostgreSQL output, and then—after a few
seconds—the familiar refrain:
myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick 1.3.1
myapp_web_1 | [2014-01-17 17:16:29] INFO ruby 2.2.0 (2014-12-25) [x86_64-linux-gnu]
myapp_web_1 | [2014-01-17 17:16:29] INFO WEBrick::HTTPServer#start: pid=1 port=3000
Finally, you need to create the database. In another terminal, run:
$ docker-compose run web rake db:create
That's it. Your app should now be running on port 3000 on your Docker daemon (if
you're using Boot2docker, `boot2docker ip` will tell you its address).
## More Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -1,122 +0,0 @@
page_title: Quickstart Guide: Compose and Wordpress
page_description: Getting started with Docker Compose and Rails
page_keywords: documentation, docs, docker, compose, orchestration, containers,
wordpress
## Getting started with Compose and Wordpress
You can use Compose to easily run Wordpress in an isolated environment built
with Docker containers.
### Define the project
First, [Install Compose](install.md) and then download Wordpress into the
current directory:
$ curl https://wordpress.org/latest.tar.gz | tar -xvzf -
This will create a directory called `wordpress`. If you wish, you can rename it
to the name of your project.
Next, inside that directory, create a `Dockerfile`, a file that defines what
environment your app is going to run in. For more information on how to write
Dockerfiles, see the
[Docker user guide](https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the
[Dockerfile reference](http://docs.docker.com/reference/builder/). In this case,
your Dockerfile should be:
```
FROM orchardup/php5
ADD . /code
```
This tells Docker how to build an image defining a container that contains PHP
and Wordpress.
Next you'll create a `docker-compose.yml` file that will start your web service
and a separate MySQL instance:
```
web:
build: .
command: php -S 0.0.0.0:8000 -t /code
ports:
- "8000:8000"
links:
- db
volumes:
- .:/code
db:
image: orchardup/mysql
environment:
MYSQL_DATABASE: wordpress
```
Two supporting files are needed to get this working - first, `wp-config.php` is
the standard Wordpress config file with a single change to point the database
configuration at the `db` container:
```
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', "db:3306");
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
$table_prefix = 'wp_';
define('WPLANG', '');
define('WP_DEBUG', false);
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
```
Second, `router.php` tells PHP's built-in web server how to run Wordpress:
```
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
if(strpos($path,'.php') === false) return false;
else {
chdir(dirname($root.$path));
require_once $root.$path;
}
}else include_once 'index.php';
```
### Build the project
With those four files in place, run `docker-compose up` inside your Wordpress
directory and it'll pull and build the needed images, and then start the web and
database containers. You'll then be able to visit Wordpress at port 8000 on your
Docker daemon (if you're using Boot2docker, `boot2docker ip` will tell you its
address).
## More Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Yaml file reference](yml.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -1,333 +0,0 @@
---
layout: default
title: docker-compose.yml reference
page_title: docker-compose.yml reference
page_description: docker-compose.yml reference
page_keywords: fig, composition, compose, docker
---
# docker-compose.yml reference
Each service defined in `docker-compose.yml` must specify exactly one of
`image` or `build`. Other keys are optional, and are analogous to their
`docker run` command-line counterparts.
As with `docker run`, options specified in the Dockerfile (e.g., `CMD`,
`EXPOSE`, `VOLUME`, `ENV`) are respected by default - you don't need to
specify them again in `docker-compose.yml`.
### image
Tag or partial image ID. Can be local or remote - Compose will attempt to
pull if it doesn't exist locally.
```
image: ubuntu
image: orchardup/postgresql
image: a4bc65fd
```
### build
Path to a directory containing a Dockerfile. This directory is also the
build context that is sent to the Docker daemon.
Compose will build and tag it with a generated name, and use that image thereafter.
```
build: /path/to/build/dir
```
### command
Override the default command.
```
command: bundle exec thin -p 3000
```
<a name="links"></a>
### links
Link to containers in another service. Either specify both the service name and
the link alias (`SERVICE:ALIAS`), or just the service name (which will also be
used for the alias).
```
links:
- db
- db:database
- redis
```
An entry with the alias' name will be created in `/etc/hosts` inside containers
for this service, e.g:
```
172.17.2.186 db
172.17.2.186 database
172.17.2.187 redis
```
Environment variables will also be created - see the [environment variable
reference](env.md) for details.
### external_links
Link to containers started outside this `docker-compose.yml` or even outside
of Compose, especially for containers that provide shared or common services.
`external_links` follow semantics similar to `links` when specifying both the
container name and the link alias (`CONTAINER:ALIAS`).
```
external_links:
- redis_1
- project_db_1:mysql
- project_db_1:postgresql
```
### ports
Expose ports. Either specify both ports (`HOST:CONTAINER`), or just the container
port (a random host port will be chosen).
> **Note:** When mapping ports in the `HOST:CONTAINER` format, you may experience
> erroneous results when using a container port lower than 60, because YAML will
> parse numbers in the format `xx:yy` as sexagesimal (base 60). For this reason,
> we recommend always explicitly specifying your port mappings as strings.
```
ports:
- "3000"
- "8000:8000"
- "49100:22"
- "127.0.0.1:8001:8001"
```
### expose
Expose ports without publishing them to the host machine - they'll only be
accessible to linked services. Only the internal port can be specified.
```
expose:
- "3000"
- "8000"
```
### volumes
Mount paths as volumes, optionally specifying a path on the host machine
(`HOST:CONTAINER`), or an access mode (`HOST:CONTAINER:ro`).
```
volumes:
- /var/lib/mysql
- cache/:/tmp/cache
- ~/configs:/etc/configs/:ro
```
### volumes_from
Mount all of the volumes from another service or container.
```
volumes_from:
- service_name
- container_name
```
### environment
Add environment variables. You can use either an array or a dictionary.
Environment variables with only a key are resolved to their values on the
machine Compose is running on, which can be helpful for secret or host-specific values.
```
environment:
RACK_ENV: development
SESSION_SECRET:
environment:
- RACK_ENV=development
- SESSION_SECRET
```
### env_file
Add environment variables from a file. Can be a single value or a list.
If you have specified a Compose file with `docker-compose -f FILE`, paths in
`env_file` are relative to the directory that file is in.
Environment variables specified in `environment` override these values.
```
env_file: .env
env_file:
- ./common.env
- ./apps/web.env
- /opt/secrets.env
```
```
RACK_ENV: development
```
### extends
Extend another service, in the current file or another, optionally overriding
configuration.
Here's a simple example. Suppose we have 2 files - **common.yml** and
**development.yml**. We can use `extends` to define a service in
**development.yml** which uses configuration defined in **common.yml**:
**common.yml**
```
webapp:
build: ./webapp
environment:
- DEBUG=false
- SEND_EMAILS=false
```
**development.yml**
```
web:
extends:
file: common.yml
service: webapp
ports:
- "8000:8000"
links:
- db
environment:
- DEBUG=true
db:
image: postgres
```
Here, the `web` service in **development.yml** inherits the configuration of
the `webapp` service in **common.yml** - the `build` and `environment` keys -
and adds `ports` and `links` configuration. It overrides one of the defined
environment variables (DEBUG) with a new value, and the other one
(SEND_EMAILS) is left untouched. It's exactly as if you defined `web` like
this:
```yaml
web:
build: ./webapp
ports:
- "8000:8000"
links:
- db
environment:
- DEBUG=true
- SEND_EMAILS=false
```
The `extends` option is great for sharing configuration between different
apps, or for configuring the same app differently for different environments.
You could write a new file for a staging environment, **staging.yml**, which
binds to a different port and doesn't turn on debugging:
```
web:
extends:
file: common.yml
service: webapp
ports:
- "80:8000"
links:
- db
db:
image: postgres
```
> **Note:** When you extend a service, `links` and `volumes_from`
> configuration options are **not** inherited - you will have to define
> those manually each time you extend it.
### net
Networking mode. Use the same values as the docker client `--net` parameter.
```
net: "bridge"
net: "none"
net: "container:[name or id]"
net: "host"
```
### dns
Custom DNS servers. Can be a single value or a list.
```
dns: 8.8.8.8
dns:
- 8.8.8.8
- 9.9.9.9
```
### cap_add, cap_drop
Add or drop container capabilities.
See `man 7 capabilities` for a full list.
```
cap_add:
- ALL
cap_drop:
- NET_ADMIN
- SYS_ADMIN
```
### dns_search
Custom DNS search domains. Can be a single value or a list.
```
dns_search: example.com
dns_search:
- dc1.example.com
- dc2.example.com
```
### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares
Each of these is a single value, analogous to its
[docker run](https://docs.docker.com/reference/run/) counterpart.
```
cpu_shares: 73
working_dir: /code
entrypoint: /code/entrypoint.sh
user: postgresql
hostname: foo
domainname: foo.com
mem_limit: 1000000000
privileged: true
restart: always
stdin_open: true
tty: true
```
## Compose documentation
- [Installing Compose](install.md)
- [User guide](index.md)
- [Command line reference](cli.md)
- [Compose environment variables](env.md)
- [Compose command line completion](completion.md)

View file

@ -0,0 +1,5 @@
# Experimental: Compose, Swarm and Multi-Host Networking
Compose now supports multi-host networking as standard. Read more here:
https://docs.docker.com/compose/networking

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

35
project/ISSUE-TRIAGE.md Normal file
View file

@ -0,0 +1,35 @@
Triaging of issues
------------------
The docker-compose issue triage process follows
https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md
with the following additions or exceptions.
### Classify the Issue
The following labels are provided in additional to the standard labels:
| Kind | Description |
|--------------|-------------------------------------------------------------------|
| kind/cleanup | A refactor or improvement that is related to quality not function |
| kind/parity | A request for feature parity with docker cli |
### Functional areas
Most issues should fit into one of the following functional areas:
| Area |
|-----------------|
| area/build |
| area/cli |
| area/config |
| area/logs |
| area/networking |
| area/packaging |
| area/run |
| area/scale |
| area/tests |
| area/up |
| area/volumes |

139
project/RELEASE-PROCESS.md Normal file
View file

@ -0,0 +1,139 @@
Building a Compose release
==========================
## Prerequisites
The release scripts require the following tools installed on the host:
* https://hub.github.com/
* https://stedolan.github.io/jq/
* http://pandoc.org/
## To get started with a new release
Create a branch, update version, and add release notes by running `make-branch`
./script/release/make-branch $VERSION [$BASE_VERSION]
`$BASE_VERSION` will default to master. Use the last version tag for a bug fix
release.
As part of this script you'll be asked to:
1. Update the version in `compose/__init__.py` and `script/run/run.sh`.
If the next release will be an RC, append `-rcN`, e.g. `1.4.0-rc1`.
2. Write release notes in `CHANGES.md`.
Almost every feature enhancement should be mentioned, with the most
visible/exciting ones first. Use descriptive sentences and give context
where appropriate.
Bug fixes are worth mentioning if it's likely that they've affected lots
of people, or if they were regressions in the previous version.
Improvements to the code are not worth mentioning.
3. Create a new repository on [bintray](https://bintray.com/docker-compose).
The name has to match the name of the branch (e.g. `bump-1.9.0`) and the
type should be "Generic". Other fields can be left blank.
4. Check that the `vnext-compose` branch on
[the docs repo](https://github.com/docker/docker.github.io/) has
documentation for all the new additions in the upcoming release, and create
a PR there for what needs to be amended.
## When a PR is merged into master that we want in the release
1. Check out the bump branch and run the cherry pick script
git checkout bump-$VERSION
./script/release/cherry-pick-pr $PR_NUMBER
2. When you are done cherry-picking branches move the bump version commit to HEAD
./script/release/rebase-bump-commit
git push --force $USERNAME bump-$VERSION
## To release a version (whether RC or stable)
Check out the bump branch and run the `build-binaries` script
git checkout bump-$VERSION
./script/release/build-binaries
When prompted build the non-linux binaries and test them.
1. Download the osx binary from Bintray. Make sure that the latest Travis
build has finished, otherwise you'll be downloading an old binary.
https://dl.bintray.com/docker-compose/$BRANCH_NAME/
2. Download the windows binary from AppVeyor
https://ci.appveyor.com/project/docker/compose
3. Draft a release from the tag on GitHub (the script will open the window for
you)
The tag will only be present on Github when you run the `push-release`
script in step 7, but you can pre-fill it at that point.
4. Paste in installation instructions and release notes. Here's an example -
change the Compose version and Docker version as appropriate:
If you're a Mac or Windows user, the best way to install Compose and keep it up-to-date is **[Docker for Mac and Windows](https://www.docker.com/products/docker)**.
Note that Compose 1.9.0 requires Docker Engine 1.10.0 or later for version 2 of the Compose File format, and Docker Engine 1.9.1 or later for version 1. Docker for Mac and Windows will automatically install the latest version of Docker Engine for you.
Alternatively, you can use the usual commands to install or upgrade Compose:
```
curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
```
See the [install docs](https://docs.docker.com/compose/install/) for more install options and instructions.
Here's what's new:
...release notes go here...
5. Attach the binaries and `script/run/run.sh`
6. Add "Thanks" with a list of contributors. The contributor list can be generated
by running `./script/release/contributors`.
7. If everything looks good, it's time to push the release.
./script/release/push-release
8. Merge the bump PR.
8. Publish the release on GitHub.
9. Check that all the binaries download (following the install instructions) and run.
10. Email maintainers@dockerproject.org and engineering@docker.com about the new release.
## If its a stable release (not an RC)
1. Close the releases milestone.
## If its a minor release (1.x.0), rather than a patch release (1.x.y)
1. Open a PR against `master` to:
- update `CHANGELOG.md` to bring it in line with `release`
- bump the version in `compose/__init__.py` to the *next* minor version number with `dev` appended. For example, if you just released `1.4.0`, update it to `1.5.0dev`.
2. Get the PR merged.
## Finally
1. Celebrate, however youd like.

1
requirements-build.txt Normal file
View file

@ -0,0 +1 @@
pyinstaller==3.2.1

View file

@ -1,6 +1,4 @@
mock >= 1.0.1
nose==1.3.4
git+https://github.com/pyinstaller/pyinstaller.git@12e40471c77f588ea5be352f7219c873ddaae056#egg=pyinstaller
unittest2==0.8.0
flake8==2.3.0
pep8==1.6.1
coverage==3.7.1
mock>=1.0.1
pytest==2.7.2
pytest-cov==2.1.0

View file

@ -1,8 +1,16 @@
PyYAML==3.10
docker-py==1.0.0
dockerpty==0.3.2
PyYAML==3.11
backports.ssl-match-hostname==3.5.0.1; python_version < '3'
cached-property==1.2.0
colorama==0.3.7
docker==2.0.2
dockerpty==0.4.1
docopt==0.6.1
requests==2.2.1
six==1.7.3
texttable==0.8.2
websocket-client==0.11.0
enum34==1.0.4; python_version < '3.4'
functools32==3.2.3.post2; python_version < '3.2'
ipaddress==1.0.16
jsonschema==2.5.1
pypiwin32==219; sys_platform == 'win32'
requests==2.11.1
six==1.10.0
texttable==0.8.4
websocket-client==0.32.0

View file

@ -1,33 +0,0 @@
#!/bin/bash
if [ -z "$VALIDATE_UPSTREAM" ]; then
# this is kind of an expensive check, so let's not do this twice if we
# are running more than one validate bundlescript
VALIDATE_REPO='https://github.com/docker/fig.git'
VALIDATE_BRANCH='master'
if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
VALIDATE_BRANCH="${TRAVIS_BRANCH}"
fi
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
validate_diff() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git diff "$VALIDATE_COMMIT_DIFF" "$@"
fi
}
validate_log() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git log "$VALIDATE_COMMIT_LOG" "$@"
fi
}
fi

View file

@ -1,8 +0,0 @@
#!/bin/sh
set -ex
mkdir -p `pwd`/dist
chmod 777 `pwd`/dist
docker build -t docker-compose .
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint pyinstaller docker-compose -F bin/docker-compose
mv dist/docker-compose dist/docker-compose-Linux-x86_64
docker run -u user -v `pwd`/dist:/code/dist --rm --entrypoint dist/docker-compose-Linux-x86_64 docker-compose --version

View file

@ -1,10 +0,0 @@
#!/bin/bash
set -ex
rm -rf venv
virtualenv venv
venv/bin/pip install -r requirements.txt
venv/bin/pip install -r requirements-dev.txt
venv/bin/pip install .
venv/bin/pyinstaller -F bin/docker-compose
mv dist/docker-compose dist/docker-compose-Darwin-x86_64
dist/docker-compose-Darwin-x86_64 --version

15
script/build/image Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
set -e
if [ -z "$1" ]; then
>&2 echo "First argument must be image tag."
exit 1
fi
TAG=$1
VERSION="$(python setup.py --version)"
./script/build/write-git-sha
python setup.py sdist bdist_wheel
docker build --build-arg version=$VERSION -t docker/compose:$TAG -f Dockerfile.run .

13
script/build/linux Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -ex
./script/clean
TAG="docker-compose"
docker build -t "$TAG" . | tail -n 200
docker run \
--rm --entrypoint="script/build/linux-entrypoint" \
-v $(pwd)/dist:/code/dist \
-v $(pwd)/.git:/code/.git \
"$TAG"

15
script/build/linux-entrypoint Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
set -ex
TARGET=dist/docker-compose-$(uname -s)-$(uname -m)
VENV=/code/.tox/py27
mkdir -p `pwd`/dist
chmod 777 `pwd`/dist
$VENV/bin/pip install -q -r requirements-build.txt
./script/build/write-git-sha
su -c "$VENV/bin/pyinstaller docker-compose.spec" user
mv dist/docker-compose $TARGET
$TARGET version

15
script/build/osx Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
set -ex
PATH="/usr/local/bin:$PATH"
rm -rf venv
virtualenv -p /usr/local/bin/python venv
venv/bin/pip install -r requirements.txt
venv/bin/pip install -r requirements-build.txt
venv/bin/pip install --no-deps .
./script/build/write-git-sha
venv/bin/pyinstaller docker-compose.spec
mv dist/docker-compose dist/docker-compose-Darwin-x86_64
dist/docker-compose-Darwin-x86_64 version

60
script/build/windows.ps1 Normal file
View file

@ -0,0 +1,60 @@
# Builds the Windows binary.
#
# From a fresh 64-bit Windows 10 install, prepare the system as follows:
#
# 1. Install Git:
#
# http://git-scm.com/download/win
#
# 2. Install Python 2.7.10:
#
# https://www.python.org/downloads/
#
# 3. Append ";C:\Python27;C:\Python27\Scripts" to the "Path" environment variable:
#
# https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true
#
# 4. In Powershell, run the following commands:
#
# $ pip install virtualenv
# $ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
#
# 5. Clone the repository:
#
# $ git clone https://github.com/docker/compose.git
# $ cd compose
#
# 6. Build the binary:
#
# .\script\build\windows.ps1
$ErrorActionPreference = "Stop"
# Remove virtualenv
if (Test-Path venv) {
Remove-Item -Recurse -Force .\venv
}
# Remove .pyc files
Get-ChildItem -Recurse -Include *.pyc | foreach ($_) { Remove-Item $_.FullName }
# Create virtualenv
virtualenv .\venv
# pip and pyinstaller generate lots of warnings, so we need to ignore them
$ErrorActionPreference = "Continue"
# Install dependencies
.\venv\Scripts\pip install pypiwin32==219
.\venv\Scripts\pip install -r requirements.txt
.\venv\Scripts\pip install --no-deps .
.\venv\Scripts\pip install --allow-external pyinstaller -r requirements-build.txt
git rev-parse --short HEAD | out-file -encoding ASCII compose\GITSHA
# Build binary
.\venv\Scripts\pyinstaller .\docker-compose.spec
$ErrorActionPreference = "Stop"
Move-Item -Force .\dist\docker-compose.exe .\dist\docker-compose-Windows-x86_64.exe
.\dist\docker-compose-Windows-x86_64.exe --version

7
script/build/write-git-sha Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
#
# Write the current commit sha to the file GITSHA. This file is included in
# packaging so that `docker-compose version` can include the git sha.
#
set -e
git rev-parse --short HEAD > compose/GITSHA

8
script/ci Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
#
# Backwards compatiblity for jenkins
#
# TODO: remove this script after all current PRs and jenkins are updated with
# the new script/test/ci change
set -e
exec script/test/ci

View file

@ -1,3 +1,7 @@
#!/bin/sh
set -e
find . -type f -name '*.pyc' -delete
find . -name .coverage.* -delete
find . -name __pycache__ -delete
rm -rf docs/_site build dist docker-compose.egg-info

View file

@ -1,21 +0,0 @@
#!/bin/bash
# This is a script for running Compose inside a Docker container. It's handy for
# development.
#
# $ ln -s `pwd`/script/dev /usr/local/bin/docker-compose
# $ cd /a/compose/project
# $ docker-compose up
#
set -e
# Follow symbolic links
if [ -h "$0" ]; then
DIR=$(readlink "$0")
else
DIR=$0
fi
DIR="$(dirname "$DIR")"/..
docker build -t docker-compose $DIR
exec docker run -i -t -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:`pwd` -w `pwd` docker-compose $@

View file

@ -1,88 +0,0 @@
#!/bin/bash
set -e
# DinD: a wrapper script which allows docker to be run inside a docker container.
# Original version by Jerome Petazzoni <jerome@docker.com>
# See the blog post: http://blog.docker.com/2013/09/docker-can-now-run-within-docker/
#
# This script should be executed inside a docker container in privilieged mode
# ('docker run --privileged', introduced in docker 0.6).
# Usage: dind CMD [ARG...]
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
export container=docker
# First, make sure that cgroups are mounted correctly.
CGROUP=/cgroup
mkdir -p "$CGROUP"
if ! mountpoint -q "$CGROUP"; then
mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || {
echo >&2 'Could not make a tmpfs mount. Did you use --privileged?'
exit 1
}
fi
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
mount -t securityfs none /sys/kernel/security || {
echo >&2 'Could not mount /sys/kernel/security.'
echo >&2 'AppArmor detection and -privileged mode might break.'
}
fi
# Mount the cgroup hierarchies exactly as they are in the parent system.
for SUBSYS in $(cut -d: -f2 /proc/1/cgroup); do
mkdir -p "$CGROUP/$SUBSYS"
if ! mountpoint -q $CGROUP/$SUBSYS; then
mount -n -t cgroup -o "$SUBSYS" cgroup "$CGROUP/$SUBSYS"
fi
# The two following sections address a bug which manifests itself
# by a cryptic "lxc-start: no ns_cgroup option specified" when
# trying to start containers withina container.
# The bug seems to appear when the cgroup hierarchies are not
# mounted on the exact same directories in the host, and in the
# container.
# Named, control-less cgroups are mounted with "-o name=foo"
# (and appear as such under /proc/<pid>/cgroup) but are usually
# mounted on a directory named "foo" (without the "name=" prefix).
# Systemd and OpenRC (and possibly others) both create such a
# cgroup. To avoid the aforementioned bug, we symlink "foo" to
# "name=foo". This shouldn't have any adverse effect.
name="${SUBSYS#name=}"
if [ "$name" != "$SUBSYS" ]; then
ln -s "$SUBSYS" "$CGROUP/$name"
fi
# Likewise, on at least one system, it has been reported that
# systemd would mount the CPU and CPU accounting controllers
# (respectively "cpu" and "cpuacct") with "-o cpuacct,cpu"
# but on a directory called "cpu,cpuacct" (note the inversion
# in the order of the groups). This tries to work around it.
if [ "$SUBSYS" = 'cpuacct,cpu' ]; then
ln -s "$SUBSYS" "$CGROUP/cpu,cpuacct"
fi
done
# Note: as I write those lines, the LXC userland tools cannot setup
# a "sub-container" properly if the "devices" cgroup is not in its
# own hierarchy. Let's detect this and issue a warning.
if ! grep -q :devices: /proc/1/cgroup; then
echo >&2 'WARNING: the "devices" cgroup should be in its own hierarchy.'
fi
if ! grep -qw devices /proc/1/cgroup; then
echo >&2 'WARNING: it looks like the "devices" cgroup is not mounted.'
fi
# Mount /tmp
mount -t tmpfs none /tmp
if [ $# -gt 0 ]; then
exec "$@"
fi
echo >&2 'ERROR: No command specified.'
echo >&2 'You probably want to run hack/make.sh, or maybe a shell?'

View file

@ -1,11 +0,0 @@
#!/bin/sh
set -ex
# import the existing docs build cmds from docker/docker
DOCSPORT=8000
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
DOCKER_DOCS_IMAGE="compose-docs$GIT_BRANCH"
DOCKER_RUN_DOCS="docker run --rm -it -e NOCACHE"
docker build -t "$DOCKER_DOCS_IMAGE" -f docs/Dockerfile .
$DOCKER_RUN_DOCS -p $DOCSPORT:8000 "$DOCKER_DOCS_IMAGE" mkdocs serve

37
script/release/build-binaries Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
#
# Build the release binaries
#
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
function usage() {
>&2 cat << EOM
Build binaries for the release.
This script requires that 'git config branch.${BRANCH}.release' is set to the
release version for the release branch.
EOM
exit 1
}
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
VERSION="$(git config "branch.${BRANCH}.release")" || usage
REPO=docker/compose
# Build the binaries
script/clean
script/build/linux
echo "Building the container distribution"
script/build/image $VERSION
echo "Create a github release"
# TODO: script more of this https://developer.github.com/v3/repos/releases/
browser https://github.com/$REPO/releases/new
echo "Don't forget to download the osx and windows binaries from appveyor/bintray\!"
echo "https://dl.bintray.com/docker-compose/$BRANCH/"
echo "https://ci.appveyor.com/project/docker/compose"
echo

34
script/release/cherry-pick-pr Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
#
# Cherry-pick a PR into the release branch
#
set -e
set -o pipefail
function usage() {
>&2 cat << EOM
Cherry-pick commits from a github pull request.
Usage:
$0 <github PR number>
EOM
exit 1
}
[ -n "$1" ] || usage
if [ -z "$(command -v hub 2> /dev/null)" ]; then
>&2 echo "$0 requires https://hub.github.com/."
>&2 echo "Please install it and make sure it is available on your \$PATH."
exit 2
fi
REPO=docker/compose
GITHUB=https://github.com/$REPO/pull
PR=$1
url="$GITHUB/$PR"
hub am -3 $url

30
script/release/contributors Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
set -e
function usage() {
>&2 cat << EOM
Print the list of github contributors for the release
Usage:
$0 <previous release tag>
EOM
exit 1
}
[[ -n "$1" ]] || usage
PREV_RELEASE=$1
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
URL="https://api.github.com/repos/docker/compose/compare"
contribs=$(curl -sf "$URL/$PREV_RELEASE...$BRANCH" | \
jq -r '.commits[].author.login' | \
sort | \
uniq -c | \
sort -nr)
echo "Contributions by user: "
echo "$contribs"
echo
echo "$contribs" | awk '{print "@"$2","}' | xargs

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