Próbuję pobrać domyślną stronę z nginx, ale nie mogę połączyć się z portem 80 przez http po kontener działa.nginx: [emerg] bind() do 0.0.0.0:80 nie powiodło się (98: Adres już w użyciu) na dockerze
Używam Döcker 1.9.9
Kroki Wziąłem są jak następuje:
stworzyłem złożyć Docker, że:
FROM ubuntu:15.10
RUN echo "Europe/London" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y nginx
RUN apt-get install -y supervisor
RUN apt-get update && apt-get -q -y install lsof
RUN apt-get install net-tools
RUN apt-get install psmisc
RUN apt-get -y install curl
ADD supervisor.nginx.conf /etc/supervisor.d/nginx.conf
CMD /usr/bin/supervisord -n
RUN rm -Rf /etc/nginx/conf.d/*
RUN rm /etc/nginx/sites-enabled/default
RUN mkdir /etc/nginx/logs/
RUN touch /etc/nginx/logs/error.log
RUN mkdir /usr/share/nginx/logs/
RUN touch /usr/share/nginx/logs/error.log
ADD ./conf/nginx.conf /etc/nginx/sites-available/default
RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
copy ./dist /usr/share/nginx/html
CMD /usr/bin/supervisord -n
kopie plików doker plik konfiguracyjny nginx poniżej do /etc/nginx/sites-available/default
i tworzy dowiązanie symboliczne do tego pliku dla /etc/nginx/sites-enabled/default
.
server {
root /usr/share/nginx/html;
index index.html index.htm;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 5d;
}
# deny access to . files, for security
#
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
}
Potem zbudował obraz z:
docker build -t dnginx
zacząłem pojemnik z:
docker run --name d3 -d -p 80:80 dnginx
I wtedy okazało się, że adres IP i próbował połączyć
curl http://172.17.0.2
Która zwróciła
Zwijanie się: (7) nie do łączenia 172.17.0.2 portu 80: Działanie limit czasu
że otwarte powłokę wybić otwór pojemnika, który prowadził nginx
wracający
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Jeśli biegnę netstat --listen
uzyskać:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:80 *:* LISTEN
Jeśli biegnę netstat -ltnp | grep :80
uzyskać:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
mam absolutnie żadnego pojęcia, co się dzieje.
To samo dzieje się, gdy podłączę się tylko do obrazu nginx.
Po uruchomieniu 'netstat --listen' na hosta systemu operacyjnego, co jest słuchanie na porcie 80? – mgaido
Otrzymuję: tcp 0 0 *: http *: * LISTEN – dagda1
Oznacza to, że jest coś, co nasłuchuje na porcie 80 ... – mgaido