ityouknow / blog-comments

15 stars 0 forks source link

Spring Boot 2.0(四):使用 Docker 部署 Spring Boot - 纯洁的微笑博客 #133

Open ityouknow opened 6 years ago

ityouknow commented 6 years ago

http://www.ityouknow.com/springboot/2018/03/19/spring-boot-docker.html

Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。

MondayCoke commented 5 years ago

赞,已成功跑起来。上面的修改环境变量: MAVEN_HOME=/usr/local/maven3/apache-maven-3.6.1 export MAVEN_HOME export PATH=${PATH}:${MAVEN_HOME}/bin

baitianmozhichao commented 5 years ago

很好 ,一次跑通

zcx1218029121 commented 5 years ago

@djh2717 为什么要安装 Maven 和 jdk, 这些不已经存在我们构建的镜像当中了吗?

VOLUME /tmp 简单说就是docker的持久化

liuzhipincomeon commented 5 years ago

maven 和 jdk 不能也同时使用镜像吗?

ccitboy commented 4 years ago

博主你好,请问下 用idea启动docker容器报“ failed to create OCI runtime console socket: stat /tmp: no such file or directory: unknown”是什么原因 ,镜像构建没报错误,容器卷都挂载了,在服务器用命令启动没报错,为啥用idea docker插件启动容器报这个 文件没找到

WinterChenS commented 4 years ago

@XiaoChang216 因为你的本机环境没有这个文件夹吧,你启动的时候会去挂载这个文件夹,构建镜像的时候并不会,linux服务器是有/tmp这个文件夹所以没有报错

ChunlinYu commented 4 years ago

@kely39 mvn package docker:build时报错:

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:17 min [INFO] Finished at: 2018-06-05T17:18:11+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project springboot-docker-demo: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException: Cannot retry request with a non-repeatable request entity: Connection reset by peer -> [Help 1]

怎么破?

@chencong-plan

[INFO] Copying /developer/repository/springboot-docker/target/springboot-0.0.1-SNAPSHOT.jar -> /developer/repository/springboot-docker/target/docker/springboot-0.0.1-SNAPSHOT.jar
[INFO] Copying src/main/docker/Dockerfile -> /developer/repository/springboot-docker/target/docker/Dockerfile
[INFO] Building image springboot/springboot
Step 1/4 : FROM openjdk:8-jdk-alpine
 ---> 5801f7d008e5
Step 2/4 : VOLUME /tmp
 ---> Using cache
 ---> d5a539e5511f
Step 3/4 : ADD spring-boot-docker-1.0.jar app.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.405 s
[INFO] Finished at: 2018-08-13T14:09:45+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project springboot: Exception caught: lstat spring-boot-docker-1.0.jar: no such file or directory -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我也出现异常了 在执行mvn package docker:build这一步

同样问题+1

ChunlinYu commented 4 years ago

我解决了,是因为权限问题,在创建镜像时候应该在root权限下面,在普通用户下不可以,切换到root权限后成功解决。

longdean commented 4 years ago

docker-maven-plugin是不是已经被废弃了,我在构建的时候提示错误信息是:在maven仓库中找不到这个插件的,用Dockerfile-maven-plugin可以找到