Configure local yum on docker container.
Below are the simple steps to configure local yum using RHEL8 iso in docker container-
Step 1 - Mount your ISO on your (Docker)local system
[root@server109 ~]# mkdir /iso
[root@server109 ~]# mount -o loop /RHEL-8-0-0-BaseOS-x86_64.iso /iso
[root@server109 ~]#
Step 2 - Launch a container
[root@server109 _data]# docker container run -dit --name yum -v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso centos:7
a3483d2b718f339f6c3e9a4600e27e61086af512ef6bca67fcc1b73ada70838c
-dit - Tags(Detach, Interactive, Terminal )
--name yum - Name of container
-v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso - /iso here dvd will bind on container
centos:7 - Name of container image:version
Step 3 - Attach container
[root@server109 _data]# docker container attach yum
[root@a3483d2b718f /]# cd /iso/
[root@a3483d2b718f iso]# ls
AppStream BaseOS EFI EULA GPL RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-release TRANS.TBL extra_files.json images isolinux media.repo
Below are the simple steps to configure local yum using RHEL8 iso in docker container-
Step 1 - Mount your ISO on your (Docker)local system
[root@server109 ~]# mkdir /iso
[root@server109 ~]# mount -o loop /RHEL-8-0-0-BaseOS-x86_64.iso /iso
[root@server109 ~]#
Step 2 - Launch a container
[root@server109 _data]# docker container run -dit --name yum -v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso centos:7
a3483d2b718f339f6c3e9a4600e27e61086af512ef6bca67fcc1b73ada70838c
-dit - Tags(Detach, Interactive, Terminal )
--name yum - Name of container
-v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso - /iso here dvd will bind on container
centos:7 - Name of container image:version
Step 3 - Attach container
[root@server109 _data]# docker container attach yum
[root@a3483d2b718f /]# cd /iso/
[root@a3483d2b718f iso]# ls
AppStream BaseOS EFI EULA GPL RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-release TRANS.TBL extra_files.json images isolinux media.repo
RPM packages are available under AppStream and BaseOS directories, now we can configure yum very easily. Before that let's check how many packages are available from by default yum configuration -
[root@872e373dcd53 /]# yum repolist |grep repolist
repolist: 12225
Step 4 - Configure local yum
[root@a3483d2b718f iso]# cd /etc/yum.repos.d/
[root@a3483d2b718f yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-fasttrack.repo
[root@a3483d2b718f yum.repos.d]# rm -rf *.repo
[root@a3483d2b718f yum.repos.d]# ls
[root@a3483d2b718f yum.repos.d]#
[root@a3483d2b718f yum.repos.d]# vi myyum.repo
[dvd]
name = dvd1
baseurl=file:///iso/AppStream
gpgcheck=0
[dvd]
name = dvd2
baseurl=file:///iso/BaseOS
gpgcheck=0
[root@a3483d2b718f yum.repos.d]# yum repolist |grep repolist
repolist: 6647
That's all, your local yum has been configured!!
Comments
Post a Comment
Please share your experience.....