AS AgentScopeAPI 手册 / API Reference

DockerSandboxClientOptions

public class DockerSandboxClientOptions extends SandboxClientOptions
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:33–317

Docker 沙箱客户端选项,保存相关配置项。位于 io.agentscope.harness.agent.sandbox.impl.docker 包,继承自 SandboxClientOptions。核心成员包括 getType、createClient、getImage、image、setImage、getWorkspaceRoot。

Configuration options for the Docker sandbox client.

Describes the Docker container configuration used when creating or resuming a io.agentscope.harness.agent.sandbox.impl.docker.DockerSandbox. The Docker CLI must be available on the host system's PATH.

方法摘要Method Summary

方法Method说明Description
public String getType()
获取类型。
Returns the type.
public SandboxClient<DockerSandboxClientOptions> createClient()
创建`DockerSandboxClient`用于这些选项。
Creates a `DockerSandboxClient` for these options.
public String getImage()
获取图像。
Returns the Docker image name.
public DockerSandboxClientOptions image(String image)
设置图像。
Sets the Docker image name.
public void setImage(String image)
设置图像。
Sets the Docker image name.
public String getWorkspaceRoot()
获取工作区根。
Returns the workspace root path inside the container.
public DockerSandboxClientOptions workspaceRoot(String workspaceRoot)
设置工作区根。
Sets the workspace root path inside the container.
public void setWorkspaceRoot(String workspaceRoot)
设置工作区根。
Sets the workspace root path inside the container.
public Map<String, String> getEnvironment()
获取环境。
Returns the container environment variables.
public void setEnvironment(Map<String, String> environment)
设置环境。
Sets the container environment variables.
public Long getMemorySizeBytes()
返回可选记忆限制 in 字节。
Returns the optional memory limit in bytes.
public DockerSandboxClientOptions memorySizeBytes(Long memorySizeBytes)
设置记忆限制 in 字节。
Sets the memory limit in bytes.
public void setMemorySizeBytes(Long memorySizeBytes)
设置记忆限制 in 字节。
Sets the memory limit in bytes.
public Long getCpuCount()
返回可选 CPU 数量限制。
Returns the optional CPU count limit.
public DockerSandboxClientOptions cpuCount(Long cpuCount)
设置CPU 数量限制。
Sets the CPU count limit.
public void setCpuCount(Long cpuCount)
设置CPU 数量限制。
Sets the CPU count limit.
public int[] getExposedPorts()
获取 `getExposedPorts`。
Returns the host ports to expose.
public DockerSandboxClientOptions exposedPorts(int... exposedPorts)
设置该参数。
Sets the host ports to expose from the container.
public void setExposedPorts(int[] exposedPorts)
设置 `setExposedPorts`。
Sets the host ports to expose from the container.
public String getNetwork()
获取 `getNetwork`。
Returns the docker network mode or network name.
public DockerSandboxClientOptions network(String network)
设置该参数。
Sets the docker network mode or network name.
public void setNetwork(String network)
设置 `setNetwork`。
Sets the docker network mode or network name.
public List<String> getAdditionalRunArgs()
获取 `getAdditionalRunArgs`。
Returns additional raw arguments appended to `docker run`.
public DockerSandboxClientOptions additionalRunArgs(String... additionalRunArgs)
设置该参数。
Appends additional raw arguments to `docker run` before the image name.
public void setAdditionalRunArgs(List<String> additionalRunArgs)
设置 `setAdditionalRunArgs`。
Sets the additional raw arguments appended to `docker run`.

方法详情Method Detail

getType

public String getType()

获取类型。

Returns the type.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:59–62

createClient

public SandboxClient<DockerSandboxClientOptions> createClient()

创建DockerSandboxClient用于这些选项。

Creates a DockerSandboxClient for these options.

返回Returns SandboxClient<DockerSandboxClientOptions>
返回SandboxClient。new Docker sandbox client
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:69–72

getImage

public String getImage()

获取图像。

Returns the Docker image name.

返回Returns String
返回字符串结果。Docker image
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:79–81

image

public DockerSandboxClientOptions image(String image)

设置图像。

Sets the Docker image name.

参数Parameters
名称Name类型Type说明Description
imageString图像(类型 `String`)。Docker image (e.g. `python:3.12-slim`)
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:89–92

setImage

public void setImage(String image)

设置图像。

Sets the Docker image name.

参数Parameters
名称Name类型Type说明Description
imageString图像(类型 `String`)。Docker image
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:99–101

getWorkspaceRoot

public String getWorkspaceRoot()

获取工作区根。

Returns the workspace root path inside the container.

返回Returns String
返回字符串结果。workspace root
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:108–110

workspaceRoot

public DockerSandboxClientOptions workspaceRoot(String workspaceRoot)

设置工作区根。

Sets the workspace root path inside the container.

参数Parameters
名称Name类型Type说明Description
workspaceRootString工作区根(类型 `String`)。absolute path inside the container
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:118–121

