帕克胖夜话Docker-创建jenkins

通过docker部署jenkins超简单

前置条件

操作系统

1
2
3
4
5
6
docker@ubuntu-docker03:~/shell$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty

docker engine版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
docker@ubuntu-docker03:~/shell$ docker version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:35:49 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:35:49 UTC 2015
OS/Arch: linux/amd64

如果docker engine版本不对的话,那么会导致jenkins调用外部docker失败
按照安装Docker Engine,正确安装Docker Engine指定版本

安装jenkins

挂载共享文件nfs

1
sudo mount -t nfs 192.168.0.250:/srv/data/share /home/docker/storage

下载jenkins docker镜像

1
docker pull registry.aliyuncs.com/haibin/jenkins

启动jenkins

1
2
3
4
5
6
7
8
9
docker run \
--name jenkins-new \
-d \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker \
-v /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1:/lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 \
-v /home/docker/storage/docker_data/jenkins:/var/jenkins_home \
-p 18088:8080 \
registry.aliyuncs.com/haibin/jenkins

验证jenkins

访问http://localhost:18088
如果出现以下情况,则创建成功
jenkins效果图

相关阅读

建立可用的NFS存储

关注链智思维导图,最新文章主动推送
关注链智思维导图(linqmind)