当前位置: 首页>>代码示例>>Java>>正文


Java CopyArchiveToContainerCmd类代码示例

本文整理汇总了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;
}
 
开发者ID:Qorr,项目名称:Hvalspik,代码行数:23,代码来源:CopyFileCommand.java

示例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;

}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:14,代码来源:CopyArchiveToContainerCmdExec.java

示例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;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:15,代码来源:CopyArchiveToContainerCmdExec.java

示例4: createCopyArchiveToContainerCmdExec

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd.Exec createCopyArchiveToContainerCmdExec() {
    return new CopyArchiveToContainerCmdExec(getBaseResource(), getDockerClientConfig());
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:5,代码来源:JerseyDockerCmdExecFactory.java

示例5: copyArchiveToContainerCmd

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd copyArchiveToContainerCmd(String containerId) {
    return new CopyArchiveToContainerCmdImpl(getDockerCmdExecFactory().createCopyArchiveToContainerCmdExec(),
            containerId);
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:6,代码来源:DockerClientImpl.java

示例6: CopyArchiveToContainerCmdImpl

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
public CopyArchiveToContainerCmdImpl(CopyArchiveToContainerCmd.Exec exec, String containerId) {
    super(exec);
    withContainerId(containerId);
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:5,代码来源:CopyArchiveToContainerCmdImpl.java

示例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;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:7,代码来源:CopyArchiveToContainerCmdImpl.java

示例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;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:7,代码来源:CopyArchiveToContainerCmdImpl.java

示例9: withNoOverwriteDirNonDir

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withNoOverwriteDirNonDir(boolean noOverwriteDirNonDir) {
    this.noOverwriteDirNonDir = noOverwriteDirNonDir;
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:6,代码来源:CopyArchiveToContainerCmdImpl.java

示例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;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:7,代码来源:CopyArchiveToContainerCmdImpl.java

示例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;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:7,代码来源:CopyArchiveToContainerCmdImpl.java

示例12: withDirChildrenOnly

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd withDirChildrenOnly(boolean dirChildrenOnly) {
    this.dirChildrenOnly = dirChildrenOnly;
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:6,代码来源:CopyArchiveToContainerCmdImpl.java

示例13: createCopyArchiveToContainerCmdExec

import com.github.dockerjava.api.command.CopyArchiveToContainerCmd; //导入依赖的package包/类
@Override
public CopyArchiveToContainerCmd.Exec createCopyArchiveToContainerCmdExec() {
    return delegate.createCopyArchiveToContainerCmdExec();
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:5,代码来源:TestDockerCmdExecFactory.java

示例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);
 
开发者ID:docker-java,项目名称:docker-java,代码行数:10,代码来源:DockerClient.java


注:本文中的com.github.dockerjava.api.command.CopyArchiveToContainerCmd类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。