{"record":{"id":"441ccd2bc25d3cae","repo":"TryGhost/Ghost","slug":"build-image-not-found-build-image-n-nyou-are-r","errorCode":null,"errorMessage":"Build image not found: ${BUILD_IMAGE}\\n\\nYou are running in \"build\" mode, which requires a pre-built Docker image.\\nFor local development, \"dev\" mode is recommended instead.\\n\\nTo fix this, either:\\n  1. (Recommended) Run \"pnpm dev\" first, then re-run tests — dev mode is auto-detected and doesn't need this image\\n  2. Build locally: pnpm --filter @tryghost/e2e build:docker (with GHOST_E2E_BASE_IMAGE set)\\n  3. Pull from registry: docker pull ${BUILD_IMAGE}\\n  4. Use a different image: GHOST_E2E_MODE=build GHOST_E2E_IMAGE=<image> pnpm --filter @tryghost/e2e test","messagePattern":"Build image not found: \\$\\{BUILD_IMAGE\\}\\\\n\\\\nYou are running in \"build\" mode, which requires a pre-built Docker image\\.\\\\nFor local development, \"dev\" mode is recommended instead\\.\\\\n\\\\nTo fix this, either:\\\\n  1\\. \\(Recommended\\) Run \"pnpm dev\" first, then re-run tests — dev mode is auto-detected and doesn't need this image\\\\n  2\\. Build locally: pnpm --filter @tryghost/e2e build:docker \\(with GHOST_E2E_BASE_IMAGE set\\)\\\\n  3\\. Pull from registry: docker pull \\$\\{BUILD_IMAGE\\}\\\\n  4\\. Use a different image: GHOST_E2E_MODE=build GHOST_E2E_IMAGE=<image> pnpm --filter @tryghost/e2e test","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"e2e/helpers/environment/service-managers/ghost-manager.ts","lineNumber":127,"sourceCode":"    }\n\n    /**\n     * Verify the build image exists locally.\n     * Fails early with a helpful error message if the image is not available.\n     */\n    async verifyBuildImageExists(): Promise<void> {\n        const buildImageKey = `${BUILD_IMAGE}\\n${BUILD_GATEWAY_IMAGE}`;\n        if (GhostManager.verifiedBuildImageKey === buildImageKey) {\n            debug(`Build images already verified: ${BUILD_IMAGE}, ${BUILD_GATEWAY_IMAGE}`);\n            return;\n        }\n\n        try {\n            const image = this.docker.getImage(BUILD_IMAGE);\n            await image.inspect();\n            debug(`Build image verified: ${BUILD_IMAGE}`);\n        } catch {\n            throw new Error(\n                `Build image not found: ${BUILD_IMAGE}\\n\\n` +\n                `You are running in \"build\" mode, which requires a pre-built Docker image.\\n` +\n                `For local development, \"dev\" mode is recommended instead.\\n\\n` +\n                `To fix this, either:\\n` +\n                `  1. (Recommended) Run \"pnpm dev\" first, then re-run tests — dev mode is auto-detected and doesn't need this image\\n` +\n                `  2. Build locally: pnpm --filter @tryghost/e2e build:docker (with GHOST_E2E_BASE_IMAGE set)\\n` +\n                `  3. Pull from registry: docker pull ${BUILD_IMAGE}\\n` +\n                `  4. Use a different image: GHOST_E2E_MODE=build GHOST_E2E_IMAGE=<image> pnpm --filter @tryghost/e2e test`\n            );\n        }\n\n        try {\n            const gatewayImage = this.docker.getImage(BUILD_GATEWAY_IMAGE);\n            await gatewayImage.inspect();\n            debug(`Build gateway image verified: ${BUILD_GATEWAY_IMAGE}`);\n        } catch {\n            throw new Error(\n                `Build gateway image not found: ${BUILD_GATEWAY_IMAGE}\\n\\n` +","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/e2e/helpers/environment/service-managers/ghost-manager.ts#L109-L145","documentation":"GhostManager.verifyBuildImageExists() probes the local Docker image store with docker.getImage(BUILD_IMAGE).inspect() before running build-mode tests. If inspect rejects (image absent), it throws with remediation steps. A static cache (verifiedBuildImageKey) prevents re-inspecting once verified within the process. This fires only in GHOST_E2E_MODE=build, where tests assume a pre-built production Ghost image rather than a live dev server.","triggerScenarios":"GHOST_E2E_MODE=build set without first building the image. BUILD_IMAGE (derived from GHOST_E2E_IMAGE / registry tag) doesn't exist locally and wasn't pulled. The image was built under a different tag than BUILD_IMAGE resolves to. A previous docker system prune removed it.","commonSituations":"Running the build-mode test suite in a fresh CI worker that never ran build:docker; switching GHOST_E2E_BASE_IMAGE without rebuilding; tagging mismatch between the build pipeline and what the test resolves; running build mode when dev mode (pnpm dev) was intended.","solutions":["Run pnpm dev first and re-run tests — dev mode is auto-detected and bypasses this image entirely (recommended for local dev).","Build the image locally: pnpm --filter @tryghost/e2e build:docker with GHOST_E2E_BASE_IMAGE set.","Pull the image: docker pull ${BUILD_IMAGE}.","Point at an existing image: GHOST_E2E_MODE=build GHOST_E2E_IMAGE=<image> pnpm --filter @tryghost/e2e test."],"exampleFix":"# before\nGHOST_E2E_MODE=build pnpm --filter @tryghost/e2e test\n\n# after (pick one)\npnpm dev && pnpm --filter @tryghost/e2e test\n# or\npnpm --filter @tryghost/e2e build:docker && GHOST_E2E_MODE=build pnpm --filter @tryghost/e2e test","handlingStrategy":"validation","validationCode":"import Docker from 'dockerode';\nconst docker = new Docker();\nasync function imageExists(tag: string): Promise<boolean> {\n    try { await docker.getImage(tag).inspect(); return true; }\n    catch { return false; }\n}\n// call before running build-mode tests:\nif (GHOST_E2E_MODE === 'build' && !await imageExists(BUILD_IMAGE)) {\n    throw new Error(`Pre-flight: ${BUILD_IMAGE} missing. Run pnpm --filter @tryghost/e2e build:docker.`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to dev mode (pnpm dev) for local work; it bypasses the build image entirely.","Add a docker image inspect pre-flight to CI before invoking the build-mode suite.","Pin GHOST_E2E_BASE_IMAGE and build in the same pipeline that runs build-mode tests."],"tags":["docker","e2e","build-mode","configuration","ci"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}