github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/cli/compose/loader/full-example.yml (about) 1 version: "3.10" 2 3 services: 4 foo: 5 6 build: 7 context: ./dir 8 dockerfile: Dockerfile 9 args: 10 foo: bar 11 target: foo 12 network: foo 13 cache_from: 14 - foo 15 - bar 16 extra_hosts: 17 - "ipv4.example.com:127.0.0.1" 18 - "ipv6.example.com:::1" 19 labels: [FOO=BAR] 20 21 22 cap_add: 23 - ALL 24 25 cap_drop: 26 - NET_ADMIN 27 - SYS_ADMIN 28 29 cgroup_parent: m-executor-abcd 30 31 # String or list 32 command: bundle exec thin -p 3000 33 # command: ["bundle", "exec", "thin", "-p", "3000"] 34 35 configs: 36 - config1 37 - source: config2 38 target: /my_config 39 uid: '103' 40 gid: '103' 41 mode: 0440 42 43 container_name: my-web-container 44 45 depends_on: 46 - db 47 - redis 48 49 deploy: 50 mode: replicated 51 replicas: 6 52 labels: [FOO=BAR] 53 rollback_config: 54 parallelism: 3 55 delay: 10s 56 failure_action: continue 57 monitor: 60s 58 max_failure_ratio: 0.3 59 order: start-first 60 update_config: 61 parallelism: 3 62 delay: 10s 63 failure_action: continue 64 monitor: 60s 65 max_failure_ratio: 0.3 66 order: start-first 67 resources: 68 limits: 69 cpus: '0.001' 70 memory: 50M 71 pids: 100 72 reservations: 73 cpus: '0.0001' 74 memory: 20M 75 generic_resources: 76 - discrete_resource_spec: 77 kind: 'gpu' 78 value: 2 79 - discrete_resource_spec: 80 kind: 'ssd' 81 value: 1 82 restart_policy: 83 condition: on-failure 84 delay: 5s 85 max_attempts: 3 86 window: 120s 87 placement: 88 constraints: [node=foo] 89 max_replicas_per_node: 5 90 preferences: 91 - spread: node.labels.az 92 endpoint_mode: dnsrr 93 94 devices: 95 - "/dev/ttyUSB0:/dev/ttyUSB0" 96 97 # String or list 98 # dns: 8.8.8.8 99 dns: 100 - 8.8.8.8 101 - 9.9.9.9 102 103 # String or list 104 # dns_search: example.com 105 dns_search: 106 - dc1.example.com 107 - dc2.example.com 108 109 domainname: foo.com 110 111 # String or list 112 # entrypoint: /code/entrypoint.sh -p 3000 113 entrypoint: ["/code/entrypoint.sh", "-p", "3000"] 114 115 # String or list 116 # env_file: .env 117 env_file: 118 - ./example1.env 119 - ./example2.env 120 121 # Mapping or list 122 # Mapping values can be strings, numbers or null 123 # Booleans are not allowed - must be quoted 124 environment: 125 BAZ: baz_from_service_def 126 QUX: 127 # environment: 128 # - RACK_ENV=development 129 # - SHOW=true 130 # - SESSION_SECRET 131 132 # Items can be strings or numbers 133 expose: 134 - "3000" 135 - 8000 136 137 external_links: 138 - redis_1 139 - project_db_1:mysql 140 - project_db_1:postgresql 141 142 # Mapping or list 143 # Mapping values must be strings 144 # extra_hosts: 145 # somehost: "162.242.195.82" 146 # otherhost: "50.31.209.229" 147 # host.docker.internal: "host-gateway" 148 extra_hosts: 149 - "somehost:162.242.195.82" 150 - "otherhost:50.31.209.229" 151 - "host.docker.internal:host-gateway" 152 153 hostname: foo 154 155 healthcheck: 156 test: echo "hello world" 157 interval: 10s 158 timeout: 1s 159 retries: 5 160 start_period: 15s 161 162 # Any valid image reference - repo, tag, id, sha 163 image: redis 164 # image: ubuntu:14.04 165 # image: tutum/influxdb 166 # image: example-registry.com:4000/postgresql 167 # image: a4bc65fd 168 # image: busybox@sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b52004ee8502d 169 170 ipc: host 171 172 # Mapping or list 173 # Mapping values can be strings, numbers or null 174 labels: 175 com.example.description: "Accounting webapp" 176 com.example.number: 42 177 com.example.empty-label: 178 # labels: 179 # - "com.example.description=Accounting webapp" 180 # - "com.example.number=42" 181 # - "com.example.empty-label" 182 183 links: 184 - db 185 - db:database 186 - redis 187 188 logging: 189 driver: syslog 190 options: 191 syslog-address: "tcp://192.168.0.42:123" 192 193 mac_address: 02:42:ac:11:65:43 194 195 # network_mode: "bridge" 196 # network_mode: "host" 197 # network_mode: "none" 198 # Use the network mode of an arbitrary container from another service 199 # network_mode: "service:db" 200 # Use the network mode of another container, specified by name or id 201 # network_mode: "container:some-container" 202 network_mode: "container:0cfeab0f748b9a743dc3da582046357c6ef497631c1a016d28d2bf9b4f899f7b" 203 204 networks: 205 some-network: 206 aliases: 207 - alias1 208 - alias3 209 other-network: 210 ipv4_address: 172.16.238.10 211 ipv6_address: 2001:3984:3989::10 212 other-other-network: 213 214 pid: "host" 215 216 ports: 217 - 3000 218 - "3001-3005" 219 - "8000:8000" 220 - "9090-9091:8080-8081" 221 - "49100:22" 222 - "127.0.0.1:8001:8001" 223 - "127.0.0.1:5000-5010:5000-5010" 224 225 privileged: true 226 227 read_only: true 228 229 restart: always 230 231 secrets: 232 - secret1 233 - source: secret2 234 target: my_secret 235 uid: '103' 236 gid: '103' 237 mode: 0440 238 239 security_opt: 240 - label=level:s0:c100,c200 241 - label=type:svirt_apache_t 242 243 stdin_open: true 244 245 stop_grace_period: 20s 246 247 stop_signal: SIGUSR1 248 249 sysctls: 250 net.core.somaxconn: 1024 251 net.ipv4.tcp_syncookies: 0 252 253 # String or list 254 # tmpfs: /run 255 tmpfs: 256 - /run 257 - /tmp 258 259 tty: true 260 261 ulimits: 262 # Single number or mapping with soft + hard limits 263 nproc: 65535 264 nofile: 265 soft: 20000 266 hard: 40000 267 268 user: someone 269 270 volumes: 271 # Just specify a path and let the Engine create a volume 272 - /var/lib/mysql 273 # Specify an absolute path mapping 274 - /opt/data:/var/lib/mysql 275 # Path on the host, relative to the Compose file 276 - .:/code 277 - ./static:/var/www/html 278 # User-relative path 279 - ~/configs:/etc/configs/:ro 280 # Named volume 281 - datavolume:/var/lib/mysql 282 - type: bind 283 source: ./opt 284 target: /opt 285 consistency: cached 286 - type: tmpfs 287 target: /opt 288 tmpfs: 289 size: 10000 290 - type: cluster 291 source: group:mygroup 292 target: /srv 293 294 working_dir: /code 295 x-bar: baz 296 x-foo: bar 297 298 networks: 299 # Entries can be null, which specifies simply that a network 300 # called "{project name}_some-network" should be created and 301 # use the default driver 302 some-network: 303 304 other-network: 305 driver: overlay 306 307 driver_opts: 308 # Values can be strings or numbers 309 foo: "bar" 310 baz: 1 311 312 ipam: 313 driver: overlay 314 # driver_opts: 315 # # Values can be strings or numbers 316 # com.docker.network.enable_ipv6: "true" 317 # com.docker.network.numeric_value: 1 318 config: 319 - subnet: 172.16.238.0/24 320 # gateway: 172.16.238.1 321 - subnet: 2001:3984:3989::/64 322 # gateway: 2001:3984:3989::1 323 324 labels: 325 foo: bar 326 327 external-network: 328 # Specifies that a pre-existing network called "external-network" 329 # can be referred to within this file as "external-network" 330 external: true 331 332 other-external-network: 333 # Specifies that a pre-existing network called "my-cool-network" 334 # can be referred to within this file as "other-external-network" 335 external: 336 name: my-cool-network 337 x-bar: baz 338 x-foo: bar 339 340 volumes: 341 # Entries can be null, which specifies simply that a volume 342 # called "{project name}_some-volume" should be created and 343 # use the default driver 344 some-volume: 345 346 other-volume: 347 driver: flocker 348 349 driver_opts: 350 # Values can be strings or numbers 351 foo: "bar" 352 baz: 1 353 labels: 354 foo: bar 355 356 another-volume: 357 name: "user_specified_name" 358 driver: vsphere 359 360 driver_opts: 361 # Values can be strings or numbers 362 foo: "bar" 363 baz: 1 364 365 external-volume: 366 # Specifies that a pre-existing volume called "external-volume" 367 # can be referred to within this file as "external-volume" 368 external: true 369 370 other-external-volume: 371 # Specifies that a pre-existing volume called "my-cool-volume" 372 # can be referred to within this file as "other-external-volume" 373 # This example uses the deprecated "volume.external.name" (replaced by "volume.name") 374 external: 375 name: my-cool-volume 376 377 external-volume3: 378 # Specifies that a pre-existing volume called "this-is-volume3" 379 # can be referred to within this file as "external-volume3" 380 name: this-is-volume3 381 external: true 382 x-bar: baz 383 x-foo: bar 384 385 cluster-volume: 386 driver: my-csi-driver 387 x-cluster-spec: 388 group: mygroup 389 access_mode: 390 scope: single 391 sharing: none 392 block_volume: {} 393 accessibility_requirements: 394 requisite: 395 - segments: 396 - region=R1 397 - zone=Z1 398 - segments: 399 region: R1 400 zone: Z2 401 preferred: 402 - segments: 403 region: R1 404 zone: Z1 405 capacity_range: 406 required_bytes: 1G 407 limit_bytes: 8G 408 secrets: 409 - key: mycsisecret 410 secret: secret1 411 - key: mycsisecret2 412 secret: secret4 413 availability: active 414 415 configs: 416 config1: 417 file: ./config_data 418 labels: 419 foo: bar 420 config2: 421 external: 422 name: my_config 423 config3: 424 external: true 425 config4: 426 name: foo 427 x-bar: baz 428 x-foo: bar 429 430 secrets: 431 secret1: 432 file: ./secret_data 433 labels: 434 foo: bar 435 secret2: 436 external: 437 name: my_secret 438 secret3: 439 external: true 440 secret4: 441 name: bar 442 x-bar: baz 443 x-foo: bar 444 x-bar: baz 445 x-foo: bar 446 x-nested: 447 bar: baz 448 foo: bar