GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — No such container error · Issue #4803 · testcontainers/testcontainers-java

No such container error #4803

New issue
Copy link
New issue
Copy link
Closed
Closed
No such container error#4803
Copy link

Description

@luis-alves
luis-alves
opened on Dec 27, 2021
Issue body actions

Spring boot versions: 2.5.3
testcontainers version: 1.16.2
Added dependencies:

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>

When I run the below integration test it gives the following error:

com.github.dockerjava.api.exception.NotFoundException: Status 404: {"message":"No such container: 28b30f05bc53b19fae5f11daa9244e28f1eca57ceee6eb11558f1e730341c7f1"}

@ActiveProfiles("it")
@Testcontainers
//@formatter:off
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
                classes = RestApplication.class) //@formatter:on
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
class DummyResourceIT {

    private static String BASE_PATH;

    @Container
    public static PostgreSQLContainer container = new PostgreSQLContainer("postgres:latest")
            .withUsername("dummyusername")
            .withPassword("dummypassword")
            .withDatabaseName("dummydb");

    @DynamicPropertySource
    static void properties(DynamicPropertyRegistry registry) {
        registry.add("spring.datasource.url", container::getJdbcUrl);
        registry.add("spring.datasource.username", container::getUsername);
        registry.add("spring.datasource.password", container::getPassword);
    }

    @LocalServerPort
    private int serverPort;

    @BeforeEach
    void setUp() {
        BASE_PATH = "http://localhost:" + serverPort + "/api";
    }

    @Test()
    void should_pass() {
        String url = BASE_PATH + "/v1/dummy";
        
        //@formatter:off
        given()
            .contentType(MediaType.APPLICATION_JSON_VALUE)
        .when()
            .get(url)
        .then()
            .statusCode(200)
            .log()
            .all()
            .body("size()", Matchers.equalTo(0));
        //@formatter:on
    }

What I'm doing wrong!?

Activity

  1. luis-alves commented on Dec 28, 2021

    @luis-alves
    luis-alves
    on Dec 28, 2021
    Author
    More actions

    I managed to run the project in a virtual box, but this time with the official Docker engine, instead of the one provided by dnf packager, and it ran has expected. So I'm closing this issue.

    Reacted by Denis Novac
  2. luis-alves
    closed this as completedon Dec 28, 2021
  3. kiview commented on Jan 3, 2022

    @kiview
    kiview
    on Jan 3, 2022
    Member
    More actions

    Thanks for reporting and closing again with your fix. Indeed, we generally only support the official Docker packages, since some distro packages have a tendency to have strange quirks.

    Since you are using dnf, were you on Fedora or RHEL? It might have even given you podman, not sure about their behavior at the moment.

  4. luis-alves commented on Jan 3, 2022

    @luis-alves
    luis-alves
    on Jan 3, 2022
    Author
    More actions

    I'm on Fedora 35. What do you mean by "It might have even given you podman"? Can I use podman instead?

  5. kiview commented on Jan 3, 2022

    @kiview
    kiview
    on Jan 3, 2022
    Member
    More actions

    Since podman is not yet a fully compatible Docker replacement, podman does not work with Testcontainers. Also, see our blog post with some insights on this topic.

    That being said, I just checked that dnf install docker does indeed install Docker on Fedora 35. So if the distro shipped Docker package does not work with Testcontainers, the issue should be somewhere else. If you are interested in resolving this, you can provide more Testcontainers logs.

    However, I'd suggest continuing using the official Docker packages instead.

    The NotFoundException likely was from Testcontainers not being able to start Ryuk. Also, see this PR for an explanation of the exception:
    #4842

    Reacted by mykhaylo.symulyk
  6. moemen commented on Jan 4, 2023

    @moemen
    moemen
    on Jan 4, 2023
    More actions

    I had the same issue on fedora 37 and the official docker desktop downloaded from docker website.

    Problem was that docker desktop was returning success response to createContainer request and actually return an id, but I couldn't find that container anywhere or any logs related to it. Then the failure happens on startContainer call with the No such container error.

    Solution for me was to uninstall docker desktop and use docker engine instead.

    Reacted by Michael Weirauch, Ivan and sanzodiego
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.