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.

docker:start wait on tcp port always failing

See original GitHub issue

Description

Using below configuration:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>me.chanjar</groupId>
  <artifactId>dmp-test</artifactId>
  <version>1.0-SNAPSHOT</version>
  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.30.0</version>
        <configuration>
          <images>
            <image>
              <name>postgres</name>
              <alias>postgres</alias>
              <run>
                <env>
                  <POSTGRES_DB>saga</POSTGRES_DB>
                  <POSTGRES_USER>saga</POSTGRES_USER>
                  <POSTGRES_PASSWORD>password</POSTGRES_PASSWORD>
                </env>
                <wait>
                  <log>database system is ready to accept connections</log>
                  <tcp>
                    <ports>
                      <port>5432</port>
                    </ports>
                  </tcp>
                  <time>60000</time>
                </wait>
                <ports>
                  <port>postgres.port:5432</port>
                </ports>
              </run>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

mvn docker:start got error:

[INFO] DOCKER> [postgres:latest] "postgres": Start container b76c2d9ed4cc
[INFO] DOCKER> [postgres:latest] "postgres": Network mode: default
[INFO] DOCKER> [postgres:latest] "postgres": Waiting for ports [5432] directly on container with IP (null).
[ERROR] DOCKER> Error occurred during container startup, shutting down...
[INFO] DOCKER> Pattern 'database system is ready to accept connections' matched for container b76c2d9ed4cc
[INFO] DOCKER> [postgres:latest] "postgres": Stop and removed container b76c2d9ed4cc after 0 ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.610 s
[INFO] Finished at: 2019-06-29T03:07:40Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.30.0:start (default-cli) on project dmp-test: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.30.0:start failed: hostname can't be null -> [Help 1]

If downgrade d-m-p to 0.28.0 everything goes fine.

Info

  • d-m-p version : 0.30.0
  • Maven version (mvn -v) :
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
Maven home: /home/ubuntu/maven
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-52-generic", arch: "amd64", family: "unix"
  • Docker version : 18.09.6

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
amoriartycommented, Aug 2, 2019

Hi, It take me all morning figuring out how to solve this issue. Finally the solution I’ve found is to change the tcp mode in my configuration to mapped. However I’m on the 0.29.0 version and not sure it will work on the latest. Also, I’m still thinking there’s a bug here and my solution is more of a hack than a real way to solve this issue.

1reaction
WillemJiangcommented, Nov 21, 2019

@rhuss I just ran the test with the 0.31-SNAPSHOT(by building the source on my box, as I didn’t find the snapshot link from maven central), the test passed on my project without any issue. I’m looking forward to the new release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker wait for postgresql to be running - Stack Overflow
I've spent some hours investigating this problem and I got a solution. Docker depends_on just consider service startup to run another service.
Read more >
Fatal iptables/host port errors on 'docker run' after updating to ...
After update to beta18, I re-launched my containers from a script and got this error: + docker run -d --restart=always --net=wnet -v /Users/kdh ......
Read more >
Docker containers fail to start, iptables forwarding rules failing
root@dhost:~# docker ps -a. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 377239b49753 securityonionsolutions/so-logstash "/usr/local/bin/do.
Read more >
Docker Compose Wait for MySQL Container to be Ready
You need to add the docker-compose-wait tool in your application Dockerfile. Contents: Quick start; Step 0: Download a template; Step 1: Add the...
Read more >
Configure Liveness, Readiness and Startup Probes
When the container starts, it executes this command: /bin/sh -c "touch /tmp/healthy; ... You can use a named port for HTTP and TCP...
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