在定制端口上配置端口侦听

默认情况下,Harbor的侦听端口80(HTTP)和443(HTTPS,如果配置)有时候你有其他原因,你可以配置一个定制一个。

Http 协议

1.修改 docker-compose.yml
替换 "80" port 为一个定制的 port, 例如 8888:80.

proxy:
    image: library/nginx:1.11.5
    restart: always
    volumes:
      - ./config/nginx:/etc/nginx
    ports:
      - 8888:80
      - 443:443
    depends_on:
      - mysql
      - registry
      - ui
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "proxy"

2.修改 harbor.cfg,在 "hostname" 参数增加一个port:

hostname = 192.168.0.2:8888

3.使配置生效

$ sudo docker-compose down -v
$ vim harbor.cfg
$ sudo prepare
$ sudo docker-compose up -d

HTTPS 协议

1.修改 docker-compose.yml
替换 "443" port 为一个定制的 port, 例如 8888:443.

proxy:
    image: library/nginx:1.11.5
    restart: always
    volumes:
      - ./config/nginx:/etc/nginx
    ports:
      - 80:80
      - 8888:443
    depends_on:
      - mysql
      - registry
      - ui
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "proxy"

2.修改 harbor.cfg,在 "hostname" 参数增加一个port:

hostname = 192.168.0.2:8888

3.使配置生效

$ sudo docker-compose down -v
$ vim harbor.cfg
$ sudo prepare
$ sudo docker-compose up -d

参考:

https://github.com/vmware/harbor/blob/v1.4.0/docs/installation_guide.md#configuring-harbor-listening-on-a-customized-port



Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