github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/cli/compose/loader/full-example.yml (about)

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