Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker -compose部署失败 #21

Closed
hehe9011 opened this issue Apr 8, 2022 · 18 comments
Closed

Docker -compose部署失败 #21

hehe9011 opened this issue Apr 8, 2022 · 18 comments

Comments

@hehe9011
Copy link

hehe9011 commented Apr 8, 2022

系统是ubuntu20.04,访问9021端口显示拒绝访问

version: '3.1'
services:
read_all:
image: hectorqin/reader
container_name: reader
restart: always
ports:
- 9021:8080
volumes:
- ./log:/log
- ./storage:/storage
environment:
- SPRING_PROFILES_ACTIVE=prod
- READER_APP_SECURE=true
- READER_APP_SECUREKEY= password

@hectorqin
Copy link
Owner

需要确认 容器是否正常运行

@hehe9011
Copy link
Author

hehe9011 commented Apr 9, 2022

需要确认 容器是否正常运行

容器一直在重启,docker logs -f看不到日志,只有大大的reader...

@hectorqin
Copy link
Owner

volumes:

  • ./logs:/logs

磁盘映射改一下,然后再重启,再在logs目录找一下日志文件看看

@hehe9011

This comment was marked as resolved.

@hectorqin
Copy link
Owner

你的docker版本多少?是什么架构的?

@hehe9011
Copy link
Author

你的docker版本多少?是什么架构的?

Client:
Version: 20.10.7
API version: 1.41
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu5~20.04.2
Built: Mon Nov 1 00:34:17 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu520.04.2
Built: Fri Oct 22 00:45:53 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.5-0ubuntu3
20.04.2
GitCommit:
runc:
Version: 1.0.1-0ubuntu2~20.04.1
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:

@hectorqin
Copy link
Owner

加tg群问问群友吧,或者换个镜像试试,这个问题我这边没法复现

@qiebu3509
Copy link

(删容器,重新部署,然后机子reboot就好了,但如果之后机子要是reboot之后就又回到这个问题,所以就要重新弄一遍。)
我是试了很多次,感觉这是一个bug

@hectorqin
Copy link
Owner

hectorqin commented Apr 17, 2022

Caused by: java.lang.IllegalArgumentException: availableProcessors: 0 (expected: > 0)
at io.netty.util.internal.ObjectUtil.checkPositive(ObjectUtil.java:44)
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:44)
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.availableProcessors(NettyRuntime.java:70)
at io.netty.util.NettyRuntime.availableProcessors(NettyRuntime.java:98)
at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:41)

启动的时候netty框架检查可用的cpu核心,结果cpu核心为0,不知道这是docker的问题,还是java的问题

@qiebu3509
Copy link

Caused by: java.lang.IllegalArgumentException: availableProcessors: 0 (expected: > 0)
at io.netty.util.internal.ObjectUtil.checkPositive(ObjectUtil.java:44)
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:44)
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.availableProcessors(NettyRuntime.java:70)
at io.netty.util.NettyRuntime.availableProcessors(NettyRuntime.java:98)
at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:41)

启动的时候netty框架检查可用的cpu内核问题,结果cpu内核问题为0,不知道这是docker的,还是java的问题

这个问题我大前天遇到的。重新部署然后机器reboot就可以了,但之后机器reboot的话又会变回这样,这就很神奇

@hehe9011
Copy link
Author

我的已经好了,应该是之前的镜像有问题,更新某一版本就好了

version: '3.1'
services:
read_own:
image: hectorqin/reader
container_name: reader
restart: always
ports:
- 9030:8080
volumes:
- ./logs:/logs
- ./storage:/storage
environment:
- SPRING_PROFILES_ACTIVE=prod

@hehe9011
Copy link
Author

果然重启之后又不行了

@lialosiu
Copy link

lialosiu commented May 7, 2022

我这也是这种情况,我是在lxc下的alpine模板部署的docker

@hehe9011
Copy link
Author

hehe9011 commented May 7, 2022

我怀疑是lxc的问题,我是lxc的ubuntu,部署在甲骨文的没问题

@lialosiu
Copy link

lialosiu commented May 7, 2022

我找到解决方案了,看这里: itzg/docker-minecraft-server#466 (comment)

@lialosiu
Copy link

lialosiu commented May 7, 2022

应该就是在lxc中,jvm不知为啥拿不到cpu核心数
手动
-XX:ActiveProcessorCount=1
指定核心数就好了

@lialosiu
Copy link

lialosiu commented May 7, 2022

实测,在docker-compose.yml的相应容器中添加

command: "java -XX:ActiveProcessorCount=1 -jar /app/bin/reader.jar"

springboot就正常跑起来了

[main] 11:28:07.807 INFO  ReaderApplicationKt - Starting ReaderApplicationKt on de82ce1fb07c with PID 7 (/app/bin/reader.jar started by root in /)
[main] 11:28:07.820 DEBUG ReaderApplicationKt - Running with Spring Boot v2.1.6.RELEASE, Spring v5.1.8.RELEASE
[main] 11:28:07.821 INFO  ReaderApplicationKt - The following profiles are active: prod
[vert.x-eventloop-thread-0] 11:28:14.235 INFO  YueduApi - port: 8080
[vert.x-eventloop-thread-0] 11:28:14.248 INFO  YueduApi - serverPort: 8080
[vert.x-eventloop-thread-0] 11:28:14.448 INFO  VertExt - osName: Linux currentDir: /
[vert.x-eventloop-thread-0] 11:28:14.604 INFO  VertExt - storage key: [cache, invalidBookSourceList] path: /storage/cache/invalidBookSourceList.json
[vert.x-eventloop-thread-0] 11:28:14.738 INFO  RestVerticle - port: 8080
[main] 11:28:14.854 INFO  ThreadPoolTaskScheduler - Initializing ExecutorService 'taskScheduler'
[main] 11:28:15.249 INFO  ReaderApplicationKt - Started ReaderApplicationKt in 9.59 seconds (JVM running for 11.751)
[vert.x-eventloop-thread-0] 11:28:15.558 INFO  RestVerticle - Server running at: http://localhost:8080
[vert.x-eventloop-thread-0] 11:28:15.558 INFO  RestVerticle - Web reader running at: http://localhost:8080
[DefaultDispatcher-worker-1] 11:30:00.020 INFO  VertExt - storage key: [cache, invalidBookSourceList] path: /storage/cache/invalidBookSourceList.json
[DefaultDispatcher-worker-1] 11:30:00.021 INFO  YueduApi - 开始检查书架书籍更新
[DefaultDispatcher-worker-1] 11:30:00.022 INFO  VertExt - storage key: [data, default, bookshelf] path: /storage/data/default/bookshelf.json
[DefaultDispatcher-worker-1] 11:30:00.022 INFO  VertExt - storage key: [data, users] path: /storage/data/users.json
[DefaultDispatcher-worker-1] 11:30:00.022 INFO  YueduApi - 书架书籍更新检查结束

@hectorqin
Copy link
Owner

ok,感谢各位大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants