機器 vultr一臺,centos7html
jdk,maven java
1.解壓資源 tar -zxvf jdk8.tar.gz tar -zxvf apache-maven-3.3.9-bin.tar.gz 2.配置環境變量 vim /etc/profile export JAVA_HOME=/root/jdk8 export MAVEN_HOME=/root/apache-maven-3.3.9 export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH 3.資源生效 source /etc/profile
pan-search-springboot pom.xml新增docker配置git
<plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.3</version> <configuration> <imageName>${docker.image.prefix}/${project.artifactId}</imageName> <dockerDirectory>src/main/docker</dockerDirectory> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </plugin>
FROM frolvlad/alpine-oraclejdk8:slim VOLUME /tmp ADD docker-spring-boot-1.0.0.jar app.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
項目根路徑下執行 mvn package docker:build
docker run -p 8080:8080 -t kite/pan-search-springboot
registergithub
docker login
docker push kitesweet/pan-search-springboot
docker pull kitesweet/pan-search-springboot
查看 docker ps docker ps -a爲查看全部的容器,包括已經中止的 刪除全部容器 docker rm $(docker ps -a -q) 刪除單個容器 docker rm <容器名orID> 中止、啓動、殺死一個容器 docker stop <容器名orID> docker start <容器名orID> docker kill <容器名orID> 查看全部鏡像 docker images 查看容器日誌 docker logs -f <容器名orID>