---
url: /zh/workspaces/vscode-likes.md
description: >
  介绍如何在自定义云原生开发环境中配置 openssh-server 以支持 VSCode、Cursor、CodeBuddy 客户端远程连接，
  以及解决窗口覆盖等常见问题。
---
云原生开发默认环境支持 VSCode、Cursor、CodeBuddy 客户端远程连接。

## 自定义环境配置

使用自定义开发环境时，需额外配置：

### 安装 SSH 服务

在 Dockerfile 中预装 `openssh-server`。注意：基础镜像不同，安装方式可能存在差异。

以下通过 `vscode` 事件指定自定义镜像，并在 Dockerfile 中预装 `openssh-server`。
以 Debian 系镜像（`node:22`）为例：

```yaml title=".cnb.yml"
$:
  vscode:
    - docker:
        build:
          dockerfile: .ide/Dockerfile
      services:
        - vscode
```

```dockerfile title=".ide/Dockerfile"
FROM node:22

# 安装 SSH 服务，支持 VSCode / Cursor / CodeBuddy 客户端远程连接
RUN apt-get update && apt-get install -y openssh-server
```

::: tip
若使用 `alpine` 等其它基础镜像，需改用对应的包管理器（如 `apk add openssh-server`）安装。
:::

### 安装客户端

下载 VSCode/Cursor/CodeBuddy 客户端并安装 Remote-SSH 插件。

### 解决窗口覆盖问题

点击 VSCode 客户端按钮可能覆盖已有窗口。

将 `Open Folders In New Window` 设置为 `on` 即可解决：

* Manage → Settings → User → Window → New Window → Open Folders in New Window
