docker + Jenkins 容器网络问题
如下是jenkins案例
- 创建 bridge
docker network create -d bridge my-net
- 用dockers-compose 启动Jenkins
Jenkins.yml
version: '3'
services:
jenkins:
image: 'jenkins/jenkins'
container_name: jenkins
privileged: true
restart: always
ports:
- '8888:8080'
- '50000:50000'
volumes:
- '/opt/jenkins_volume:/var/jenkins_home'
- "/var/run/docker.sock:/var/run/docker.sock"
- "/usr/bin/docker:/usr/bin/docker"
networks:
my-net: {}
networks:
my-net:
external: true
3.Jenkins 容器内ping baidu.com
4. 下载插件太慢可以换源
步骤: 系统管理>>管理插件>>高级
将 [升级站点] 更换为
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json