상현에 하루하루
개발자의 하루

오프라인상태 Centos 7에 Docker 설치하기

( 업데이트: )

최근에 오프라인상태 VPN을 통해서 접속한 Centos 7에다 web/was를 구축해야 될 일이 생겼습니다. 한번 구축하고나면 권한이 모두 제거되기때문에 이후에도 접속해서 was 관련 설정이나 구축을 하기위해서 Docker로 구성해야겠다 생각했습니다.

처음부터 난관이었습니다. Centos 7이라는 것을 처음 접하게되었고 rpm 이라던지 yum으로 설치해야된다던지 처음접하는 저한태는 매우 어려웠습니다. 그래서 제가 삽질하던 경험을 공유하려합니다.

네트워크 연결이 되어있는 다른 Linux Centos 7에서 아래 CLI를 실행하여 Docker 오프라인 설치에 필요한 모든 패키지를 식별합니다.

repoquery -R docker-ce-18.03.1.ce-1.el7.centos

출력에서 Docker 오프라인 설치를 완료하려면 다음 패키지가 필요하다는 것을 알았습니다.

  1. libsepol-2.5-8.1.el7
  2. libselinux-2.5-12.el7
  3. audit-libs-2.8.1-3.el7_5.1
  4. libsemanage-2.5-11.el7
  5. libselinux-utils-2.5- 12.el7
  6. policycoreutils-2.5-22.el7
  7. selinux-policy-3.13.1-192.el7
  8. libcgroup-0.41-15.el7
  9. selinux-policy-targeted-3.13.1-19
  10. libsemanage -python-2.5-11.el7
  11. audit-libs-python-2.8.1-3.el7_5.1
  12. setools-libs-3.3.8-2.el7
  13. python-IPy-0.75-6.el7
  14. pigz-2.3.3-1.el7.centos
  15. checkpolicy-2.5-6.el7
  16. policycoreutils-python-2.5-22.el7
  17. container-selinux-2 : 2.68-1.el7
  18. docker-ce -18.03.1.ce-1.el7.centos
  19. audit-2.8.1-3.el7_5.1

그런 다음 yumdownloader를 사용하여 docker rpm 패키지와 모든 종속 패키지를 다운로드하였습니다.

yumdownloader -resolve docker-ce-18.03.1.ce-1.el7.centos

위의 패키지(tar cf docker.ce.offline.tar *.rpm)를 보관하고 오프라인 Centos 7 가상 머신에 업로드했습니다. 그런 다음 rpm CLI를 사용하여 Docker를 설치합니다.

rpm -ivhreplacefilesreplacepkgs * .rpmCode language: CSS (css)

설치가 완료된 후 Docker 서비스를 시작하고 활성화합니다.

systemctl enable docker

/etc/systemd/system/multi-user.target.wants/docker.service에서 /usr/lib/systemd/system/docker.service로 심볼릭 링크를 생성했습니다.

sudo ln -s <meta charset="utf-8"><em>/etc/systemd/system/multi-user.target.wants/docker.service</em> <meta charset="utf-8"><em>/usr/lib/systemd/system/docker.service</em>Code language: HTML, XML (xml)
systemctl start docker