1. 根据现有的docker容器重建镜像及运行

docker在构建镜像包时,就把jvm的参数预先编写好了,在遇到性能问题后,需要修改jvm参数进行调整。

docker commit命令创建新的镜像

1、运行容器

2、修改容器

docker exec -it 容器id sh
#修改配置

3、将容器保存为新镜像

docker commit 0521893d603d reg.xxx.net/preprod/red-xxx:cce7f12d-jvmparams
sh service-update.sh reg.xxx.net/preprod/red-xxx:cce7f12d-jvmparams

2、调整某个docker的内存限制

[ec2-user@ip---- ~]$ docker service update --limit-memory 1G op-m-front
op-m-front
overall progress: out of tasks
w5hk1y1rgqeh: running [==================================================>]
verify: Waiting seconds to verify that tasks are stable...
Error: No such service: op-m-front
[ec2-user@ip---- ~]$

3、dockerd: time="2019-12-09T05:29:36.169298343Z" level=error msg="fatal task error" error="task: non-zero exit (137)

Issue

If a container is no longer running, use the following command to find the status of the container:

docker container ls -a

This article explains possible reasons for the following exit code:

"task: non-zero exit (137)"

With exit code 137, you might also notice a status of Shutdown or the following failed message:

Failed 42 hours ago

Resolution

The "task: non-zero exit (137)" message is effectively the result of a kill -9 (128 + 9). This can be due to a couple possibilities (seen most often with Java applications):

  1. The container received a docker stop, and the application didn't gracefully handle SIGTERM (kill -15) — whenever a SIGTERM has been issued, the docker daemon waits 10 seconds then issue a SIGKILL (kill -9) to guarantee the shutdown. To test whether your containerized application correctly handles SIGTERM, simply issue a docker stop against the container ID and check to see whether you get the "task: non-zero exit (137)". This is not something to test in a production environment, as you can expect at least a brief interruption of service. Best practices would be to test in a development or test Docker environment.
  2. The application hit an OOM (out of memory) condition. With regards to OOM condition handling, review the node's kernel logs to validate whether this occurred. This would require knowing which node the failed container was running on, or proceed with checking all nodes. Run something like this on your node(s) to help you identify whether you've had a container hit an OOM condition: journalctl -k | grep -i -e memory -e oom Another option would be to inspect the (failed) container: docker inspect <container ID> Review the application's memory requirements and ensure that the container it's running in has sufficient memory. Conversely, set a limit on the container's memory to ensure that wherever it runs, it does not consume memory to the detriment of the node. If the application is Java-based, you may want to review the maximum memory configuration settings.

References

4、docker top 容器id

查看容器里的进程

[ec2-user@ip---- ~]$ docker top 2c1
UID PID PPID C STIME TTY TIME CMD
ec2-user : ? :: sh entrypoint.sh
ec2-user : ? :: java -Xmx1344m -Xms1344m -Xmn448M -XX:MaxMetaspaceSize=192M -XX:MetaspaceSize=192M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/logs/loyalty-dump

5、

启动 
systemctl start docker
守护进程重启
systemctl daemon-reload
重启docker服务
systemctl restart docker / service docker restart
关闭
docker service docker stop / docker systemctl stop docker

