以下内容为原创,转载请注明出处!


环境:阿里云轻量应用服务器,Ubuntu系统                               


安装docker:

    方法一:查看我的另一篇文章:https://www.520pf.cn/article/155.html

    方法二:wget -qO- https://get.docker.com/ | sh


安装docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version

展示以下内容说明安装成功
docker-compose version 1.23.1, build 1719ceb


安装harbor:

  •     下载安装包:

wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-offline-installer-v1.6.3.tgz
  •     解压:

tar -zxvf harbor-offline-installer-v1.6.3.tgz
  •     修改harbor.cfg配置仓库访问地址:vim harbor.cfg

hostname = xxx.xxx.xxx.xxx:9004
  •     修改docker-compose.yml文件,主要是修改端口,因为nginx默认绑定80,如果443端口也被占用了,也可修改:

ports:
      - 9004:80
      - 442:443
      - 4443:4443
  •     执行:

./install.sh
  •     查看镜像启动状态,出现以下状况说明启动成功,

docker ps

进入容器:
docker exec -it 5c28645016d1 /bin/bash
root@iZsqvvaakhm44gZ:/opt/harbor# docker ps
CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS                    PORTS                                                                NAMES
634c6acb00fc        goharbor/nginx-photon:v1.6.3             "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes (healthy)   0.0.0.0:4443->4443/tcp, 0.0.0.0:9004->80/tcp, 0.0.0.0:442->443/tcp   nginx
bff4b04b5ebb        goharbor/harbor-jobservice:v1.6.3        "/harbor/start.sh"       18 minutes ago      Up 18 minutes                                                                                  harbor-jobservice
239e94b5a254        goharbor/harbor-ui:v1.6.3                "/harbor/start.sh"       18 minutes ago      Up 18 minutes (healthy)                                                                        harbor-ui
c2122a1fb260        goharbor/redis-photon:v1.6.3             "docker-entrypoint.s…"   18 minutes ago      Up 18 minutes             6379/tcp                                                             redis
91f097451164        goharbor/harbor-adminserver:v1.6.3       "/harbor/start.sh"       18 minutes ago      Up 18 minutes (healthy)                                                                        harbor-adminserver
6691be9b5f9a        goharbor/registry-photon:v2.6.2-v1.6.3   "/entrypoint.sh /etc…"   18 minutes ago      Up 18 minutes (healthy)   5000/tcp                                                             registry
f669e506a13b        goharbor/harbor-db:v1.6.3                "/entrypoint.sh post…"   18 minutes ago      Up 18 minutes (healthy)   5432/tcp                                                             harbor-db
9222449cddf6        goharbor/harbor-log:v1.6.3               "/bin/sh -c /usr/loc…"   18 minutes ago      Up 18 minutes (healthy)   127.0.0.1:1514->10514/tcp                                            harbor-log

访问地址,出现以下ui说明启动成功,登录密码可以在harbor.cfg中修改(该密码仅在Harbor 第一次启动时生效。之后,此设置将被忽略,只能在UI中修改管理员的密码。默认admin / Harbor12345。):

1545117245513.jpg



推送自己的镜像(仓库中建立项目:dp_web):

  •     login登录仓库:

docker login xxx.xxx.xxx.xxx:9004
  •     给镜像打tag:

docker tag python:3.6 xxx.xxx.xxx.xxx:9004/dp_web/python:3.6
  •     push镜像:

docker push xxx.xxx.xxx.xxx:9004/dp_web/python:3.6