github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/cli/compose/loader/full-example.yml (about) 1 version: "3.12" 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 start_interval: 1s 162 163 # Any valid image reference - repo, tag, id, sha 164 image: redis 165 # image: ubuntu:14.04 166 # image: tutum/influxdb 167 # image: example-registry.com:4000/postgresql 168 # image: a4bc65fd 169 # image: busybox@sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b52004ee8502d 170 171 ipc: host 172 173 # Mapping or list 174 # Mapping values can be strings, numbers or null 175 labels: 176 com.example.description: "Accounting webapp" 177 com.example.number: 42 178 com.example.empty-label: 179 # labels: 180 # - "com.example.description=Accounting webapp" 181 # - "com.example.number=42" 182 # - "com.example.empty-label" 183 184 links: 185 - db 186 - db:database 187 - redis 188 189 logging: 190 driver: syslog 191 options: 192 syslog-address: "tcp://192.168.0.42:123" 193 194 mac_address: 02:42:ac:11:65:43 195 196 # network_mode: "bridge" 197 # network_mode: "host" 198 # network_mode: "none" 199 # Use the network mode of an arbitrary container from another service 200 # network_mode: "service:db" 201 # Use the network mode of another container, specified by name or id 202 # network_mode: "container:some-container" 203 network_mode: "container:0cfeab0f748b9a743dc3da582046357c6ef497631c1a016d28d2bf9b4f899f7b" 204 205 networks: 206 some-network: 207 aliases: 208 - alias1 209 - alias3 210 other-network: 211 ipv4_address: 172.16.238.10 212 ipv6_address: 2001:3984:3989::10 213 other-other-network: 214 215 pid: "host" 216 217 ports: 218 - 3000 219 - "3001-3005" 220 - "8000:8000" 221 - "9090-9091:8080-8081" 222 - "49100:22" 223 - "127.0.0.1:8001:8001" 224 - "127.0.0.1:5000-5010:5000-5010" 225 226 privileged: true 227 228 read_only: true 229 230 restart: always 231 232 secrets: 233 - secret1 234 - source: secret2 235 target: my_secret 236 uid: '103' 237 gid: '103' 238 mode: 0440 239 240 security_opt: 241 - label=level:s0:c100,c200 242 - label=type:svirt_apache_t 243 244 stdin_open: true 245 246 stop_grace_period: 20s 247 248 stop_signal: SIGUSR1 249 250 sysctls: 251 net.core.somaxconn: 1024 252 net.ipv4.tcp_syncookies: 0 253 254 # String or list 255 # tmpfs: /run 256 tmpfs: 257 - /run 258 - /tmp 259 260 tty: true 261 262 ulimits: 263 # Single number or mapping with soft + hard limits 264 nproc: 65535 265 nofile: 266 soft: 20000 267 hard: 40000 268 269 user: someone 270 271 volumes: 272 # Just specify a path and let the Engine create a volume 273 - /var/lib/mysql 274 # Specify an absolute path mapping 275 - /opt/data:/var/lib/mysql 276 # Path on the host, relative to the Compose file 277 - .:/code 278 - ./static:/var/www/html 279 # User-relative path 280 - ~/configs:/etc/configs/:ro 281 # Named volume 282 - datavolume:/var/lib/mysql 283 - type: bind 284 source: ./opt 285 target: /opt 286 consistency: cached 287 - type: tmpfs 288 target: /opt 289 tmpfs: 290 size: 10000 291 - type: cluster 292 source: group:mygroup 293 target: /srv 294 295 working_dir: /code 296 x-bar: baz 297 x-foo: bar 298 299 networks: 300 # Entries can be null, which specifies simply that a network 301 # called "{project name}_some-network" should be created and 302 # use the default driver 303 some-network: 304 305 other-network: 306 driver: overlay 307 308 driver_opts: 309 # Values can be strings or numbers 310 foo: "bar" 311 baz: 1 312 313 ipam: 314 driver: overlay 315 # driver_opts: 316 # # Values can be strings or numbers 317 # com.docker.network.enable_ipv6: "true" 318 # com.docker.network.numeric_value: 1 319 config: 320 - subnet: 172.16.238.0/24 321 # gateway: 172.16.238.1 322 - subnet: 2001:3984:3989::/64 323 # gateway: 2001:3984:3989::1 324 325 labels: 326 foo: bar 327 328 external-network: 329 # Specifies that a pre-existing network called "external-network" 330 # can be referred to within this file as "external-network" 331 external: true 332 333 other-external-network: 334 # Specifies that a pre-existing network called "my-cool-network" 335 # can be referred to within this file as "other-external-network" 336 external: 337 name: my-cool-network 338 x-bar: baz 339 x-foo: bar 340 341 volumes: 342 # Entries can be null, which specifies simply that a volume 343 # called "{project name}_some-volume" should be created and 344 # use the default driver 345 some-volume: 346 347 other-volume: 348 driver: flocker 349 350 driver_opts: 351 # Values can be strings or numbers 352 foo: "bar" 353 baz: 1 354 labels: 355 foo: bar 356 357 another-volume: 358 name: "user_specified_name" 359 driver: vsphere 360 361 driver_opts: 362 # Values can be strings or numbers 363 foo: "bar" 364 baz: 1 365 366 external-volume: 367 # Specifies that a pre-existing volume called "external-volume" 368 # can be referred to within this file as "external-volume" 369 external: true 370 371 other-external-volume: 372 # Specifies that a pre-existing volume called "my-cool-volume" 373 # can be referred to within this file as "other-external-volume" 374 # This example uses the deprecated "volume.external.name" (replaced by "volume.name") 375 external: 376 name: my-cool-volume 377 378 external-volume3: 379 # Specifies that a pre-existing volume called "this-is-volume3" 380 # can be referred to within this file as "external-volume3" 381 name: this-is-volume3 382 external: true 383 x-bar: baz 384 x-foo: bar 385 386 cluster-volume: 387 driver: my-csi-driver 388 x-cluster-spec: 389 group: mygroup 390 access_mode: 391 scope: single 392 sharing: none 393 block_volume: {} 394 accessibility_requirements: 395 requisite: 396 - segments: 397 - region=R1 398 - zone=Z1 399 - segments: 400 region: R1 401 zone: Z2 402 preferred: 403 - segments: 404 region: R1 405 zone: Z1 406 capacity_range: 407 required_bytes: 1G 408 limit_bytes: 8G 409 secrets: 410 - key: mycsisecret 411 secret: secret1 412 - key: mycsisecret2 413 secret: secret4 414 availability: active 415 416 configs: 417 config1: 418 file: ./config_data 419 labels: 420 foo: bar 421 config2: 422 external: 423 name: my_config 424 config3: 425 external: true 426 config4: 427 name: foo 428 x-bar: baz 429 x-foo: bar 430 431 secrets: 432 secret1: 433 file: ./secret_data 434 labels: 435 foo: bar 436 secret2: 437 external: 438 name: my_secret 439 secret3: 440 external: true 441 secret4: 442 name: bar 443 x-bar: baz 444 x-foo: bar 445 x-bar: baz 446 x-foo: bar 447 x-nested: 448 bar: baz 449 foo: bar