如何创建具有命名卷的容器?
How to create container with named volume?
如何使用 docker-java library 创建名为 docker 卷的容器?
好的,我找到了解决方案:
Volume newVolume = new Volume("/target");
Bind bind = new Bind(namedVolumeName, newVolume);
CreateContainerResponse container = dockerClient.createContainerCmd(imageId)
.withName(containerName)
.withHostConfig(HostConfig.newHostConfig().withBinds(bind))
.exec();
如何使用 docker-java library 创建名为 docker 卷的容器?
好的,我找到了解决方案:
Volume newVolume = new Volume("/target");
Bind bind = new Bind(namedVolumeName, newVolume);
CreateContainerResponse container = dockerClient.createContainerCmd(imageId)
.withName(containerName)
.withHostConfig(HostConfig.newHostConfig().withBinds(bind))
.exec();