setWorkspaceRoot

public void setWorkspaceRoot(String workspaceRoot)

设置工作区根。

Sets the workspace root path inside the container.

参数Parameters
名称Name类型Type说明Description
workspaceRootString工作区根(类型 `String`)。absolute path inside the container
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:128–130

getEnvironment

public Map<String, String> getEnvironment()

获取环境。

Returns the container environment variables.

返回Returns Map<String, String>
返回映射。environment variable map
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:137–139

setEnvironment

public void setEnvironment(Map<String, String> environment)

设置环境。

Sets the container environment variables.

参数Parameters
名称Name类型Type说明Description
environmentMap<String, String>环境(类型 `Map`)。key-value pairs
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:146–148

getMemorySizeBytes

public Long getMemorySizeBytes()

返回可选记忆限制 in 字节。

Returns the optional memory limit in bytes.

返回Returns Long
返回数值结果。memory limit or `null` if not set
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:155–157

memorySizeBytes

public DockerSandboxClientOptions memorySizeBytes(Long memorySizeBytes)

设置记忆限制 in 字节。

Sets the memory limit in bytes.

参数Parameters
名称Name类型Type说明Description
memorySizeBytesLong记忆大小字节(类型 `Long`)。memory limit (e.g. `512 * 1024 * 1024L`)
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:165–168

setMemorySizeBytes

public void setMemorySizeBytes(Long memorySizeBytes)

设置记忆限制 in 字节。

Sets the memory limit in bytes.

参数Parameters
名称Name类型Type说明Description
memorySizeBytesLong记忆大小字节(类型 `Long`)。memory limit in bytes
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:175–177

getCpuCount

public Long getCpuCount()

返回可选 CPU 数量限制。

Returns the optional CPU count limit.

返回Returns Long
返回数值结果。CPU count or `null` if not set
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:184–186

cpuCount

public DockerSandboxClientOptions cpuCount(Long cpuCount)

设置CPU 数量限制。

Sets the CPU count limit.

参数Parameters
名称Name类型Type说明Description
cpuCountLongcpu 数量(类型 `Long`)。number of CPUs (e.g. `2L`)
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:194–197

setCpuCount

public void setCpuCount(Long cpuCount)

设置CPU 数量限制。

Sets the CPU count limit.

参数Parameters
名称Name类型Type说明Description
cpuCountLongCPUs的数量。number of CPUs
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:204–206

getExposedPorts

public int[] getExposedPorts()

获取 getExposedPorts。

Returns the host ports to expose.

返回Returns int[]
返回int[]。exposed ports array
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:213–215

exposedPorts

public DockerSandboxClientOptions exposedPorts(int... exposedPorts)

设置该参数。

Sets the host ports to expose from the container.

参数Parameters
名称Name类型Type说明Description
exposedPorts varargsint...exposed Ports(类型 `int...`)。port numbers
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:223–226

setExposedPorts

public void setExposedPorts(int[] exposedPorts)

设置 setExposedPorts。

Sets the host ports to expose from the container.

参数Parameters
名称Name类型Type说明Description
exposedPortsint[]exposed Ports(类型 `int[]`)。port numbers
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:233–235

getNetwork

public String getNetwork()

获取 getNetwork。

Returns the docker network mode or network name.

返回Returns String
返回字符串结果。docker network value, or `null` when unset
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:242–244

network

public DockerSandboxClientOptions network(String network)

设置该参数。

Sets the docker network mode or network name.

参数Parameters
名称Name类型Type说明Description
networkStringnetwork(类型 `String`)。docker network value
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:252–255

setNetwork

public void setNetwork(String network)

设置 setNetwork。

Sets the docker network mode or network name.

参数Parameters
名称Name类型Type说明Description
networkStringnetwork(类型 `String`)。docker network value
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:262–264

getAdditionalRunArgs

public List<String> getAdditionalRunArgs()

获取 getAdditionalRunArgs。

Returns additional raw arguments appended to docker run.

返回Returns List<String>
返回列出。additional docker run arguments
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:271–273

additionalRunArgs

public DockerSandboxClientOptions additionalRunArgs(String... additionalRunArgs)

设置该参数。

Appends additional raw arguments to docker run before the image name.

参数Parameters
名称Name类型Type说明Description
additionalRunArgs varargsString...additional 运行参数(类型 `String...`)。additional docker run arguments
返回Returns DockerSandboxClientOptions
返回DockerSandboxClientOptions。this options instance
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:281–291

setAdditionalRunArgs

public void setAdditionalRunArgs(List<String> additionalRunArgs)

设置 setAdditionalRunArgs。

Sets the additional raw arguments appended to docker run.

参数Parameters
名称Name类型Type说明Description
additionalRunArgsList<String>additional 运行参数(类型 `List`)。additional docker run arguments
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxClientOptions.java:298–308
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.