compose_spec 0.2.0

Types for (de)serializing from/to the compose-spec
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# A compose file for testing the structural correctness of `compose_spec::Compose`.
#
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json

version: version

name: name

include:
  - include
  - path: path
    project_directory: project_directory
    env_file: env_file

services:
  build-short:
    build: context

  build-long-dockerfile:
    build:
      dockerfile: dockerfile

  build-long-dockerfile_inline:
    build:
      dockerfile_inline: dockerfile_inline

  build-long-args-list:
    build:
      args:
        - arg=value

  build-long-args-map:
    build:
      args:
        arg: value

  build-long-network-none:
    build:
      network: none

  build-long-other:
    build:
      context: context
      ssh:
        - default
        - id=key
      cache_from:
        - image:latest
      cache_to:
        - type=registry,ref=image,key=value
        - type=local,src=path
      additional_contexts:
        additional_context: https://example.com/
        additional_context2: /path
      entitlements:
        - network.host
        - security.insecure
      extra_hosts:
        host4: 127.0.0.1
        host6: ::1
      isolation: isolation
      privileged: true
      labels:
        - label=value
      no_cache: true
      pull: true
      network: network
      shm_size: 1b
      target: target
      secrets:
        - secret
        - source: secret
          target: target
          uid: "1000"
          gid: "1000"
          mode: 365
          x-test: test
      tags:
        - image:tag
        - registry/username/repo:tag
      ulimits:
        ulimit: 500
        softhard:
          soft: 100
          hard: 200
          x-test: test
      platforms:
        - linux/amd64
        - linux/arm
        - linux/arm/v6
        - linux/arm/v7
        - linux/arm/v8
        - linux/arm64
        - linux/arm64/v8

  blkio_config:
    blkio_config:
      device_read_bps:
        - path: /path
          rate: 1kb
      device_read_iops:
        - path: /path
          rate: 100
      device_write_bps:
        - path: /path
          rate: 1mb
      device_write_iops:
        - path: /path
          rate: 100
      weight: 10
      weight_device:
        - path: /path
          weight: 1000

  cgroup-host:
    cgroup: host

  cgroup-private:
    cgroup: private

  command-string:
    command: string

  command-list:
    command:
      - one
      - two

  credential_spec-config:
    credential_spec:
      config: config
      x-test: test

  credential_spec-file:
    credential_spec:
      file: file
      x-test: test

  credential_spec-registry:
    credential_spec:
      registry: registry
      x-test: test

  depends_on-short:
    depends_on:
      - service

  depends_on-long-condition-started:
    depends_on:
      service:
        condition: service_started
        restart: true
        required: false

  depends_on-long-condition-healthy:
    depends_on:
      service:
        condition: service_healthy

  depends_on-long-condition-completed_successfully:
    depends_on:
      service:
        condition: service_completed_successfully

  deploy-endpoint_mode-vip:
    deploy:
      endpoint_mode: vip

  deploy-endpoint_mode-dnsrr:
    deploy:
      endpoint_mode: dnsrr

  deploy-mode-global:
    deploy:
      mode: global

  deploy-mode-replicated:
    deploy:
      mode: replicated

  deploy-restart_policy-condition-none:
    deploy:
      restart_policy:
        condition: none

  deploy-restart_policy-condition-on-failure:
    deploy:
      restart_policy:
        condition: on-failure

  deploy-restart_policy-condition-any:
    deploy:
      restart_policy:
        condition: any

  deploy-other:
    deploy:
      endpoint_mode: other
      labels:
        label: value
      placement:
        constraints:
          - constraint
        preferences:
          - spread: spread
            x-test: test
        max_replicas_per_node: 2
        x-test: test
      replicas: 2
      resources:
        limits:
          cpus: 1.5
          memory: 1gb
          pids: 10
          x-test: test
        reservations:
          cpus: 1.5
          memory: 1gb
          devices:
            - capabilities:
                - gpu
                - tpu
              driver: driver
              count: all
              options:
                - opt=value
            - capabilities:
                - other
              count: 1
              device_ids:
                - id
              options:
                opt: value
              x-test: test
          generic_resources:
            - discrete_resource_spec:
                kind: kind
                value: 1
                x-test: test
              x-test: test
          x-test: test
        x-test: test
      restart_policy:
        delay: 1s
        max_attempts: 1
        window: 1m
        x-test: test
      rollback_config:
        parallelism: 0
        delay: 1h
        failure_action: continue
        monitor: 1s
        max_failure_ratio: 0
        order: stop-first
        x-test: test
      update_config:
        parallelism: 0
        delay: 1h
        failure_action: continue
        monitor: 1s
        max_failure_ratio: 0
        order: stop-first
        x-test: test
      x-test: test

  develop:
    develop:
      watch:
        - action: rebuild
          path: path
        - action: sync
          path: path
        - action: sync+restart
          ignore:
            - ignore
          path: path
          target: /target
          x-test: test

  dns-string:
    dns: 1.1.1.1

  dns-list:
    dns:
      - 1.1.1.1
      - ::1

  dns_search-string:
    dns_search: search

  dns_search-list:
    dns_search:
      - search

  entrypoint-string:
    entrypoint: entrypoint

  entrypoint-list:
    entrypoint:
      - one
      - two

  env_file-string:
    env_file: env_file

  env_file-list:
    env_file:
      - env_file
      - path: path
        required: false

  environment-list:
    environment:
      - var=value

  environment-map:
    environment:
      var: value

  annotations-list:
    annotations:
      - annotation=value

  annotations-map:
    annotations:
      annotation: value

  healthcheck-disable:
    healthcheck:
      disable: true

  healthcheck-test-string:
    healthcheck:
      test: test

  healthcheck-test-list:
    healthcheck:
      test:
        - CMD
        - test

  healthcheck-other:
    healthcheck:
      interval: 1s
      timeout: 1s
      retries: 1
      start_period: 1s
      start_interval: 1s
      x-test: test

  ipc-shareable:
    ipc: shareable

  ipc-service:
    ipc: service:service

  ipc-other:
    ipc: other

  labels-list:
    labels:
      - label=value

  labels-map:
    labels:
      label: value

  network_mode-none:
    network_mode: none

  network_mode-host:
    network_mode: host

  network_mode-service:
    network_mode: service:service

  network_mode-other:
    network_mode: other

  networks-short:
    networks:
      - network

  networks-long:
    networks:
      network:
        aliases:
          - alias
        ipv4_address: 127.0.0.1
        ipv6_address: ::1
        link_local_ips:
          - 127.0.0.1
          - ::1
        mac_address: 92:d0:c6:0a:29:33
        priority: 100
        x-test: test

  pull_policy-always:
    pull_policy: always

  pull_policy-never:
    pull_policy: never

  pull_policy-missing:
    pull_policy: missing

  pull_policy-build:
    pull_policy: build

  restart-no:
    restart: no

  restart-always:
    restart: always

  restart-on-failure:
    restart: on-failure

  restart-unless-stopped:
    restart: unless-stopped

  sysctls-list:
    sysctls:
      - one
      - two

  sysctls-map:
    sysctls:
      key: value

  tmpfs-string:
    tmpfs: /tmpfs

  tmpfs-list:
    tmpfs:
      - /tmpfs

  other:
    attach: false
    cpu_count: 2
    cpu_percent: 100
    cpu_shares: 1
    cpu_period: 1
    cpu_quota: 1
    cpu_rt_runtime: 1us
    cpu_rt_period: 1ms
    cpus: 1.5
    cpuset: 0-2,4,6-8
    cap_add:
      - ALL
    cap_drop:
      - ALL
    cgroup_parent: parent
    configs:
      - config
      - source: config
        target: target
        uid: "1000"
        gid: "1000"
        mode: 365
        x-test: test
    container_name: name
    device_cgroup_rules:
      - a *:* r
      - c 1:1 w
      - b 2:2 m
      - a 3:3 rwm
    devices:
      - host:/container
      - host:/container:rwm
    dns_opt:
      - opt
    domainname: domainname
    expose:
      - 100
      - 100-200
      - 100/tcp
      - 100-200/udp
      - 100-200/other
    extends:
      service: service
      file: file
    external_links:
      - service
      - service:alias
    extra_hosts:
      host4: 127.0.0.1
      host6: ::1
    group_add:
      - group
      - 1000
    hostname: hostname
    image: image
    init: true
    uts: host
    isolation: isolation
    links:
      - service
      - service:alias
    logging:
      driver: driver
      options:
        string: string
        number: 1.5
        "null": null
      x-test: test
    mac_address: 92:d0:c6:0a:29:33
    mem_limit: 1gb
    mem_reservation: 1gb
    mem_swappiness: 0
    memswap_limit: -1
    oom_kill_disable: true
    oom_score_adj: -1000
    pid: pid
    pids_limit: 10
    platform: darwin/arm64
    ports:
      - 100
      - 100:100
      - 100-200
      - 100-200:100-200
      - 100/tcp
      - 100/udp
      - 100/other
      - target: 100
        published: 100-200
        host_ip: ::1
        protocol: tcp
        mode: host
      - name: name
        target: 100
        published: 100
        host_ip: 127.0.0.1
        protocol: udp
        app_protocol: http
        mode: ingress
        x-test: test
    privileged: true
    profiles:
      - profile
    read_only: true
    runtime: crun
    scale: 1
    secrets:
      - secret
      - source: secret
        target: target
        uid: "1000"
        gid: "1000"
        mode: 365
        x-test: test
    security_opt:
      - security_opt
    shm_size: 1gb
    stdin_open: true
    stop_grace_period: 1s
    stop_signal: signal
    storage_opt:
      key: value
    tty: true
    ulimits:
      ulimit: 500
      softhard:
        soft: 100
        hard: 200
        x-test: test
    user: user
    userns_mode: userns_mode
    volumes:
      - /container
      - host:/container
      - ./host:/container
      - ./host:/container:ro,z
      - ./host:/container:Z
      - type: volume
        source: source
        target: /target
        read_only: true
        volume:
          nocopy: true
          subpath: subpath
          x-test: test
        consistency: consistency
        x-test: test
      - type: bind
        source: ./source
        target: /target
        read_only: true
        bind:
          propagation: private
          create_host_path: true
          selinux: z
        consistency: consistency
        x-test: test
      - type: tmpfs
        target: /target
        read_only: true
        tmpfs:
          size: 1gb
          mode: 365
        consistency: consistency
        x-test: test
      - type: npipe
        source: ./source
        target: /target
        read_only: true
        consistency: consistency
        x-test: test
      - type: cluster
        source: source
        target: /target
        read_only: true
        consistency: consistency
        x-test: test
    volumes_from:
      - service
      - container:container
      - container:container:ro
    working_dir: /working_dir
    x-test: test

