正文
一、安装Maven私服Sonatype Nexus
1、下载镜像
[root@localhost ~]# docker pull sonatype/nexus3
2、挂载启动
[root@localhost ~]# docker run -d -p 8081:8081 --name nexus -v /root/nexus-data:/var/nexus-data --restart=always sonatype/nexus3
3、关闭防火墙
[root@localhost ~]# systemctl stop firewalld
4、浏览器访问http//ip:8081/
5、查看密码
admin:[root@localhost ~]# docker exec -it 0a3be49d95a0 bash bash-4.4$ cat /nexus-data/admin.password 400aa478-eb9c-454f-92f8-11b0e3534389bash-4.4$ #bash前面的部分为密码
6、配置(settings.xml)
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <!--本地仓库--> <localRepository>D:\maven\my_repository</localRepository> <!--添加账号--> <servers> <server> <!--此处id需要对应项目中pom.xml文件中的<distributionManagement> 标签下的id--> <id>test-release</id> <username>admin</username> <password>123456</password> </server> <server> <id>test-snapshots</id> <username>admin</username> <password>123456</password> </server> </servers> <profiles> <profile> <!--profile的id--> <id>dev</id> <repositories> <repository> <!--仓库id,repositories可以配置多个仓库,保证id不重复--> <id>nexus</id> <!--仓库地址,即nexus仓库组的地址--> <url>http://192.168.6.135:8081/repository/maven-public/</url> <!--是否下载releases构件--> <releases> <enabled>true</enabled> </releases> <!--是否下载snapshots构件--> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 --> <pluginRepository> <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 --> <id>public</id> <name>Public Repositories</name> <url>http://192.168.6.135:8081/repository/maven-public/</url> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> <!--<mirrors> <mirror> <id>alimaven</id> <mirrorOf>*</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors>--> </settings>
pom文件
<distributionManagement> <repository> <id>test-release</id> <url>http://192.168.6.135:8081/repository/test-release/</url> </repository> <snapshotRepository> <id>test-snapshots</id> <url>http://192.168.6.135:8081/repository/test-snapshots/</url> </snapshotRepository> </distributionManagement>
二、安装Gitlab
1、拉取镜像
[root@localhost ~]# docker pull beginor/gitlab-ce
2、创建日记数据等文件
[root@localhost ~]# mkdir -p /mnt/gitlab/etc [root@localhost ~]# mkdir -p /mnt/gitlab/log [root@localhost ~]# mkdir -p /mnt/gitlab/data
3、运行容器
docker run \ --detach \ --publish 8443:443 \ --publish 8090:8090 \ --name gitlab \ --restart unless-stopped \ -v /mnt/gitlab/etc:/etc/gitlab \ -v /mnt/gitlab/log:/var/log/gitlab \ -v /mnt/gitlab/data:/var/opt/gitlab \ beginor/gitlab-ce:latest
4、修改配置
[root@localhost ~]# vi /mnt/gitlab/etc/gitlab.rb #修改这句,这个地址就是我们clone时那个地址 external_url 'http://192.168.6.135:8090'
[root@localhost ~]# vi /mnt/gitlab/data/gitlab-rails/etc/gitlab.yml
5、重新启动容器
#查看运行的镜像 [root@localhost ~]# docker ps #重启docker [root@localhost ~]# systemctl restart docker #重启容器 [root@localhost ~]# docker restart gitlab
6、访问http://ip:8090
注意:设置密码时候,密码长度不能小于8位
参考:
https://blog.csdn.net/sinat_39789638/article/details/77918292