实验环境

cat /etc/redhat-release && uname -a

CentOS Linux release 7.8.2003 (Core)

Linux centos7-1 3.10.0-1127.el7.x86_64


systemctl stop firewalld && systemctl disable firewalld

echo SELINUX=disabled > /etc/sysconfig/selinux


cp -pv /etc/sysctl.conf /etc/sysctl.conf.bak

cat >> /etc/sysctl.conf << EOF

> net.ipv4.tcp_syncookies = 1

> net.ipv4.tcp_tw_reuse = 1

> net.ipv4.tcp_tw_recycle = 1

> net.ipv4.tcp_fin_timeout = 10

> net.ipv4.ip_forward= 1

> EOF  &&   sysctl -p



软件安装

yum install -y   yum-utils  docker-ce-18.06.3.ce  

systemctl daemon-reload

systemctl start docker && systemctl enable docker

docker --version

Docker version 18.06.2-ce, build 6d37f41


docker pull mysql:5.7  

docker run -itd -p 3306:3306

   --restart=always   --privileged=true  \  

   -e MYSQL_ROOT_PASSWORD=root  \  

   -v /usr/local/mysql/data:/var/lib/mysql   \  

   -v /usr/local/mysql/log:/var/log/mysql/log  \  

   --name mysql mysql:5.7  


docker exec -it mysql /bin/bash

mysql -uroot -p数据库权限

root@2fd175c791c2:/# mysql -uconfluence -pconfluence

mysql> CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8_bin;

mysql> grant all privileges on *.* to confluence@'%' identified by 'confluence';

mysql> flush privileges;

mysql> ALTER DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;

mysql> SET GLOBAL tx_isolation='READ-COMMITTED';

mysql> select u.id, u.user_name, u.active from cwd_user u join cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_id where g.group_name = 'confluence-administrators' and d.directory_name='Confluence Internal Directory';

+--------+-----------+--------+

| id     | user_name | active |

+--------+-----------+--------+

| 262145 | admin     | T      |

+--------+-----------+--------+

mysql> update cwd_user set credential = 'x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A==' where id=262145;  

重置管理员权限


docker pull  blacklabelops/confluence

docker run -itd  --name confluence \

  --restart=always  -p 8091:8091  \

 blacklabelops/confluence  && docker logs -f   confluence


netstat -tuplna | grep LISTEN

tcp        0      0 0.0.0.0:8091     0.0.0.0:*     LISTEN      1647/docker-proxy

tcp6       0      0 :::8091       :::*              LISTEN      1653/docker-proxy


http://serverip:8091/

 docker部署confluence企业知识库_linux

 docker部署confluence企业知识库_docker_02

 docker部署confluence企业知识库_linux_03

 docker部署confluence企业知识库_docker_04

 docker部署confluence企业知识库_mysql_05

 docker部署confluence企业知识库_docker_06

 docker部署confluence企业知识库_mysql_07

 docker部署confluence企业知识库_docker_08

 docker部署confluence企业知识库_mysql_09


 docker部署confluence企业知识库_mysql_10


docker save blacklabelops/confluence > /root/confluence-$(date +%Y%m%d).tar.gz  备份镜像

docker load < /root/confluence_images.tar.gz                           还原镜像

docker export -o confluence-`date +%Y%m%d`.tar.gz confluence           备份运行容器

docker import  confluence-20211227.tar.gz   confluence                 恢复备份容器