Single/Double Container Mode
About 569 wordsAbout 2 min
Cloud-native development supports two launch modes:
- Single Container Mode: Development environment and code service (
code-server) are in the same container - Double Container Mode: Development environment and code service (
code-server) are in separate containers, with the workspace (/workspace) directories shared between them
Development Environment: A user-customized container (configured via .ide/Dockerfile or a custom image), or the default CNB container environment, which includes user-installed or pre-installed software.
Single Container Mode
Single container mode is recommended. The following methods start in single container mode:
Starting with Default Configuration
When users haven't made any configurations (i.e., haven't configured a startup pipeline and .ide/Dockerfile), the development environment starts with default configuration. The default environment has code-server and ssh installed, so it starts in single container mode, supporting both WebIDE and VSCode remote development.
See Default Development Environment for details.
Starting with Custom Configuration
When users have configured a startup pipeline or .ide/Dockerfile, and the custom image or .ide/Dockerfile has code-server installed, the development environment and code-server run in the same container, using single container mode.
The following three methods (all launch images have code-server installed) start in single container mode:
- Specifying development environment via Docker image
- Customizing development environment via Dockerfile
- Customizing both development environment and startup process
Double Container Mode
When the development environment container doesn't have code-server installed, the system will start an additional code-server container to provide code service, supporting WebIDE and VSCode client access — this is double container mode. The workspace (/workspace) directories are shared between the two containers.
The following two methods will start in double container mode:
Docker Image Without code-server Installed
$:
vscode:
# Docker image without code-server service installed
- docker:
image: node:22
services:
- vscode
- docker
# Tasks to execute after the development environment starts
stages:
- name: ls
script: ls -alCustom Dockerfile Without code-server Installed
# .ide/Dockerfile
# You can replace node with your required base image
FROM node:20
# Install software as needed
RUN apt-get update && apt-get install -y git wget unzip openssh-server
# Specify character set to support Chinese input in command line (choose character set as needed)
ENV LANG C.UTF-8
ENV LANGUAGE C.UTF-8Double Container Mode — Cross-Container Terminal
In double container mode, accessing WebIDE or VSCode actually connects to the code-server container. To access the development environment container, you can use the cross-container terminal provided in the code-server container. When opening a terminal in WebIDE or VSCode, the default terminal is a cross-container terminal named CNB.
If the development environment container doesn't support git, switch to a non-CNB terminal to use the built-in code-server terminal for git operations.
Double Container Mode — Plugin Capability Limitations
In double container mode, VSCode plugins are installed in the code-server container and may not be able to access the development environment container (such as Debug and other features that require access to it).