You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用远程Docker实例时IntelliJ IDEA Docker插件无法构建镜像

问题

使用IntelliJ IDEA 2024.1.5版本与Docker 27.0.2版本,点击构建镜像时,构建日志仅显示“Deploying 'cron Dockerfile: Dockerfile'…”,远程Docker连接正常,但无法完成镜像构建。

构建日志卡住界面

错误日志

2024-07-21 14:23:12,153 [   8547]   WARN - #c.i.e.c.PtyCommandLine - 无法通过PTY运行进程
com.pty4j.windows.conpty.LastErrorExceptionEx: CreateProcessW失败: GetLastError()返回2: 系统找不到指定的文件。
    at com.pty4j.windows.conpty.ProcessUtils.start(ProcessUtils.java:91)
    at com.pty4j.windows.conpty.ProcessUtils.startProcess(ProcessUtils.java:25)
    at com.pty4j.windows.conpty.WinConPtyProcess.<init>(WinConPtyProcess.java:42)
    at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:139)
    at com.intellij.execution.process.ProcessServiceImpl.startPtyProcess(ProcessServiceImpl.kt:37)
    at com.intellij.execution.configurations.PtyCommandLine.startProcessWithPty(PtyCommandLine.java:172)
    at com.intellij.execution.configurations.PtyCommandLine.startProcess(PtyCommandLine.java:112)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:357)
    at com.intellij.docker.cli.CliExecutor$doCreateProcess$2.invokeSuspend(CliExecutor.kt:153)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

排查与解决方法

从日志里的CreateProcessW失败: GetLastError()返回2: 系统找不到指定的文件可以明确,IDEA在调用PTY(伪终端)进程时无法定位指定文件,结合远程Docker场景,按以下步骤处理:

  • 检查Docker CLI路径与环境变量
    打开IDEA设置(File > Settings > Build, Execution, Deployment > Docker),确认远程连接配置里的CLI路径正确。同时在本地终端执行docker --version验证命令是否可用,Windows用户需确保docker.exe所在目录已添加到系统PATH环境变量中。

  • 禁用终端运行构建
    打开构建配置编辑界面(顶部运行按钮下拉框选择Edit Configurations...),找到对应Docker构建配置,切换到Runner标签,取消勾选Run in terminal选项,保存后重新尝试构建。

  • 确认远程Docker连接有效性
    在本地终端执行docker -H <远程Docker地址> info,确保能正常获取远程Docker服务信息,排除远程连接本身的问题。

  • 版本兼容性调整
    尝试将IDEA更新至最新稳定版,或回退到2024.1.4等已知稳定版本;同时确认本地Docker CLI版本与远程Docker daemon版本差异不超过2个大版本(Docker官方兼容性要求)。

内容的提问来源于stack exchange,提问作者itning

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 14:13:10