jenkins + gitlab + harbor 搭建

1,gitlab 仓库搭建

docker run -d \
  --name gitlab \
  -p 8443:443 \
  -p 9999:9999 \
  -p 9998:22 \
  -v $PWD/config:/etc/gitlab \
  -v $PWD/logs:/var/log/gitlab \
  -v $PWD/data:/var/opt/gitlab \
  -v /etc/localtime:/etc/localtime \
  lizhenliang/gitlab-ce-zh:latest
  gitlab/gitlab-ce:latest

修改默认端口

vim config/gitlab.rb

external_url 'http://10.1.1.11:9999'

2,安装 docker-compose

#!/bin/bash
sudo curl -L https://github.com/docker/compose/releases/download/1.23.0-rc3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

docker-compose version

3,habor仓库搭建   https://vmware.github.io/

1、安装docker与docker-compose
2、解压离线包部署
# tar zxvf harbor-offline-installer-v1.9.1.tgz
# cd harbor
# vi harbor.yml
hostname: 10.1.1.1
# ./prepare
# ./install.sh

4,修改加速地址

tee /etc/docker/daemon.json <<-'EOF'
{
        "registry-mirrors": ["https://a960lhr2.mirror.aliyuncs.com"],
        "insecure-registries":["10.1.1.11"]
}
EOF

5.重启docker ,上传一个镜像

docker login --username=admin 10.1.1.11 --password=Harbor12345
docker tag nginx 10.1.1.11/data/nginx:latest
docker push 10.1.1.11/data/nginx:latest
docker rmi 10.1.1.11/data/nginx:latest

6,jenkins 搭建

### 3.1 准备JDK和Maven环境

```
# tar zxvf jdk-8u45-linux-x64.tar.gz
# mv jdk1.8.0_45 /usr/local/jdk
# tar zxf apache-maven-3.5.0-bin.tar.gz
# mv apache-maven-3.5.0 /usr/local/maven
```

```
docker run -d --name jenkins -p 9000:8080 -p 50000:50000 -u root  \
   -v /opt/jenkins_home:/var/jenkins_home \
   -v /var/run/docker.sock:/var/run/docker.sock   \
   -v /usr/bin/docker:/usr/bin/docker \
   -v /usr/local/maven:/usr/local/maven \
   -v /usr/local/jdk:/usr/local/jdk \
   -v /etc/localtime:/etc/localtime \
   --name jenkins jenkins/jenkins:lts

 

 

你可能感兴趣的:(docker)