question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

listImagesCmd().withImageNameFilter("blang/latex:ubuntu") returns all local images

See original GitHub issue

Hi there,

This used to work and I’ve updated my Docker Desktop for Mac version to the latest, currently 3.0.3 (51017) and it’s not working anymore. I’m not 100% sure this is caused by this upgrade but it could be.

I was using Docker-java 3.2.5 and I’ve upgraded to 3.2.7 in the hope that it would fix it but it didn’t and I get all the local images listed:

Screenshot 2021-01-04 at 13 43 00

The code that I have:

        DockerClient dockerClient = getDockerClient();
        List<Image> images =
            dockerClient.listImagesCmd().withImageNameFilter("blang/latex:ubuntu").exec();

Where getDockerClient() is:

    private DockerClient getDockerClient()
    {
        DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
        DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder()
            .dockerHost(config.getDockerHost())
            .sslConfig(config.getSSLConfig())
            .build();
        return DockerClientImpl.getInstance(config, httpClient);
    }

Any idea?

Thanks a lot

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vmassolcommented, Jan 4, 2021

Perfect, thanks!

1reaction
bsideupcommented, Jan 4, 2021

@vmassol glad to be helpful! Setting the API version would preserve the backward compatibility, just it is not set by default 😃

See https://github.com/testcontainers/testcontainers-java/blob/0e8523db9df728a31c2b951eeee08abf7196ec6f/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java#L243 for an example of how to set the API version 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

With Docker 20.10.0 listImages filter no longer works #1516
With 20.10.0 docker removed the filter parameter when listing images. ... return dockerClient.listImagesCmd() .withImageNameFilter("mongo:4.2") .
Read more >
ListImagesCmd.withImageNameFilter - Java - Tabnine
Check whether the image is available locally and pull it otherwise */ public void checkAndPullImage(DockerClient client, String image) { List<Image> images ...
Read more >
ListImagesCmdImpl (docker-java 3.0.8 API) - javadoc.io
Description copied from interface: ListImagesCmd. Show all images (by default filter out the intermediate images used to build).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found