[에러] OCI runtime create failed: container_linux.go:370: starting container process caused: exec:

nayoon·2021년 2월 1일
1

error

목록 보기
1/4

문제 상황

프로젝트 파일을 수정하고 이미지를 빌드해서 도커를 띄우려고 하는데, 아래와 같이 에러가 뜨면서 도커가 안 띄워진다.

> docker-compose stop
> sudo docker-compose up --build -d                                   
(boanbot)  ubuntu@ip-172-31-27-226  /srv/boanbot   master ± ⬆ ✹ ✭  sudo docker-compose up --build -d                                   (1h22m) 02:30:18  
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Removing boanbot
Building web
Sending build context to Docker daemon  16.78MB

Step 1/10 : FROM ubuntu:latest
 ---> f63181f19b2f
Step 2/10 : MAINTAINER nayoonkym@gmail.com
 ---> Using cache
 ---> ad6b45a1f0b2
Step 3/10 : WORKDIR /srv/boanbot
 ---> Using cache
 ---> f6e5a89e9d0e
Step 4/10 : RUN apt-get update
 ---> Using cache
 ---> a91860c52766
Step 5/10 : RUN apt-get update
 ---> Using cache
 ---> a0a9d74c419f
Step 6/10 : RUN apt-get install -y python3.8 python3-pip --fix-missing
 ---> Using cache
 ---> a852e9271db0
Step 7/10 : WORKDIR /srv/boanbot
 ---> Using cache
 ---> f8d76cc5ac13
Step 8/10 : COPY requirements.txt /srv/boanbot
 ---> Using cache
 ---> f266f69904aa
Step 9/10 : RUN pip3 install -r requirements.txt
 ---> Using cache
 ---> 1e8e45206400
Step 10/10 : COPY . /srv/boanbot
 ---> Using cache
 ---> c5ca4fa46841
Successfully built c5ca4fa46841
Successfully tagged boanbot:latest
Recreating 7b35d359a502_boanbot ... error

ERROR: for 7b35d359a502_boanbot  Cannot start service web: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "gunicorn": executable file not found in $PATH: unknown

ERROR: for web  Cannot start service web: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "gunicorn": executable file not found in $PATH: unknown
ERROR: Encountered errors while bringing up the project.

문제 해결을 위한 구글링

일단 구글링부터 했더니 나와 같은 문제에 직면한 사람을 만날 수 있었다.

https://stackoverflow.com/questions/49928825/gunicorn-throwing-error-cannot-find-executable-on-path-docker-nginx

이 글에서 다음과 같은 글을 발견하였다.

해석하자면 가상환경에 gunicorn을 설치하고 requirements 파일에 포함시켜줬어! 인데 갑자기 등골이 서늘해서 에러 메시지로 돌아가보았다.

문제 상황 해석

에러 메시지를 보면 "OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "gunicorn": executable file not found in $PATH: unknown" 라고 나와있는데, "gunicorn" 실행 파일 위치를 찾을 수 없다라고 나온다.

혹시나 해서 requirements.txt를 살펴보았는데, gunicorn이 없다..!

> cat requirements.txt
asgiref==3.3.1
beautifulsoup4==4.9.3
bs4==0.0.1
certifi==2020.12.5
chardet==4.0.0
Django==3.1.5
djangorestframework==3.12.2
EasyProcess==0.3
idna==2.10
pytz==2020.5
PyVirtualDisplay==2.0
requests==2.25.1
selenium==3.141.0
soupsieve==2.1
sqlparse==0.4.1
urllib3==1.26.3
xlrd==2.0.1

pip으로 설치만 해놓고 requirements.txt에 포함시키지 않았던 것 같다.

> pip freeze > requirements.txt
> cat requirements.txt
asgiref==3.3.1
attrs==20.3.0
bcrypt==3.2.0
beautifulsoup4==4.9.3
bs4==0.0.1
cached-property==1.5.2
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
cryptography==3.3.1
distro==1.5.0
Django==3.1.5
djangorestframework==3.12.2
docker==4.4.1
dockerpty==0.4.1
docopt==0.6.2
EasyProcess==0.3
gunicorn==20.0.4 # 포함된 것을 확인할 수 있다!
idna==2.10
jsonschema==3.2.0
paramiko==2.7.2
pycparser==2.20
PyNaCl==1.4.0
pyrsistent==0.17.3
python-dotenv==0.15.0
pytz==2020.5
PyVirtualDisplay==2.0
PyYAML==5.4.1
requests==2.25.1
selenium==3.141.0
six==1.15.0
soupsieve==2.1
sqlparse==0.4.1
texttable==1.6.3
urllib3==1.26.3
websocket-client==0.57.0
xlrd==2.0.1

requirements.txt를 다시 만들고 docker-compose up --build -d를 다시 실행하였다.

Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Removing boanbot
Building web
Sending build context to Docker daemon  16.78MB

Step 1/10 : FROM ubuntu:latest
 ---> f63181f19b2f
Step 2/10 : MAINTAINER nayoonkym@gmail.com
 ---> Using cache
 ---> ad6b45a1f0b2
Step 3/10 : WORKDIR /srv/boanbot
 ---> Using cache
 ---> f6e5a89e9d0e
Step 4/10 : RUN apt-get update
 ---> Using cache
 ---> a91860c52766
Step 5/10 : RUN apt-get update
 ---> Using cache
 ---> a0a9d74c419f
Step 6/10 : RUN apt-get install -y python3.8 python3-pip --fix-missing
 ---> Using cache
 ---> a852e9271db0
Step 7/10 : WORKDIR /srv/boanbot
 ---> Using cache
 ---> f8d76cc5ac13
Step 8/10 : COPY requirements.txt /srv/boanbot
 ---> Using cache
 ---> 913f3f7d1b15
Step 9/10 : RUN pip3 install -r requirements.txt
 ---> Using cache
 ---> 2b2ce1a9c7b5
Step 10/10 : COPY . /srv/boanbot
 ---> 067eb4486326
Successfully built 067eb4486326
Successfully tagged boanbot:latest
Recreating 7b35d359a502_boanbot ... done
Recreating boanbot_nginx_1      ... done

잘 실행된 것을 확인할 수 있다!

참고

https://stackoverflow.com/questions/49928825/gunicorn-throwing-error-cannot-find-executable-on-path-docker-nginx

profile
뚜벅뚜벅 열심히 공부하는 개발자

1개의 댓글

comment-user-thumbnail
2021년 5월 17일

덕분에 오류를 금방 찾았습니다. 감사합니다!

답글 달기