本文整理汇总了Java中com.github.dockerjava.api.command.CopyArchiveToContainerCmd类的典型用法代码示例。如果您正苦于以下问题:Java CopyArchiveToContainerCmd类的具体用法?Java CopyArchiveToContainerCmd怎么用?Java CopyArchiveToContainerCmd使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CopyArchiveToContainerCmd类属于com.github.dockerjava.api.command包,在下文中一共展示了CopyArchiveToContainerCmd类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
protected Void run() throws Exception {
String copySource = localPath;
if (hostFileName.isPresent() && !localPath.toLowerCase().endsWith(hostFileName.get().toLowerCase())) {
Path sourcePath = Paths.get(localPath);
checkState(!java.nio.file.Files.isDirectory(sourcePath), "Cannot specify target name if source is directory");
File tempDir = Files.createTempDir();
tempDir.deleteOnExit();
File tempFile = new File(tempDir, hostFileName.get());
copySource = tempFile.getAbsolutePath();
Files.copy(new File(localPath), tempFile);
}
try (CopyArchiveToContainerCmd cmd =
dockerClient.copyArchiveToContainerCmd(containerId).withHostResource(copySource).withRemotePath(hostDirectory).withNoOverwriteDirNonDir(false)) {
cmd.exec();
}
return null;
}
示例2: execute
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
protected Void execute(CopyArchiveToContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/archive").resolveTemplate("id",
command.getContainerId());
LOGGER.trace("PUT: " + webResource.toString());
InputStream streamToUpload = command.getTarInputStream();
webResource.queryParam("path", command.getRemotePath())
.queryParam("noOverwriteDirNonDir", command.isNoOverwriteDirNonDir()).request()
.put(entity(streamToUpload, "application/x-tar")).close();
return null;
}
示例3: execute
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
protected Void execute(CopyArchiveToContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/archive").resolveTemplate("id",
command.getContainerId());
LOGGER.trace("PUT: " + webResource.toString());
InputStream streamToUpload = command.getTarInputStream();
webResource.queryParam("path", command.getRemotePath())
.queryParam("noOverwriteDirNonDir", command.isNoOverwriteDirNonDir()).request()
.put(streamToUpload, MediaType.APPLICATION_X_TAR);
return null;
}
示例4: createCopyArchiveToContainerCmdExec
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd.Exec createCopyArchiveToContainerCmdExec() {
return new CopyArchiveToContainerCmdExec(getBaseResource(), getDockerClientConfig());
}
示例5: copyArchiveToContainerCmd
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd copyArchiveToContainerCmd(String containerId) {
return new CopyArchiveToContainerCmdImpl(getDockerCmdExecFactory().createCopyArchiveToContainerCmdExec(),
containerId);
}
示例6: CopyArchiveToContainerCmdImpl
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
public CopyArchiveToContainerCmdImpl(CopyArchiveToContainerCmd.Exec exec, String containerId) {
super(exec);
withContainerId(containerId);
}
示例7: withContainerId
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withContainerId(String containerId) {
checkNotNull(containerId, "containerId was not specified");
this.containerId = containerId;
return this;
}
示例8: withHostResource
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withHostResource(String hostResource) {
checkNotNull(hostResource, "hostResource was not specified");
this.hostResource = hostResource;
return this;
}
示例9: withNoOverwriteDirNonDir
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withNoOverwriteDirNonDir(boolean noOverwriteDirNonDir) {
this.noOverwriteDirNonDir = noOverwriteDirNonDir;
return this;
}
示例10: withRemotePath
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withRemotePath(String remotePath) {
checkNotNull(remotePath, "remotePath was not specified");
this.remotePath = remotePath;
return this;
}
示例11: withTarInputStream
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withTarInputStream(InputStream tarInputStream) {
checkNotNull(tarInputStream, "tarInputStream was not specified");
this.tarInputStream = tarInputStream;
return this;
}
示例12: withDirChildrenOnly
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withDirChildrenOnly(boolean dirChildrenOnly) {
this.dirChildrenOnly = dirChildrenOnly;
return this;
}
示例13: createCopyArchiveToContainerCmdExec
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd.Exec createCopyArchiveToContainerCmdExec() {
return delegate.createCopyArchiveToContainerCmdExec();
}
示例14: copyArchiveToContainerCmd
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
/**
* Copy archive from local machine to remote container
*
* @param containerId
* id of the container
* @return created command
* @since {@link RemoteApiVersion#VERSION_1_20}
*/
CopyArchiveToContainerCmd copyArchiveToContainerCmd(@Nonnull String containerId);