1 回答

TA貢獻(xiàn)1788條經(jīng)驗(yàn) 獲得超4個(gè)贊
我使用了以下代碼并且它對(duì)我有用(版本 8.14.3):
final ContainerConfig containerConfig = ContainerConfig.builder()
.hostConfig(HostConfig.builder().networkMode("host").build())
.image("helloworldjob")
.build();
final ContainerCreation creation = docker.createContainer(containerConfig, "image");
final String id = creation.id();
try {
docker.startContainer(id);
final ContainerExit exit = docker.waitContainer(id);
assertThat(exit.statusCode()).isEqualTo(0);
} finally {
docker.removeContainer(id);
}
添加回答
舉報(bào)