基于容器制作镜像

一。镜像基础

 

一。基于容器制作镜像

  1. 查看并关联运行的容器

[gh@localhost ~]$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
4da438fc9a8e        busybox             "sh"                2 days ago          Up 3 seconds                            aaaaa
[gh@localhost ~]$ docker container attach aaaaa
/ # 

  2. 创建文件夹和文件

/ # mkdir /var/html
/ # vi /var/html/index.html
/ # cat /var/html/index.html
............
httpd
...........
/ # 

  3. 查看httpd服务帮助

/ # which httpd
/bin/httpd
/ # httpd -h
-f        前台运行
-h        家目录
/ # 

  4. 制作镜像

---- docker container commit --help

-a:作者信息

-c:修改COMMAND,即容器主程序

-m:说明

-p:暂停容器

[gh@localhost ~]$ docker container commit -a "name <abc@163.com>" -c 'CMD ["/bin/httpd","-f","-h","/var/html"]' -p aaaaa myhttpd:v9.0
sha256:9fdc2c89794f1d716a8ef3c90e4109991210e48fed46fa3f76dd9d35cc2e636f
[gh@localhost ~]$ docker image ls |grep "myhttpd"
myhttpd             v9.0                9fdc2c89794f        18 seconds ago      1.13MB
[gh@localhost ~]$ 

  5. 运行镜像

[gh@localhost ~]$ docker container run --name httpd -d myhttpd:v9.0 
e51a67a0346bd766b0716d6e0b2f5c101d98d45a0afd04a5b7f6ebc8007c24e1
[gh@localhost ~]$ docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
e51a67a0346b        myhttpd:v9.0        "/bin/httpd -f -h /v…"   6 seconds ago       Up 5 seconds                            httpd
4da438fc9a8e        busybox             "sh"                     2 days ago          Up 6 minutes                            aaaaa
[gh@localhost ~]$ 

  6. 访问服务

[gh@localhost ~]$ curl 172.17.0.3
............
httpd
...........
[gh@localhost ~]$ 

  7. 与容器关联

[gh@localhost ~]$ docker container exec -it httpd /bin/sh
/ # ps -e
PID   USER     TIME   COMMAND1 root       0:00 /bin/httpd -f -h /var/html11 root       0:00 /bin/sh16 root       0:00 ps -e
/ # 

   8. 登陆阿里云仓库(密码保存在家目录 .docker/config.json)

[gh@localhost ~]$ docker login --username=1596430280@qq.com registry.cn-shenzhen.aliyuncs.com
Password: 
Login Succeeded
[gh@localhost ~]$

  9. 修改标签(阿里云仓库里有操作说明)

[gh@localhost ~]$ docker image ls |grep "myhttpd"
myhttpd             v9.0                9fdc2c89794f        13 hours ago        1.13MB
[gh@localhost ~]$ docker image tag 9fdc2c89794f registry.cn-shenzhen.aliyuncs.com/ghh/test:v9.9
[gh@localhost ~]$ docker image ls |grep "9fdc2c89794f"
myhttpd                                      v9.0                9fdc2c89794f        13 hours ago        1.13MB
registry.cn-shenzhen.aliyuncs.com/ghh/test   v9.9                9fdc2c89794f        13 hours ago        1.13MB
[gh@localhost ~]$ 

  10. 推送镜像

[gh@localhost ~]$ docker image push registry.cn-shenzhen.aliyuncs.com/ghh/test:v9.9
The push refers to repository [registry.cn-shenzhen.aliyuncs.com/ghh/test]
49946ae5d4d2: Pushed 
6a749002dd6a: Pushed 
v9.9: digest: sha256:096ff2618334d8c79750770c1ac20ba6d8f33c6945dafaa7ae17bbbe3eafe5a2 size: 734
[gh@localhost ~]$ 

  11. 登出

转载于:https://www.cnblogs.com/GH-123/p/10226604.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388688.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

认识数据分析_认识您的最佳探索数据分析新朋友

认识数据分析Visualization often plays a minimal role in the data science and model-building process, yet Tukey, the creator of Exploratory Data Analysis, specifically advocated for the heavy use of visualization to address the limitations of numerical indi…

架构探险笔记10-框架优化之文件上传

确定文件上传使用场景 通常情况下&#xff0c;我们可以通过一个form&#xff08;表单&#xff09;来上传文件&#xff0c;就以下面的“创建客户”为例来说明&#xff08;对应的文件名是customer_create.jsp&#xff09;&#xff0c;需要提供一个form&#xff0c;并将其enctype属…

Windows Server 2003 DNS服务安装篇

