Estimated reading time: 15 minutes
The Compose file is a YAML file defining services,networks, and volumes for a Docker application.
Application,Utilities, 2019-02-13 14 MB Downloads: 3 Description NetWorker is a lightweight and easy to use tool that shows network information in the menu bar. It is fully customizable and supports both wireless and wired network adapters. .NET framework 3.5 and 4.0 are two versions of the Microsoft.NET framework. Microsoft always comes up with various applications and frameworks so that the application development is more advanced and enhanced. Microsoft.NET Framework is a framework which is designed for Windows operating system.
The Compose file formats are now described in these references, specific to each version.
Reference file | What changed in this version |
---|---|
Compose Specification (most current, and recommended) | Versioning |
Version 3 | Version 3 updates |
Version 2 | Version 2 updates |
Version 1 | Version 1 updates |
The topics below explain the differences among the versions, Docker Enginecompatibility, and how to upgrade.
Compatibility matrix
There are several versions of the Compose file format – 1, 2, 2.x, and 3.x
This table shows which Compose file versions support specific Docker releases.
Compose file format | Docker Engine release |
---|---|
Compose specification | 19.03.0+ |
3.8 | 19.03.0+ |
3.7 | 18.06.0+ |
3.6 | 18.02.0+ |
3.5 | 17.12.0+ |
3.4 | 17.09.0+ |
3.3 | 17.06.0+ |
3.2 | 17.04.0+ |
3.1 | 1.13.1+ |
3.0 | 1.13.0+ |
2.4 | 17.12.0+ |
2.3 | 17.06.0+ |
2.2 | 1.13.0+ |
2.1 | 1.12.0+ |
2.0 | 1.10.0+ |
1.0 | 1.9.1.+ |
In addition to Compose file format versions shown in the table, the Composeitself is on a release schedule, as shown in Composereleases, but file format versionsdo not necessarily increment with each release. For example, Compose file format3.0 was first introduced in Compose release1.10.0, and versionedgradually in subsequent releases.
The latest Compose file format is defined by the Compose Specification and is implemented by Docker Compose 1.27.0+.
Looking for more detail on Docker and Compose compatibility?
We recommend keeping up-to-date with newer releases as much as possible.However, if you are using an older version of Docker and want to determine whichCompose release is compatible, refer to the Compose releasenotes. Each set of release notesgives details on which versions of Docker Engine are supported, alongwith compatible Compose file format versions. (See also, the discussion inissue #3404.)
For details on versions and how to upgrade, seeVersioning andUpgrading.
Versioning
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'
orversion: '2.1'
, etc., entry at the root of the YAML.Version 3.x, designed to be cross-compatible between Compose and the Docker Engine'sswarm mode. This is specified with a
version: '3'
orversion: '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. This format merges the 2.x and 3.x versions and is implemented by Compose 1.27.0+.
v2 and v3 Declaration
Note: When specifying the Compose file version to use, make sure tospecify both the major and minor numbers. If no minor version is given,0
is used by default and not the latest minor version.
The Compatibility Matrix shows Compose file versions mapped to Docker Engine releases.
To move your project to a later version, see the Upgradingsection.
Note: If you're usingmultiple Compose files orextending services, each file must be of thesame version - you cannot, for example, mix version 1 and 2 in a singleproject.
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.
Networker 5 3 0 4 Dfsg
Version 1
Compose files that do not declare a version are considered 'version 1'. In thosefiles, all the services aredeclared at the root of the document.
Version 1 is supported by Compose up to 1.6.x. It will be deprecated in afuture Compose release.
Version 1 files cannot declare namedvolumes, networks orbuild arguments.
Compose does not take advantage of networking when youuse version 1: every container is placed on the default bridge
network and isreachable from every other container at its IP address. You need to uselinks to enable discovery between containers.
Example:
Version 2
Compose files using the version 2 syntax must indicate the version number atthe root of the document. All servicesmust be declared under the services
key.
Version 2 files are supported by Compose 1.6.0+ and require a Docker Engineof version 1.10.0+.
Named volumes can be declared under thevolumes
key, and networks can be declaredunder the networks
key.
By default, every container joins an application-wide default network, and isdiscoverable at a hostname that's the same as the service name. This meanslinks are largely unnecessary. For more details, seeNetworking in Compose.
Note: When specifying the Compose file version to use, make sure tospecify 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 inlater versions will not be supported. For example:
is equivalent to:
Paragon ntfs 15 0 911. Simple example:
A more extended example, defining volumes and networks:
Several other options were added to support networking, such as:
The
depends_on
option can be used in place of links to indicate dependenciesbetween services and startup order.
Variable substitution also was added in Version 2.
Version 2.1
An upgrade of version 2 that introduces new parameters onlyavailable with Docker Engine version 1.12.0+. Version 2.1 files aresupported by Compose 1.9.0+.
Introduces the following additional parameters:
isolation
in build configurations andservice definitionslabels
for volumes,networks, andbuildname
for volumes
Version 2.2
An upgrade of version 2.1 that introduces new parameters onlyavailable with Docker Engine version 1.13.0+. Version 2.2 files aresupported by Compose 1.13.0+. This version also allows you to specifydefault scale numbers inside the service's configuration.
Introduces the following additional parameters:
network
for build configurations
Version 2.3
An upgrade of version 2.2 that introduces new parameters onlyavailable with Docker Engine version 17.06.0+. Version 2.3 files aresupported by Compose 1.16.0+.
Introduces the following additional parameters:
target
,extra_hosts
andshm_size
for build configurationsstart_period
forhealthchecks
runtime
for service definitions
Version 2.4
An upgrade of version 2.3 that introduces new parameters onlyavailable with Docker Engine version 17.12.0+. Version 2.4 files aresupported by Compose 1.21.0+.
Introduces the following additional parameters:
platform
for service definitions- Support for extension fields at the root of service, network, and volumedefinitions
Version 3
Designed to be cross-compatible between Compose and the Docker Engine'sswarm mode, version 3 removes several options and addsseveral more.
Removed:
volume_driver
,volumes_from
,cpu_shares
,cpu_quota
,cpuset
,mem_limit
,memswap_limit
,extends
,group_add
. Seethe upgrading guide for how to migrate away from these.(For more information onextends
, see Extending services.)Added: deploy
Note: When specifying the Compose file version to use, make sure tospecify 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 inlater versions will not be supported. For example:
is equivalent to:
Version 3.1
An upgrade of version 3 that introduces new parameters onlyavailable with Docker Engine version 1.13.1+, and higher.
Introduces the following additional parameters:
Version 3.2
An upgrade of version 3 that introduces new parameters onlyavailable with Docker Engine version 17.04.0+, and higher.
Introduces the following additional parameters:
cache_from
in build configurations- Long syntax for ports and volume mounts
attachable
network driver option
Version 3.3
An upgrade of version 3 that introduces new parameters onlyavailable with Docker Engine version 17.06.0+, and higher.
Introduces the following additional parameters:
Version 3.4
An upgrade of version 3 that introduces new parameters. It isonly available with Docker Engine version 17.09.0 and higher.
Introduces the following additional parameters:
target
andnetwork
inbuild configurationsstart_period
forhealthchecks
order
for update configurationsname
for volumes
Version 3.5
An upgrade of version 3 that introduces new parameters. It isonly available with Docker Engine version 17.12.0 and higher.
Introduces the following additional parameters:
isolation
in service definitionsname
for networks, secrets and configsshm_size
in build configurations
Version 3.6
An upgrade of version 3 that introduces new parameters. It isonly available with Docker Engine version 18.02.0 and higher.
Introduces the following additional parameters:
tmpfs
size fortmpfs
-type mounts
Version 3.7
An upgrade of version 3 that introduces new parameters. It isonly available with Docker Engine version 18.06.0 and higher.
Introduces the following additional parameters:
init
in service definitionsrollback_config
in deploy configurations- Support for extension fields at the root of service, network, volume, secretand config definitions
Version 3.8
An upgrade of version 3 that introduces new parameters. It isonly available with Docker Engine version 19.03.0 and higher.
5/3 Bank Login
Introduces the following additional parameters:
max_replicas_per_node
in placementconfigurationstemplate_driver
option for config and secret configurations. This option is only supported when deploying swarm services usingdocker stack deploy
.driver
anddriver_opts
option for secret configurations. This option is only supported when deploying swarm services usingdocker stack deploy
.
Upgrading
Version 2.x to 3.x
Between versions 2.x and 3.x, the structure of the Compose file is the same, butseveral options have been removed:
volume_driver
: Instead of setting the volume driver on the service, definea volume using thetop-levelvolumes
optionand specify the driver there.volumes_from
: To share a volume between services, define it using thetop-levelvolumes
optionand reference it from each service that shares it using theservice-levelvolumes
Car mechanic simulator 2018 apk. option.cpu_shares
,cpu_quota
,cpuset
,mem_limit
,memswap_limit
: Thesehave been replaced by the resources key underdeploy
.deploy
configuration only takes effect when usingdocker stack deploy
, and is ignored bydocker-compose
.extends
: This option has been removed forversion: '3.x'
Compose files. (For more information, see Extending services.)group_add
: This option has been removed forversion: '3.x'
Compose files.pids_limit
: This option has not been introduced inversion: '3.x'
Compose files.link_local_ips
innetworks
: This option has not been introduced inversion: '3.x'
Compose files.
Version 1 to 2.x
In the majority of cases, moving from version 1 to 2 is a very simple process:
- Indent the whole file by one level and put a
services:
key at the top. - Add a
version: '2'
line at the top of the file.
It's more complicated if you're using particular configuration features: Screenfloat 1 5 17 esv.
dockerfile
: This now lives under thebuild
key:log_driver
,log_opt
: These now live under thelogging
key:links
with environment variables: environment variables created bylinks, such asCONTAINERNAME_PORT
, ` have been deprecated for some time. In the new Docker network system,they have been removed. You should either connect directly to theappropriate hostname or set the relevant environment variable yourself,using the link hostname:external_links
: Compose uses Docker networks when running version 2projects, so links behave slightly differently. In particular, twocontainers must be connected to at least one network in common in order tocommunicate, even if explicitly linked together.Either connect the external container to your app'sdefault network, or connect both the external container andyour service's containers to anexternal network.
net
: This is now replaced by network_mode:If you're using
net: 'container:[service name]'
, you must now usenetwork_mode: 'service:[service name]'
instead.If you're using
net: 'container:[container name/id]'
, the value does notneed to change.volumes
with named volumes: these must now be explicitly declared in atop-levelvolumes
section of your Compose file. If a service mounts anamed volume calleddata
, you must declare adata
volume in yourtop-levelvolumes
section. The whole file might look like this:By default, Compose creates a volume whose name is prefixed with yourproject name. If you want it to just be called
data
, declare it asexternal:
Compatibility mode
docker-compose
1.20.0 introduces a new --compatibility
flag designed tohelp developers transition to version 3 more easily. When enabled,docker-compose
reads the deploy
section of each service's definition andattempts to translate it into the equivalent version 2 parameter. Currently,the following deploy keys are translated:
- resources limits and memory reservations
- restart_policy
condition
andmax_attempts
All other keys are ignored and produce a warning if present. You can reviewthe 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. Because theresulting configuration is only an approximate using non-Swarm modeproperties, it may produce unexpected results.