github.com/itscaro/cli@v0.0.0-20190705081621-c9db0fe93829/cli/compose/loader/full-example.yml (about)

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