[13th][Day12] docker commit

前几天我都是 pull 别人 build 好的 docker image , 那麽如何编辑一个属於自己的 docker image呢?

build image 的两个方法:

  1. docker commit command
  2. docker build & Dockerfile 文件

一般来说我们并不是创建一个『全新的』image,而是基於一个已经存在的 basic image,比方说 ubuntu / fedora ... etc 往上叠加成属於自己的 image

首先要拥有一个 docker hub 帐号
https://hub.docker.com/signup

在本机login docker hub

docker login

https://ithelp.ithome.com.tw/upload/images/20210920/20119546wexryljeep.png

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.

create 一个要进行修改的 custome container

docker run -it ubuntu bash

https://ithelp.ithome.com.tw/upload/images/20210920/20119546ITfGbuaEDm.png

安装 apache package

root@4ed09b9645e0:/# apt-get -yqq update
root@4ed09b9645e0:/# apt-get -y install apache2

选择 apache 时区
https://ithelp.ithome.com.tw/upload/images/20210920/20119546meA7BPS1bh.png

提交custome container

docker commit e0090b4914f4 eric211924/apache2

https://ithelp.ithome.com.tw/upload/images/20210920/20119546Er2eg9GptU.png

检查创建的 image

docker images eric211924/apache2

https://ithelp.ithome.com.tw/upload/images/20210920/201195469HOLyCq34x.png

提交一个新的 custome container

docker commit -m"a new custom image" -a"Eric Learning" e0090b4914f4 eric211924/apache:webserver

此处的 hash_id 是 container id 而非 image id
https://ithelp.ithome.com.tw/upload/images/20210920/201195466xszse35y5.png

查看详细讯息

docker inspect eric211924/apache:webserver

https://ithelp.ithome.com.tw/upload/images/20210920/20119546qpQ2W4XRGy.png

从自己的 image run 一个新的 container

docker run -it eric211924/apache:webserver bash

https://ithelp.ithome.com.tw/upload/images/20210920/20119546gvkrLfGwIM.png


<<:  初学者跪着学JavaScript Day5 : 资料型别:Primitive values 和 Non-primitive values

>>:  [13th][Day10] waiting group

day25 矮额是callback,把它变成flow好了 简单的callbackFlow

终於写道flow的最後一篇了 尽管我们在自己的开发上,能够高兴地写coroutine和suspend...

21. React简易实作_购物车清单( 将下层State提升给上层元件 )

今天要解释的是: 如何将下层State提升给上层元件。 但如果没有举例真的太抽象了,所以就乾脆做个功...

铁人赛 Day16 -- 前端工程师一定要会的 -- RWD响应式网页 @media 媒体查询

@media 基本语法 一样是写在style当中,和CSS一样 @media screen and ...

DAY 18 『 画面间跳页传值 - Protocol And Delegate 』

昨天介绍完如何跳页,今天将会分享如何跳页传值。 成品: 刚执行模拟器的样子 按下 Button 後会...

[Day6] 最佳化均线交叉讯号

在开始今天最佳化的主题之前,先对ma讯号的部分做个修正,把里面dropna的部分注解掉,今天发现後面...