2016-07-15 4 views
0

I의 nginx 서버를 시작하도록되어 다음 Dockerfile이 시작 때 내가 고정 표시기 빌드를 사용하여 만든 이미지를 시작했을 때도커 오류 이미지

# Set the base image to Ubuntu 
FROM ubuntu 

# File Author/Maintainer 
MAINTAINER myname "[email protected]" 

# Install Nginx 

# Add application repository URL to the default sources 
# RUN echo "deb http://archive.ubuntu.com/ubuntu/ raring main universe" >> /etc/apt/sources.list 

# Update the repository 
RUN apt-get update 

# Install necessary tools 
RUN apt-get install -y nano wget dialog net-tools 

# Download and Install Nginx 
RUN apt-get install -y nginx 

# Remove the default Nginx configuration file 
RUN rm -v /etc/nginx/nginx.conf 

# Copy a configuration file from the current directory 
ADD nginx.conf /etc/nginx/ 

# Append "daemon off;" to the configuration file 
RUN echo "daemon off;" >> /etc/nginx/nginx.conf 

# Expose ports 
EXPOSE 80 

# Set the default command to execute when creating a new container 
CMD service nginx start 

을, 나는 다음과 같은 오류가 발생합니다 :

에게
my-MacBook-Pro:nginx-docker me$ docker run -it myname:nginx-latest 
2016-07-15T12:57:00.525640076+02:00 container create 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth) 
2016-07-15T12:57:00.542025710+02:00 container attach 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth) 
                                           2016-07-15T12:57:00.573835719+02:00 network connect 5e0b48e45380f1548ab524cfa7bfe94ae952ce740df76fda9e35561a258e31ef (container=0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451, name=bridge, type=bridge) 
        2016-07-15T12:57:00.654772110+02:00 container start 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth) 
                                                2016-07-15T12:57:00.656973139+02:00 container resize 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (height=42, image=myname:nginx-latest, name=sad_knuth, width=181) 
                                                * Starting nginx nginx                                      [fail] 
2016-07-15T12:57:00.715136152+02:00 container die 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (exitCode=1, image=myname:nginx-latest, name=sad_knuth) 
                                              2016-07-15T12:57:00.757891577+02:00 network disconnect 5e0b48e45380f1548ab524cfa7bfe94ae952ce740df76fda9e35561a258e31ef (container=0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451, name=bridge, type=bridge) 
my-MacBook-Pro:nginx-docker me$ 

는 편집 :

:

나는 심지어 권고에 따라 다음과 같은 시도

+1

이것을 시도해 볼 수 있습니까? 'docker ps -a'를 입력하면 컨테이너가 종료 상태로 표시됩니다. 그런 다음 '도커 로그 '을 실행하십시오. 출력을 게시 할 수 있습니까? – ryekayo

답변

0

CMD 서비스 nginx start는 nginx를 시작한 후 기본 프로세스가 immediatly 종료된다는 것을 의미합니다.

당신은

CMD /usr/sbin/nginx -g "daemon off;" 

그것이 데몬 모드로 실행되어 있지 않은지 확인해야합니다.
Other alternatives are here하지만 프로세스 수를 nginx로 제한하므로이 방법을 선호합니다.