导读-- DNS(Domain Name System&#xff0c;域名系统)是一种组织成层次结构的分布式数据库&#xff0c;里面包含有从DNS域名到各种数据类型(如IP地址)的映射“贵有恒&#xff0c;何必三更起五更勤;最无益&#xff0c;只怕一日曝十日寒。”前一段时间巴哥因为一些生活琐事而中止…

arima模型怎么拟合_7个统计测试,用于验证和帮助拟合ARIMA模型

arima模型怎么拟合什么是ARIMA&#xff1f; (What is ARIMA?) ARIMA models are one of the most classic and most widely used statistical forecasting techniques when dealing with univariate time series. It basically uses the lag values and lagged forecast error…

[WPF]ListView点击列头排序功能实现

[WPF]ListView点击列头排序功能实现 这是一个非常常见的功能&#xff0c;要求也很简单&#xff0c;在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了。微软的MSDN也已经提供了实现方式。微软的方法中&#xff0c;是通过ColumnHeader Templ…

天池幸福感的数据处理_了解幸福感与数据(第1部分)

天池幸福感的数据处理In these exceptional times, the lockdown left many of us with a lot of time to think. Think about the past and the future. Think about our way of life and our achievements. But most importantly, think about what has been and would be ou…

红草绿叶

从小到大喜欢阴天&#xff0c;喜欢下雨&#xff0c;喜欢那种潮湿的感觉。却又丝毫容不得脚上有一丝的水汽&#xff0c;也极其讨厌穿凉鞋。小时候特别喜欢去山上玩&#xff0c;偷桃子柿子&#xff0c;一切一切都成了美好的回忆&#xff0c;长大了&#xff0c;那些事情就都不复存…

詹森不等式_注意詹森差距

詹森不等式背景 (Background) In Kaggle’s M5 Forecasting — Accuracy competition, the square root transformation ruined many of my team’s forecasts and led to a selective patching effort in the eleventh hour. Although it turned out well, we were reminded t…

数据分析师 需求分析师_是什么让分析师出色?

数据分析师 需求分析师重点 (Top highlight)Before we dissect the nature of analytical excellence, let’s start with a quick summary of three common misconceptions about analytics from Part 1:在剖析卓越分析的本质之前&#xff0c;让我们从第1部分中对分析的三种常…

JQuery发起ajax请求,并在页面动态的添加元素

页面html代码&#xff1a; <li><div class"coll-tit"><span class"coll-icon"><iclass"sysfont coll-default"></i>全域旅游目的地</span></div><div class"coll-panel"><div c…

MAYA插件入门

我们知道&#xff0c; MAYA 是一个基于结点的插件式软件架构&#xff0c;这种开放式的软件架构是非常优秀的&#xff0c;它可以让用户非常方便地在其基础上开发一些自已想要的插件&#xff0c;从而实现一些特殊的功能或效果。 在MAYA上开发自已的插件&#xff0c;你有3种选择&a…

(原創) 如何使用C++/CLI读/写jpg檔? (.NET) (C++/CLI) (GDI+) (C/C++) (Image Processing)

Abstract因为Computer Vision的作业&#xff0c;之前都是用C# GDI写&#xff0c;但这次的作业要做Grayscale Dilation&#xff0c;想用STL的Generic Algorithm写&#xff0c;但C Standard Library并无法读取jpg档&#xff0c;用其它Library又比较麻烦&#xff0c;所以又回头想…

猫眼电影评论_电影的人群意见和评论家的意见一样好吗?

猫眼电影评论Ryan Bellgardt’s 2018 movie, The Jurassic Games, tells the story of ten death row inmates who must compete for survival in a virtual reality game where they not only fight each other but must also fight dinosaurs which can kill them both in th…

c#对文件的读写

最近需要对一个文件进行数量的分割&#xff0c;因为数据量庞大&#xff0c;所以就想到了通过写程序来处理。将代码贴出来以备以后使用。 //读取文件的内容 放置于StringBuilder 中 StreamReader sr new StreamReader(path, Encoding.Default); String line; StringBuilder sb …

ai前沿公司_美术是AI的下一个前沿吗?

ai前沿公司In 1950, Alan Turing developed the Turing Test as a test of a machine’s ability to display human-like intelligent behavior. In his prolific paper, he posed the following questions:1950年&#xff0c;阿兰图灵开发的图灵测试作为一台机器的显示类似人类…

关于WKWebView高度的问题的解决

关于WKWebView高度的问题的解决 IOS端嵌入网页的方式有两种UIWebView和WKWebView。其中WKWebView的性能要高些;WKWebView的使用也相对简单 WKWebView在加载完成后&#xff0c;在相应的代理里面获取其内容高度&#xff0c;大多数网上的方法在获取高度是会出现一定的问题&#xf…

测试nignx php请求并发数,nginx 优化(突破十万并发)

一般来说nginx 配置文件中对优化比较有作用的为以下几项&#xff1a;worker_processes 8;nginx 进程数&#xff0c;建议按照cpu 数目来指定&#xff0c;一般为它的倍数。worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;为每个进…

mardown 标题带数字_标题中带有数字的故事更成功吗?

mardown 标题带数字统计 (Statistics) I have read a few stories on Medium about writing advice, and there were some of them which, along with other tips, suggested that putting numbers in your story’s title will increase the number of views, as people tend …

使用Pandas 1.1.0进行稳健的2个DataFrames验证

Pandas is one of the most used Python library for both data scientist and data engineers. Today, I want to share some Python tips to help us do qualification checks between 2 Dataframes.Pandas是数据科学家和数据工程师最常用的Python库之一。 今天&#xff0c;我…

置信区间的置信区间_什么是置信区间,为什么人们使用它们?

置信区间的置信区间I’m going to try something a little different today, in which I combine two (completely unrelated) topics I love talking about, and hopefully create something that is interesting and educational.今天&#xff0c;我将尝试一些与众不同的东西…