DevOps安装、部署持续集成

1、重启docker服务,开启iptables转发功能

# systemctl start docker

# vi /etc/sysctl.conf 

# sysctl -p

[root@localhost ~]# systemctl start docker
[root@localhost ~]# 
[root@localhost ~]# vi /etc/sysctl.conf 
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forwerd=1
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0

[root@localhost ~]#
[root@localhost ~]# sysctl -p
sysctl: cannot stat /proc/sys/net/ipv4/ip_forwerd: No such file or directory
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
[root@localhost ~]#

2、拉去镜像

(1)、拉取gogs和mysql的镜像到本地

# docker pull gogs/gogs:latest

[root@localhost ~]# docker pull gogs/gogs:latest
latest: Pulling from gogs/gogs
cd784148e348: Pull complete 
f0e1b639074f: Pull complete 
e71af6f4a6ad: Pull complete 
a64b4ab49da6: Pull complete 
efab18b5c706: Pull complete 
17399ed4c107: Pull complete 
b7b418729010: Pull complete 
c82ba2f905fb: Pull complete 
6cab86c6d6d0: Pull complete 
ba110a57d653: Pull complete 
Digest: sha256:a2aa44992d2a520647f625c32bd6ccdfc8fbb5703baf5c5eedec98deda5c42a4
Status: Downloaded newer image for gogs/gogs:latest
[root@localhost ~]# 

 # docker pull mysql:latest

[root@localhost ~]# docker pull mysql:latest
latest: Pulling from library/mysql
177e7ef0df69: Pull complete 
cac25352c4c8: Pull complete 
8585afabb40a: Pull complete 
1e4af4996053: Pull complete 
c326522894da: Pull complete 
9020d6b6b171: Pull complete 
55eb37ec6e5f: Pull complete 
37f3f3d72fbd: Pull complete 
03f098d64268: Pull complete 
46a52a54cfe9: Pull complete 
202bc662895d: Pull complete 
46014f07b258: Pull complete 
Digest: sha256:196c04e1944c5e4ea3ab86ae5f78f697cf18ee43865f25e334a6ffb1dbea81e6
Status: Downloaded newer image for mysql:latest
[root@localhost ~]# 

 # docker images

[root@localhost ~]# docker images
mysql                                                  latest              102816b1ee7d        2 weeks ago         486MB
gogs/gogs                                              latest              5fc13abdcbd5        3 weeks ago         93.8MB

 (2)、启动gogs容器和mysql容器

# docker run -d -p 81:3000 --name gogs gogs/gogs:latest

# docker run -d -p 13306:3306 -e MYSQL_ROOT_PASSWORD=000000 --name gogs-mysql mysql:latest

3、创建数据库

(1)、进入mysql容器,创建gogs数据库

# docker exec -it gogs-mysql /usr/bin/mysql -uroot -p000000

mysql> create database gogs;

 mysql> show databases;

 mysql> exit

(2)、在网页上登录gogs服务,配置数据库连接地址、用户、密码等参数

关闭防火墙

在浏览器中输入:

http://192.168.100.117:81

注册登录后

(5)、复制git库到本地/opt目录,构建私有仓库

# yum install git -y

# git clone http://192.168.100.117:81/djl/djl.git

猜你喜欢

转载自www.cnblogs.com/djlsunshine/p/10282720.html