Replace deprecated checkAndPullImage with RemoteDockerImage#5148
Replace deprecated checkAndPullImage with RemoteDockerImage#5148
checkAndPullImage with RemoteDockerImage#5148Conversation
|
@bsideup and others, while this is probably a great change, it's quite hard for me as a user to understand how I should edit my code to use the new API. 🤔 I looked but I couldn't find anything obvious in the release notes.
What we have (with 1.15.1) is something like this: DockerClientFactory clientFactory = DockerClientFactory.instance()
try {
clientFactory.checkAndPullImage(
clientFactory.client(),
containerName
);
return true;
}
catch ( NotFoundException e ) {
return false;
}In other words: attempt to pull an image, return |
|
Hey @perlun, can you give us the context/use-case of the code? Else it's hard to recommend what you should do instead. |
|
@kiview - the use case is to check if a specifically named remote container exist or not, and if not, choose a different code path (using another image without a pre-seeded DB structure and then create the DB structure manually instead). But one of my colleagues already solved this I think, without me even knowing about it. 🙂 Here's the replacement code, sharing it in the hope that it will be useful to others: try {
DockerImageName dockerImageName = DockerImageName.parse( preSeededDbContainerName );
RemoteDockerImage remoteDockerImage = new RemoteDockerImage( dockerImageName );
remoteDockerImage.get();
return true;
}
catch ( ContainerFetchException e ) {
return false;
} |
No description provided.