networks:
  "null": null

  empty: {}

  external:
    external: true
    name: name

  driver-host:
    driver: host

  driver-none:
    driver: none

  driver-other:
    driver: other

  labels-list:
    labels:
      - label=value

  labels-map:
    labels:
      label: value

  other:
    driver_opts:
      string: string
      number: 1.5
    attachable: true
    enable_ipv6: true
    ipam:
      driver: driver
      config:
        - subnet: 10.0.0.0/24
          ip_range: 10.0.0.0/32
          gateway: 10.0.0.1
          aux_addresses:
            host: 10.0.0.5
          x-test: test
      options: 
        option: value
      x-test: test
    name: name
    x-test: test
    
volumes:
  "null": null

  empty: {}

  external:
    external: true
    name: name

  labels-list:
    labels:
      - label=value

  labels-map:
    labels:
      label: value

  other:
    driver: driver
    driver_opts:
      string: string
      number: 1.5
    name: name
    x-test: test

configs:
  external:
    external: true
    name: name

  file:
    file: file
    x-test: test

  environment:
    environment: environment
    x-test: test

  content:
    content: content
    x-test: test

secrets:
  external:
    external: true
    name: name

  file:
    file: file
    x-test: test

  environment:
    environment: environment
    labels:
      label: value
    driver: driver
    driver_opts:
      string: string
      number: 1.5
    x-test: test