Public | Automated Build

Last pushed: 4 months ago
Short Description
jumpserver
Full Description

源码github:https://github.com/jumpserver/jumpserver

branch:dev sha1:1816925

以下所有操作都在宿主机上操作

使用overlay网络,使容器可以解析容器name转换为ip

docker swarm init
docker network create -d overlay --attachable jumpserver --subnet=192.168.100.0/24
export DB_HOST=jumpserver-mysql
export DB_USER=root
export DB_PASSWORD=mypassword
export DB_PORT=3306
export DB_NAME=jumpserver_db
export REDIS_HOST=jumpserver-redis
export SITE_URL=http://jumpserver.xxx.com
export EMAIL_PORT=587
export EMAIL_HOST=smtp.xxx.com
export EMAIL_HOST_USER=jumpserver@xxx.com
export EMAIL_HOST_PASSWORD=******
export JUMPSERVER_ENDPOINT=http://myjumpserver.com

docker run -d --restart=always --name $DB_HOST -e MYSQL_ROOT_PASSWORD=$DB_PASSWORD --network jumpserver mysql:5.7

创建数据库,需要等待mysql启动完成(预计10秒)

docker exec -it $DB_HOST mysql -u$DB_USER -p$DB_PASSWORD -e 'CREATE DATABASE '$DB_NAME' DEFAULT CHARACTER SET utf8 ';

创建redis

docker run -d --restart=always --name $REDIS_HOST --network jumpserver redis

容器自定义配置,使用环境变量方式

echo -e "DB_HOST=$DB_HOST\nDB_USER=$DB_USER\nDB_PASSWORD=$DB_PASSWORD\nDB_NAME=$DB_NAME\nREDIS_HOST=$REDIS_HOST\nSITE_URL=$SITE_URL\nEMAIL_PORT=$EMAIL_PORT\nEMAIL_HOST=$EMAIL_HOST\nEMAIL_HOST_USER=$EMAIL_HOST_USER\nEMAIL_HOST_PASSWORD=$EMAIL_HOST_PASSWORD" > /tmp/envinfo

envinfo信息如下:

cat envinfo
DB_HOST=jumpserver-mysql
DB_USER=root
DB_PASSWORD=mypassword
DB_NAME=jumpserver_db
REDIS_HOST=jumpserver-redis
SITE_URL=http://jumpserver.xxx.com
EMAIL_PORT=587
EMAIL_HOST=smtp.xxx.com
EMAIL_HOST_USER=jumpserver@xxx.com
EMAIL_HOST_PASSWORD=******

envinfo参数list如下:

SECRET_KEY = os.environ.get('SECRET_KEY') or '2vym+ky!997d5kkcc64mnz06y1mmui3lut#(^wd=%s_qj$1%x'
SITE_URL = os.environ.get('SITE_URL') or 'http://localhost'
DOMAIN_NAME = os.environ.get('DOMAIN_NAME') or 'jumpserver.org'
DEBUG = os.environ.get('DEBUG') or True
REDIS_HOST = os.environ.get('REDIS_HOST') or '127.0.0.1'
REDIS_PORT = os.environ.get('REDIS_PORT') or '6379'
REDIS_PASSWORD = os.environ.get('REDIS_PASSWORD') or ''
DB_HOST = os.environ.get('DB_HOST') or '127.0.0.1'
DB_PORT = os.environ.get('DB_PORT') or '3306'
DB_USER = os.environ.get('DB_USER') or 'root'
DB_PASSWORD = os.environ.get('DB_PASSWORD') or 'root'
DB_NAME = os.environ.get('DB_NAME') or 'jumpserver_db'
EMAIL_HOST = os.environ.get('EMAIL_HOST') or 'smtp.qq.com'
EMAIL_PORT = int(os.environ.get('EMAIL_PORT', 465))
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER') or 'admin'
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD') or 'somepasswrd'
EMAIL_SUBJECT_PREFIX = os.environ.get('EMAIL_SUBJECT_PREFIX') or '[Jumpserver] '

启动服务,映射到本地80端口

docker run -d --restart=always --name jumpserver -p 80:80 --env-file=/tmp/envinfo -v /var/log/jumpserver:/root/jumpserver/logs --network jumpserver njqaaa/jumpserver

初始化db

docker exec -it jumpserver bash /root/jumpserver/init_db.sh

验证

docker exec -it jumpserver curl -i 127.0.0.1

coco组件

docker run -d --restart=always -e 'JUMPSERVER_ENDPOINT='$JUMPSERVER_ENDPOINT'' --name coco -p 2222:2222 --network jumpserver njqaaa/coco

luna组件

docker run -d --restart=always -e 'JUMPSERVER_ENDPOINT='$JUMPSERVER_ENDPOINT'' --name luna -p 5000:5000 --network jumpserver njqaaa/luna

账号密码

admin admin

Docker Pull Command
Owner
njqaaa
Source Repository

Comments (0)