{"record":{"id":"7f4c5329793b2515","repo":"mlflow/mlflow","slug":"project-with-docker-environment-must-specify-the-d","errorCode":null,"errorMessage":"Project with docker environment must specify the docker image to use via an 'image' field under the 'docker_env' field.","messagePattern":"Project with docker environment must specify the docker image to use via an 'image' field under the 'docker_env' field\\.","errorType":"exception","errorClass":"ExecutionException","httpStatus":null,"severity":"error","filePath":"mlflow/projects/docker.py","lineNumber":62,"sourceCode":"        capture_output=False,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n    )\n    if prc.returncode != 0:\n        joined_cmd = \" \".join(cmd)\n        raise ExecutionException(\n            f\"Ran `{joined_cmd}` to ensure docker daemon is running but it failed \"\n            f\"with the following output:\\n{prc.stdout}\"\n        )\n\n\ndef validate_docker_env(project):\n    if not project.name:\n        raise ExecutionException(\n            \"Project name in MLProject must be specified when using docker for image tagging.\"\n        )\n    if not project.docker_env.get(\"image\"):\n        raise ExecutionException(\n            \"Project with docker environment must specify the docker image \"\n            \"to use via an 'image' field under the 'docker_env' field.\"\n        )\n\n\ndef build_docker_image(work_dir, repository_uri, base_image, run_id, build_image, docker_auth):\n    \"\"\"\n    Build a docker image containing the project in `work_dir`, using the base image.\n    \"\"\"\n    image_uri = _get_docker_image_uri(repository_uri=repository_uri, work_dir=work_dir)\n    client = docker.from_env()\n    if docker_auth is not None:\n        client.login(**docker_auth)\n\n    if not build_image:\n        if not client.images.list(name=base_image):\n            _logger.info(f\"Pulling {base_image}\")\n            image = client.images.pull(base_image)","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/projects/docker.py#L44-L80","documentation":"MLflow raises this ExecutionException when an MLproject file declares docker as its environment but the 'docker_env' section is missing an 'image' key. The image name is required because MLflow builds/tags the project's Docker container from it. Without it, the project cannot be executed with the docker backend.","triggerScenarios":"Running `mlflow run --backend docker` (or calling ProjectUtils.get_docker_env / validate_docker_env via _run) on an MLproject whose environment is `docker: {}` or `docker: {image: null}`, or whose docker_env omits the image field entirely.","commonSituations":"Hand-editing MLproject YAML and forgetting the image key; copying an MLproject that uses 'build' semantics assuming MLflow infers the image; typos like 'images' instead of 'image'.","solutions":["Add an 'image' field under 'docker_env' in MLproject, e.g. docker_env: {image: myregistry/myimage:latest}","Verify the MLproject YAML parses as expected (project.docker_env is a dict containing 'image')","If you intend MLflow to build the image, still set a base/tag name for image via docker_env.image"],"exampleFix":"# before\ndocker_env: {}\n# after\ndocker_env:\n  image: my-project-image:latest","handlingStrategy":"validation","validationCode":"import yaml\ndef validate_mlproject(path):\n    spec = yaml.safe_load(open(path))\n    env = spec.get('docker_env') or {}\n    if spec.get('docker_env') is not None and not env.get('image'):\n        raise ValueError(\"MLproject docker_env must include an 'image' field\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include docker_env.image when environment type is docker in MLproject","Validate MLproject YAML in CI with a small schema check","Key the field exactly 'image' (not 'images' or 'name')"],"tags":["mlflow","docker","config","projects"],"backgroundTag":"missing-required-config-field","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}