SchemaΒΆ

The document below provides a comprehensive schema definition for Docker Interface.

{
    "title": "Declarative Docker Interface (DI) definition.",
    "additionalProperties": false,
    "properties": {
        "workspace": {
            "type": "string",
            "description": "Path defining the DI workspace (absolute or relative to the URI of this document). All subsequent path definitions must be absolute or relative to the `workspace`."
        },
        "docker": {
            "type": "string",
            "description": "Name of the docker CLI.",
            "default": "docker"
        },
        "log-level": {
            "type": "string",
            "enum": [
                "debug",
                "info",
                "warning",
                "error",
                "critical",
                "fatal"
            ],
            "default": "info"
        },
        "dry-run": {
            "type": "boolean",
            "description": "Whether to just construct the docker command.",
            "default": false
        },
        "status-code": {
            "type": "integer",
            "description": "status code returned by docker"
        },
        "plugins": {
            "oneOf": [
                {
                    "type": "array",
                    "description": "Enable the listed plugins and disable all plugins not listed.",
                    "items": {
                        "type": "string"
                    }
                },
                {
                    "type": "object",
                    "properties": {
                        "enable": {
                            "type": "array",
                            "description": "Enable the listed plugins.",
                            "items": {
                                "type": "string"
                            }
                        },
                        "disable": {
                            "type": "array",
                            "description": "Disable the listed plugins.",
                            "items": {
                                "type": "string"
                            }
                        }
                    },
                    "additionalProperties": false
                }
            ]
        },
        "run": {
            "properties": {
                "workspace-dir": {
                    "type": "string",
                    "description": "Path at which to mount the workspace in the container.",
                    "default": "/workspace"
                },
                "workdir": {
                    "type": "string",
                    "default": "#{workspace-dir}",
                    "description": "Working directory inside the container"
                },
                "user": {
                    "type": "string",
                    "description": "Username or UID (format: <name|uid>[:<group|gid>])"
                },
                "env": {
                    "type": "object",
                    "description": "Set environment variables (use `null` to forward environment variables).",
                    "additionalProperties": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "tty": {
                    "type": "boolean",
                    "description": "Allocate a pseudo-TTY"
                },
                "runtime": {
                    "type": "string",
                    "description": "Runtime to use for this container."
                },
                "group-add": {
                    "type": "array",
                    "description": "Additional groups to run as.",
                    "items": {
                        "type": "string"
                    }
                },
                "privileged": {
                    "type": "boolean",
                    "description": "Give extended privileges to this container",
                    "default": false
                },
                "cpu-shares": {
                    "type": "integer",
                    "description": "CPU shares (relative weight)",
                    "minimum": 0,
                    "maximum": 1024
                },
                "name": {
                    "type": "string",
                    "description": "Assign a name to the container"
                },
                "mount": {
                    "type": "array",
                    "description": "Attach a filesystem mount to the container.",
                    "items": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "bind",
                                    "tmpfs",
                                    "volume"
                                ]
                            },
                            "source": {
                                "type": "string",
                                "description": "Volume name or path on the host."
                            },
                            "destination": {
                                "type": "string",
                                "description": "Absolute mount path in the container."
                            },
                            "readonly": {
                                "type": "boolean",
                                "description": "Whether to mount the volume read-only."
                            }
                        },
                        "required": [
                            "type",
                            "destination"
                        ],
                        "additionalProperties": false
                    }
                },
                "image": {
                    "type": "string",
                    "description": "Image to derive the container from.",
                    "default": "#{/build/tag}"
                },
                "entrypoint": {
                    "type": "string",
                    "description": "Overwrite the default ENTRYPOINT of the image"
                },
                "publish": {
                    "type": "array",
                    "description": "Publish a container's port(s), or range(s) of ports, to the host.",
                    "items": {
                        "type": "object",
                        "properties": {
                            "ip": {
                                "type": "string",
                                "description": ""
                            },
                            "host": {
                                "anyOf": [
                                    {
                                        "type": "number"
                                    },
                                    {
                                        "type": "string",
                                        "pattern": "\\d+-\\d+"
                                    }
                                ],
                                "description": "Port (e.g. `8000`) or range of ports (e.g. `8000-8100`) on the host."
                            },
                            "container": {
                                "anyOf": [
                                    {
                                        "type": "number"
                                    },
                                    {
                                        "type": "string",
                                        "pattern": "\\d+-\\d+"
                                    }
                                ],
                                "description": "Port (e.g. `8000`) or range of ports (e.g. `8000-8100`) on the container."
                            }
                        },
                        "required": [
                            "container"
                        ],
                        "additionalProperties": false
                    }
                },
                "memory": {
                    "type": "string",
                    "description": "Memory limit"
                },
                "network": {
                    "type": "string",
                    "description": "Connect a container to a network (default \"default\")"
                },
                "tmpfs": {
                    "type": "array",
                    "description": "Mount a tmpfs directory",
                    "items": {
                        "type": "object",
                        "properties": {
                            "destination": {
                                "type": "string",
                                "description": "Absolute mount path in the container."
                            },
                            "options": {
                                "type": "array",
                                "description": "Mount options for the temporary file system.",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "size": {
                                "type": "integer",
                                "description": "Size of the tmpfs mount in bytes."
                            },
                            "mode": {
                                "type": "integer",
                                "description": "File mode of the tmpfs in octal."
                            }
                        },
                        "required": [
                            "destination"
                        ],
                        "additionalProperties": false
                    }
                },
                "interactive": {
                    "type": "boolean",
                    "description": "Keep STDIN open even if not attached"
                },
                "gpus": {
                    "type": "string",
                    "description": "GPU devices to add to the container (\u2018all\u2019 to pass all GPUs)"
                },
                "env-file": {
                    "type": "array",
                    "description": "Read in a file of environment variables.",
                    "items": {
                        "type": "string"
                    }
                },
                "label": {
                    "type": "array",
                    "description": "Set meta data on a container"
                },
                "rm": {
                    "type": "boolean",
                    "description": "Automatically remove the container when it exits",
                    "default": true
                },
                "cmd": {
                    "type": "array",
                    "description": "Command to execute inside the container.",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "additionalProperties": false
        },
        "build": {
            "properties": {
                "path": {
                    "type": "string",
                    "description": "Path of the build context.",
                    "default": "#{/workspace}"
                },
                "tag": {
                    "type": "string",
                    "description": "Name and optionally a tag in the 'name:tag' format.",
                    "default": "docker-interface-image"
                },
                "file": {
                    "type": "string",
                    "description": "Name of the Dockerfile.",
                    "default": "#{path}/Dockerfile"
                },
                "build-arg": {
                    "type": "object",
                    "description": "Set build-time variables.",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "no-cache": {
                    "type": "boolean",
                    "description": "Do not use cache when building the image"
                },
                "quiet": {
                    "type": "boolean",
                    "description": "Suppress the build output and print image ID on success"
                },
                "cpu-shares": {
                    "type": "integer",
                    "description": "CPU shares (relative weight)",
                    "minimum": 0,
                    "maximum": 1024
                },
                "memory": {
                    "type": "string",
                    "description": "Memory limit"
                }
            },
            "required": [
                "tag",
                "path",
                "file"
            ],
            "additionalProperties": false
        }
    },
    "required": [
        "workspace",
        "docker"
    ],
    "$schema": "http://json-schema.org/draft-04/schema"
}