Compare commits

..

3 Commits
v1 ... 1.29.1

Author SHA1 Message Date
Anca Iordache
c34c88b217 "Bump 1.29.1"
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2021-04-13 20:36:47 +02:00
Anca Iordache
575d67618e Merge branch 'master' into 1.29.x 2021-04-13 20:22:04 +02:00
Anca Iordache
0773730525 "Bump 1.29.0"
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2021-04-06 20:54:33 +02:00
29 changed files with 83 additions and 6499 deletions

View File

@@ -7,16 +7,6 @@ assignees: ''
---
<!--
**DEPRECATION NOTICE:**
Compose V1 is end-of-life, and as such only issues relating to security vulnerabilities will be considered.
Please do not submit issues regarding bugs or improvements.
For a more up-to-date compose, check v2: https://github.com/docker/compose/tree/v2/
-->
<!--
Welcome to the docker-compose issue tracker! Before creating an issue, please heed the following:
@@ -35,10 +25,7 @@ Welcome to the docker-compose issue tracker! Before creating an issue, please he
## Context information (for bug reports)
- [ ] Using Compose V2 `docker compose ...`
- [ ] Using Compose V1 `docker-compose ...`
**Output of `docker(-)compose version`**
**Output of `docker-compose version`**
```
(paste here)
```

View File

