1、下载agent
wget https://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/java-agent/8.14.0/apache-skywalking-java-agent-8.14.0.tgz
2、解压到微服务部署路径
tar xf apache-skywalking-java-agent-8.14.0.tgz -C /data/docker/pig-gateway mv /data/docker/pig-gateway/skywalking-agent /data/docker/pig-gateway/agent
3、服务启动配置
# vim docker-compose.yaml version: '3.9' services: pig-gateway: image: reg.istack.com/demo/pig-gateway:v1 container_name: pig-gateway restart: always ports: - 9999:9999 networks: - pig_default volumes: - ./agent:/pig-gateway/agent command: "java -Xms512m -Xmx1024m -javaagent:./agent/skywalking-agent.jar=agent.service_name=pig-gateway,collector.backend_service=172.16.1.120:11800 -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=utf-8 -jar pig-gateway.jar" networks: pig_default: external: true
参考:
https://skywalking.apache.org/docs/skywalking-java/latest/readme/