John Davidson

docker - exec: "php-fpm": executable file not found in $PATH: unknown

0 comments
Message:


Getting below error while running docker-compose up -d for laravel Project.


ERROR: for groshop_laravel-env_1  Cannot start service laravel-env: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "php-fpm": executable file not found in $PATH: unknown

ERROR: for laravel-env Cannot start service laravel-env: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "php-fpm": executable file not found in $PATH: unknown
ERROR: Encountered errors while bringing up the project.

My dockerFile looks like


FROM centos:7

# Install some must-haves
RUN yum -y install vim wget sendmail
RUN yum -y install libtool make automake autoconf nasm libpng-static
RUN yum -y install git
RUN git --version

# Install PHP 7.1 on CentOS
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum install yum-utils
RUN yum install epel-release
RUN yum-config-manager --enable remi-php73

RUN yum --enablerepo=remi-php73 -y install php php-bcmath php-cli php-common php-gd php-intl php-ldap php-mbstring \
php-mysqlnd php-pear php-soap php-xml php-xmlrpc php-zip

RUN php -v

# Prepare PHP environment
COPY config/php/php-fpm.conf /etc/php-fpm.conf
COPY config/php/www.conf /etc/php-fpm.d/www.conf
COPY config/php/php.ini /usr/local/etc/php/php.ini
COPY config/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/bin/composer
RUN composer --version

# Install Node.js
RUN curl -sL https://rpm.nodesource.com/setup_7.x | bash -
RUN yum -y install nodejs
RUN yum list installed nodejs
RUN node -v

# Final update and clean up
RUN yum -y update --skip-broken
RUN yum clean all

# Define work directory
WORKDIR /var/www/laravel-boilerplate

# Expose ports
EXPOSE 9000

# CMD ["php-fpm", "-F", "-O"]
CMD ["php-fpm", "-F"]

Also i have php files under config. have tried CMD line with changes but no luck.
Any idea?
Also one other observation i looked at is, i couldnt see those php-fpm.* files under /etc but only supervisord.conf file with below content.



[supervisord] nodaemon=true


[program:php-fpm] command=/usr/sbin/php-fpm -F -R user = root
autostart = true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0




My Answer:
The `docker exec` command allows you to run a command inside a running container. This can be useful for troubleshooting, debugging, or performing administrative tasks within the container.

Here is the basic syntax for using `docker exec`:


docker exec [OPTIONS] CONTAINER COMMAND [ARG...]


- `OPTIONS`: Additional options that can be passed to the `docker exec` command.
- `CONTAINER`: The name or ID of the container in which you want to run the command.
- `COMMAND`: The command that you want to run inside the container.
- `ARG`: Additional arguments that can be passed to the command.

For example, to run a shell inside a running container named `my-container`, you can use the following command:


docker exec -it my-container /bin/bash


This will start a new interactive shell session inside the `my-container` container.

Rate this post

3 of 5 based on 4689 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us