docker-09-写Dockerfile并上传DockerHub
Created At :
Count:385
Views 👀 :
教你写Dockerfile并上传DockerHub
DockerFile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| FROM centos LABEL version="1.0" LABEL maintainer="shaotongjie335@163.com"
RUN yum update && yum install -y vim \ Python-dev WORKDIR /root WORKDIR /test ADD test.tar.gz / COPY hello test/ ADD与COPY - 优先使用COPY命令 -ADD除了COPY功能还有解压功能 ENV ENV MYSQL_VERSION 5.6
|
编写DockerFile文件
vim DockerFile
1 2 3 4 5 6 7 8 9 10 11 12 13
| FROM nginx:1.17.6 ENV LANG en_US.UTF-8 ADD index.html /usr/share/nginx/html EXPOSE 80 EXPOSE 443
docker build . -t hello-k8s:0.0.1
|
那么如何将构建好的镜像上传到中央仓库呢?
可以在YOPmail 注册临时邮箱
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| docker login
docker tag hello-k8s:0.0.1 pig4cloud/hello-k8s:0.0.1
docker push pig4cloud/hello-k8s:0.0.1
docker rmi pig4cloud/hello-k8s:0.0.1 docker pull pig4cloud/hello-k8s:0.0.1
|
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 1210331079@qq.com
Title:docker-09-写Dockerfile并上传DockerHub
Count:385
Author:千 羽
Created At:2020-08-17, 23:34:15
Updated At:2020-08-30, 14:09:50
Url:https://nateshao.github.io/2020/08/17/docker-09-%E5%86%99Dockerfile%E5%B9%B6%E4%B8%8A%E4%BC%A0DockerHub/
Copyright: 'Attribution-non-commercial-shared in the same way 4.0' Reprint please keep the original link and author.