docker-compose方式部署skywalking

docker-compose方式部署skywalking

    • Elasticsearch的docker-compose.yml
    • skywalking的docker-compose.yml
    • 当前的docker版本启动报错
    • 需要升级docker的版本
      • 需要先删除容器和所有镜像
      • 停止docker服务
      • 卸载docker
      • 安装docker
      • 启动docker
      • 配置/etc/docker/daemon.json
      • 升级docker-compose


报错:Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.

Elasticsearch的docker-compose.yml

官网参考

version: '3'
services:
  es:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6
    container_name: es
    environment:
      - TZ=Asia/Shanghai
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    restart: always
volumes:
  data:
    driver: local

skywalking的docker-compose.yml

官网参考

version: '3'
services:
  skywalking-server:
    image: docker.io/apache/skywalking-oap-server:9.2.0
    container_name: skywalking-server
    environment:
      - TZ=Asia/Shanghai
      - SW_STORAGE=elasticsearch
      - SW_STORAGE_ES_CLUSTER_NODES=172.17.0.1:9200
      - "JAVA_OPTS=-Xms1024m -Xmx1024m"
    ports:
      - 12800:12800
      - 11800:11800
    restart: always
  skywalking-ui:
    depends_on:
      - skywalking-server
    image: docker.io/apache/skywalking-ui:9.2.0
    container_name: skywalking-ui
    environment:
      - TZ=Asia/Shanghai
      - SW_OAP_ADDRESS=http://172.17.0.1:12800
    ports:
      - 13800:8080
    restart: always

当前的docker版本启动报错

[root@docker ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar  2 15:25:43 2022
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar  2 15:25:43 2022
 OS/Arch:         linux/amd64
 Experimental:    false
[root@docker ~]# docker-compose version
Docker Compose version v2.12.2

报错信息

skywalking-server  | [0.152s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
skywalking-server  | #
skywalking-server  | # There is insufficient memory for the Java Runtime Environment to continue.
skywalking-server  | # Cannot create worker GC thread. Out of system resources.
skywalking-server  | # An error report file with more information is saved as:
skywalking-server  | # /skywalking/hs_err_pid1.log
skywalking-ui      | [0.015s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
skywalking-ui      | #
skywalking-ui      | # There is insufficient memory for the Java Runtime Environment to continue.
skywalking-ui      | # Cannot create worker GC thread. Out of system resources.
skywalking-ui      | # An error report file with more information is saved as:
skywalking-ui      | # /skywalking/hs_err_pid1.log
skywalking-server exited with code 1

需要升级docker的版本

需要先删除容器和所有镜像

docker rm -f xxx
docker rmi xxx

停止docker服务

[root@docker skywalking]# systemctl disable docker
Removed symlink /etc/systemd/system/multi-user.target.wants/docker.service.
[root@docker skywalking]# systemctl stop docker

卸载docker

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

安装docker

#更新yum
yum update
#安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
#使用ali仓库源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#按需选择适合自己的版本
yum list docker-ce --showduplicates
#安装默认最新的
yum install docker-ce docker-ce-cli containerd.io

启动docker

# 配置开机启动
systemctl enable docker
# 启动docker 服务
systemctl start docker
# 查看版本
[root@docker skywalking]# docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:04:24 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 18:02:38 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.10
  GitCommit:        770bd0108c32f3fb5c73ae1264f7e503fe7b2661
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

配置/etc/docker/daemon.json

{
 #镜像源管理,我增加了阿里镜像源,可以提速 
"registry-mirrors" : [
    "https://jkfdsf2u.mirror.aliyuncs.com",
    "https://registry.docker-cn.com"
  ],
#docker私服配置,因为不是https链接,所以在此配置
  "insecure-registries" : [
    "docker-registry.zjq.com"
  ],
#日志最大存储限制,如果不配置它,可能会导致/var/lib/docker/tmp/containers目录中的容器日志过大,挤占系统盘空间。
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "10"
  },
#Docker运行时使用的根路径,默认 "/var/lib/docker"
  "data-root": "/data/docker"
}

升级docker-compose

# 原版本
[root@docker skywalking]# docker-compose version
Docker Compose version v2.12.2
# 下载最新版本
[root@docker skywalking]# curl -L "https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 43.5M  100 43.5M    0     0  2880k      0  0:00:15  0:00:15 --:--:-- 7670k

# 添加执行权限
[root@docker skywalking]# chmod +x /usr/local/bin/docker-compose
# 查看新的版本
[root@docker skywalking]# docker-compose version
Docker Compose version v2.13.0

你可能感兴趣的:(工具,docker,docker,skywalking,容器)