title: docker-compose file cannot download maven dependencies from private nexus repository
body: <p>Currently i am using docker ee in which multi build is not supported. So i am using named volume to store data from one container and use the same data for another container.
  I made 2 Docker files in which 1 docker file get the project from git repository and in 2nd file it uses maven to run that project.
  The thing is it is working fine when you run both of them separately but then i tried with docker-compose it is failing to download dependencies from private nexus repository.Do i have to provide anything in docker-compose file inorder to pull dependencies from private repository.It shows unknown host repositry </p>
  
  <p>Dockerfile_git-</p>
  
  <pre><code>FROM alpine/git
  MAINTAINER Tejas
  RUN mkdir /root/.ssh/
  ADD id_rsa /root/.ssh/id_rsa
  RUN touch /root/.ssh/known_hosts
  RUN ssh-keyscan &lt;&lt;host&gt;&gt; &gt;&gt; ~/.ssh/known_hosts
  WORKDIR /share
  RUN git clone &lt;&lt;url&gt;&gt;
  </code></pre>
  
  <p>Dockerfile_mvn-</p>
  
  <pre><code>FROM maven:3.5-jdk-8-alpine
  MAINTAINER Tejas
  WORKDIR /share/trainingcontainers/
  RUN echo $MAVEN_HOME
  RUN rm -f $MAVEN_HOME/conf/settings.xml
  COPY ./settings.xml $MAVEN_HOME/conf/
  WORKDIR /share/trainingcontainers/selenium-grid/Website_Login
  CMD mvn clean install
  </code></pre>
  
  <pre><code>version: "3"
  services:
    task1:
      build:
        context: .
        dockerfile: Dockerfile_git
      volumes:
        - "myshare2:/share"
    task2:
      build:
        context: .
        dockerfile: Dockerfile_mvn
      volumes:
        - "myshare2:/share"
  volumes:
      myshare2:
  </code></pre>
  
  <p>Compose file logs-</p>
  
  <pre><code>task2_1  | [INFO] --------------------&lt; Website_Login:Website_Login &gt;---------------------
  task2_1  | [INFO] Building Website_Login 0.0.1-SNAPSHOT
  task2_1  | [INFO] --------------------------------[ jar ]---------------------------------
  task2_1  | Downloading from nexus: http://&lt;&lt;hostname&gt;&gt;/repository/maven-public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
  task2_1  | [INFO] ------------------------------------------------------------------------
  task2_1  | [INFO] BUILD FAILURE
  task2_1  | [INFO] ------------------------------------------------------------------------
  task2_1  | [INFO] Total time: 6.003 s
  task2_1  | [INFO] Finished at: 2019-04-01T10:15:01Z
  task2_1  | [INFO] ------------------------------------------------------------------------
  task2_1  | [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to nexus (http://&lt;&lt;hostname&gt;&gt;/repository/maven-public/): &lt;&lt;hostname&gt;&gt;: Try again: Unknown host &lt;&lt;hostname&gt;&gt;: Try again -&gt; [Help 1]
  
  </code></pre>
  
  <p>settings.xml -</p>
  
  <pre><code>&lt;mirrors&gt;
          &lt;mirror&gt;
              &lt;!--This sends everything else to /public --&gt;
              &lt;id&gt;nexus&lt;/id&gt;
              &lt;mirrorOf&gt;*&lt;/mirrorOf&gt;
              &lt;url&gt;http://&lt;&lt;hostname&gt;&gt;/repository/maven-public/&lt;/url&gt;
          &lt;/mirror&gt;
      &lt;/mirrors&gt;
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;nexus&lt;/id&gt;
              &lt;!--Enable snapshots for the built in central repo to direct --&gt;
              &lt;!--all requests to nexus via the mirror --&gt;
              &lt;repositories&gt;
                  &lt;repository&gt;
                      &lt;id&gt;central&lt;/id&gt;
                      &lt;url&gt;http://central&lt;/url&gt;
                      &lt;releases&gt;
                          &lt;enabled&gt;true&lt;/enabled&gt;
                      &lt;/releases&gt;
                      &lt;snapshots&gt;
                          &lt;enabled&gt;true&lt;/enabled&gt;
                      &lt;/snapshots&gt;
                  &lt;/repository&gt;
              &lt;/repositories&gt;
              &lt;pluginRepositories&gt;
                  &lt;pluginRepository&gt;
                      &lt;id&gt;central&lt;/id&gt;
                      &lt;url&gt;http://central&lt;/url&gt;
                      &lt;releases&gt;
                          &lt;enabled&gt;true&lt;/enabled&gt;
                      &lt;/releases&gt;
                      &lt;snapshots&gt;
                          &lt;enabled&gt;true&lt;/enabled&gt;
                      &lt;/snapshots&gt;
                  &lt;/pluginRepository&gt;
              &lt;/pluginRepositories&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;sonar&lt;/id&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
          &lt;properties&gt;
              &lt;!-- Optional URL to server. Default value is http://localhost:9000 --&gt;
              &lt;sonar.host.url&gt;
                  http://localhost:9000
              &lt;/sonar.host.url&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;activeProfiles&gt;
          &lt;!--make the profile active all the time --&gt;
          &lt;activeProfile&gt;nexus&lt;/activeProfile&gt;
      &lt;/activeProfiles&gt;
  
  </code></pre>