add docker doc. #364

This commit is contained in:
hengyunabc 2018-12-19 14:18:21 +08:00
parent 931f05aef7
commit 67697ce6dc
6 changed files with 132 additions and 0 deletions

View File

@ -76,6 +76,7 @@ You can enter its interactive interface by executing `as.sh`, or execute `as.sh
* [Quick start](https://alibaba.github.io/arthas/en/quick-start.html)
* [Advanced usage](https://alibaba.github.io/arthas/en/advanced-use.html)
* [Commands](https://alibaba.github.io/arthas/en/commands.html)
* [Docker](https://alibaba.github.io/arthas/en/docker.html)
* [User cases](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
* [Questions and answers](https://github.com/alibaba/arthas/issues?utf8=%E2%9C%93&q=label%3Aquestion-answered+)
* [How to contribute](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)

View File

@ -68,6 +68,7 @@ curl -L https://alibaba.github.io/arthas/install.sh | sh
* [快速入门](https://alibaba.github.io/arthas/quick-start.html)
* [进阶使用](https://alibaba.github.io/arthas/advanced-use.html)
* [命令列表](https://alibaba.github.io/arthas/commands.html)
* [Docker](https://alibaba.github.io/arthas/docker.html)
* [用户案例](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
* [常见问题](https://github.com/alibaba/arthas/issues?utf8=%E2%9C%93&q=label%3Aquestion-answered+)
* [参与贡献](https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md)

View File

@ -0,0 +1,64 @@
Docker
===
## 通过Docker快速入门
1. 删除本地已有的`arthas-demo` docker container非必要
```sh
$ docker stop arthas-demo || true && docker rm arthas-demo || true
```
1. 启动`arthas-demo`
```sh
$ docker run --name arthas-demo -it hengyunabc/arthas:latest /bin/sh -c "java -jar /opt/arthas/arthas-demo.jar"
```
1. 启动`arthas-boot`来进行诊断
```sh
$ docker exec -it arthas-demo /bin/sh -c "java -jar /opt/arthas/arthas-boot.jar"
* [1]: 9 jar
[INFO] arthas home: /opt/arthas
[INFO] Try to attach process 9
[INFO] Attach process 9 success.
[INFO] arthas-client connect 127.0.0.1 3658
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://alibaba.github.io/arthas
version: 3.0.5
pid: 9
time: 2018-12-18 11:30:36
```
## 诊断Docker里的Java进程
```sh
docker exec -it ${containerId} /bin/bash -c "wget https://alibaba.github.io/arthas/arthas-boot.jar && java -jar arthas-boot.jar"
```
## 诊断k8s里容器里的Java进程
```sh
kubectl exec -it ${pod} --container ${containerId} -- /bin/bash -c "wget https://alibaba.github.io/arthas/arthas-boot.jar && java -jar arthas-boot.jar"
```
## 把Arthas安装到基础镜像里
可以很简单把Arthas安装到你的Docker镜像里。
```
FROM openjdk:8-jdk-alpine
# copy arthas
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
```
* [https://cloud.docker.com/repository/docker/hengyunabc/arthas](https://cloud.docker.com/repository/docker/hengyunabc/arthas)

View File

@ -0,0 +1,64 @@
Docker
===
## Quick start with Docker
1. Delete the existing `arthas-demo` docker container (not necessary)
```sh
$ docker stop arthas-demo || true && docker rm arthas-demo || true
```
1. Start `arthas-demo`
```sh
$ docker run --name arthas-demo -it hengyunabc/arthas:latest /bin/sh -c "java -jar /opt/arthas/arthas-demo.jar"
```
1. Start `arthas-boot` for diagnosis
```sh
$ docker exec -it arthas-demo /bin/sh -c "java -jar /opt/arthas/arthas-boot.jar"
* [1]: 9 jar
[INFO] arthas home: /opt/arthas
[INFO] Try to attach process 9
[INFO] Attach process 9 success.
[INFO] arthas-client connect 127.0.0.1 3658
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://alibaba.github.io/arthas
version: 3.0.5
pid: 9
time: 2018-12-18 11:30:36
```
## Diagnose the Java process in Docker
```sh
docker exec -it ${containerId} /bin/bash -c "wget https://alibaba.github.io/arthas/arthas-boot.jar && java -jar arthas-boot.jar"
```
## Diagnose the Java process in the container in k8s
```sh
kubectl exec -it ${pod} --container ${containerId} -- /bin/bash -c "wget https://alibaba.github.io/arthas/arthas-boot.jar && java -jar arthas-boot.jar"
```
## Install Arthas into the base Docker image
It's easy to install Arthas into your Docker image.
```
FROM openjdk:8-jdk-alpine
# copy arthas
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
```
* [https://cloud.docker.com/repository/docker/hengyunabc/arthas](https://cloud.docker.com/repository/docker/hengyunabc/arthas)

View File

@ -41,6 +41,7 @@ Contents
* [Quick start](quick-start.md)
* [Advanced usage](advanced-use.md)
* [Commands](commands.md)
* [Docker](docker.md)
* [User cases](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
* [Questions and answers](https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered)
* [Fork me at GitHub](https://github.com/alibaba/arthas)

View File

@ -30,6 +30,7 @@ Contents
* [快速入门](quick-start.md)
* [进阶使用](advanced-use.md)
* [命令列表](commands.md)
* [Docker](docker.md)
* [用户案例](https://github.com/alibaba/arthas/issues?q=label%3Auser-case)
* [常见问题](https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered)
* [Fork me at GitHub](https://github.com/alibaba/arthas)