{"record":{"id":"d56068bc392aa447","repo":"jesseduffield/lazydocker","slug":"create-ssh-tunnel-tmp-file-w","errorCode":null,"errorMessage":"create ssh tunnel tmp file: %w","messagePattern":"create ssh tunnel tmp file: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/ssh/ssh.go","lineNumber":91,"sourceCode":"\nfunc (noopCloser) Close() error { return nil }\n\ntype tunneledDockerHost struct {\n\tsocketPath string\n\tcmd        *exec.Cmd\n\toSCommand  CmdKiller\n}\n\nvar _ io.Closer = (*tunneledDockerHost)(nil)\n\nfunc (t *tunneledDockerHost) Close() error {\n\treturn t.oSCommand.Kill(t.cmd)\n}\n\nfunc (self *SSHHandler) createDockerHostTunnel(ctx context.Context, remoteHost string) (*tunneledDockerHost, error) {\n\tsocketDir, err := self.tempDir(\"/tmp\", \"lazydocker-sshtunnel-\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create ssh tunnel tmp file: %w\", err)\n\t}\n\tlocalSocket := path.Join(socketDir, \"dockerhost.sock\")\n\n\tcmd, err := self.tunnelSSH(ctx, remoteHost, localSocket)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"tunnel docker host over ssh: %w\", err)\n\t}\n\n\t// set a reasonable timeout, then wait for the socket to dial successfully\n\t// before attempting to create a new docker client\n\tconst socketTunnelTimeout = 8 * time.Second\n\tctx, cancel := context.WithTimeout(ctx, socketTunnelTimeout)\n\tdefer cancel()\n\n\terr = self.retrySocketDial(ctx, localSocket)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ssh tunneled socket never became available: %w\", err)\n\t}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/jesseduffield/lazydocker/blob/7e7aadc2071d58031bf2daafca1fbd4093efc23f/pkg/commands/ssh/ssh.go#L73-L109","documentation":"The first step of createDockerHostTunnel creates a temporary directory /tmp/lazydocker-sshtunnel-* to hold the local unix socket that will forward to the remote docker daemon. This error means that os.MkdirTemp-style call failed, with the OS error chained via %w (despite the message saying 'tmp file').","triggerScenarios":"Starting lazydocker with DOCKER_HOST=ssh://... when /tmp is not writable, the disk/inode pool is exhausted, TMPDIR-related restrictions apply (sandbox, read-only rootfs, seccomp/container restrictions), or the process lacks permission to create directories under /tmp.","commonSituations":"Running lazydocker inside a container with a read-only or full filesystem; hardened/sandboxed environments (noexec/nodev/nosuid tmp mounts, systemd PrivateTmp restrictions); disk-full servers; unusual setups where /tmp is a small tmpfs that filled up.","solutions":["Free space or fix permissions on /tmp: `df -h /tmp` and `ls -ld /tmp` (should be drwxrwxrwt, owned by root).","If in a container, mount a writable /tmp or run with an adequate tmpfs size.","Clean stale lazydocker-sshtunnel-* directories left by crashed runs: `rm -rf /tmp/lazydocker-sshtunnel-*`.","As a workaround, build the tunnel manually with ssh -L into a writable directory and point DOCKER_HOST at that socket."],"exampleFix":"# before\n# /tmp read-only inside container\nlazydocker   # create ssh tunnel tmp file: ...: read-only file system\n\n# after (run container with writable tmp)\ndocker run -v /tmp:/tmp ... lazydocker\n# or fix the mount: tmpfs on /tmp with rw","handlingStrategy":"validation","validationCode":"if err := checkWritableDir(\"/tmp\"); err != nil {\n    return fmt.Errorf(\"cannot use /tmp for ssh tunnel socket: %w\", err)\n}\n// checkWritableDir: create+remove a probe file in the directory","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep /tmp writable and non-full on hosts that use DOCKER_HOST=ssh://.","Periodically clean stale /tmp/lazydocker-sshtunnel-* leftovers from crashed sessions.","In containers, mount a writable /tmp or tmpfs of adequate size."],"tags":["docker","ssh","filesystem","tmp","permissions","disk-full"],"backgroundTag":null,"analyzedSha":"7e7aadc2071d58031bf2daafca1fbd4093efc23f","analyzedAt":"2026-08-15T09:51:48.093Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}