github.com/olljanat/moby@v1.13.1/cli/compose/loader/full-example.yml (about)

     1  version: "3"
     2  
     3  services:
     4    foo:
     5      cap_add:
     6        - ALL
     7  
     8      cap_drop:
     9        - NET_ADMIN
    10        - SYS_ADMIN
    11  
    12      cgroup_parent: m-executor-abcd
    13  
    14      # String or list
    15      command: bundle exec thin -p 3000
    16      # command: ["bundle", "exec", "thin", "-p", "3000"]
    17  
    18      container_name: my-web-container
    19  
    20      depends_on:
    21        - db
    22        - redis
    23  
    24      deploy:
    25        mode: replicated
    26        replicas: 6
    27        labels: [FOO=BAR]
    28        update_config:
    29          parallelism: 3
    30          delay: 10s
    31          failure_action: continue
    32          monitor: 60s
    33          max_failure_ratio: 0.3
    34        resources:
    35          limits:
    36            cpus: '0.001'
    37            memory: 50M
    38          reservations:
    39            cpus: '0.0001'
    40            memory: 20M
    41        restart_policy:
    42          condition: on_failure
    43          delay: 5s
    44          max_attempts: 3
    45          window: 120s
    46        placement:
    47          constraints: [node=foo]
    48  
    49      devices:
    50        - "/dev/ttyUSB0:/dev/ttyUSB0"
    51  
    52      # String or list
    53      # dns: 8.8.8.8
    54      dns:
    55        - 8.8.8.8
    56        - 9.9.9.9
    57  
    58      # String or list
    59      # dns_search: example.com
    60      dns_search:
    61        - dc1.example.com
    62        - dc2.example.com
    63  
    64      domainname: foo.com
    65  
    66      # String or list
    67      # entrypoint: /code/entrypoint.sh -p 3000
    68      entrypoint: ["/code/entrypoint.sh", "-p", "3000"]
    69  
    70      # String or list
    71      # env_file: .env
    72      env_file:
    73        - ./example1.env
    74        - ./example2.env
    75  
    76      # Mapping or list
    77      # Mapping values can be strings, numbers or null
    78      # Booleans are not allowed - must be quoted
    79      environment:
    80        RACK_ENV: development
    81        SHOW: 'true'
    82        SESSION_SECRET:
    83        BAZ: 3
    84      # environment:
    85      #   - RACK_ENV=development
    86      #   - SHOW=true
    87      #   - SESSION_SECRET
    88  
    89      # Items can be strings or numbers
    90      expose:
    91       - "3000"
    92       - 8000
    93  
    94      external_links:
    95        - redis_1
    96        - project_db_1:mysql
    97        - project_db_1:postgresql
    98  
    99      # Mapping or list
   100      # Mapping values must be strings
   101      # extra_hosts:
   102      #   somehost: "162.242.195.82"
   103      #   otherhost: "50.31.209.229"
   104      extra_hosts:
   105        - "somehost:162.242.195.82"
   106        - "otherhost:50.31.209.229"
   107  
   108      hostname: foo
   109  
   110      healthcheck:
   111        test: echo "hello world"
   112        interval: 10s
   113        timeout: 1s
   114        retries: 5
   115  
   116      # Any valid image reference - repo, tag, id, sha
   117      image: redis
   118      # image: ubuntu:14.04
   119      # image: tutum/influxdb
   120      # image: example-registry.com:4000/postgresql
   121      # image: a4bc65fd
   122      # image: busybox@sha256:38a203e1986cf79639cfb9b2e1d6e773de84002feea2d4eb006b52004ee8502d
   123  
   124      ipc: host
   125  
   126      # Mapping or list
   127      # Mapping values can be strings, numbers or null
   128      labels:
   129        com.example.description: "Accounting webapp"
   130        com.example.number: 42
   131        com.example.empty-label:
   132      # labels:
   133      #   - "com.example.description=Accounting webapp"
   134      #   - "com.example.number=42"
   135      #   - "com.example.empty-label"
   136  
   137      links:
   138       - db
   139       - db:database
   140       - redis
   141  
   142      logging:
   143        driver: syslog
   144        options:
   145          syslog-address: "tcp://192.168.0.42:123"
   146  
   147      mac_address: 02:42:ac:11:65:43
   148  
   149      # network_mode: "bridge"
   150      # network_mode: "host"
   151      # network_mode: "none"
   152      # Use the network mode of an arbitrary container from another service
   153      # network_mode: "service:db"
   154      # Use the network mode of another container, specified by name or id
   155      # network_mode: "container:some-container"
   156      network_mode: "container:0cfeab0f748b9a743dc3da582046357c6ef497631c1a016d28d2bf9b4f899f7b"
   157  
   158      networks:
   159        some-network:
   160          aliases:
   161           - alias1
   162           - alias3
   163        other-network:
   164          ipv4_address: 172.16.238.10
   165          ipv6_address: 2001:3984:3989::10
   166        other-other-network:
   167  
   168      pid: "host"
   169  
   170      ports:
   171        - 3000
   172        - "3000-3005"
   173        - "8000:8000"
   174        - "9090-9091:8080-8081"
   175        - "49100:22"
   176        - "127.0.0.1:8001:8001"
   177        - "127.0.0.1:5000-5010:5000-5010"
   178  
   179      privileged: true
   180  
   181      read_only: true
   182  
   183      restart: always
   184  
   185      security_opt:
   186        - label=level:s0:c100,c200
   187        - label=type:svirt_apache_t
   188  
   189      stdin_open: true
   190  
   191      stop_grace_period: 20s
   192  
   193      stop_signal: SIGUSR1
   194  
   195      # String or list
   196      # tmpfs: /run
   197      tmpfs:
   198        - /run
   199        - /tmp
   200  
   201      tty: true
   202  
   203      ulimits:
   204        # Single number or mapping with soft + hard limits
   205        nproc: 65535
   206        nofile:
   207          soft: 20000
   208          hard: 40000
   209  
   210      user: someone
   211  
   212      volumes:
   213        # Just specify a path and let the Engine create a volume
   214        - /var/lib/mysql
   215        # Specify an absolute path mapping
   216        - /opt/data:/var/lib/mysql
   217        # Path on the host, relative to the Compose file
   218        - .:/code
   219        - ./static:/var/www/html
   220        # User-relative path
   221        - ~/configs:/etc/configs/:ro
   222        # Named volume
   223        - datavolume:/var/lib/mysql
   224  
   225      working_dir: /code
   226  
   227  networks:
   228    # Entries can be null, which specifies simply that a network
   229    # called "{project name}_some-network" should be created and
   230    # use the default driver
   231    some-network:
   232  
   233    other-network:
   234      driver: overlay
   235  
   236      driver_opts:
   237        # Values can be strings or numbers
   238        foo: "bar"
   239        baz: 1
   240  
   241      ipam:
   242        driver: overlay
   243        # driver_opts:
   244        #   # Values can be strings or numbers
   245        #   com.docker.network.enable_ipv6: "true"
   246        #   com.docker.network.numeric_value: 1
   247        config:
   248        - subnet: 172.16.238.0/24
   249          # gateway: 172.16.238.1
   250        - subnet: 2001:3984:3989::/64
   251          # gateway: 2001:3984:3989::1
   252  
   253    external-network:
   254      # Specifies that a pre-existing network called "external-network"
   255      # can be referred to within this file as "external-network"
   256      external: true
   257  
   258    other-external-network:
   259      # Specifies that a pre-existing network called "my-cool-network"
   260      # can be referred to within this file as "other-external-network"
   261      external:
   262        name: my-cool-network
   263  
   264  volumes:
   265    # Entries can be null, which specifies simply that a volume
   266    # called "{project name}_some-volume" should be created and
   267    # use the default driver
   268    some-volume:
   269  
   270    other-volume:
   271      driver: flocker
   272  
   273      driver_opts:
   274        # Values can be strings or numbers
   275        foo: "bar"
   276        baz: 1
   277  
   278    external-volume:
   279      # Specifies that a pre-existing volume called "external-volume"
   280      # can be referred to within this file as "external-volume"
   281      external: true
   282  
   283    other-external-volume:
   284      # Specifies that a pre-existing volume called "my-cool-volume"
   285      # can be referred to within this file as "other-external-volume"
   286      external:
   287        name: my-cool-volume