Sto cercando di ottenere la pagina Web predefinita da nginx caricata ma non riesco a connettermi alla porta 80 su http dopo il contenitore è in esecuzione.nginx: [emerge] bind() a 0.0.0.0:80 non riuscito (98: indirizzo già in uso) sulla finestra mobile
Sono in esecuzione finestra mobile 1.9.9
i passi che ho preso sono come segue:
ho creato un file Docker che questo:
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
il file finestra mobile copia il file di configurazione nginx di seguito in /etc/nginx/sites-available/default
e crea un collegamento simbolico a questo file per /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;
}
}
ho poi costruito l'immagine con:
docker build -t dnginx
ho iniziato il contenitore con:
docker run --name d3 -d -p 80:80 dnginx
Poi ho trovato l'indirizzo IP e ha tentato di connettersi
curl http://172.17.0.2
che restituisce
arricciatura: (7) Impossibile connettersi al 172.17.0.2 porta 80: Timeout dell'operazione
Aprii una shell bash nel contenitore e corse nginx
che restituito:
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()
Se corro netstat --listen
ottengo:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:80 *:* LISTEN
Se corro 01.232.ottengo:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
non ho assolutamente idea di cosa sta succedendo.
La stessa cosa accade se mi collego solo all'immagine di nginx.
Se si esegue 'netstat --listen' sul sistema operativo host che cosa sta ascoltando sulla porta 80? – mgaido
Ottengo: tcp 0 0 *: http *: * ASCOLTA – dagda1
Ciò significa che c'è qualcosa in ascolto sulla tua porta 80 ... – mgaido