Manage sub-containers with DockerBoard
DSW sub-containers are built on Docker in Docker (DinD) technology, which lets you create and manage multiple sub-containers within a single DSW instance for environment isolation and resource management. The console provides a visual interface for creating, starting, stopping, and deleting sub-containers, as well as connecting to them over SSH.
Use cases
Isolate different development environments within the same DSW instance to compare and validate training results across different images.
Switch runtime environments by creating sub-containers with different images when GPU resources are limited, instead of creating a new instance and waiting for it to be provisioned.
Share a single DSW instance among multiple developers while keeping their environments and resources isolated through sub-containers.
Prerequisites
Sub-containers are supported only on DSW instances created with Lingjun resource groups or general-purpose resource groups.
The instance owner (the user who created the instance) must have permissions to create and manage DSW instances.
The DSW instance must have the Enable Multi-Container Isolation (DinD) feature enabled at creation time.
If you need SSH access to sub-containers, the DSW instance must also have SSH enabled.
Roles and permissions
Sub-container management involves two roles:
Instance owner: the user who created the DSW instance. The owner handles instance-level configuration, including enabling DinD, configuring access restrictions, setting the maximum number of sub-containers, and defining data directory isolation rules.
Sub-container developer: a user who holds the appropriate workspace role (such as Algorithm Developer) or RAM permissions. Developers can view the sub-container list, create their own sub-containers, and connect to them over SSH. Each developer can only start, stop, and delete their own sub-containers, but can view information about all sub-containers.
Access control supports two approaches:
Workspace role-based: the instance owner can restrict specific workspace roles (such as Algorithm Developer) from accessing the primary container. Restricted roles can only develop through sub-containers. This approach is recommended for most scenarios.
RAM policy-based: use RAM policies for finer-grained access control. Permissions can be scoped to specific sub-containers on specific instances. This approach is suited for enterprise customers with stricter access control requirements.
Instance owner guide
Enable multi-container isolation when creating an instance
Log on to the PAI console, go to the DSW page, and click Create Instance.
In the instance settings, find the Enable Multi-Container Isolation (DinD) toggle and turn it on.
After you enable DinD, the following configuration options appear:
Restrict roles that can access the main container: select the workspace roles that you want to restrict from the drop-down list. Users with restricted roles cannot directly open or operate the DSW primary container and can only develop by connecting to sub-containers over SSH.
For example, if you select Algorithm Development, users with the Algorithm Developer role cannot access the primary container, but can still create and use their own sub-containers from the Sub-container Management tab on the instance details page.
If no role is selected, all authorized users can access the primary container as usual, which is consistent with the existing behavior.
Maximum Number of Sub-containers: set the maximum number of sub-containers allowed for this instance. You can specify an integer from 1 to 16. The default value is 10.
Data Catalog Fencing Configuration: specify the path to the data directory isolation configuration file inside the primary container. The default path is
/etc/docker/dockerboard/mount_access.json. This configuration file controls which data directories users can mount when creating sub-containers. You can click Configuration Template Download to download the configuration file template first. For the subsequent configuration steps, see Configure data directory isolation.
Complete the remaining instance settings and click Create to create the instance.
Configure data directory isolation
Data directory isolation controls which data directories each developer can mount when creating sub-containers, preventing developers from accessing data stored by other users.
Configuration steps:
On the instance creation or editing page, click the Configuration Template Download link below Data Catalog Fencing Configuration to download the JSON template file.
Edit the downloaded template to define the allowed directories for each RAM user UID.
Place the completed
mount_access.jsonfile at the path specified in the DSW primary container configuration (the default is/etc/docker/dockerboard/mount_access.json).
Configuration file format:
The configuration file is in JSON format. Each key is a RAM user's UID, and each user entry can include an Allow field (list of directories the user can mount) and a Deny field (list of directories the user cannot mount). Example:
{
"123124432xxx": {
"Allow": [
"/mnt/workspace",
"/mnt/data1"
],
"Deny": [
"/mnt/data2"
]
},
"224321234xxx": {
"Allow": [
"*"
]
}
}Field descriptions:
Field | Description |
key (e.g., | The UID of the RAM user. |
Allow | The list of primary container directories the user can mount. Set to |
Deny | The list of primary container directories the user cannot mount. Deny takes precedence over Allow: if a directory appears in both lists, mounting is denied. This field is optional. |
Configuration behavior:
If the configuration file exists and has a valid format, the system validates whether the current user has permission to mount the selected directories when a sub-container is created.
If the current user's UID is not found in the configuration file, the user cannot mount any data directories when creating a sub-container. The following message appears: "Your account does not have any available DSW paths. If you need to mount directories, contact the instance owner to add your configuration."
If the configuration file path is empty or the file does not exist, the system does not enforce directory isolation and all users can mount any directory in the primary container.
Sub-container developer guide
Open the sub-container management page
Log on to the PAI console and go to the DSW page.
In the instance list, click the name of the target instance that has DinD enabled to go to the instance details page.
On the instance details page, click the Sub-container Management tab to open the management page.
The sub-container management tab is only available when the DSW primary container is in the Running state. If the primary container is not running, this tab is not displayed.
Create a sub-container
On the sub-container management page, click the Create Sub-container button and complete the following settings in the creation form.
Basic information
Parameter | Required | Description | Example |
Container name | Yes | Specify a recognizable name for the sub-container. | Example: |
Hostname | No | Specify a custom hostname for the sub-container. | Example: |
Restart policy | No | Set the automatic restart policy after the container exits. | Example: Do not restart automatically |
Environment settings
Parameter | Required | Description | Example |
Image configuration | Yes | Select the image for the sub-container. Two image sources are available:
| Example: |
SSH public key | Yes | Enter the SSH public key from your local client. This key is used for SSH access to the sub-container later. | If you have not generated an SSH key pair yet, run |
Primary container mounts | No | For instances with persistent system disks enabled, sub-containers can mount any path from the primary container. For instances without persistent system disks, sub-containers can only mount the storage paths and datasets that are already mounted to the primary container. | |
Dataset mounts | No | Only datasets that are already mounted to the primary container can be mounted to the sub-container. | |
Environment variables | No | Set custom environment variables for the sub-container as key-value pairs. | Example: |
Startup command | No | Specify the command to run when the container starts. | Example: |
Entrypoint | No | Specify a custom entrypoint for the container. | Example: |
Resource settings
Parameter | Required | Description | Example |
GPU device mounts | No | If the DSW instance has GPU resources, you can select which GPU devices to assign to the sub-container. The system lists all available GPU cards and their device IDs. You can select multiple GPUs. After you select GPUs, the corresponding GPU devices are assigned to the sub-container for use. | |
CPU limit | No | Set the maximum CPU resources the sub-container can use. If left empty, no limit is imposed, and the sub-container may consume idle resources from other workloads on the instance. | Example: 8 cores |
Memory limit | No | Set the maximum memory the sub-container can use. If left empty, no limit is imposed, and the sub-container may consume idle resources from other workloads on the instance. | Example: 48 GiB |
After you complete the settings, click Confirm to create the sub-container. You can click Child Container Creation Progress on the sub-container management page to track the creation progress.
Manage sub-containers
In the sub-container list, the following actions are available for each sub-container:
You can only manage sub-containers that you created.
Start: restart a stopped sub-container.
Stop: stop a running sub-container. After the container is stopped, all processes inside are terminated, but the container configuration and mounted storage data are preserved.
Restart: restart a running sub-container. This stops and then starts the container in a single operation.
Logs: view the runtime logs of the sub-container for troubleshooting.
SSH connection details: view the SSH connection information for the sub-container, including the connection username and connection command.
Delete: delete the sub-container. After deletion, any data that was not persisted through mounted storage is permanently lost and cannot be recovered. Proceed with caution.
View the sub-container list
The sub-container management page displays a list of all sub-containers on the current instance. The list includes the following information:
Only sub-containers created through the sub-container management page are listed. Sub-containers created manually using Docker commands are not included.
Field | Description |
Container name | The name of the sub-container. |
User name | The name of the user who created the sub-container. |
Status | The current status. Possible values: Creating (pulling image), Created, Running, Paused, Restarting, Stopped, Starting, Stopping, Updating, and others. |
GPU memory (GiB) | The GPU device ID and GPU memory usage. |
CPU resources | The CPU usage and number of cores. |
Memory (GiB) | The memory usage. |
Container image | The image used by the sub-container. |
Created at | The time when the sub-container was created. |
All users with read access to DSW can view the full sub-container list, but can only manage (start, stop, or delete) sub-containers they created.
View the creation task list
Sub-container creation can take a while, especially when pulling large images. The system provides creation task tracking to help you monitor progress.
In the upper-right corner of the sub-container management page, click Child Container Creation Progress to view the status and logs of all container creation tasks. For tasks that are still in the Creating state, you can manually abort them. Task records are kept for 3 days and then automatically deleted.
Access a sub-container over SSH
After a sub-container is successfully created and enters the Running state, you can connect to it over SSH.
Steps:
In the sub-container list, find the target sub-container and click SSH connection details in the Actions column. The dialog shows the connection username and the full connection command.
Run the connection command in your local terminal to connect to the sub-container. The command format is:
ssh <connection_username>@<instance_public_IP> -p 22 -i <local_private_key_path>Parameter descriptions:
Parameter | Description |
Connection username | Bound to each sub-container individually. Displayed in the SSH connection details dialog. |
Instance public IP | The public IP address of the DSW primary container. |
Local private key path | The path to the private key file that corresponds to the SSH public key provided when the sub-container was created (e.g., ~/.ssh/id_rsa). |
After a successful SSH login, you are placed directly in the command-line environment of the corresponding sub-container. All sub-containers share port 22 of the DSW primary container. Each sub-container is isolated through its own unique SSH key and a dedicated connection username.
Considerations and limits
Dependence on the primary container: all sub-container management features depend on the DSW primary container being in a running state. When the primary container is stopped or encounters an error, the sub-container management page is unavailable and sub-containers cannot be accessed.
Storage mount scope: sub-containers can only mount directories within the primary container. External storage cannot be mounted directly.
Sub-container limit: the number of sub-containers per instance is subject to the limit configured by the instance owner. The maximum configurable value is 16.
Feature scope: sub-containers do not include built-in applications such as JupyterLab, Terminal, or WebIDE that are available in the DSW primary container. To interact with a sub-container, use SSH.
Data persistence: data inside a sub-container that is not persisted through mounted storage is permanently lost when the sub-container is deleted. Store important data in mounted directories.
Instance deletion impact: when a DSW instance is deleted, all its sub-containers are also deleted. Back up your data before deleting an instance.
FAQ
Q: Why can't I see the sub-container management tab on the instance details page?
Check the following:
The DSW instance was created with the Enable Multi-Container Isolation (DinD) feature enabled.
The DSW primary container is currently in the Running state. When the primary container is not running, the sub-container management tab is not displayed.
Q: Why can't I mount data directories when creating a sub-container?
This is likely because the instance owner has configured a data directory isolation policy, and your RAM user account has not been assigned any available directories in the configuration file. Contact the instance owner to add your configuration in mount_access.json.
Q: Why does my SSH connection to a sub-container fail?
Check the following in order:
Is the sub-container in the Running state?
Does the local private key match the public key provided when the sub-container was created?
Is SSH enabled on the DSW instance?
Can your network reach the instance's public IP address on port 22?
Q: Why does sub-container creation take so long?
Sub-container creation time depends mainly on the image pull speed. The first pull of a large image may take a considerable amount of time. You can monitor the progress and logs in the creation task list. When you create subsequent containers with the same image, the process is much faster because the image is already cached locally.
Q: Can I manage sub-containers created by other users?
By default, each user can only manage their own sub-containers, but can view basic information about all sub-containers. To manage another user's sub-containers, the instance owner must grant the appropriate permissions through a RAM policy.