{"record":{"id":"e76e9f1536e62172","repo":"jdx/mise","slug":"docker-load-failed-ensure-the-docker-d","errorCode":null,"errorMessage":"`docker load` failed ({}): {}. Ensure the docker daemon is running and your user has access to the socket.","messagePattern":"`docker load` failed \\((.+?)\\): (.+?)\\. Ensure the docker daemon is running and your user has access to the socket\\.","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/oci/docker_archive.rs","lineNumber":113,"sourceCode":"        .join()\n        .map_err(|_| eyre::eyre!(\"docker archive writer thread panicked\"))?;\n\n    if !out.status.success() {\n        let stderr = String::from_utf8_lossy(&out.stderr);\n        let mut msg = format!(\n            \"`docker load` failed ({}): {}. Ensure the docker daemon is running and \\\n             your user has access to the socket.\",\n            out.status,\n            stderr.trim()\n        );\n        // A write error here is usually the broken pipe caused by docker\n        // dying (so docker's stderr is the real cause), but if it's something\n        // else — e.g. a layer failed to decompress — surface it too so the\n        // truncated-archive error from docker doesn't mask the root cause.\n        if let Err(e) = &write_result {\n            msg.push_str(&format!(\"\\n(while writing archive: {e})\"));\n        }\n        bail!(msg);\n    }\n    // docker succeeded — don't swallow a writer error if one somehow occurred.\n    write_result?;\n    Ok(())\n}\n\nfn write_docker_archive<W: Write>(\n    out: W,\n    layout: &ImageLayout,\n    manifest: &ImageManifest,\n    config_bytes: &[u8],\n    tag: &str,\n) -> Result<()> {\n    let mut builder = Builder::new(out);\n\n    let config_name = format!(\"{}.json\", hex_of(&manifest.config.digest));\n    append_bytes(&mut builder, &config_name, config_bytes)?;\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/oci/docker_archive.rs#L95-L131","documentation":"After streaming the docker archive, mise checks the `docker load` child's exit status; non-zero triggers this error with the status, docker's stderr, and — when the archive writer also failed (e.g. a layer that will not decompress) — an extra `(while writing archive: ...)` line so the root cause is not masked (src/oci/docker_archive.rs:113).","triggerScenarios":"`mise oci run` when the docker daemon is not running (`Cannot connect to the Docker daemon`), the user lacks socket permission (`permission denied ... /var/run/docker.sock`), or a layer blob in the image dir is corrupt so docker dies mid-stream.","commonSituations":"Fresh machines where docker isn't started; user not in the docker group; Docker Desktop not launched; CI without a docker service; image dirs damaged by partial copies or interrupted builds.","solutions":["Verify docker works: `docker ps`; if it fails, start the daemon (`systemctl start docker` or launch Docker Desktop)","Fix socket permissions: `sudo usermod -aG docker $USER` then log out/in","If the message includes `(while writing archive: ...)`, treat that as the cause: rebuild the image (`mise oci build`) — the layer blob is corrupt"],"exampleFix":"# before\nmise oci run   # docker load failed\n# after\nsudo systemctl start docker\ndocker ps   # verify access\nmise oci run","handlingStrategy":"retry","validationCode":"#!/usr/bin/env bash\ndocker info >/dev/null 2>&1 || { echo 'docker daemon unreachable — start it before mise oci run' >&2; exit 1; }\nmise oci run","typeGuard":null,"tryCatchPattern":"# Retry once after ensuring the daemon is reachable (CI service startup race):\nfor i in 1 2; do\n  docker info >/dev/null 2>&1 && mise oci run && break\n  [ \"$i\" = 2 ] && { echo 'docker never became ready' >&2; exit 1; }\n  # host wait primitive, not sleep: block until the socket answers\n  timeout 30 bash -c 'until docker info >/dev/null 2>&1; do read -t 1 -u 1 || true; done'\ndone","preventionTips":["In CI, add a health-check step (`docker info`) before any docker-dependent mise command","Ensure the CI user is in the docker group and the docker service is started","If `(while writing archive: ...)` appears, rebuild the image instead of retrying — the layers are corrupt"],"tags":["oci","docker","docker-daemon","permissions"],"backgroundTag":"docker-daemon-unavailable","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}