{
    "allOf": [
        {
            "$ref": "#/definitions/service"
        },
        {
            "$ref": "#/definitions/constraints"
        }
    ],
    "definitions": {
        "constraints": {
            "_id": "#/definitions/constraints",
            "anyOf": [
                {
                    "required": [
                        "build"
                    ]
                },
                {
                    "required": [
                        "image"
                    ]
                }
            ],
            "properties": {
                "build": {
                    "required": [
                        "context"
                    ]
                }
            }
        },
        "list_of_strings": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "_uniqueItems": true
        },
        "list_or_dict": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "patternProperties": {
                        ".+": {
                            "format": "bool-value-in-mapping",
                            "type": [
                                "string",
                                "number",
                                "boolean",
                                "null"
                            ]
                        }
                    },
                    "type": "object"
                },
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                }
            ]
        },
        "service": {
            "_id": "#/definitions/service",
            "additionalProperties": false,
            "dependencies": {
                "memswap_limit": [
                    "mem_limit"
                ]
            },
            "properties": {
                "build": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "additionalProperties": false,
                            "properties": {
                                "args": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/definitions/list_of_strings"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "patternProperties": {
                                                "^.+$": {
                                                    "type": [
                                                        "string",
                                                        "number"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                },
                                "context": {
                                    "type": "string"
                                },
                                "dockerfile": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    ]
                },
                "cap_add": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "cap_drop": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "cgroup_parent": {
                    "type": "string"
                },
                "command": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "container_name": {
                    "type": "string"
                },
                "cpu_quota": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "cpu_shares": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "cpuset": {
                    "type": "string"
                },
                "depends_on": {
                    "$ref": "#/definitions/list_of_strings"
                },
                "devices": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "dns": {
                    "$ref": "#/definitions/string_or_list"
                },
                "dns_search": {
                    "$ref": "#/definitions/string_or_list"
                },
                "domainname": {
                    "type": "string"
                },
                "entrypoint": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "env_file": {
                    "$ref": "#/definitions/string_or_list"
                },
                "environment": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "expose": {
                    "items": {
                        "format": "expose",
                        "type": [
                            "string",
                            "number"
                        ]
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "extends": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "additionalProperties": false,
                            "properties": {
                                "file": {
                                    "type": "string"
                                },
                                "service": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "service"
                            ],
                            "type": "object"
                        }
                    ]
                },
                "external_links": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "extra_hosts": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "hostname": {
                    "type": "string"
                },
                "image": {
                    "type": "string"
                },
                "ipc": {
                    "type": "string"
                },
                "labels": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "links": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "logging": {
                    "additionalProperties": false,
                    "properties": {
                        "driver": {
                            "type": "string"
                        },
                        "options": {
                            "type": "object"
                        }
                    },
                    "type": "object"
                },
                "mac_address": {
                    "type": "string"
                },
                "mem_limit": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "memswap_limit": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "network_mode": {
                    "type": "string"
                },
                "networks": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/list_of_strings"
                        },
                        {
                            "additionalProperties": false,
                            "patternProperties": {
                                "^[a-zA-Z0-9._-]+$": {
                                    "oneOf": [
                                        {
                                            "additionalProperties": false,
                                            "properties": {
                                                "aliases": {
                                                    "$ref": "#/definitions/list_of_strings"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ]
                                }
                            },
                            "type": "object"
                        }
                    ]
                },
                "pid": {
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "ports": {
                    "items": {
                        "format": "ports",
                        "type": [
                            "string",
                            "number"
                        ]
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "privileged": {
                    "type": "boolean"
                },
                "read_only": {
                    "type": "boolean"
                },
                "restart": {
                    "type": "string"
                },
                "security_opt": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "shm_size": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "stdin_open": {
                    "type": "boolean"
                },
                "stop_signal": {
                    "type": "string"
                },
                "tty": {
                    "type": "boolean"
                },
                "ulimits": {
                    "patternProperties": {
                        "^[a-z]+$": {
                            "oneOf": [
                                {
                                    "type": "integer"
                                },
                                {
                                    "additionalProperties": false,
                                    "properties": {
                                        "hard": {
                                            "type": "integer"
                                        },
                                        "soft": {
                                            "type": "integer"
                                        }
                                    },
                                    "required": [
                                        "soft",
                                        "hard"
                                    ],
                                    "type": "object"
                                }
                            ]
                        }
                    },
                    "type": "object"
                },
                "user": {
                    "type": "string"
                },
                "volume_driver": {
                    "type": "string"
                },
                "volumes": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "volumes_from": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "working_dir": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "string_or_list": {
            "oneOf": [
                {
                    "type": "string"
                },
                {
                    "$ref": "#/definitions/list_of_strings"
                }
            ]
        }
    },
    "type": "object"
}