1.下载docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
docker-compose.yml
version: '3' services: jenkins: restart: always image: jenkins/jenkins:lts container_name: docker_jenkins ports: - '8080:8080' - '50000:50000' volumes: - ./data/:/var/jenkins_home - /var/run/docker.sock:/var/run/docker.sock - /usr/bin/docker:/usr/bin/docker - /usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7
创建 data 目录并设置权限
mkdir data
sudo chown -R 1000 data
//把当前目录的拥有者赋值给uid 1000
若已启动则需要重建下服务
构建Jenkins服务
docker-compose up -d