4,dockerfile的基本使用

dockerfile:
FROM构建新镜像是基于哪个镜像
MAINTAINER镜像维护者姓名或邮箱地址
RUN构建镜像时运行的Shell命令
COPY拷贝文件或目录到镜像中
ENV设置环境变量
USER为RUN、CMD和ENTRYPOINT执行命令指定运行用户
EXPOSE声明容器运行的服务端口
HEALTHCHECK容器中服务健康检查
WORKDIR为RUN、CMD、ENTRYPOINT、COPY和ADD设置工作目录
ENTRYPOINT运行容器时执行,如果有多个ENTRYPOINT指令,最后一个生效
CMD运行容器时执行,如果有多个CMD指令,最后一个生效


Harbor部署(harbor的http安装):
1,安装harbor先安装他的依赖,docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
2,离线安装
# tar zxvf harbor-offline-installer-v1.5.1.tgz
# cd harbor
# vi harbor.cfg
hostname = 10.206.240.188   
ui_url_protocol = http
harbor_admin_password = 123456  
# ./prepare
# ./install.sh

3,推送镜像
# docker tag nginx:latest 192.168.0.12/library/nginx:latest

报错:harbor默认访问的是443
[root@centos7 harbor]# docker push 192.168.0.12/library/nginx:latest
The push refers to repository [192.168.0.12/library/nginx]
Get https://192.168.0.12/v2/: dial tcp 192.168.0.12:443: connect: connection refused
[root@centos7 harbor]#

添加可以信任:
[root@centos7 ~]# cat /etc/docker/daemon.json 
{
	"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
	"insecure-registries": ["192.168.0.12"]
}
[root@centos7 ~]# 

再次推送,显示拒绝,是因为没有创建用户登陆harbor
[root@centos7 harbor]# docker push 192.168.0.12/library/nginx:latest
The push refers to repository [192.168.0.12/library/nginx]
f978b9ed3f26: Preparing 
9040af41bb66: Preparing 
7c7d7f446182: Preparing 
d4cf327d8ef5: Preparing 
13cb14c2acd3: Preparing 
denied: requested access to the resource is denied
[root@centos7 harbor]# 




harbor-adminserver配置管理中心
harbor-dbMysql数据库
harbor-jobservice负责镜像复制
harbor-log记录操作日志
harbor-uiWeb管理页面和
APInginx前端代理,负责前端页面和镜像上传/下载转发
redis会话
registry镜像存储

  

你可能感兴趣的:(4,dockerfile的基本使用)