Tomcat Docker容器自动重启问题排查的更多相关文章

  1. 使用Watchtower实现Docker容器自动更新

    前言:通常情况下我们手动更新容器的步骤比较繁琐,需要四个步骤: 1.停止容器 2.删除容器 3.检查镜像更新情况,更新镜像 4.重新启动容器 容器少还无所谓,但要是需要更新大量的容器就会工作量巨大. ...

  2. (转)Docker容器的重启策略及docker run的--restart选项详解

    1. Docker容器的重启策略 Docker容器的重启策略是面向生产环境的一个启动策略,在开发过程中可以忽略该策略. Docker容器的重启都是由Docker守护进程完成的,因此与守护进程息息相关. ...

  3. tomcat监控,自动重启shell脚本

    tomcat监控,自动重启shell脚本如下,取名 monitor_tomcat.sh: #!/bin/sh # func:自动监控tomcat脚本并且执行重启操作 # 获取tomcat进程ID(其中 ...

  4. Docker容器的重启策略及docker run的--restart选项详解

    https://blog.csdn.net/taiyangdao/article/details/73076019 1. Docker容器的重启策略 Docker容器的重启策略是面向生产环境的一个启动 ...

  5. docker容器自动退出的问题

    如果用了一段时间的docker就会发现,我们的容器经常用了一段时间就自动退出了,docker ps已经找不到了,在docker ps -a里面了,然后我们docker start containerI ...

  6. supervisor开机自动启动脚本+redis+MySQL+tomcat+nginx进程自动重启配置

    [root@mongodb-host supervisord]# cat mongo.conf [program:mongo]command=/usr/local/mongodb/bin/mongod ...

  7. tomcat宕机自动重启脚本

    #!/bin/bash# 获取tomcat进程ID /usr/share/tomcatTomcatID=$(ps -ef |grep tomcat |grep -w 'tomcat'|grep -v ...

  8. Docker容器优雅重启

    默认情况下,当 Docker 守护进程终止时,它将关闭正在运行的容器.您可以配置守护程序,以便容器在守护程序不可用时保持运行.此功能称为live-restore.live-restore选项有助于减少 ...

  9. Docker容器自动更新

    前言: Watchtower 是一个可以实现自动化更新 Docker 基础镜像与容器的实用工具.它监视正在运行的容器以及相关的镜像,当检测到reg­istry中的镜像与本地的镜像有差异时,它会拉取最新 ...

随机推荐

  1. NYOJ 47:过河问题(思维)

    47-过河问题 内存限制:64MB 时间限制:1000ms 特判: No 通过数:6 提交数:10 难度:5 题目描述: 在漆黑的夜里,N位旅行者来到了一座狭窄而且没有护栏的桥边.如果不借助手电筒的话 ...

  2. 1001.A+B Format (20)题目解答

    前言 最开始看到这个题目,我的第一个想法是有没有那种输出格式可以直接拿来用的,然后我百度了一下,想偷懒,然而并没有这种东西.只好动动自己的脑子了. 关于GitHub 这个问题,当初我弄了五天才建立好联 ...

  3. macbook air 获取root权限

    以下内容为转载 原创连接:http://blog.itpub.net/26148431/viewspace-1401745/ 1. 从 Apple 菜单中选取系统偏好设置,从显示菜单中选取用户与群组. ...

  4. 简单矩阵快速幂(HDU Tr A 1575)

    题目中所给的方阵就是一个矩阵,而就是只要将题目所给矩阵不断进行相乘即可,本题中我采用的是直接重载运算符*,使矩阵每一个都进行运算,可以简化为只对对角线上的元素进行运算.最后所得结果就只需将最终的矩阵上 ...

  5. java-代码块-局部代码块、构造代码块、静态代码块

    1.代码块概述: 在Java中,使用{ }括起来的代码被称为代码块. 2.代码块分类: 根据其位置和声明的不同,可以分为局部代码块,构造代码块.静态代码块和同步代码块(多线程). 3.常见代码块的应用 ...

  6. js实现一条抛物线

    抛物线运动解释: 以右开口为例,根据公式  y^2 = 2px .确定p的值,已知x求y. <!DOCTYPE html> <html> <head> <me ...

  7. MySQL Binlog信息查看

    ##=====================================## ## 在MySQL内部查看binlog文件列表 ## SHOW BINARY LOGS; ##=========== ...

  8. Producer and consumer

    Below is from wiki, just for study & record. In computing, the producer–consumer problem (also k ...

  9. AIX系统日志

    1.系统错误日志 存放路径:/var/adm/ras/errlog 说明:该日志记录了系统所检测到的软硬件故障和错误,尤其对系统的硬件故障有很大的参考价值,是AIX提供的最有价值的日志之一, errl ...

  10. MySQL 5.7 修改root密码

    更新 MySQL 5.7 以后通过以下方法无法在修改root密码: ') where user='root'; 查看下MySQL的官方文档发现版本更新后原来user里的password字段已经变更为a ...