This process needs CentOS7 host that has internet connection for creating offline repo.
This particular example illustrates installing nginx specifically, but I think this should work for any other packages.
host-with-net:/# yum install yum-plugin-downloadonly yum-utils createrepo
host-with-net:/# mkdir -p /root/playground/nginx
host-with-net:/# mkdir -p /root/playground/nginx-installroot
host-with-net:/# vi /etc/yum.repos.d/nginx.repo[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
host-with-net:/# yum install --downloadonly --installroot=/root/playground/nginx-installroot --releasever=7 --downloaddir=/root/playground/nginx nginx
host-with-net:/# createrepo --database /root/playground/nginx
host-with-net:/# rm -rf /root/playground/nginx-installroot
host-with-net:/# vi /etc/yum.repos.d/offline-nginx.repo[offline-nginx]
name=CentOS-$releasever - nginx
baseurl=file:///root/playground/nginx
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
host-with-net:/# repoclosure --repoid=offline-nginxCopy the offline repo that you just created(/root/playground/nginx) to the host that has no internet connection by any means(ex, docker cp, scp, via usb, ...).
host-without-net:/# vi /etc/yum.repos.d/offline-nginx.repo[offline-nginx]
name=CentOS-$releasever - nginx
baseurl=file:///root/playground/nginx
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
host-without-net:/# yum --disablerepo=\* --enablerepo=offline-nginx install nginx --nogpgcheck
Reference: https://fabianlee.org/2016/10/02/node-js-packaging-modules-for-offline-deployment-using-npm-bundle/