67 questions
0
votes
1
answer
466
views
java.lang.ClassNotFoundException: org.apache.hc.client5.http.ssl.TlsSocketStrategy when using docker-java API 3.5.0
I'm trying to use the Docker-Java API. Following the instruction in https://github.com/docker-java/docker-java/blob/main/docs/getting_started.md I build a DockerClientConfig and try to build a ...
0
votes
1
answer
138
views
Why can't I push an image to a local Docker registry started with Testcontainers?
I'm trying to create a local Docker registry using Testcontainers and push an image programatically to it. However, I'm getting a connection refused error when attempting to push the image. The first ...
0
votes
1
answer
343
views
LinkageError after adding javax.ws.rs-api to Gradle build in Spring Boot 3.2 Kotlin project
Initial Error:
Encountered a NoClassDefFoundError when building with Docker Java API on a spring boot "3.2.1" Kotlin 1.9.21 project
java.lang.NoClassDefFoundError: javax/ws/rs/core/...
1
vote
1
answer
391
views
docker-java equivalent for 'docker exec {container name} touch test.txt'
I am trying to run an exec command on an already running docker container on a remote host using java.
I am successfully able to run the exec command from the CLI of the host machine using
docker exec ...
1
vote
1
answer
2k
views
java.lang.NoClassDefFoundError: com/github/dockerjava/api/command/LoadImageAsyncCmd
I am trying to create a Docker client with the Docker Java API, but I get a ClassNotFoundException when running my code. I am following this Baeldung guide,
but I am using the latest version of docker-...
1
vote
1
answer
3k
views
Use CMD parameters in distroless image
I am using azul/zulu-openjdk-distroless:17.0.6 image and want to execute the java command with parameters but it fails at the runtime
Here is my docker image:
FROM alpine:3.17.3 as build-env
ARG ...
3
votes
2
answers
5k
views
Testcontainers with sftp image throws Error on "nc not found" or "Address Not Available"
I have this very simple code for running my integration test:
(using Testcontainer artifact version 1.16.2)
Note: I have tested whether this port in test is available before running the test case.
@...
0
votes
1
answer
655
views
docker-Java stop timeout
i'm using the java-docker client from here: https://github.com/docker-java/docker-java.
I trying to figure out how to set the stop timeout for the docker stop command.
So i'm using in java the method ...
18
votes
3
answers
24k
views
Testcontainer cannot configure port binding
I'm using testcontainer version 1.15.2. Tests are run in intellij on windows 10.
I have a wiremock container. By default it listens on the port 8080. I would like to map this port to let's say 8081. ...
1
vote
1
answer
871
views
Get Docker Image Name when loading image to docker using docker-java lib
I am trying to load image to docker from tar file and verify if the tar file is valid or not.
Now if tar file is valid I need to get the imageName and tag.
But I checked and the return type for exec ...
-1
votes
1
answer
1k
views
How to run a java swing application with Docker because docker run command throws headless exception
When I try to run the java swing image getting the "Headless Exception error"
DockerFile:
FROM openjdk:8
COPY requiredlibararies requiredlibraries
COPY myjar.jar myjar.jar
CMD ["java&...
3
votes
1
answer
12k
views
Socket read interrupted during callback from Docker Java
Context
I have a webservice writing a test id in a queue. Then, a listener reads the queue, searches the test and starts it. During those steps, it writes updates of the test in the database in order ...
0
votes
2
answers
740
views
List images in Google Container Registry in Java program
We wanted to list images and tags which names start with certain string. So far, we explored a few java lib (docker-java and spotify ones) and did quite amount of research, but still couldn't find a ...
5
votes
1
answer
374
views
How to get output of docker executed command in docker-java library
I am trying to pull an alpine image using docker-java library. Image got pulled successfully but I am not seeing any docker output on console. How to enable logging in docker-java library.
public ...
-1
votes
2
answers
3k
views
Not able to access web app running inside docker container from local machine
I am using windows 10 enterprise version and i have tested docker hello world web app it works just fine.
Dockerfile
FROM adoptopenjdk/openjdk11:latest
WORKDIR /app
COPY ./ ./
EXPOSE 3000
CMD ["...
2
votes
0
answers
488
views
How can I log docker-java operations to the console?
I'm using the docker-java library in a command-line project, doing things like this:
private DockerClient client;
public Docker() {
var config = DefaultDockerClientConfig
...
1
vote
1
answer
1k
views
docker-java run container with -rm flag
I am using docker-java to spawn new containers.
I want to remove the containers after they are finished.
Is there a way to achieve this with docker-java?
So I basically want something like
docker ...
0
votes
1
answer
782
views
How to check if an image is already present locally
I am using the docker-java Maven library, and I would like to know if there is a way to check if an image has already been pulled or is present locally before pulling it if necessary, with only the ...
0
votes
2
answers
454
views
docker-java equivalent of "docker service create --with-registry-auth"
Using https://github.com/docker-java/docker-java and looking for a way to add the --with-registry-auth option from https://docs.docker.com/v17.12/engine/reference/commandline/service_create/#options
...
2
votes
2
answers
9k
views
How to get the docker host URI on my localhost
Is there a command that I can evaluate (eval $COMMAND) or an environment variable that I can inspect to get the URI of the locally running docker host? I need to be this an expression to evaluate at ...
0
votes
1
answer
134
views
Docker: Publishing ports from a user-defined network to a specific host IP address with docker-java
I'm trying to achieve something similar to this:
-p 192.168.1.100:8080:80
with docker-java. The only example that I found for publishing/mapping ports with docker-java is using the .withExposedPorts ...
5
votes
0
answers
635
views
TestContainers: reuse network from DockerComposeContainer to use in other GenericContainer?
There is a method:
org.testcontainers.containers.GenericContainer#withNetwork
which I can use to spawn containers with a same network using TestContainers lib.
But what about DockerComposeContainer,...
0
votes
2
answers
3k
views
Disable IPv6 in Docker container from Java
I need to disable IPv6 when starting a Docker container from Java code. Using the command line, it is as follows:
docker run --sysctl net.ipv6.conf.all.disable_ipv6=1 ...
Is it possible to do the ...
85
votes
3
answers
196k
views
How to make curl available in Docker image based java:8-jdk-alpine and keep the image clean?
We are having java code that runs curl command to fetch the some result.
We have built a jar file and the jar file executes fine
Now, when we try to dokerize the java program (using jar) and run the ...
0
votes
1
answer
92
views
Unable to see Container Processes with docker-java
I'm using the docker-java libraries to handle start up of a Docker image:
DockerClient dockerClient = DockerClientBuilder.getInstance("unix:///var/run/docker.sock").build();
CreateContainerResponse ...