登录到linux系统
1、安装必备的应用
yum install net-tools vim wget lrzsz epel-release -ycat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
SELINUX=disabled 改成disabled
2、添加docker源
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker.repo
3、安装docker
yum install docker-ce -y
4、Docker镜像管理
vim /etc/docker/daemon.json 阿里云Docker镜像加速
{
"registry-mirrors":["https://dhq9bx4f.mirror.aliyuncs.com"]
}
#重载systemctl的配置
systemctl daemon-reload
systemctl restart docker
5、加入开机启动
systemctl enable docker
6、设置docker基本参数
vim /etc/docker/daemon.json
{
"bip": "172.xx.x.1/16", 设置IP
"max-concurrent-downloads": 10,
"log-driver": "json-file",
"log-level": "warn",
"log-opts": {
"max-size": "20m",
"max-file": "2"
},
"storage-driver": "overlay2"
}保存退出重启dokcer
systemctl restart docker
7、Jenkins Docker安装文件
dokcer-composer.yml
dokcer-composer.yml
version: '3'
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins:latest
restart: always
ports:
- 8080:8080
- 5000:5000
volumes:
- /etc/localtime:/etc/localtime:ro
- /opt/jenkins_home:/var/jenkins_home:rw