Docker 镜像

假想控 edited this page Nov 17, 2016 · 1 revision
一、环境

JMS 192.168.50.131 Centos-7.2-x86_64 mini

镜像 docker pull jiaxiangkong/jumpserver_docker

二、基本环境安装

[root@docker ~]# cd /opt

[root@docker opt]#yum install -y epel-release

[root@docker opt]#yum install -y curl iptables-services

[root@docker opt]#systemctl stop iptables

[root@docker opt]#systemctl stop firewalld.service

三、安装docker
3.1 查看内核版本

[root@docker opt]# uname -r

3.10.0-327.el7.x86_64

建议内核版本3.10.0以上

3.2 执行安装docker命令

[root@docker opt]# curl –sSL https://get.docker.com/ | sh

[root@docker opt]# systemctl start docker

[root@docker opt]# systemctl enable docker

[root@docker opt]# docker -v

Docker version 1.12.3, build 6b644ec

四、安装mariadb
4.1 执行安装mariadb命令

[root@docker opt]# yum -y install mariadb-server mariadb-devel

[root@docker opt]# systemctl start mariadb.service

[root@docker opt]# systemctl enable mariadb.service

4.2 执行创建数据库jumpserver命令

[root@docker opt]# mysql -e "create database jumpserver charset='utf8';"

[root@docker opt]# mysql -e "grant all on jumpserver.* to 'jumpserver'@'192.168.50.131' identified by '5Lov@wife';"

[root@docker opt]# mysql -e "flush privileges;"

[root@docker opt]# mysql -e "show databases;"

五、jumpserver docker镜像
5.1 拉镜像

[root@docker opt]# docker pull jiaxiangkong/jumpserver_docker:0.3.2

webterminal

5.2 创建一个容器

[root@docker opt]# docker run -d -p 2222:22 -p 8888:80 --restart=always --name jms jiaxiangkong/jumpserver_docker:0.3.2

webterminal

5.3 登录容器编辑jumpserver.conf

[root@docker opt]# docker exec -it 0c2f7dd76174 /bin/sh

/jumpserver # ifconfig

/jumpserver # vi jumpserver.conf

webterminal

5.4 初始化数据库

/jumpserver # cd install && python next.py

webterminal

5.5 访问 192.168.50.131:8888登录

webterminal

webterminal

六、更新 jumpserver docker镜像
6.1 执行更新命令

[root@docker jumpserver]# docker pull jiaxiangkong/jumpserver_docker:0.3.2

webterminal