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
Dockerfile_git-
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 <<host>> >> ~/.ssh/known_hosts
WORKDIR /share
RUN git clone <<url>>
Dockerfile_mvn-
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
version: "3"
services:
task1:
build:
context: .
dockerfile: Dockerfile_git
volumes:
- "myshare2:/share"
task2:
build:
context: .
dockerfile: Dockerfile_mvn
volumes:
- "myshare2:/share"
volumes:
myshare2:
Compose file logs-
task2_1 | [INFO] --------------------< Website_Login:Website_Login >---------------------
task2_1 | [INFO] Building Website_Login 0.0.1-SNAPSHOT
task2_1 | [INFO] --------------------------------[ jar ]---------------------------------
task2_1 | Downloading from nexus: http://<<hostname>>/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://<<hostname>>/repository/maven-public/): <<hostname>>: Try again: Unknown host <<hostname>>: Try again -> [Help 1]
settings.xml -
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://<<hostname>>/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://localhost:9000
</sonar.host.url>
</properties>
</profile>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>