如何提交docker镜像到DockerHub
Write a Dockerfile
In detail:
FROM(指定基础image)
构建指令,必须指定且需要在Dockerfile其他指令的前面。后续的指令都依赖于该指令指定的image。FROM指令指定的基础image可以是官方远程仓库中的,也可以位于本地仓库。FROM <image>
FROM <image>:<tag>
MAINTAINER(用来指定镜像创建者信息)构建指令,用于将image的制作者相关的信息写入到image中。当我们对该image执行docker inspect命令时,输出中有相应的字段记录该信息。
MAINTAINER <name>
RUN(安装软件用)构建指令,RUN可以运行任何被基础image支持的命令。如基础image选择了ubuntu,那么软件管理部分只能使用ubuntu的命令。
RUN <command> (the command is run in a shell - `/bin/sh -c`)
RUN ["executable", "param1", "param2" ... ] (exec form)
CMD(设置container启动时执行的操作)设置指令,用于container启动时指定的操作。该操作可以是执行自定义脚本,也可以是执行系统命令。该指令只能在文件中存在一次,如果有多个,则只执行最后一条。
CMD ["executable","param1","param2"] (like an exec, this is the preferred form)
CMD command param1 param2 (as a shell)
ENTRYPOINT(设置container启动时执行的操作)设置指令,指定容器启动时执行的命令,可以多次设置,但是只有最后一个有效。
ENTRYPOINT ["executable", "param1", "param2"] (like an exec, the preferred form)
ENTRYPOINT command param1 param2 (as a shell)
USER(设置container容器的用户)设置指令,设置启动容器的用户,默认是root用户。
EXPOSE(指定容器需要映射到宿主机器的端口)
EXPOSE <port> [<port>...]
# 映射多个端口
EXPOSE port1 port2 port3
ENV(用于设置环境变量)
ENV <key> <value>
ENV JAVA_HOME /path/to/java/dirent
ADD(从src复制文件到container的dest路径)
ADD <src> <dest>
For example, create a dockerfile in /home/pyt/test/:
FROM ubuntu:14.04.4
MAINTAINER puyangsky "puyangsky@163.com"
RUN apt-get update
RUN apt-get install -y nginx
RUN echo "hi , i am in your container" > /usr/share/nginx/html/index.html
expose 80
Build the image:
# docker build -t="puyangsky/test:v0.1" /home/pyt/test/
the result is like:
we see all images:
# docker images
Run the image
the second one is that we just created. And we run it up.
# docker run -d -p 80:80 --name test puyangsky/test:v0.1 nginx -g "daemon off;"
4f6306d2ff200ce37cd3c1ddffee97d29725aeb1871122051ca9a96e0ee852a0
we open the browser and type "localhost:80" and we get:
Push the image to Dockerhub
root@pyt:/home/pyt/test# docker push puyangsky/test:v0.1
The push refers to a repository [puyangsky/test] (len: 1)
229fc9eec22a: Image already exists
737e1830ecac: Image successfully pushed
12094b42ed11: Image successfully pushed
2ff6c8fffe7e: Image successfully pushed
874509123f48: Image successfully pushed
87d8afb341b5: Image successfully pushed
46e772baf32a: Image successfully pushed
0a7a3b768106: Image successfully pushed
e094bcb9d0fe: Image successfully pushed
a16f6804bd85: Image successfully pushed
Digest: sha256:174cec58394568c6af9a8a98c822a352f535811b2c30171e0e2e217bd60436be
And the image is uploaded to hub.docker.com, https://hub.docker.com/r/puyangsky/test/
Automated from github
Created a github repo: https://github.com/puyangsky/nginx_demo, and create from dockerhub.
So the image is automated by the github repo at https://hub.docker.com/r/puyangsky/nginx_demo/
如何提交docker镜像到DockerHub的更多相关文章
- 如何push一个docker镜像到DockerHub上
在DockerHub上创建账号:https://hub.docker.com/ 这里我的账号是firewarm 本地下载镜像(这里拿alpine做示例),并为镜像打tag [root@host-30 ...
- 发布Docker 镜像到dockerhub
公有仓库 docker提供了一个类似于github的仓库dockerhub, 网址 https://hub.docker.com/ 需要注册使用 注意要保证image的tag是账户名,如果镜像名字不对 ...
- 如何使用vs将asp.net core项目添加容器支持并发布docker镜像到私有dockerhub和添加k8s/helm管理
这篇文章介绍一下,如何使用VS2017给asp.net core添加容器支持,并发布镜像到私有docker hub,然后用chart管理容器镜像的操作流程. 话不多说,just do it. 新建项目 ...
- [Docker镜像] 关于阿里云容器镜像服务的使用(以天池比赛提交镜像为例)
最近在参加天池比赛,由于比赛需要使用阿里云容器镜像服务完成线上预测任务,所以花费了3-4天的时间了解并使用Docker完成相关镜像操作,在此分享下我学习的内容,以下是本文的目录结构: 介绍 镜像 容器 ...
- Docker镜像的管理和创建
1. Docker镜像和Docker容器: Docker镜像实际上是一系列的文件系统,通常的Linux系统一般是两层文件系统,bootfs和rootfs,bootfs就是bootloader ...
- 使用镜像仓库托管自己构建的Docker镜像
自己构建的Docker镜像,默认存储在本机中,Docker有提供某些方式分享这些镜像,但不是主流的镜像分享方式,也有违于开源社区的共享精神. 本文介绍如何使用GitHub托管Dockerfile:使用 ...
- Docker镜像细节
前言 只有光头才能变强. 文本已收录至我的GitHub仓库,欢迎Star:https://github.com/ZhongFuCheng3y/3y 回顾前面: 为什么需要Docker? Docker入 ...
- docker镜像基本操作
操作镜像 使用 docker 命令行操作 docker 镜像 获取镜像 使用「docker pull +镜像名称」从网络上下载image镜像 core@localhost ~ $ docker pul ...
- Docker容器打包成镜像 - OpenDaylight官方 SDN Hub Tutorial VM 的docker镜像
由于工作需要,在看OpenDaylight (一个SDN的开源控制器) 官方Tutorial有一个比较基础且介绍比较详细的文档(http://sdnhub.org/tutorials/opendayl ...
随机推荐
- ios 项目引用全局pch文件
1.在项目中新建添加PCH文件 把这些记下来,下次直接粘贴:$(SRCROOT)/工程名/pch文件名
- vim编辑格式与环境设置
set wildmenu set backspace= set pastetoggle=<f3> filetype on filetype plugin on filetype inden ...
- 测试C++代码与WebBrowser HTML的互动
testWebBrowserDlg.h // testWebBrowserDlg.h : 头文件 // #pragma once #include "explorer1.h" #i ...
- SUSE Linux Enterprise Server 11 软件源
1.添加软件源 zypper ar http://ftp5.gwdg.de/pub/opensuse/discontinued/distribution/11.4/repo/oss oss zyppe ...
- CentOS6.4完全安装FFmpeg手记
鼓捣媒体的人对FFmpeg应该不会陌生,它不仅功能强大,结构优美,灵活.易扩展,也是很其他多媒体播放器的基础,例如VLC,Mplayer等等,还有好多商业播放器都用了ffmpeg,但这些商业软件却没有 ...
- win10下vs2015配置Opencv3.1.0过程详解
下载安装Opencv3.1.0 下载Opencv3.1.0,进入官网,点击opencv for windows即可下载. 点击运行下载好的文件.实际上,opencv的安装程序就是解压缩文件,个人因为 ...
- JavaScript-join连接符
1.转字符串:2种 1.将数组中每个元素都转为字符串,再用逗号分隔:var str=String(arr); 2.将数组中每个元素都字符串,再用自定义下标连接每个元素 var str=arr.join ...
- Linux下的网络远程安装
Linux下的网络远程安装 1.用RHEL6.5光盘安装第一台服务器 2.在第一台服务器上配置YUM服务器 先创建一个挂载 #mount #umount /dev/cdrom #mkdir /mnt/ ...
- Registered Nurse in the US
注册护士移民美国的条件 美国护士RN考试介绍 美国注册护士考试复习 美国各州注册护士考试要求 CGFNS Registered nurse Top Paid Registered Nurses
- cordova3.X的部署和环境搭建教程
针对cordova3.0,至现在的3.6都能用. 一.准备工作: 1.下载Node.js 网址:http://nodejs.org/ 2.下载phonegap 打开CMD窗口 Windows平台: ...