인프런 커뮤니티 질문&답변

오세한님의 프로필 이미지
오세한

작성한 질문수

Jenkins를 이용한 CI/CD Pipeline 구축

실습5) Jenkins + Ansible Playbook 사용하기 ②

섹션3 실습5번 진행 중 오류 관련해서 질문 드립니다!

작성

·

371

0

안녕하세요 다름이 아니라 실습5번에서 yml 을 실행하려는데 다음과 같은 오류가 발생하였습니다 ㅠ

 

ERROR: failed to register layer: Error processing tar file(exit status 1): Error while loading /: Permission denied\n\n------\n > [1/2] FROM docker.io/library/tomcat:9.0@sha256:e2bdaf135765a6ce6a3d92db3b58943e021ed3301e21b730c7e43a8dcd35351c:\n------\nDockerfile:1\n--------------------\n 1 | >>> FROM tomcat:9.0\r\n 2 | \r\n 3 | LABEL org.opencontainers.image.authors=\"edowon0623@gmail.com\"\r\n--------------------\nERROR: failed to solve: failed to register layer: Error processing tar file(exit status 1): Error while loading /: Permission denied", "stderr_lines": ["#1 [internal] load .dockerignore",

 

permission 같은 단어가 있는 거 보니 권한 문제인거 같은데 검색해도 원인이 따로 나오는 거 같지 않아서 질문 드립니다!

아래는 오류 전문입니다

 

[root@acb70fd76efa ~]# ansible-playbook -i hosts first-devops-playbook.yml [WARNING]: An error occurred while calling ansible.utils.display.initialize_locale (unsupported locale setting). This may result in incorrectly calculated text widths that can cause Display to print incorrect line lengths PLAY [all] ***************************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************** ok: [172.17.0.3] TASK [build a docker image with deplyed war file] ************************************************************************************************************************************************************************************** fatal: [172.17.0.3]: FAILED! => {"changed": true, "cmd": ["docker", "build", "-t", "cicd-project-ansible", "."], "delta": "0:00:26.702816", "end": "2024-02-12 12:37:07.840628", "msg": "non-zero return code", "rc": 1, "start": "2024-02-12 12:36:41.137812", "stderr": "#1 [internal] load .dockerignore\n#1 transferring context: 2B 0.0s done\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 171B 0.0s done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/tomcat:9.0\n#3 DONE 1.8s\n\n#4 [internal] load build context\n#4 transferring context: 39B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/tomcat:9.0@sha256:e2bdaf135765a6ce6a3d92db3b58943e021ed3301e21b730c7e43a8dcd35351c\n#5 resolve docker.io/library/tomcat:9.0@sha256:e2bdaf135765a6ce6a3d92db3b58943e021ed3301e21b730c7e43a8dcd35351c done\n#5 sha256:e2bdaf135765a6ce6a3d92db3b58943e021ed3301e21b730c7e43a8dcd35351c 979B / 979B done\n#5 sha256:d8bf4e0f8db83dd8836c709953ac17b85c7892065a0dd52e9ed14a165283c0c5 2.00kB / 2.00kB done\n#5 sha256:1086ae6876558ceb14909f97116645d8fbd906fa4b49157d3c569589794a18f9 13.16kB / 13.16kB done\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 0B / 30.45MB 0.1s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 0B / 17.46MB 0.2s\n#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 0B / 159.59MB 0.2s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 1.05MB / 17.46MB 0.5s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 2.10MB / 17.46MB 0.7s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 3.15MB / 17.46MB 0.8s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 4.19MB / 17.46MB 1.0s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 2.10MB / 30.45MB 1.6s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 5.24MB / 17.46MB 1.6s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 4.19MB / 30.45MB 2.0s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 6.29MB / 17.46MB 2.0s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 6.29MB / 30.45MB 2.5s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 8.39MB / 30.45MB 2.8s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 7.34MB / 17.46MB 2.8s\n#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 8.39MB / 159.59MB 3.0s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 10.49MB / 30.45MB 3.1s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 12.58MB / 30.45MB 3.4s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 14.68MB / 30.45MB 3.8s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 8.39MB / 17.46MB 3.8s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 16.78MB / 30.45MB 4.1s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 18.87MB / 30.45MB 4.6s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 9.44MB / 17.46MB 4.7s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 20.97MB / 30.45MB 4.9s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 10.49MB / 17.46MB 5.3s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 23.07MB / 30.45MB 5.5s\n#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 16.78MB / 159.59MB 5.7s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 11.53MB / 17.46MB 5.8s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 25.17MB / 30.45MB 6.3s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 12.58MB / 17.46MB 6.3s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 13.63MB / 17.46MB 6.6s\n#5 sha256:31bd5f451a847d651a0996256753a9b22a6ea8c65fefb010e77ea9c839fe2fac 27.26MB / 30.45MB 6.9s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4 14.68MB / 17.46MB 6.9s\n#5 sha256:26611c45681a8966387aee7b2e1494405e20bc5a46dc5da0af9228c45f8e8ec4...(중간 생략)... 135.27MB / 159.59MB 20.6s", "#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 143.65MB / 159.59MB 21.5s", "#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 153.09MB / 159.59MB 22.6s", "#5 sha256:08e5157807e9b9c65d974d61c154ede442ef90216bfc1a6bf15c9056fc25fba9 159.59MB / 159.59MB 23.4s done", "#5 ERROR: failed to register layer: Error processing tar file(exit status 1): Error while loading /: Permission denied", "", "------", " > [1/2] FROM docker.io/library/tomcat:9.0@sha256:e2bdaf135765a6ce6a3d92db3b58943e021ed3301e21b730c7e43a8dcd35351c:", "------", "Dockerfile:1", "--------------------", " 1 | >>> FROM tomcat:9.0", " 2 | ", " 3 | LABEL org.opencontainers.image.authors=\"edowon0623@gmail.com\"", "--------------------", "ERROR: failed to solve: failed to register layer: Error processing tar file(exit status 1): Error while loading /: Permission denied"], "stdout": "", "stdout_lines": []} PLAY RECAP ***************************************************************************************************************************************************************************************************************************** 172.17.0.3 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

 

답변 1

0

Dowon Lee님의 프로필 이미지
Dowon Lee
지식공유자

안녕하세요, 이도원입니다.

 

먼저 해당 작업을 Windows 환경에서 재테스트 해 보았을 시 정상 작동되었음을 확인해 보고 답변드립니다.

테스트 환경) Windows + Docker Desktop

