栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

安装docker、docker-compose和harbor

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

安装docker、docker-compose和harbor

一、安装docker 1) 下载

线上安装包 https://download.docker.com/linux/static/stable/x86_64/
有公网时下载对应版本:

wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz
2)解压
tar -xvzf docker-20.10.0.tgz 
3)复制内容到对应目录
cp docker/* /usr/bin/
4)编写docker.service
vi /etc/systemd/system/docker.service

添加内容进去

[Unit]
Description=Docker Application Container Engine
documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

授权

chmod +x /etc/systemd/system/docker.service
5)启动
systemctl start docker.service
6)查看状态
systemctl status docker.service
7) 开机自启动
systemctl enable docker.service
二、安装docker-compose 1)下载

官网:https://github.com/docker/compose/releases
本次测试版本
链接: https://pan.baidu.com/s/1PwSxF9DWhjXbDaKO1bQ1DA 提取码: 128u

2)复制和授权
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3)检测是否安装成功
docker-compose --version
三、安装harbor 1)下载

官网:https://github.com/goharbor/harbor/releases
链接: https://pan.baidu.com/s/1PrlDRVFHygxO0OOrw43CUQ 提取码: 49m1

2) 解压
tar -xzvf  harbor-offline-installer-v2.3.4.tgz
3)修改配置文件

如果是harbor.yml.tmpl,则复制

cp harbor.yml.tmpl harbor.yml

修改文件,不需要https访问

vi harbor.yml
hostname: ip地址,公网ip
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8051

# https related config
#https:
  # https port for harbor, default is 443
 # port: 443
  # The path of cert and key files for nginx
  #certificate: /your/certificate/path
  #private_key: /your/private/key/path
4)启动
.prepare
./install.sh
5)登录网址

hostname:port
hostname和port 是配置文件里面配置的ip和端口

用户名:admin
密码:Harbor12345
用户名和密码配置文件里面也有

6)docker 登录harbor

需要修改daemon.json文件

vi /etc/docker/daemon.json   
{
 "registry-mirrors": ["https://i22aew6l.mirror.aliyuncs.com"], 
 "insecure-registries": ["hostname:8051"]
}

hostname是harbor.yml配置文件里面的hostname

docker login hostname:port
Username: admin
Password: Harbor12345
7)推送镜像到harbor

打标签

docker tag test:v1 hostname:port/harbor项目名/test:v2

docker push hostname:port/harbor项目名/test:v2
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/747681.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号