트센::aws-ec2 docker설치

YP J·2023년 2월 18일
0

42transcendence::

목록 보기
2/2

마지막 부분에 해결책과 고찰 이 있습니다.

  • 삽질 시작.

일단 OS 확인

  • cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
sudo yum install -y docker-ce docker-ce-cli containerd.io

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
https://download.docker.com/linux/centos/2/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (Docker CE Stable - x86_64),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=docker-ce-stable ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable docker-ce-stable
        or
            subscription-manager repos --disable=docker-ce-stable

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/2/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
  • docker-ce 에 해당하는 url을 못찾는 문제가 발생했다.

  • 그래서 검색후 Centos 버전에 맞는 docker-ce url로 baseurl을 수정해주었다.

  • /etc/yum.repos.d/docker-ce.repo 여기에서 docker-ce block 의 baesurl=

https://download.docker.com/linux/centos/8/x86_64/stable
  • 그랬더니 이젠 의존성 문제에 봉착했다.
ec2-user@ip-172-31-7-39 etc]$ sudo yum update -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
8 packages excluded due to repository priority protections
No packages marked for update
[ec2-user@ip-172-31-7-39 etc]$ sudo yum install docker -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
8 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 0:20.10.17-1.amzn2.0.2 will be installed
--> Processing Dependency: runc >= 1.0.0 for package: docker-20.10.17-1.amzn2.0.2.x86_64
--> Processing Dependency: libcgroup >= 0.40.rc1-5.15 for package: docker-20.10.17-1.amzn2.0.2.x86_64
--> Processing Dependency: containerd >= 1.3.2 for package: docker-20.10.17-1.amzn2.0.2.x86_64
--> Processing Dependency: pigz for package: docker-20.10.17-1.amzn2.0.2.x86_64
--> Running transaction check
---> Package containerd.io.x86_64 0:1.6.18-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.6.18-3.1.el7.x86_64
---> Package libcgroup.x86_64 0:0.41-21.amzn2 will be installed
---> Package pigz.x86_64 0:2.3.4-1.amzn2.0.1 will be installed
--> Finished Dependency Resolution
Error: Package: containerd.io-1.6.18-3.1.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
  • 그래서 다시 7로 버젼을 낮춰 봤다.
    sed -i 's/$releasever/7/g' /etc/yum.repos.d/docker-ce.repo
  • 결국 이거랑 똑같은 방법
    baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/
  • 계속 의존성 문제 발생해서 한번 해보자는 식으로 에러 메세지 표시대로 sellinux버전을 맞게 설치해줬다.
  • https://ttubeoki.tistory.com/41

`sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm

`

근데 그냥

sudo amazon-linux-extras install docker

이거 명령어 한줄이면 됐다..
심지어 docker centos 공홈 보고 따라하면 생기는
/etc/yum.repos.d/docker-ce.repo 파일도 삭제 하란다.

https://dog-developers.tistory.com/235
https://www.joinc.co.kr/w/man/12/aws/ec2DockerInstall

//

문제점.

내 환경에 대한 공부를 시작하지 않고 그냥 linux? -> centos 닌까 docker 공홈 centos 설치 버젼을보자
하고 했던게 문제였다.

일단 내가 설치하려는 환경의 OS에 대해 공부를 했어야 한다.

  • AWS 클라우드 최적화된 애플리케이션 패키지를 제공하는 독자적인 (extras)저장소, 인스턴스를 재 부팅하지 않고도 커널보안 및 버그패치를 적용 할 수 있는 Kernel Live Patching기능등을 사용 할 수 있다.

  • 일반적으로 리눅스 운영체제에서의 docker 인스톨은 docker 공식 사이트에서 관리하는 패키지 저장소의 것을 사용한다.

  • Amazon Linux 도 마찬가지로 사용 할 수 있겠으나 아무래도 AWS에서 제공하는 docker 버전을 사용하는게 깔끔할 것이다.

  • extras는 Amazon Linux2를 안전하게 사용하기 위한 검증된 패키지를 관리하는 저장소이다.

  • 어떤 버전의 프로그램을 설치 할지 고민 되면 그냥 extras 로 설치 해서 저장하면 된다.

profile
be pro

0개의 댓글