- ansible-server container

- docker-server container

올려주신 오류를 확인해 보면, 말씀하신 것 처럼 Permission denied 오류가 발생한 것 같습니다. 확인 해 보실 수 있는 부분을 몇가지 정리해 보면,

1. ansible 서버에서 ansible 명령어로 172.17.0.3 서버에 명령어 전달이 되는지? ansible에서 접속하려는 대상의 IP가 172.17.0.3이 맞는지?

    root@ansible-server ~] # ansible all -m ping

2. 설정하신 ansible hosts의 정보가 172.17.0.3 맞고 ansible에서 ssh 접속이 가능한지 (암호를 입력하지 않고 접속 가능한지 확인 필요)

    root@ansible-server ~] # ssh root@172.17.0.3

3. 172.17.0.3 서버에서 ansible-playbook 파일에서 작업하려고 하는 Docker 명령어를 직접 실행하였을 때 정상적으로 작동 되는지? 이 작업을 테스트하기 위해서는 172.17.0.3 서버에 Dockerfile과 hello-world.war 파일이 존재하는지 확인하신 다음에 진행하시기 바랍니다.

    root@172.17.0.3 ~] # docker build -t cicd-project-ansible .

위 항목을 확인해 보신 후 해결이 안되시면, 작업하신 내용을 다시 한번 공유해 주시기 바랍니다.

 

감사합니다.

오세한님의 프로필 이미지
오세한

작성한 질문수

질문하기