Sign In | Join Free | My gimpguru.org
Home >

docker expose

Product Categories
docker limited

docker expose

Country/Region china
Company docker limited
Update 2020-01-09 22:57:07
ICP License Issued by the Chinese Ministry
Contact Now

Compose file version 3 reference

Estimated reading time: 74 minutes

Reference and guidelines

These topics describe version 3 of the Compose file format. This is the newest version.

Compose and Docker compatibility matrix

There are several versions of the Compose file format 1, 2, 2.x, and 3.x. The table below is a quick look. For full details on what each version includes and how to upgrade, see About versions and upgrading.

This table shows which Compose file versions support specific Docker releases.

Compose file formatDocker Engine release
3.718.06.0+
3.618.02.0+
3.517.12.0+
3.417.09.0+
3.317.06.0+
3.217.04.0+
3.11.13.1+
3.01.13.0+
2.417.12.0+
2.317.06.0+
2.21.13.0+
2.11.12.0+
2.01.10.0+
1.01.9.1.+

In addition to Compose file format versions shown in the table, the Compose itself is on a release schedule, as shown in Compose releases, but file format versions do not necessarily increment with each release. For example, Compose file format 3.0 was first introduced in Compose release 1.10.0, and versioned gradually in subsequent releases.

Compose file structure and examples

Here is a sample Compose file from the voting app sample used in the Docker for Beginners lab topic on Deploying an app to a Swarm:

Example Compose file version 3
version: "3.7" servicesredisimage: redis:alpine ports- "6379" networks- frontend deployreplicas: 2 update_configparallelism: 2 delay: 10s restart_policycondition: on-failure dbimage: postgres:9.4 volumes- db-data:/var/lib/postgresql/data networks- backend deployplacementconstraints: [node.role == manager] voteimage: dockersamples/examplevotingapp_vote:before ports- "5000:80" networks- frontend depends_on- redis deployreplicas: 2 update_configparallelism: 2 restart_policycondition: on-failure resultimage: dockersamples/examplevotingapp_result:before ports- "5001:80" networks- backend depends_on- db deployreplicas: 1 update_configparallelism: 2 delay: 10s restart_policycondition: on-failure workerimage: dockersamples/examplevotingapp_worker networks- frontend - backend deploymode: replicated replicas: 1 labels: [APP=VOTING] restart_policycondition: on-failure delay: 10s max_attempts: 3 window: 120s placementconstraints: [node.role == manager] visualizerimage: dockersamples/visualizer:stable ports- "8080:8080" stop_grace_period: 1m30s volumes- "/var/run/docker.sock:/var/run/docker.sock" deployplacementconstraints: [node.role == manager] networksfrontendbackend: volumesdb-data:

The topics on this reference page are organized alphabetically by top-level key to reflect the structure of the Compose file itself. Top-level keys that define a section in the configuration file such as build, deploy, depends_on, networks, and so on, are listed with the options that support them as sub-topics. This maps to the <key>: <option>: <value> indent structure of the Compose file.

Service configuration reference

The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml.

Tip: You can use either a .yml or .yaml extension for this file. They both work.

A service definition contains configuration that is applied to each container started for that service, much like passing command-line parameters to docker container create. Likewise, network and volume definitions are analogous to docker network create and docker volume create.

As with docker container create, options specified in the Dockerfile, such as CMD, EXPOSE, VOLUME, ENV, are respected by default - you don’t need to specify them again in docker-compose.yml.

You can use environment variables in configuration values with a Bash-like ${VARIABLE} syntax - see variable substitution for full details.

This section contains a list of all configuration options supported by a service definition in version 3.

build

Configuration options that are applied at build time.

build can be specified either as a string containing a path to the build context:

version: "3.7" services: webapp: build: ./dir

China Customized Inflatable Bumper Ball Game Bubble Adult Grass CE supplier

docker expose Images

Inquiry Cart 0
Send your message to this supplier
 
From:
To: docker limited
Subject:
Message:
Characters Remaining: (0/3000)