Ali cloud docker image library is built with the use of private

1. Register Ali cloud account https://www.aliyun.com, then click on Product search: container mirror service, click Admin Console, go to the home page docker service.

 

 

2. Click New Mirror warehouse, will first register, create your docker client to access the user name and password.

3. Create a namespace.

 

 idea springboot project package upload

1.maven dependence

<plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.3.6</version>
                <configuration>
                    <repository>${project.artifactId}</repository>
                    <buildArgs>
                        <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                </configuration>
  </plugin>

2.docker file

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

3.打tag,上传阿里云。

mvn package dockerfile:build -e -DskipTests
docker login --username=bupt910 registry.cn-hangzhou.aliyuncs.com
docker tag pcs-consult:latest registry.cn-hangzhou.aliyuncs.com/bupt-pcs/pcs:consult
docker push registry.cn-hangzhou.aliyuncs.com/bupt-pcs/pcs:consult

  

Guess you like

Origin www.cnblogs.com/wzzxz/p/12156948.html