Docker(5) maven的私有仓库Nexus3的搭建

1.拉去nexus3的镜像

docker pull sonatype/nexus3

2. 制作启动文件 nexus.sh

#!/bin/bash
echo "restart nexus..."
docker stop nexus && echo "停止服务成功!" || echo "停止服务失败!"
docker rm nexus && echo "销毁服务成功!" || echo "销毁服务失败!"
docker run --detach \
        --publish 8081:8081 \
        --volume /home/docker/nexus/nexus-data:/var/nexus-data \
        --name nexus \
        sonatype/nexus3

3.运行nexus (这里设置运行权限什么的都不说了)

./nexus.sh

4. 开放端口8081

firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --reload

5. 使用nginx代理(nexus.weipaiku.com)

server {
  listen 80;
  server_name nexus.weipaiku.com;

  # disable any limits to avoid HTTP 413 for large image uploads
  client_max_body_size 0;

  # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
  chunked_transfer_encoding on;

  location / {
    proxy_pass                          http://192.168.0.210:8081;
    proxy_set_header  Host              $http_host;   # required for docker client's sake
    proxy_set_header  X-Real-IP         $remote_addr; # pass on real client's IP
    proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_read_timeout                  900;
  }
}

6. 访问

http://nexus.weipaiku.com
用户/密码: admin/admin123

你可能感兴趣的:(docker)