skip to Main Content
FROM php:7.4-fpm

RUN apt-get update && apt-get install -y 
        libfreetype6-dev 
        libjpeg62-turbo-dev 
        libpng-dev 
        libmcrypt-dev 
        gcc 
        make 
    && docker-php-ext-configure gd --with-freetype --with-jpeg 
    && docker-php-ext-install -j$(nproc) gd

RUN set -xe; 
    apt-get update -yqq && 
    pecl channel-update pecl.php.net && 
    apt-get install -yqq 
    apt-utils 
    libzip-dev zip unzip && 
    docker-php-ext-configure zip; 
    docker-php-ext-install zip && 
    php -m | grep -q 'zip'

RUN docker-php-ext-install pdo_mysql
RUN apt-get install -y nano
RUN apt-get install -y build-essential cron
RUN apt-get install -y cron
RUN apt-get install -y procps
RUN apt-get install -y net-tools

RUN apt-get update && apt-get install libmagickwand-dev -y --no-install-recommends 
    && pecl install imagick-3.5.1 
    && docker-php-ext-enable imagick

RUN apt-get install -y ghostscript


COPY --from=composer /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /composer
ENV PATH $PATH:/composer/vendor/bin


WORKDIR /var/www

RUN apt-get install -y git


COPY ./src /var/www
COPY  ./php/php.ini /usr/local/etc/php/php.ini
COPY  ./php/policy.xml /etc/ImageMagick-6/policy.xml

RUN chmod -R 777 /var/www/storage
RUN chmod -R 777 /var/www/bootstrap

I have docker file like this.

It can create the container but, there is no server in it.

in container, it accept only ip6

tcp6       0      0 :::9000                 :::*                    LISTEN

I want to access fpm-cgi server by curl localhost 9000

Where should I set?

2

Answers


  1. try it in the docker container

    service php7.4-fpm start
    

    if it works, you can add it to Dockerfile as below

    RUN service php7.4-fpm start
    

    you can check stop,start,staus

    service php7.4-fpm status|stop|start
    
    Login or Signup to reply.
  2. First and foremost, fix your permissions and do not expose services running as root.

    FROM php:7.4-fpm
    
    RUN groupadd -g 101 nginx && 
        useradd -u 101 -ms /bin/bash -g nginx nginx
    
    # ...
    
    RUN chown -R nginx:nginx /var/www/storage
    RUN chown -R nginx:nginx /var/www/bootstrap
    

    Next, you need to expose the service to the containers network, preferably as nginx.

    USER nginx
    EXPOSE 9000
    CMD ["php-fpm"]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search