I want to pull image on remote docker-machine so I found one git repo which will run docker using java.
So I tried using the following way,
- First I configured a docker setup
final DockerClient docker = DefaultDockerClient.builder()
.uri(URI.create("https://remote ipaddress:port"))
.dockerCertificates(new DockerCertificates(docker certificate path))
.build();
- host configured
final HostConfig hostConfig = HostConfig.builder().build();
- Pull image
docker.pull("image name");
- Creating container with ContainerConfig
final ContainerConfig containerConfig = ContainerConfig.builder()
.hostConfig(hostConfig)
.image("image name")
.cmd("sh", "-c", "while :; do sleep 1; done")
.build();
- Deploying docker container at remote location
final ContainerCreation creation = docker.createContainer(containerConfig);
final String id = creation.id();
- Start container
docker.startContainer(id);
After following all the step I am not able to pull image on remote docker configuration pc.
So as a conclusion I want to run docker from the current machine to provided remote docker configuration using java. If you have any idea how can I achieve please let me know.