2016-11-07 2 views
1

Docker Cloud/Docker Hub에서 공개/개인 저장소에 내 로컬에서 maven을 사용하여 빌드하는 도커 이미지를 푸시하려고합니다. Push 할 때 인덱스 응답에 엔드 포인트가 없습니다. 아래는 pom.xml의 샘플 구성입니다.Maven을 사용하여 Docker Image를 개인 저장소에 푸시 할 때 인증 문제를 푸는 방법

여기에 누락 된 구성이 확실하지 않습니다.

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 

      <plugin> 
      <groupId>com.spotify</groupId> 
      <artifactId>docker-maven-plugin</artifactId> 
      <version>0.4.11</version> 
      <configuration> 
       <imageName>${docker.image.prefix}/dockercloudappstation</imageName> 
       <dockerDirectory>src/main/docker</dockerDirectory> 
       <!-- <dockerHost>tcp://192.168.99.100:2376</dockerHost> --> 
       <serverId>docker-hub</serverId> 
       <!-- <registryUrl>https://hub.docker.com/</registryUrl> --> 
       <resources> 
        <resource> 
         <!-- <targetPath>/</targetPath> --> 
         <directory>${project.build.directory}</directory> 
         <include>${project.build.finalName}.jar</include> 
        </resource> 
       </resources> 
      </configuration> 
      <executions> 
       <execution> 
        <id>build-image</id> 
        <phase>package</phase> 
        <goals> 
        <goal>build</goal> 
        </goals> 
       </execution> 

       <execution> 
        <id>tag-image-version</id> 
        <phase>package</phase> 
        <goals> 
         <goal>tag</goal> 
        </goals> 
        <configuration> 
         <!-- <image>${docker.image.prefix}/${project.artifactId}</image> --> 
         <image>${docker.image.prefix}/dockercloudappstation</image> 
         <newName>hub.docker.com/${docker.image.prefix}/dockercloudappstation</newName> 
         <!-- <serverId>docker-hub</serverId> --> 
         <pushImage>true</pushImage> 
        </configuration> 
       </execution> 
       <execution> 
        <id>tag-image-latest</id> 
        <phase>package</phase> 
        <goals> 
         <goal>tag</goal> 
        </goals> 
        <configuration> 
         <!-- <image>${docker.image.prefix}/${project.artifactId}</image> --> 
         <image>${docker.image.prefix}/dockercloudappstation</image> 
         <newName>hub.docker.com/${docker.image.prefix}/dockercloudappstation:latest</newName> 
         <pushImage>true</pushImage> 
        </configuration> 
       </execution> 

       <execution> 
        <id>push-image</id> 
        <phase>package</phase> 
        <goals> 
        <goal>push</goal> 
        </goals> 
        <configuration> 
        <serverId>docker-hub</serverId> 
        <!-- <imageName>${docker.image.prefix}/dockercloudappstation</imageName> --> 
        </configuration> 
       </execution> 

오류 로그 :

 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught 
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:130) 
    at com.spotify.docker.TagMojo.execute(TagMojo.java:44) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    ... 20 more 
Caused by: com.spotify.docker.client.exceptions.DockerException: Index response didn't contain any endpoints 
    at com.spotify.docker.client.AnsiProgressHandler.progress(AnsiProgressHandler.java:52) 
    at com.spotify.docker.Utils$DigestExtractingProgressHandler.progress(Utils.java:150) 
    at com.spotify.docker.client.ProgressStream.tail(ProgressStream.java:77) 
    at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1040) 
    at com.spotify.docker.Utils.pushImage(Utils.java:83) 
    at com.spotify.docker.TagMojo.execute(TagMojo.java:119) 
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:128) 

답변

2

열고 받는다는 설정 구성 settings.xml하고 자격 증명을 사용하여 여기에 서버를 추가 할 수 있습니다. 때문에 보안 문제의 pom.xml

<servers> 
    <server> 
    <id>docker-hub</id> 
    <username>username</username> 
    <password>password</password> 
    </server> 
</servers> 

이 설정이 안된다 (그리고 AFAIK가 될 수 없음) : 일반적으로이 파일은 그래서 여기에 뭔가를 추가 .m2 폴더에 있습니다.

더 안전한 옵션에 관심이 있으시면 예 : here처럼 암호를 암호화 할 수 있습니다.


당신은 너무 엉망이 있습니다 pom.xml. 간단한 pom.xml 구성으로 시작하십시오. springio example을 확인하고 springio 속성을 docker hub repo로 변경하십시오.

<properties> 
    <docker.image.prefix>springio</docker.image.prefix> 
</properties> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>com.spotify</groupId> 
      <artifactId>docker-maven-plugin</artifactId> 
      <version>0.4.11</version> 
      <configuration> 
       <imageName>${docker.image.prefix}/${project.artifactId}</imageName> 
       <dockerDirectory>src/main/docker</dockerDirectory> 
       <serverId>docker-hub</serverId> 
<!-- <registryUrl></registryUrl> is optional and defaults to https://index.docker.io/v1/ in the Spotify docker-client dependency. --> 
       <resources> 
        <resource> 
         <targetPath>/</targetPath> 
         <directory>${project.build.directory}</directory> 
         <include>${project.build.finalName}.jar</include> 
        </resource> 
       </resources> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
+0

내 setting.xml에 도커 허브 자격 증명을 제공했습니다. 하지만 이제 최종 단계에서 임포트를 시도하면서 인덱스 응답에 엔드 포인트 예외가 포함되지 않았습니다. – springbootlearner

+0

'pom.xml'에 정의 된'registryUrl'은 무엇입니까? – VladoDemcak

+0

이것은 내 레지스트리 URL입니다. https://hub.docker.com/ – springbootlearner