docker 部署Python项目 以及dockerfile文件的编写
Dockerfile文件詳解:https://www.cnblogs.com/panwenbin-logs/p/8007348.html
Docker的基本使用(部署python項目):
https://c.lanmit.com/bianchengkaifa/Python/23023.html
Docker部署Python爬蟲項目:https://segmentfault.com/a/1190000021617187?utm_source=tag-newest
Docker部署python項目:1:https://www.cnblogs.com/you-men/p/13190758.html
2:https://www.cnblogs.com/baiboy/p/docker1.html
環境:yum install -y docker-ce
? pip install docker-compose
一、 安裝
1.按照github中下載文件。https://github.com/goharbor/harbor
2.解壓縮,配置信息
? cd harbor
? vi harbor
? 設置hostname 例:10.20.5.2
? http端口: 例:80(此為宿主機端口)
? harbor_admin_password 默認為: Harbor12345
? data_volume 例:/data/harbor
? 其余酌情設置。
? ./install.sh
在需要交互的主機上
echo “{ “insecure-registries”:[“10.20.5.2”] }“ > /etc/docker/daemon.json
systemctl restart docker
二、管理
1.瀏覽器輸入 :hostname:端口 例:10.20.5.2:80
輸入管理用戶:admin
? 輸入密碼:Harbor12345
2.為使用者創建用戶。
3.新建項目。項目分為公開和私有兩種類型。公開:所有需要交互的主機都可以pull鏡像。私有:所有需要交互的主機只有登錄之后才可以pull鏡像。
docker login 10.20.5.2
輸入用戶名
輸入密碼
只有登錄之后才可以push鏡像 docker push 10.20.5.2/test/nginx:1.15
4.清理鏡像。
在網頁中刪除鏡像,并不能真正刪除鏡像。
清理刪除的鏡像:
1)停止harbor
? docker-compose stop
2)查看受影響的文件
docker run -it --name gc --rm --volumes-from registry goharbor/registry-photon:v1.9.0-dev garbage-collect --dry-run /etc/registry/config.yml
3)刪除文件
docker run -it --name gc --rm --volumes-from registry goharbor/registry-photon:v1.9.0-dev garbage-collect /etc/registry/config.yml
4)重新啟動harbor
? docker-compose start
總結
以上是生活随笔為你收集整理的docker 部署Python项目 以及dockerfile文件的编写的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 论文浅尝 | 变分知识图谱推理:在KG中
- 下一篇: python中字符串添加r的作用,原始字