Docker 部署Jumpserver-v2.2.2
https://docs.jumpserver.org/zh/master/install/docker_install/
docker 安装:
# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
或者:
yum install docker-ce-19.03.5 docker-ce-cli-19.03.5 containerd.io
# Step 4: 开启Docker服务
sudo service docker start
修改docker 默认安装位置:
systemctl stop docker
cd /var/lib/
mv docker/* /home/docker
rm -rf docker
ln -s /home/docker/ /var/lib/docker
systemctl start docker
docker info
Linux 生成随机加密秘钥, 可以用下面的命令
if [ ! "$SECRET_KEY" ]; then
SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`;
echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc;
echo $SECRET_KEY;
else
echo $SECRET_KEY;
fi
if [ ! "$BOOTSTRAP_TOKEN" ]; then
BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16`;
echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc;
echo $BOOTSTRAP_TOKEN;
else
echo $BOOTSTRAP_TOKEN;
fi
docker run --name jms_all -d \
-p 80:80 -p 2222:2222 \
-e SECRET_KEY=$SECRET_KEY \
-e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN \
-v /opt/jumpserver/data:/opt/jumpserver/data \
-v /opt/jumpserver/mysql:/var/lib/mysql \
--privileged=true \
jumpserver/jms_all:v2.2.2
docker exec -it jms_all bash //进入容器
docker rm jms_all //删除
docker ps -a
docker ps
docker images