安装docker
卸载旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
设置仓库
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
安装Docker
sudo yum install docker-ce docker-ce-cli containerd.io
使用Docker
启动
# 设置开机启动
systemctl enable docker
# 启动Docker
systemctl start docker
启动一个Jenkins容器
docker run -d --name jenkins -v /opt/jenkins_home:/var/jenkins_home --env JAVA_ARGS="-Xms1g -Xmx1g -Dhudson.util.ProcessTreeKiller.disable=true -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 -Djava.awt.headless=true -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true -Dfile.encoding=UTF-8" -p 8888:8080 -p 50000:50000 jenkins/jenkins:centos7