Skip to content
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

DockerComposeContainer pulls all images when not tag is specified #3442

Closed
kezhenxu94 opened this issue Nov 8, 2020 · 2 comments · Fixed by #4538
Closed

DockerComposeContainer pulls all images when not tag is specified #3442

kezhenxu94 opened this issue Nov 8, 2020 · 2 comments · Fixed by #4538

Comments

@kezhenxu94
Copy link
Contributor

kezhenxu94 commented Nov 8, 2020

I recently update the version to 1.15.0 due to #3166, and I found that when I use DockerComposeContainer + Dockerfile with a FROM directive w/o tag, testcontainers tries to pull all images (didn't wait for that happens, just saw it pulls several ancient images, see picture below).

Steps to Reproduce

Remove all openresty/openresty images locally

docker-compose.yml

version: '2.1'

services:
  nginx:
    build:
      context: .
      dockerfile: Dockerfile.nginx
    entrypoint: [ 'bash', '-c', 'sleep 5 && /usr/bin/openresty -c /var/nginx/conf.d/nginx.conf' ]

Dockerfile.nginx

FROM openresty/openresty

RUN echo 'whatever'

Test codes

import java.io.File;
import org.junit.Test;
import org.testcontainers.containers.DockerComposeContainer;

public class Reproduce {
    @Test
    public void reproduce() {
        final DockerComposeContainer compose = new DockerComposeContainer(new File("src/test/java/docker-compose.yml"));
        compose.start();
    }
}

Run the test codes, the logs keep printing something like this:

image

and docker images shows that it is pulling all images:

$ docker images | grep openresty
openresty/openresty    1.17.8.2-5-alpine-fat                            5a1867b4dc55        7 weeks ago         353MB
openresty/openresty    1.11.2.1-alpine                                  590e643a8136        4 years ago         44MB
openresty/openresty    1.11.2.1-centos                                  f43d744951d5        4 years ago         374MB
openresty/openresty    1.11.2.1-centos-rpm                              dfbc7fc2ba3f        4 years ago         226MB

it pulled images 4 years ago, I'm expecting it only pulls the image with tag latest by default, like what it did before upgrading to 1.15.0.

Now I work around this by specifying the tag explicitly:

FROM openresty/openresty:1.17.8.2-5-alpine-fat

This may be a bug in 1.15.0? @rnorth @bsideup

@rnorth
Copy link
Member

rnorth commented Nov 8, 2020

Thanks for reporting. We had a similar bug with non-compose images but thought it was squashed. Please continue to use that workaround (specifying a tag is generally good practice anyway!).

We'll fix this shortly.

@rnorth
Copy link
Member

rnorth commented Oct 4, 2021

I believe this is still a problem so should be reopened!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants