github.com/ali-iotechsys/cli@v20.10.0+incompatible/cli/compose/loader/full-example.yml (about)

     1  version: "3.9"
     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  
   291      working_dir: /code
   292      x-bar: baz
   293      x-foo: bar
   294  
   295  networks:
   296    # Entries can be null, which specifies simply that a network
   297    # called "{project name}_some-network" should be created and
   298    # use the default driver
   299    some-network:
   300  
   301    other-network:
   302      driver: overlay
   303  
   304      driver_opts:
   305        # Values can be strings or numbers
   306        foo: "bar"
   307        baz: 1
   308  
   309      ipam:
   310        driver: overlay
   311        # driver_opts:
   312        #   # Values can be strings or numbers
   313        #   com.docker.network.enable_ipv6: "true"
   314        #   com.docker.network.numeric_value: 1
   315        config:
   316        - subnet: 172.16.238.0/24
   317          # gateway: 172.16.238.1
   318        - subnet: 2001:3984:3989::/64
   319          # gateway: 2001:3984:3989::1
   320  
   321      labels:
   322        foo: bar
   323  
   324    external-network:
   325      # Specifies that a pre-existing network called "external-network"
   326      # can be referred to within this file as "external-network"
   327      external: true
   328  
   329    other-external-network:
   330      # Specifies that a pre-existing network called "my-cool-network"
   331      # can be referred to within this file as "other-external-network"
   332      external:
   333        name: my-cool-network
   334      x-bar: baz
   335      x-foo: bar
   336  
   337  volumes:
   338    # Entries can be null, which specifies simply that a volume
   339    # called "{project name}_some-volume" should be created and
   340    # use the default driver
   341    some-volume:
   342  
   343    other-volume:
   344      driver: flocker
   345  
   346      driver_opts:
   347        # Values can be strings or numbers
   348        foo: "bar"
   349        baz: 1
   350      labels:
   351        foo: bar
   352  
   353    another-volume:
   354      name: "user_specified_name"
   355      driver: vsphere
   356  
   357      driver_opts:
   358        # Values can be strings or numbers
   359        foo: "bar"
   360        baz: 1
   361  
   362    external-volume:
   363      # Specifies that a pre-existing volume called "external-volume"
   364      # can be referred to within this file as "external-volume"
   365      external: true
   366  
   367    other-external-volume:
   368      # Specifies that a pre-existing volume called "my-cool-volume"
   369      # can be referred to within this file as "other-external-volume"
   370      # This example uses the deprecated "volume.external.name" (replaced by "volume.name")
   371      external:
   372        name: my-cool-volume
   373  
   374    external-volume3:
   375      # Specifies that a pre-existing volume called "this-is-volume3"
   376      # can be referred to within this file as "external-volume3"
   377      name: this-is-volume3
   378      external: true
   379      x-bar: baz
   380      x-foo: bar
   381  
   382  configs:
   383    config1:
   384      file: ./config_data
   385      labels:
   386        foo: bar
   387    config2:
   388      external:
   389        name: my_config
   390    config3:
   391      external: true
   392    config4:
   393      name: foo
   394      x-bar: baz
   395      x-foo: bar
   396  
   397  secrets:
   398    secret1:
   399      file: ./secret_data
   400      labels:
   401        foo: bar
   402    secret2:
   403      external:
   404        name: my_secret
   405    secret3:
   406      external: true
   407    secret4:
   408      name: bar
   409      x-bar: baz
   410      x-foo: bar
   411  x-bar: baz
   412  x-foo: bar
   413  x-nested:
   414    bar: baz
   415    foo: bar