docker容器中使用jstack、jmap (基于livingobjects/jre8的镜像)
#进入容器里
docker exec -it xxx /bin/bash
容器里面运行:
1、修改源:
cd /etc/apk
vi repositories
2、替换成阿里源
http://mirrors.aliyun.com/alpine/v3.8/main/
http://mirrors.aliyun.com/alpine/v3.8/community/
apk update
3、安装jdk
apk add openjdk8
cd /usr/lib/jvm/java-1.8-openjdk/bin
4、运行jstack、jmap等工具
./jstack
./jmap
./jmap -dump:live,format=b,file=dump20191122.hprof (pid)