Size: 1551
Comment:
|
Size: 1556
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
'''Docker Compose''' is a method for creating containers through configuration files and the Docker daemon. Everything that Docker Compose does, you can also do through interactive execution. As such, this page runs in parallel to the [[DockerContainersSetup|docker container setup page]]. | '''Docker Compose''' is a method for creating containers through configuration files. |
Line 11: | Line 11: |
== Volumes == | == Installation == ---- == Configuration == ---- == Compose Files == === Volumes === |
Line 18: | Line 34: |
container name: CONTAINER | container_name: CONTAINER |
Line 33: | Line 49: |
container name: CONTAINER | container_name: CONTAINER |
Line 42: | Line 58: |
---- | |
Line 45: | Line 60: |
== Port Management == |
=== Port Management === |
Line 51: | Line 65: |
container name: CONTAINER | container_name: CONTAINER |
Line 60: | Line 74: |
---- | |
Line 63: | Line 76: |
== Environment Variables == |
=== Environment Variables === |
Line 69: | Line 81: |
container name: CONTAINER | container_name: CONTAINER |
Line 79: | Line 91: |
---- == See also == [[https://docs.docker.com/compose/compose-file/|Docker com,pose reference documentation]] |
Docker Compose
Docker Compose is a method for creating containers through configuration files.
Contents
Installation
Configuration
Compose Files
Volumes
Docker supports two methods for binding volumes, hereafter referred to as the 'long syntax' and the 'short syntax'. Docker Compose supports two parallel methods. Upstream recommendation is to use the long syntax.
The long syntax is as follows:
container_name: CONTAINER version: 0.1 services: web: image: IMAGE volumes: - type: bind source: relative/source/path target: /absolute/target/path read only: true
The short syntax is as follows:
container_name: CONTAINER version: 0.1 services: web: image: IMAGE volumes: - relative/source/path:/absolute/target/path:ro
Port Management
To give a container access to ports, use:
container_name: CONTAINER version: 0.1 services: web: image: IMAGE ports: - 8888:8888
Environment Variables
To pass in an environment variable from the local environment to a Docker container, use:
container_name: CONTAINER version: 0.1 services: web: image: IMAGE environment: - VARIABLE1 - VARIABLE2
See also
Docker com,pose reference documentation