@@ -7,16 +7,6 @@ assignees: ''
---
<!--
**DEPRECATION NOTICE:**
Compose V1 is end-of-life, and as such only issues relating to security vulnerabilities will be considered.
Please do not submit issues regarding bugs or improvements.
For a more up-to-date compose, check v2: https://github.com/docker/compose/tree/v2/
-->
<!--
Welcome to the docker-compose issue tracker! Before creating an issue, please heed the following:
@@ -29,9 +19,6 @@ Welcome to the docker-compose issue tracker! Before creating an issue, please he
the original discussion.
-->
/!\ If your request is about evolving the compose file format, please report on the [Compose Specification](https://github.com/compose-spec/compose-spec)
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

View File

@@ -7,16 +7,6 @@ assignees: ''
---
<!--
**DEPRECATION NOTICE:**
Compose V1 is end-of-life, and as such only issues relating to security vulnerabilities will be considered.
Please do not submit issues regarding bugs or improvements.
For a more up-to-date compose, check v2: https://github.com/docker/compose/tree/v2/
-->
Please post on our forums: https://forums.docker.com for questions about using `docker-compose`.
Posts that are not a bug report or a feature/enhancement request will not be addressed on this issue tracker.

View File

@@ -1,28 +0,0 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "14:00"
timezone: America/Los_Angeles
open-pull-requests-limit: 10
ignore:
- dependency-name: python-dotenv
versions:
- 0.15.0
- 0.16.0
- dependency-name: urllib3
versions:
- 1.26.2
- 1.26.3
- dependency-name: coverage
versions:
- 5.3.1
- "5.4"
- dependency-name: packaging
versions:
- "20.8"
- dependency-name: cached-property
versions:
- 1.5.2

View File

@@ -1,58 +0,0 @@
name: Publish Artifacts
on:
issue_comment:
types: [created]
jobs:
publish-artifacts:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/generate-artifacts')
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
- name: Build cross platform compose-plugin binaries
run: make -f builder.Makefile cross
- name: Upload macos-amd64 binary
uses: actions/upload-artifact@v2
with:
name: docker-compose-darwin-amd64
path: ${{ github.workspace }}/bin/docker-compose-darwin-amd64
- name: Upload macos-arm64 binary
uses: actions/upload-artifact@v2
with:
name: docker-compose-darwin-arm64
path: ${{ github.workspace }}/bin/docker-compose-darwin-arm64
- name: Upload linux-amd64 binary
uses: actions/upload-artifact@v2
with:
name: docker-compose-linux-amd64
path: ${{ github.workspace }}/bin/docker-compose-linux-amd64
- name: Upload windows-amd64 binary
uses: actions/upload-artifact@v2
with:
name: docker-compose-windows-amd64.exe
path: ${{ github.workspace }}/bin/docker-compose-windows-amd64.exe
- name: Update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.comment.id }}
body: |
This PR can be tested using [binaries](https://github.com/docker/compose-cli/actions/runs/${{ github.run_id }}).
reactions: eyes

View File

@@ -1,104 +0,0 @@
name: Continuous integration
on:
push:
branches:
- v2
pull_request:
branches:
- v2
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
GO111MODULE: "on"
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- name: Validate go-mod is up-to-date and license headers
run: make validate
- name: Run golangci-lint
env:
BUILD_TAGS: e2e
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.39.0
make -f builder.Makefile lint
# only on main branch, costs too much for the gain on every PR
validate-cross-build:
name: Validate cross build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
GO111MODULE: "on"
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
# Ensure we don't discover cross platform build issues at release time.
# Time used to build linux here is gained back in the build for local E2E step
- name: Build packages
run: make -f builder.Makefile cross
build:
name: Build
runs-on: ubuntu-latest
env:
GO111MODULE: "on"
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: Set up gosum
run: |
go get -u gotest.tools/gotestsum
- name: Setup docker CLI
run: |
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
- name: Test
env:
BUILD_TAGS: kube
run: make -f builder.Makefile test
- name: Build for local E2E
env:
BUILD_TAGS: e2e
run: make -f builder.Makefile compose-plugin
- name: E2E Test
run: make e2e-compose

View File

@@ -1,11 +0,0 @@
name: PR cleanup
on:
pull_request:
types: [closed]
jobs:
delete_pr_artifacts:
runs-on: ubuntu-latest
steps:
- uses: stefanluptak/delete-old-pr-artifacts@v1
with:
workflow_filename: ci.yaml

View File

@@ -1,19 +0,0 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,49 +0,0 @@
name: Releaser
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
dry-run:
description: 'Dry run'
required: false
default: 'true'
jobs:
upload-release:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: Setup docker CLI
run: |
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make -f builder.Makefile cross-compose-plugin
- name: License
run: cp packaging/* bin/
- uses: ncipollo/release-action@v1
with:
artifacts: "bin/*"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,28 +1,26 @@
exclude: .github/
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 'v0.9.1'
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: v1.3.4
hooks:
- id: reorder-python-imports
language_version: 'python3.7'
args:
- --py3-plus
- repo: https://github.com/asottile/pyupgrade
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 'v0.9.1'
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: v1.3.4
hooks:
- id: reorder-python-imports
language_version: 'python3.7'
args:
- --py3-plus
- repo: https://github.com/asottile/pyupgrade
rev: v2.1.0
hooks:
- id: pyupgrade

View File

@@ -1,17 +1,6 @@
Change log
==========
1.29.2 (2021-05-10)
-------------------
[List of PRs / issues for this release](https://github.com/docker/compose/milestone/59?closed=1)
### Miscellaneous
- Remove prompt to use `docker compose` in the `up` command
- Bump `py` to `1.10.0` in `requirements-indirect.txt`
1.29.1 (2021-04-13)
-------------------

View File

@@ -1,136 +0,0 @@
# Install Docker Compose
This page contains information on how to install Docker Compose. You can run Compose on macOS, Windows, and 64-bit Linux.
> ⚠️ The installation instructions on this page will help you to install Compose v1 which is a deprecated version. We recommend that you use the [latest version of Docker Compose](https://docs.docker.com/compose/install/).
## Prerequisites
Docker Compose relies on Docker Engine for any meaningful work, so make sure you
have Docker Engine installed either locally or remote, depending on your setup.
- Install
[Docker Engine](https://docs.docker.com/engine/install/#server)
for your OS and then come back here for
instructions on installing the Python version of Compose.
- To run Compose as a non-root user, see [Manage Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/).
## Install Compose
Follow the instructions below to install Compose using the `pip`
Python package manager or to install Compose as a container.
> Install a different version
>
> The instructions below outline installation of the current stable release
> (**v1.29.2**) of Compose. To install a different version of
> Compose, replace the given release number with the one that you want. For instructions to install Compose 2.x.x on Linux, see [Install Compose 2.x.x on Linux](https://docs.docker.com/compose/install/#install-compose-on-linux-systems).
>
> Compose releases are also listed and available for direct download on the
> [Compose repository release page on GitHub](https://github.com/docker/compose/releases).
> To install a **pre-release** of Compose, refer to the [install pre-release builds](#install-pre-release-builds)
> section.
- [Install using pip](#install-using-pip)
- [Install as a container](#install-as-a-container)
#### Install using pip
> For `alpine`, the following dependency packages are needed:
> `py-pip`, `python3-dev`, `libffi-dev`, `openssl-dev`, `gcc`, `libc-dev`, `rust`, `cargo`, and `make`.
{: .important}
You can install Compose from
[pypi](https://pypi.python.org/pypi/docker-compose) using `pip`. If you install
using `pip`, we recommend that you use a
[virtualenv](https://virtualenv.pypa.io/en/latest/) because many operating
systems have python system packages that conflict with docker-compose
dependencies. See the [virtualenv
tutorial](https://docs.python-guide.org/dev/virtualenvs/) to get
started.
```console
$ pip3 install docker-compose
```
If you are not using virtualenv,
```console
$ sudo pip install docker-compose
```
> pip version 6.0 or greater is required.
#### Install as a container
You can also run Compose inside a container, from a small bash script wrapper. To
install Compose as a container run this command:
```console
$ sudo curl -L --fail https://github.com/docker/compose/releases/download/1.29.2/run.sh -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
```
### Install pre-release builds
If you're interested in trying out a pre-release build, you can download release
candidates from the [Compose repository release page on GitHub](https://github.com/docker/compose/releases).
Follow the instructions from the link, which involves running the `curl` command
in your terminal to download the binaries.
Pre-releases built from the "master" branch are also available for download at
[https://dl.bintray.com/docker-compose/master/](https://dl.bintray.com/docker-compose/master/).
> Pre-release builds allow you to try out new features before they are released,
> but may be less stable.
----
## Upgrading
If you're upgrading from Compose 1.2 or earlier, remove or
migrate your existing containers after upgrading Compose. This is because, as of
version 1.3, Compose uses Docker labels to keep track of containers, and your
containers need to be recreated to add the labels.
If Compose detects containers that were created without labels, it refuses
to run, so that you don't end up with two sets of them. If you want to keep using
your existing containers (for example, because they have data volumes you want
to preserve), you can use Compose 1.5.x to migrate them with the following
command:
```console
$ docker-compose migrate-to-labels
```
Alternatively, if you're not worried about keeping them, you can remove them.
Compose just creates new ones.
```console
$ docker container rm -f -v myapp_web_1 myapp_db_1 ...
```
## Uninstall
To uninstall Docker Compose if you installed using `curl`:
```console
$ sudo rm /usr/local/bin/docker-compose
```
To uninstall Docker Compose if you installed using `pip`:
```console
$ pip uninstall docker-compose
```
> Got a "Permission denied" error?
>
> If you get a "Permission denied" error using either of the above
> methods, you probably do not have the proper permissions to remove
> `docker-compose`. To force the removal, prepend `sudo` to either of the above
> commands and run again.

2
Jenkinsfile vendored
View File

@@ -87,7 +87,7 @@ def buildImage(baseImage) {
def runTests(dockerVersion, pythonVersion, baseImage) {
return {
stage("python=${pythonVersion} docker=${dockerVersion} ${baseImage}") {
node("ubuntu-2004 && amd64 && !zfs && cgroup1") {
node("ubuntu && amd64 && !zfs") {
def scmvar = checkout(scm)
def imageName = "dockerpinata/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def storageDriver = sh(script: "docker info -f \'{{.Driver}}\'", returnStdout: true).trim()

View File

@@ -4,40 +4,6 @@ Docker Compose
![Docker Compose](logo.png?raw=true "Docker Compose Logo")
# :warning: *Compose V1 is DEPRECATED* :warning:
Since [Compose V2 is now GA](https://www.docker.com/blog/announcing-compose-v2-general-availability/), Compose V1 is officially **End of Life**. This means that:
- Active development and new features will only be added to the V2 codebase
- Only security-related issues will be considered for V1
Check out the [V2 branch here](https://github.com/docker/compose/tree/v2/)!!
---------------------------------------------
** Compose V2 is **Generally Available**! :star_struck: **
---------------------------------------------
Check it out [here](https://github.com/docker/compose/tree/v2/)!
Read more on the [GA announcement here](https://www.docker.com/blog/announcing-compose-v2-general-availability/)
---------------------------------------------
V1 vs V2 transition :hourglass_flowing_sand:
--------------------------------------------
"Generally Available" will mean:
- New features and bug fixes will only be considered in the V2 codebase
- Users on Mac/Windows will be defaulted into Docker Compose V2, but can still opt out through the UI and the CLI. This means when running `docker-compose` you will actually be running `docker compose`
- Our current goal is for users on Linux to receive Compose v2 with the latest version of the docker CLI, but is pending some technical discussion. Users will be able to use [compose switch](https://github.com/docker/compose-switch) to enable redirection of `docker-compose` to `docker compose`
- Docker Compose V1 will continue to be maintained regarding security issues
- [v2 branch](https://github.com/docker/compose/tree/v2) will become the default one at that time
:lock_with_ink_pen: Depending on the feedback we receive from the community of GA and the adoption on Linux, we will come up with a plan to deprecate v1, but as of right now there is no concrete timeline as we want the transition to be as smooth as possible for all users. It is important to note that we have no plans of removing any aliasing of `docker-compose` to `docker compose`. We want to make it as easy as possible to switch and not break any ones scripts. We will follow up with a blog post in the next few months with more information of an exact timeline of V1 being marked as deprecated and end of support for security issues. Wed love to hear your feedback! You can provide it [here](https://github.com/docker/roadmap/issues/257).
About
-----
Docker Compose is a tool for running multi-container applications on Docker
defined using the [Compose file format](https://compose-spec.io).
A Compose file is used to define how the one or more containers that make up
@@ -55,10 +21,26 @@ the Docker CLI. You can read more about how to do this:
Where to get Docker Compose
----------------------------
All the instructions to install the Python version of Docker Compose, aka `v1`,
are described in the [installation guide](./INSTALL.md).
### Windows and macOS
> ⚠️ This version is a deprecated version of Compose. We recommend that you use the [latest version of Docker Compose](https://docs.docker.com/compose/install/).
Docker Compose is included in
[Docker Desktop](https://www.docker.com/products/docker-desktop)
for Windows and macOS.
### Linux
You can download Docker Compose binaries from the
[release page](https://github.com/docker/compose/releases) on this repository.
### Using pip
If your platform is not supported, you can download Docker Compose using `pip`:
```console
pip install docker-compose
```
> **Note:** Docker Compose requires Python 3.6 or later.
Quick Start
-----------

View File

@@ -1 +1 @@
__version__ = '1.30.0dev'
__version__ = '1.29.1'

View File

@@ -778,9 +778,7 @@ class TopLevelCommand:
Options:
-q, --quiet Only display IDs
--services Display services
--filter KEY=VAL Filter services by a property. KEY is either:
1. `source` with values `image`, or `build`;
2. `status` with values `running`, `stopped`, `paused`, or `restarted`.
--filter KEY=VAL Filter services by a property
-a, --all Show all stopped containers (including those created by the run command)
"""
if options['--quiet'] and options['--services']:
@@ -1146,6 +1144,9 @@ class TopLevelCommand:
attach_dependencies = options.get('--attach-dependencies')
keep_prefix = not options.get('--no-log-prefix')
if not IS_LINUX_PLATFORM:
print('Docker Compose is now in the Docker CLI, try `docker compose up`\n')
if detached and (cascade_stop or exit_value_from or attach_dependencies):
raise UserError(
"-d cannot be combined with --abort-on-container-exit or --attach-dependencies.")

View File

@@ -1,474 +0,0 @@
There are three legacy versions of the Compose file format:
- Version 1. This is specified by omitting a `version` key at the root of the YAML.
- Version 2.x. This is specified with a `version: '2'` or `version: '2.1'`, etc., entry at the root of the YAML.
- Version 3.x, designed to be cross-compatible between Compose and the Docker Engine's
[swarm mode](https://docs.docker.com/engine/swarm/). This is specified with a `version: '3'` or `version: '3.1'`, etc., entry at the root of the YAML.
The latest and recommended version of the Compose file format is defined by the [Compose Specification](https://docs.docker.com/compose/compose-file/). This format merges the 2.x and 3.x versions and is implemented by **Compose 1.27.0+**.
> **Note**
>
> If you're using [multiple Compose files](https://docs.docker.com/compose/multiple-compose-files/) or
> [extending services](https://docs.docker.com/compose/multiple-compose-files/extends/),
> each file must be of the same version - you cannot, for example,
> mix version 1 and 2 in a single project.
Several things differ depending on which version you use:
- The structure and permitted configuration keys
- The minimum Docker Engine version you must be running
- Compose's behaviour with regards to networking
These differences are explained below.
### Version 2
Compose files using the version 2 syntax must indicate the version number at
the root of the document. All [services](compose-file-v2.md#service-configuration-reference)
must be declared under the `services` key.
Version 2 files are supported by **Compose 1.6.0+** and require a Docker Engine
of version **1.10.0+**.
Named [volumes](compose-file-v2.md#volume-configuration-reference) can be declared under the
`volumes` key, and [networks](compose-file-v2.md#network-configuration-reference) can be declared
under the `networks` key.
By default, every container joins an application-wide default network, and is
discoverable at a hostname that's the same as the service name. This means
[links](compose-file-v2.md#links) are largely unnecessary. For more details, see
[Networking in Compose](https://docs.docker.com/compose/networking/).
> **Note**
>
> With Compose version 2, when specifying the Compose file version to use, make sure to
> specify both the _major_ and _minor_ numbers. If no minor version is given,
> `0` is used by default and not the latest minor version. As a result, features added in later versions will not be supported. For example:
>
> ```yaml
> version: "2"
> ```
>
> is equivalent to:
>
> ```yaml
> version: "2.0"
> ```
Simple example:
version: "{{% param "compose_file_v2" %}}"
services:
web:
build: .
ports:
- "8000:5000"
volumes:
- .:/code
redis:
image: redis
A more extended example, defining volumes and networks:
version: "{{% param "compose_file_v2" %}}"
services:
web:
build: .
ports:
- "8000:5000"
volumes:
- .:/code
networks:
- front-tier
- back-tier
redis:
image: redis
volumes:
- redis-data:/var/lib/redis
networks:
- back-tier
volumes:
redis-data:
driver: local
networks:
front-tier:
driver: bridge
back-tier:
driver: bridge
Several other options were added to support networking, such as:
* [`aliases`](compose-file-v2.md#aliases)
* The [`depends_on`](compose-file-v2.md#depends_on) option can be used in place of links to indicate dependencies
between services and startup order.
version: "{{% param "compose_file_v2" %}}"
services:
web:
build: .
depends_on:
- db
- redis
redis:
image: redis
db:
image: postgres
* [`ipv4_address`, `ipv6_address`](compose-file-v2.md#ipv4_address-ipv6_address)
[Variable substitution](compose-file-v2.md#variable-substitution) also was added in Version 2.
### Version 2.1
An upgrade of [version 2](#version-2) that introduces new parameters only
available with Docker Engine version **1.12.0+**. Version 2.1 files are
supported by **Compose 1.9.0+**.
Introduces the following additional parameters:
- [`link_local_ips`](compose-file-v2.md#link_local_ips)
- [`isolation`](compose-file-v2.md#isolation-1) in build configurations and
service definitions
- `labels` for [volumes](compose-file-v2.md#volume-configuration-reference),
[networks](compose-file-v2.md#network-configuration-reference), and
[build](compose-file-v3.md#build)
- `name` for [volumes](compose-file-v2.md#volume-configuration-reference)
- [`userns_mode`](compose-file-v2.md#userns_mode)
- [`healthcheck`](compose-file-v2.md#healthcheck)
- [`sysctls`](compose-file-v2.md#sysctls)
- [`pids_limit`](compose-file-v2.md#pids_limit)
- [`oom_kill_disable`](compose-file-v2.md#cpu-and-other-resources)
- [`cpu_period`](compose-file-v2.md#cpu-and-other-resources)
### Version 2.2
An upgrade of [version 2.1](#version-21) that introduces new parameters only
available with Docker Engine version **1.13.0+**. Version 2.2 files are
supported by **Compose 1.13.0+**. This version also allows you to specify
default scale numbers inside the service's configuration.
Introduces the following additional parameters:
- [`init`](compose-file-v2.md#init)
- [`scale`](compose-file-v2.md#scale)
- [`cpu_rt_runtime` and `cpu_rt_period`](compose-file-v2.md#cpu_rt_runtime-cpu_rt_period)
- [`network`](compose-file-v2.md#network) for [build configurations](compose-file-v2.md#build)
### Version 2.3
An upgrade of [version 2.2](#version-22) that introduces new parameters only
available with Docker Engine version **17.06.0+**. Version 2.3 files are
supported by **Compose 1.16.0+**.
Introduces the following additional parameters:
- [`target`](compose-file-v2.md#target), [`extra_hosts`](compose-file-v2.md#extra_hosts-1) and
[`shm_size`](compose-file-v2.md#shm_size) for [build configurations](compose-file-v2.md#build)
- `start_period` for [`healthchecks`](compose-file-v2.md#healthcheck)
- ["Long syntax" for volumes](compose-file-v2.md#long-syntax)
- [`runtime`](compose-file-v2.md#runtime) for service definitions
- [`device_cgroup_rules`](compose-file-v2.md#device_cgroup_rules)
### Version 2.4
An upgrade of [version 2.3](#version-23) that introduces new parameters only
available with Docker Engine version **17.12.0+**. Version 2.4 files are
supported by **Compose 1.21.0+**.
Introduces the following additional parameters:
- [`platform`](compose-file-v2.md#platform) for service definitions
- Support for extension fields at the root of service, network, and volume
definitions
### Version 3
Designed to be cross-compatible between Compose and the Docker Engine's
[swarm mode](/engine/swarm/), version 3 removes several options and adds
several more.
- Removed: `volume_driver`, `volumes_from`, `cpu_shares`, `cpu_quota`,
`cpuset`, `mem_limit`, `memswap_limit`, `extends`, `group_add`. See
the [upgrading](#upgrading) guide for how to migrate away from these.
- Added: [deploy](compose-file-v3.md#deploy)
If only the major version is given (`version: '3'`),
the latest minor version is used by default.
### Version 3.1
An upgrade of [version 3](#version-3) that introduces new parameters only
available with Docker Engine version **1.13.1+**, and higher.
Introduces the following additional parameters:
- [`secrets`](compose-file-v3.md#secrets)
### Version 3.2
An upgrade of [version 3](#version-3) that introduces new parameters only
available with Docker Engine version **17.04.0+**, and higher.
Introduces the following additional parameters:
- [`cache_from`](compose-file-v3.md#cache_from) in [build configurations](compose-file-v3.md#build)
- Long syntax for [ports](compose-file-v3.md#ports) and [volume mounts](compose-file-v3.md#volumes)
- [`attachable`](compose-file-v3.md#attachable) network driver option
- [deploy `endpoint_mode`](compose-file-v3.md#endpoint_mode)
- [deploy placement `preference`](compose-file-v3.md#placement)
### Version 3.3
An upgrade of [version 3](#version-3) that introduces new parameters only
available with Docker Engine version **17.06.0+**, and higher.
Introduces the following additional parameters:
- [build `labels`](compose-file-v3.md#build)
- [`credential_spec`](compose-file-v3.md#credential_spec)
- [`configs`](compose-file-v3.md#configs)
### Version 3.4
An upgrade of [version 3](#version-3) that introduces new parameters. It is
only available with Docker Engine version **17.09.0** and higher.
Introduces the following additional parameters:
- [`target`](compose-file-v3.md#target) and [`network`](compose-file-v3.md#network) in
[build configurations](compose-file-v3.md#build)
- `start_period` for [`healthchecks`](compose-file-v3.md#healthcheck)
- `order` for [update configurations](compose-file-v3.md#update_config)
- `name` for [volumes](compose-file-v3.md#volume-configuration-reference)
### Version 3.5
An upgrade of [version 3](#version-3) that introduces new parameters. It is
only available with Docker Engine version **17.12.0** and higher.
Introduces the following additional parameters:
- [`isolation`](compose-file-v3.md#isolation) in service definitions
- `name` for networks, secrets and configs
- `shm_size` in [build configurations](compose-file-v3.md#build)
### Version 3.6
An upgrade of [version 3](#version-3) that introduces new parameters. It is
only available with Docker Engine version **18.02.0** and higher.
Introduces the following additional parameters:
- [`tmpfs` size](compose-file-v3.md#long-syntax-3) for `tmpfs`-type mounts
### Version 3.7
An upgrade of [version 3](#version-3) that introduces new parameters. It is
only available with Docker Engine version **18.06.0** and higher.
Introduces the following additional parameters:
- [`init`](compose-file-v3.md#init) in service definitions
- [`rollback_config`](compose-file-v3.md#rollback_config) in deploy configurations
- Support for extension fields at the root of service, network, volume, secret
and config definitions
### Version 3.8
An upgrade of [version 3](#version-3) that introduces new parameters. It is
only available with Docker Engine version **19.03.0** and higher.
Introduces the following additional parameters:
- [`max_replicas_per_node`](compose-file-v3.md#max_replicas_per_node) in placement
configurations
- `template_driver` option for [config](compose-file-v3.md#configs-configuration-reference)
and [secret](compose-file-v3.md#secrets-configuration-reference) configurations. This
option is only supported when deploying swarm services using
`docker stack deploy`.
- `driver` and `driver_opts` option for [secret](compose-file-v3.md#secrets-configuration-reference)
configurations. This option is only supported when deploying swarm services
using `docker stack deploy`.
### Version 1 (Deprecated)
Compose versions below 1.6.x are
Compose files that do not declare a version are considered "version 1". In those
files, all the [services](compose-file-v3.md#service-configuration-reference) are
declared at the root of the document.
Version 1 is supported by Compose up to 1.6.x** and has been deprecated.
Version 1 files cannot declare named
[volumes](compose-file-v3.md#volume-configuration-reference), [networks](compose-file-v3.md#network-configuration-reference) or
[build arguments](compose-file-v3.md#args).
Compose does not take advantage of [networking](https://docs.docker.com/compose/networking/) when you
use version 1: every container is placed on the default `bridge` network and is
reachable from every other container at its IP address. You need to use
`links` to enable discovery between containers.
Example:
web:
build: .
ports:
- "8000:5000"
volumes:
- .:/code
links:
- redis
redis:
image: redis
## Upgrading
### Version 2.x to 3.x
Between versions 2.x and 3.x, the structure of the Compose file is the same, but
several options have been removed:
- `volume_driver`: Instead of setting the volume driver on the service, define
a volume using the
[top-level `volumes` option](compose-file-v3.md#volume-configuration-reference)
and specify the driver there.
version: "3.8"
services:
db:
image: postgres
volumes:
- data:/var/lib/postgresql/data
volumes:
data:
driver: mydriver
- `volumes_from`: To share a volume between services, define it using the
[top-level `volumes` option](compose-file-v3.md#volume-configuration-reference)
and reference it from each service that shares it using the
[service-level `volumes` option](compose-file-v3.md#driver).
- `cpu_shares`, `cpu_quota`, `cpuset`, `mem_limit`, `memswap_limit`: These
have been replaced by the [resources](compose-file-v3.md#resources) key under
`deploy`. `deploy` configuration only takes effect when using
`docker stack deploy`, and is ignored by `docker-compose`.
- `extends`: This option has been removed for `version: "3.x"` Compose files.
For more information on `extends`, see
[Extending services](https://docs.docker.com/compose/multiple-compose-files/extends/).
- `group_add`: This option has been removed for `version: "3.x"` Compose files.
- `pids_limit`: This option has not been introduced in `version: "3.x"` Compose files.
- `link_local_ips` in `networks`: This option has not been introduced in
`version: "3.x"` Compose files.
#### Compatibility mode
`docker-compose` 1.20.0 introduces a new `--compatibility` flag designed to
help developers transition to version 3 more easily. When enabled,
`docker-compose` reads the `deploy` section of each service's definition and
attempts to translate it into the equivalent version 2 parameter. Currently,
the following deploy keys are translated:
- [resources](compose-file-v3.md#resources) limits and memory reservations
- [replicas](compose-file-v3.md#replicas)
- [restart_policy](compose-file-v3.md#restart_policy) `condition` and `max_attempts`
All other keys are ignored and produce a warning if present. You can review
the configuration that will be used to deploy by using the `--compatibility`
flag with the `config` command.
> Do not use this in production
>
> We recommend against using `--compatibility` mode in production. The
> resulting configuration is only an approximate using non-Swarm mode
> properties, it may produce unexpected results.
### Version 1 to 2.x
In the majority of cases, moving from version 1 to 2 is a very simple process:
1. Indent the whole file by one level and put a `services:` key at the top.
2. Add a `version: '2'` line at the top of the file.
It's more complicated if you're using particular configuration features:
- `dockerfile`: This now lives under the `build` key:
build:
context: .
dockerfile: Dockerfile-alternate
- `log_driver`, `log_opt`: These now live under the `logging` key:
logging:
driver: syslog
options:
syslog-address: "tcp://192.168.0.42:123"
- `links` with environment variables: environment variables created by
links, such as `CONTAINERNAME_PORT`, ` have been deprecated for some time. In the new Docker network system,
they have been removed. You should either connect directly to the
appropriate hostname or set the relevant environment variable yourself,
using the link hostname:
web:
links:
- db
environment:
- DB_PORT=tcp://db:5432
- `external_links`: Compose uses Docker networks when running version 2
projects, so links behave 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.
Either connect the external container to your app's
[default network](https://docs.docker.com/compose/networking/), or connect both the external container and
your service's containers to an
[external network](https://docs.docker.com/compose/networking/).
- `net`: This is now replaced by [network_mode](compose-file-v3.md#network_mode):
net: host -> network_mode: host
net: bridge -> network_mode: bridge
net: none -> network_mode: none
If you're using `net: "container:[service name]"`, you must now use
`network_mode: "service:[service name]"` instead.
net: "container:web" -> network_mode: "service:web"
If you're using `net: "container:[container name/id]"`, the value does not
need to change.
net: "container:cont-name" -> network_mode: "container:cont-name"
net: "container:abc12345" -> network_mode: "container:abc12345"
- `volumes` with named volumes: these must now be explicitly declared in a
top-level `volumes` section of your Compose file. If a service mounts a
named volume called `data`, you must declare a `data` volume in your
top-level `volumes` section. The whole file might look like this:
version: "{{% param "compose_file_v2" %}}"
services:
db:
image: postgres
volumes:
- data:/var/lib/postgresql/data
volumes:
data: {}
By default, Compose creates a volume whose name is prefixed with your
project name. If you want it to just be called `data`, declare it as
external:
volumes:
data:
external: true

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

14
docs/README.md Normal file
View File

@@ -0,0 +1,14 @@
# 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 unreleased features/changes on the `master` branch (https://github.com/docker/docker.github.io/tree/master), please prefix the PR title with `[WIP]` to indicate that it relates to an unreleased change.
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.
As always, the docs remain open-source and we appreciate your feedback and
pull requests!

437
logo.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 132 KiB

View File

@@ -1,9 +1,9 @@
Click==7.1.2
coverage==5.5
ddt==1.4.2
ddt==1.4.1
flake8==3.8.3
gitpython==3.1.11
mock==3.0.5
pytest==6.2.4; python_version >= '3.5'
pytest==6.0.1; python_version >= '3.5'
pytest==4.6.5; python_version < '3.5'
pytest-cov==2.10.1

View File

@@ -13,7 +13,7 @@ more-itertools==8.6.0; python_version >= '3.5'
more-itertools==5.0.0; python_version < '3.5'
packaging==20.9
pluggy==0.13.1
py==1.10.0
py==1.9.0
pycodestyle==2.6.0
pycparser==2.20
pyflakes==2.2.0

View File

@@ -1,8 +1,8 @@
backports.shutil_get_terminal_size==1.0.0
cached-property==1.5.1; python_version < '3.8'
certifi==2021.5.30
certifi==2020.6.20
chardet==3.0.4
colorama==0.4.4; sys_platform == 'win32'
colorama==0.4.3; sys_platform == 'win32'
distro==1.5.0
docker==5.0.0
docker-pycreds==0.4.0
@@ -11,12 +11,12 @@ docopt==0.6.2
idna==2.10
ipaddress==1.0.23
jsonschema==3.2.0
paramiko==2.7.2
paramiko==2.7.1
PySocks==1.7.1
python-dotenv==0.17.0
pywin32==301; sys_platform == 'win32'
pywin32==227; sys_platform == 'win32'
PyYAML==5.4.1
requests==2.25.1
texttable==1.6.3
urllib3==1.26.5; python_version == '3.3'
websocket-client==1.1.0
requests==2.24.0
texttable==1.6.2
urllib3==1.25.10; python_version == '3.3'
websocket-client==0.57.0

View File

@@ -20,3 +20,4 @@ This should trigger a new CI build on the new tag. When the CI finishes with the
4. In case of a GA version, please update `docker-compose`s release notes and version on [github documentation repository](https://github.com/docker/docker.github.io):
- [Release Notes](https://github.com/docker/docker.github.io/blob/master/compose/release-notes.md)
- [Config version](https://github.com/docker/docker.github.io/blob/master/_config.yml)
- [Config authoring version](https://github.com/docker/docker.github.io/blob/master/_config_authoring.yml)

0
script/release/release.py Normal file → Executable file
View File

View File

@@ -15,7 +15,7 @@
set -e
VERSION="1.26.1"
VERSION="1.29.1"
IMAGE="docker/compose:$VERSION"

View File

@@ -43,6 +43,7 @@ for version in $DOCKER_VERSIONS; do
--name "$daemon_container" \
--privileged \
--volume="/var/lib/docker" \
-v $DOCKER_CONFIG/config.json:/root/.docker/config.json \
-e "DOCKER_TLS_CERTDIR=" \
"docker:$version-dind" \
dockerd -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
@@ -50,11 +51,6 @@ for version in $DOCKER_VERSIONS; do
docker exec "$daemon_container" sh -c "apk add --no-cache git"
# copy docker config from host for authentication with Docker Hub
docker exec "$daemon_container" sh -c "mkdir /root/.docker"
docker cp /root/.docker/config.json $daemon_container:/root/.docker/config.json
docker exec "$daemon_container" sh -c "chmod 644 /root/.docker/config.json"
docker run \
--rm \
--tty \

View File

@@ -1955,10 +1955,12 @@ class ProjectTest(DockerClientTestCase):
with pytest.raises(ProjectError):
project.up()
containers = project.containers()
assert len(containers) == 0
svc1 = project.get_service('svc1')
svc2 = project.get_service('svc2')
assert 'svc1' in svc2.get_dependency_names()
assert len(svc2.containers()) == 0
with pytest.raises(CompletedUnsuccessfully):
svc1.is_completed_successfully()
@@ -1991,12 +1993,14 @@ class ProjectTest(DockerClientTestCase):
with pytest.raises(ProjectError):
project.up()
containers = project.containers()
assert len(containers) == 0
svc1 = project.get_service('svc1')
svc2 = project.get_service('svc2')
svc3 = project.get_service('svc3')
assert ['svc1', 'svc2'] == svc3.get_dependency_names()
assert svc1.is_completed_successfully()
assert len(svc3.containers()) == 0
with pytest.raises(CompletedUnsuccessfully):
svc2.is_completed_successfully()