Docker容器版Jumpserver堡垒机搭建部署方法附Redis
环境:Centos 7 docker
1.拉取mysql 镜像
root@localhost ~]# docker pull mysql:5.7.27
2。拉取redis 镜像
[root@localhost ~]# docker pull redis:5.0.9
3.分别启动容器
1.)启动mysql-jumpserver容器:
mkdir /opt/mysql/{data,conf,logs} -p —创建目录
docker run -d -p 3307:3306 --name mysql-jumpserver --hostname mysql-jumpserver -v /opt/mysql/data:/var/lib/mysql -v /opt/mysql/logs:/var/log/mysql -v /opt/mysql/conf:/etc/mysql/mysql.conf.d -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=jumpserver -e MYSQL_USER=jumpserver -e MYSQL_PASSWORD=jumpserver --restart=always --privileged=true mysql:5.7.27 --character-set-server=utf8 --collation-server=utf8_bin
2.)启动redis 容器
mkdir -p /opt/redis/data -----创建目录
docker run -d -it --name redis-jumpserver --hostname redis-jumpserver -p 6379:6379 -v /opt/redis/data:/data --restart=always --privileged=true --sysctl net.core.somaxconn=1024 redis:5.0.9 --requirepass “123456”
4.随机生成秘钥用如下命令:
if [ ! “ S E C R E T K E Y " ] ; t h e n S E C R E T K E Y = ‘ c a t / d e v / u r a n d o m ∣ t r − d c A − Z a − z 0 − 9 ∣ h e a d − c 50 ‘ ; e c h o " S E C R E T K E Y = SECRET_KEY" ]; then SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`; echo "SECRET_KEY= SECRET