Supported Top-level Docker Elements and Their Attributes
Compose File Version
- The top-level
version
field is used for backward compatibility as defined in the Compose Specification.
- Compose validates the file, issuing warnings for any unknown fields (often from newer specification versions).
- Industrial Edge Runtime supports Docker Compose versions 2.1 to 2.4.
- Refer to Compose file version and upgrading for more details.
Supported Service Attributes
Attribute |
Specifications |
cpuset |
Range:
cpuset: 0-3 List:
cpuset: 0,3 Combination:
cpuset: - 0 - 1,2 - 3-5
|
command |
command: bundle exec thin -p 3000
|
container_name |
container_name: my-webapp
container_name: ${CONTAINER_NAME}
|
environment |
Map:
environment: RACK_ENV: development SHOW: "true" USER_INPUT: Array:
environment: - RACK_ENV=development - SHOW=true - USER_INPUT
|
image |
image: redis
image: redis:5
image: redis@sha256:0ed5d5928d4737458944eb604cc8509e245c3e19d02ad83935398bc4b991aac7
|
labels |
Map:
labels: com.example.description: "Webapp" com.example.department: "Finance" com.example.label-with-empty-value: "" Array:
labels: - "com.example.description=Webapp" - "com.example.department=Finance" - "com.example.label-with-empty-value"
|
logging |
logging: driver: syslog options: syslog-address: "tcp://192.168.0.42:123"
|
mem_limit |
mem_limit: 2b
mem_limit: 1024kb
mem_limit: 300m
mem_limit: 1gb
|
mem_reservation |
mem_reservation: 2b
mem_reservation: 1024kb
mem_reservation: 300m
mem_reservation: 1gb
|
networks |
services: some-service: networks: - some-network - other-network
|
network_mode |
network_mode: "none"
network_mode: "host"
network_mode: "service:[service name]"
network_mode: "container:[container name]"
|
ports |
Short syntax:
ports: - "3000" - "8000:8000" - "127.0.0.1:8001:8001" - "6060:6060/udp" Long syntax:
ports: - name: web target: 80 host_ip: 127.0.0.1 published: "8080" protocol: tcp
|
restart |
restart: "no"
restart: always
restart: on-failure
restart: on-failure:3
restart: unless-stopped
|
user |
user: test-user
|
volumes |
Short syntax (named volume):
services: web: volumes: - mydata:/app/data volumes: mydata: Short syntax (bind mount):
services: web: volumes: - ./host/path:/container/path - /absolute/path:/container/path - ~/relative/path:/container/path Short syntax (anonymous volume):
services: web: volumes: - /container/path Short syntax (read-only mounts):
services: web: volumes: - mydata:/app/data:ro - ./host:/app/data:ro Short syntax (tmpfs mounts):
services: web: tmpfs: - /tmp - /run Long syntax:
services: backend: image: example/backend volumes: - type: volume source: db-data target: /data volume: nocopy: true subpath: sub - type: bind source: /var/run/postgres/postgres.sock target: /var/run/postgres/postgres.sock - type: tmpfs size:1024kb volumes: db-data:
|
Supported Network Attributes
Attribute |
Specifications |
driver |
Bridge:
networks: db-data: driver: bridge Host:
networks: db-data: driver: host None:
networks: db-data: driver: none
|
driver_opts |
networks: mybridge: driver: bridge driver_opts: com.docker.network.bridge.name: "custom_bridge" com.docker.network.bridge.host_binding_ipv4: "0.0.0.0" com.docker.network.driver.mtu: "1500"
|
attachable |
networks: mybridge: driver: bridge attachable: true myhost: driver: host attachable: true
|
external |
services: proxy: image: example/proxy networks: - outside networks: outside: external: true
|
internal |
services: proxy: image: example/proxy networks: - inside networks: inside: internal: true driver: bridge
|
labels |
Dictionary:
networks: mynet1: labels: com.example.description: "Financial transaction network" com.example.department: "Finance" com.example.label-with-empty-value: "" Array:
networks: mynet1: labels: - "com.example.description=Financial transaction network" - "com.example.department=Finance" - "com.example.label-with-empty-value"
|
name |
Generic:
networks: network1: name: my-app-net External:
networks: proxy-net: external: true name: "proxy-redirect"
|
Supported Volume Attributes
Attribute |
Specifications |
driver |
volumes: db-data: driver: foobar
|
driver_opts |
volumes: example: driver_opts: type: "nfs" o: "addr=10.40.0.199,nolock,soft,rw" device: ":/docker/example"
|
external |
services: backend: image: example/database volumes: - db-data:/etc/data volumes: db-data: external: true
|
labels |
Dictionary:
volumes: db-data: labels: com.example.description: "Database volume" com.example.department: "IT/Ops" com.example.label-with-empty-value: "" Array:
volumes: db-data: labels: - com.example.description="Database volume" - com.example.department="IT/Ops" - com.example.label-with-empty-value=""
|
name |
Generic:
volumes: db-data: name: "my-app-data" External:
volumes: db-data: external: true name: actual-name-of-volume
|
For descriptions, examples, and use cases, please refer to the Docker Compose documentation.