Principal › Forums › Instalação e configuração › Container não instala nginx!!
- This topic has 8 replies, 2 voices, and was last updated 6 years, 11 months ago by Cristiano Diedrich.
- AuthorPosts
- Jefferson SouzaGuest
Bom dia Pessoal!
Estou iniciando com Docker e queria tirar uma dúvida, criei um container da seguinte forma:
docker run -i -t -p 8080:80 ubuntu:14.10 /bin/bash
Porém quando tento instalar o nginx ele retorna o seguinte erro:
Install these packages without verification? [y/N] y
Err http://archive.ubuntu.com/ubuntu/ utopic/main libgeoip1 amd64 1.6.2-1
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ utopic/main libxml2 amd64 2.9.1+dfsg1-4ubuntu1
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ utopic/main fontconfig-config all 2.11.1-0ubuntu3
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ utopic/main libfreetype6 amd64 2.5.2-2ubuntu1
404 Not Found [IP: 91.189.88.161 80]Err http://archive.ubuntu.com/ubuntu/ utopic/main nginx all 1.6.2-1ubuntu1.1
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/geoip/libgeoip1_1.6.2-1_amd64.deb 404 Not Found [IP: 91.189.88.161 80]Poderiam me ajudar por favor.. Obrigado!!
Cristiano DiedrichKeymasterOi Jefferson,
Antes de mandar instalar o nginx, tu executou o apt-get update?Jefferson SouzaGuestOi Cristiano, sim fiz o apt-get update… quando criei a imagem do linux criei apenas o /bin/bash será que isso implica na instalação do nginx ?
Cristiano DiedrichKeymasterOi Jefferson,
Pode compartilhar o Dockerfile que está utilizando?JeffersonGuestBoa noite Cristiano, consegui resolver meu problema … única dúvida que fiquei é de como eu aponto meu dockerfile para minha aplicação que se encontra na pasta /var/www/html/teste
Segue Dockerfile:
FROM ubuntu
MAINTAINER Jefferson Souza <[email protected]>
RUN apt-get update
RUN sudo apt-get install apache2 -y && apt-get install php5 -y
RUN sudo /etc/init.d/apache2 restart
#RUN apt-get install -y nginx && apt-get clean
#ADD ./configs/nginx.conf /etc/nginx/sites-enabled/default
#RUN ln -sf /dev/stdout /var/log/nginx/access.log
#RUN ln -sf /dev/stderr /var/log/nginx/error.log
#RUN echo “daemon off;” >> /etc/nginx/nginx.conf
EXPOSE 8080
#ENTRYPOINT [“/usr/sbin/nginx”]
CMD [“start”, “-g”]Obrigado
Cristiano DiedrichKeymasterOi Jefferson,
Você quer colocar o site dentro da imagem, ou isso pode ser um volume mapeado no momento da criação do container?
Se for na imagem você pode usar o comando COPY para copiar os dados da pasta para dentro da imagem.
Caso seja no momento da criação do container você pode user algo assim: docker run -d… -v /var/www/html/teste:/var/www/html por exemploJeffersonGuestBoa tarde Cristiano, tentei aqui mas não deu muito certo… se eu usar este comando WORKDIR /var/www/html/teste/ ele aponta para a minha aplicação que está na minha maquina ? ou ele se refere ao caminho que está no docker ?
JeffersonGuestEu tenho este arquivo como dockerfile:
FROM ubuntu:latest
MAINTAINER JEFFERSON <[email protected]># Install apache, PHP, and supplimentary programs. openssh-server, curl, and lynx-cur are for debugging the container.
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
apache2 php7.0 php7.0-mysql libapache2-mod-php7.0 curl lynx-cur# Enable apache mods.
RUN a2enmod php7.0
RUN a2enmod rewrite# Update the PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i “s/short_open_tag = Off/short_open_tag = On/” /etc/php/7.0/apache2/php.ini
RUN sed -i “s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/” /etc/php/7.0/apache2/php.ini# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid# Expose apache.
EXPOSE 80# Copy this repo into place.
WORKDIR www /var/www/site/# Update the default apache site with the config we created.
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf# By default start up apache in the foreground, override with /bin/bash for interative.
CMD /usr/sbin/apache2ctl -D FOREGROUND==========================================================================================
e tenho este arquivo como apache-config.conf:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/site<Directory /var/www/site/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
eu crio a imagem no docker mas quando eu tento fazer um acesso ao localhost não funciona..
Poderia me auxiliar por favor
Cristiano DiedrichKeymasterOi Jefferson,
Neste caso, tu não precisa o workdir no Dockerfile, mas quando subir o container baseado nessa imagem, usa o parametro -v, assim:docker run -d -p 80:80 -v /pasta/local/do/site:/var/www/site imagem
Dessa forma tu estará mapeando a pasta do host para dentro do container, e a melhor forma, na verdade, melhor do que colocar todo teu conteudo dentro da imagem.
- AuthorPosts