Yum卸载软件并删除依赖,下载离线rpm包,制作拷贝rpm包dockerfile
生活随笔
收集整理的這篇文章主要介紹了
Yum卸载软件并删除依赖,下载离线rpm包,制作拷贝rpm包dockerfile
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
前景:四層代理的軟件包拷貝到容器yum倉庫里
1.查找安裝歷史?
~]# yum history Loaded plugins: fastestmirror, langpacks ID | Login user | Date and time | Action(s) | Altered -------------------------------------------------------------------------------28 | root <root> | 2021-11-29 14:12 | D, E | 3 27 | root <root> | 2021-11-29 14:12 | I, U | 3 26 | root <root> | 2021-11-29 14:11 | Downgrade | 2 25 | root <root> | 2021-11-29 14:08 | Erase | 1 24 | root <root> | 2021-11-29 11:50 | Install | 12.卸載所有依賴包
~]# yum history undo 243.下載rpm包并不安裝(以gcc為例)
# 先安裝離線工具 ~]# yum install -y yum-plugin-downloadonly#安裝gcc并了解其依賴 ~]# yum -y install gcc ...... Updated:gcc.x86_64 0:4.8.5-44.el7 Dependency Updated:cpp.x86_64 0:4.8.5-44.el7 libgcc.x86_64 0:4.8.5-44.el7 libgomp.x86_64 0:4.8.5-44.el7 Complete!#下載gcc與依賴包 ~]# yum reinstall --downloadonly --downloaddir=/root/nginx cpp.x86_64 0:4.8.5-44.el7 ~]# yum reinstall --downloadonly --downloaddir=/root/nginx libgcc.x86_64 0:4.8.5-44.el7 libgomp.x86_64 0:4.8.5-44.el7 gcc.x86_64 0:4.8.5-44.el7#--downloaddir=/root/nginx 安裝包放在/root/nginx下4.制作dockerfile
# 進入剛剛導(dǎo)入rpm包的目錄并把rpm包打包 ~]# cd /root/nginx/ ~]# tar -zcf nginx-rpm.tar ./# 創(chuàng)建dockerfile目錄 ~]# mkdir -p /data/docker ~]# mv nginx-rpm.tar /data/docker ~]# cd /data/docker# 書寫dockerfile ~]# vim Dockerfile # Description: nginx image FROM registry.tke.com/library/yum-repo:v18 ADD nginx-rpm.tar /repo/rpms RUN cd /repo/rpms && createrepo ./ # 開始制作,注意最后一個點 ~]# docker build -t registry.tke.com/library/yum-repo:v19 . Sending build context to Docker daemon 29.16MB Step 1/3 : FROM registry.tke.com/library/yum-repo:v18---> 6665a624f291 Step 2/3 : ADD nginx-rpm.tar /repo/rpms---> 1e7313d6914a Step 3/3 : RUN cd /repo/rpms && createrepo ./---> Running in 84143a07bc58 Spawning worker 0 with 152 pkgs Spawning worker 1 with 152 pkgs Spawning worker 2 with 151 pkgs Spawning worker 3 with 151 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete Removing intermediate container 84143a07bc58---> d5eb47188381 Successfully built d5eb47188381 Successfully tagged registry.tke.com/library/yum-repo:v19# 查看 ~]# docker images | grep registry.tke.com/library/yum-repo registry.tke.com/library/yum-repo v19 d5eb47188381 About a minute ago 1.2GB總結(jié)
以上是生活随笔為你收集整理的Yum卸载软件并删除依赖,下载离线rpm包,制作拷贝rpm包dockerfile的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VMware介绍与网络的三种模式
- 下一篇: linux下tar包追加与其他压缩追加方