首先安装mysql5.7,如果mysql为5.6可能会有问题
```
# mysql
$ create database jumpserver default charset 'utf8';
$ grant all on jumpserver.* to 'jumpserver'@'%' identified by '123456';
```
安装redis并关闭protect模式,设置访问密码requirepass
```
[root@iZbp1fag1j4cwox2vtrpqmZ ~]# docker pull jumpserver/jms_all:latest
[root@iZbp1fag1j4cwox2vtrpqmZ ~]# cat jms.sh
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 \
-v /opt/mysql:/var/lib/mysql \
-v /opt/jumpserver:/opt/jumpserver/data/media \
-p 80:80 \
-p 2222:2222 \
-e SECRET_KEY=$SECRET_KEY \
-e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN \
-e DB_HOST=172.17.0.2 \
-e DB_PORT=3306 \
-e DB_USER=jumpserver \
-e DB_PASSWORD=123456 \
-e DB_NAME=jumpserver \
-e REDIS_HOST=172.17.0.2 \
-e REDIS_PORT=6379 \
-e REDIS_PASSWORD=123456 \
jumpserver/jms_all:latest
[root@iZbp1fag1j4cwox2vtrpqmZ ~]#
```
查看容器日志
`docker logs -f jms_all`
更多`https://jumpserver.readthedocs.io/zh/latest/dockerinstall.html`