Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

445
Views
Docker Laravel Run Port Expose Permiso denegado

Queremos dockerizar una aplicación Laravel lista para implementarse en AWS ECR/ECS. Hicimos algunas pruebas pero estamos teniendo algunos problemas con la configuración de Apache.

Tenemos el siguiente Dockerfile:

 FROM php:7.4-apache WORKDIR /var/www/html # Copy composer.lock and composer.json COPY composer.lock* composer.json* /var/www/html/ # install all the dependencies and enable PHP modules RUN apt-get update && apt-get upgrade -y && apt-get install -y \ procps \ nano \ git \ unzip \ libicu-dev \ zlib1g-dev \ libxml2 \ libxml2-dev \ libreadline-dev \ supervisor \ cron \ libzip-dev \ libpng-dev \ && docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \ && docker-php-ext-configure intl \ && docker-php-ext-install \ pdo_mysql \ sockets \ intl \ opcache \ zip \ gd \ && rm -rf /tmp/* \ && rm -rf /var/list/apt/* \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean # disable default site and delete all default files inside APP_HOME RUN a2dissite 000-default.conf # put apache and php config for Laravel, enable sites COPY ./docker/general/laravel.conf /etc/apache2/sites-available/laravel.conf RUN a2ensite laravel.conf # enable apache modules RUN a2enmod rewrite RUN a2enmod ssl # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh RUN bash nodesource_setup.sh # NPM for frontend builds RUN apt-get install nodejs RUN rm nodesource_setup.sh # Add user for laravel application RUN groupadd -g 1000 www RUN useradd -u 1000 -ms /bin/bash -g www www # Copy existing application directory contents COPY ./ /var/www/html # Copy existing application directory permissions COPY --chown=www:www . /var/www/html # Change current user to www USER www # Expose port 9000 and start php-fpm server EXPOSE 80

Y docker-compose.yml:

 version: '3' services: laravel: &laravel-template image: laravel:latest build: context: . args: - "BUILD_ARGUMENT_ENV=dev" - "BUILD_ARGUMENT_DEBUG_ENABLED=false" dockerfile: ./Dockerfile container_name: laravel expose: - 80 ports: - 8080:80 volumes: - .:/var/www/html

Cuando implementamos la aplicación, no muestra ningún error, pero creemos que se debe a la exposición del puerto, si intentamos ejecutarlo localmente con docker run -it -p 8080:80 tok , muestra:

 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs

¿Nos estamos perdiendo algo?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Pasé mucho tiempo depurando el mensaje ServerName, solo para descubrir que era una pista falsa. Es una advertencia y puede ignorarse con seguridad. Resolvimos el problema agregando USER root al final del Dockerfile, lo que soluciona el error de permisos.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!