spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

Problem connecting to Docker on Vagrant #429

Closed tentelemed closed 5 years ago

tentelemed commented 5 years ago

Hello,

I'm trying to get the following working but to no avail.

I have a Docker setup running on Vagrant. Here's the Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
  config.vm.box = "generic/ubuntu1804"
  config.vm.synced_folder "Volume/", "/volume"
  config.vm.network "private_network", ip: "192.168.10.101"
  config.vm.network "forwarded_port", guest: 2375, host: 2375, host_ip: "127.0.0.1"
  config.vm.provider "virtualbox" do |vb|
    vb.name = "Docker"
    vb.memory = 2048
    vb.cpus = 2
  end
  config.vm.provision "shell", inline: <<-SHELL
    add-apt-repository ppa:openjdk-r/ppa -y
    apt-get update
    echo "\n----- Installing Docker ------\n"
    wget -qO- https://get.docker.com/ | sh
    echo "\n----- Installing Java 8 & Maven ------\n"
    apt-get -y install openjdk-8-jdk
    update-alternatives --config java
    apt-get -y install maven
  SHELL
end

As you can see, I've forwarded port 2375.

Here's my docker-maven-plugin config in the project pom.xml.

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>1.2.0</version>
    <configuration>
        <imageName>${docker.image.name}:${docker.image.tag}</imageName>
        <dockerDirectory>${basedir}/target/dockerfile</dockerDirectory>
        <resources>
            <resource>
                <targetPath>/</targetPath>
                <directory>${project.build.directory}</directory>
                <include>${project.build.finalName}.jar</include>
            </resource>
        </resources>
    </configuration>
</plugin>

However when I launch the plugin's build, I get the following...

[INFO] Building image cwsp/configuration-server:b1
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:2375: Software caused connection abort: recv failed
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://localhost:2375
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:2375: Connection reset
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://localhost:2375
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:2375: Connection reset
juil. 31, 2019 12:16:18 PM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://localhost:2375
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.890 s
[INFO] Finished at: 2019-07-31T12:16:18+02:00
[INFO] Final Memory: 34M/331M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.2.0:build (default-cli) on project configuration: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset -> [Help 1]

Any ideas ?

Many thanks,

Anthony

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.