-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing deprecated docker-client with docker-java #922
Replacing deprecated docker-client with docker-java #922
Conversation
client.pull(image) | ||
client | ||
.pullImageCmd(image) | ||
.start() | ||
} catch { | ||
case NonFatal(_) => | ||
log.warning(s"Failed to pull docker image [$image], is docker running?") | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to close the client in finally block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a finally
block here would close the connection pool of the client before executing the subsequent instruction. I proceeded by adding the client.close()
instruction in the afterTermination()
override
actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala
Show resolved
Hide resolved
actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala
Show resolved
Hide resolved
|
||
abstract class DockerBindDnsService(config: Config) extends PekkoSpec(config) with Eventually { | ||
val client = DefaultDockerClient.fromEnv().build() | ||
|
||
val dockerConfig: DockerClientConfig = DefaultDockerClientConfig.createDefaultConfigBuilder().build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultDockerClient.fromEnv()
-> DefaultDockerClientConfig.createDefaultConfigBuilder()
This change seems to bring some changes to the configuration method, it can't configration by env.
DockerClientConfig custom = DefaultDockerClientConfig.createDefaultConfigBuilder()
.withDockerHost("tcp://docker.somewhere.tld:2376")
.withDockerTlsVerify(true)
.withDockerCertPath("/home/user/.docker")
.withRegistryUsername(registryUser)
.withRegistryPassword(registryPass)
.withRegistryEmail(registryMail)
.withRegistryUrl(registryUrl)
.build();
for testContainer, we can configration by env
https://java.testcontainers.org/supported_docker_environment/
please consider the question: How can I customize the Docker configuration
,
maybe docker-java supportes it allready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laglangyue from my understanding the createDefaultConfigBuilder
fetch the configuration from env, unless overwritten, see: https://github.com/docker-java/docker-java/blob/main/docs/getting_started.md#system-environment
Please let me know if I am missing something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine,it's ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is necessary to add a document or a link to tell users how to configure it.
Both |
6dd9502
to
19e0776
Compare
Now the tests are passing - the code wasn't awaiting for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm - I'm travelling but this looks good from a quick perusal.
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* Replacing deprecated docker-client with docker-java. * Addressing feedback. * Awaiting for image pull. --------- Co-authored-by: Samuele Resca <[email protected]>
* Replacing deprecated docker-client with docker-java. * Addressing feedback. * Awaiting for image pull. --------- Co-authored-by: Samuele Resca <[email protected]>
Changes
Replacing deprecated docker-client with docker-java. See: #806
Testing
AsyncDnsResolverIntegrationSpec
andDnsDiscoverySpec
tests are successful.