feat(lms): add Docker setup guidance and improve remote workspace handling

This commit is contained in:
2026-09-09 16:59:47 +09:00
parent 104c083995
commit 54ef5836b1
10 changed files with 273 additions and 21 deletions
+27
View File
@@ -0,0 +1,27 @@
import { execFile } from 'node:child_process'
export type DockerStatus = 'ready' | 'missing' | 'permission' | 'unavailable' | 'error'
export function classifyDockerError(code: string | number | null | undefined, message: string): DockerStatus {
if (code === 'ENOENT') return 'missing'
if (/permission denied|access is denied|EACCES/i.test(message)) return 'permission'
if (/cannot connect|connection refused|is the docker daemon running/i.test(message)) return 'unavailable'
return 'error'
}
export function checkDockerStatus(): Promise<{ status: DockerStatus; platform: string }> {
return new Promise((resolve) => {
execFile('docker', ['info', '--format', '{{.ServerVersion}}'], {
timeout: 5000,
maxBuffer: 256 * 1024,
env: { ...process.env, LC_ALL: 'C', LANG: 'C' },
}, (error, stdout, stderr) => {
resolve({
status: error
? classifyDockerError(error.code, `${error.message}\n${stderr}`)
: stdout.trim() ? 'ready' : 'error',
platform: process.platform,
})
})
})
}