When attempting to run a Docker container with a PHP image, an error is encountered: "standard_init_linux.go:207: exec user process caused 'exec format error'." Additionally, the entrypoint fails to

I have created a Dockerfile with the following contents:

FROM php:7.2-fpm-alpine

ARG USERID=1000
ARG GROUPID=1000

ENV DOCKER_UID=${USERID} \
    DOCKER_GID=${GROUPID} \
    PHP_CONF_DIR="/usr/local/etc/php/conf.d" \
    XDEBUG_CONF_FILE=${PHP_CONF_DIR}/docker-php-ext-xdebug.ini \
    XDEBUG_HOST="" \
    XDEBUG_IDE_KEY="" \
    XDEBUG_PORT=9000 \
    XDEBUG_DBGP=FALSE 

RUN echo "Installing Development Dependencies \n" &&\
    // more installation steps...

# Some code goes here...

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"]

Using this docker-compose.yml, I launched the container:

// docker-compose content goes here 

But I encountered an error that said "

standard_init_linux.go:207: exec user process caused 'exec format error'
". My Docker version is 18.09.6 and the docker-compose version is 1.24.0.

Edit 1

To fix the issue, I made some changes to the ENTRYPOINT:

CMD ["/bin/sh","-c","/usr/local/bin/entrypoint.sh", "php-fpm"]

In addition, I corrected a typo in the entrypoint script and tried launching php-fpm but it did not start running successfully. The script was updated as follows:

// Updated entrypoint script...

When analyzing the output after making these adjustments, I noticed that php-fpm was still not launching properly. Any idea why?

Even after changing the last line of entrypoint.sh from one command to another, the problem persisted. Previous solutions attempted based on external resources also failed. Is there something different about how Docker handles entrypoints now?

Trying alternative methods like:

CMD ["/bin/sh","-c","/usr/local/bin/entrypoint.sh", "php-fpm"]

Did not produce the desired outcome. Further investigation is required to understand why.

Answer №1

You have a typographical error in your entrypoint.sh

#/bin/sh => #!/bin/sh

Answer №2

To improve the process, consider transitioning from exec format to shell format for launching your entrypoint:

ENTRYPOINT /usr/local/bin/entrypoint.sh php-fpm

Furthermore, remove the last CMD as the ENTRYPOINT will directly retrieve the necessary parameters. In this case, it is to specify which command to execute, such as php-fpm.

Also, make sure to address the typo pointed out by @Ntwobike.

As a result, update the Dockerfile as follows:

FROM php:7.2-fpm-alpine

ARG USERID=1000
ARG GROUPID=1000

ENV DOCKER_UID=${USERID} \
    DOCKER_GID=${GROUPID} \
    PHP_CONF_DIR="/usr/local/etc/php/conf.d" \
    XDEBUG_CONF_FILE=${PHP_CONF_DIR}/docker-php-ext-xdebug.ini \
    XDEBUG_HOST="" \
    XDEBUG_IDE_KEY="" \
    XDEBUG_PORT=9000 \
    XDEBUG_DBGP=FALSE

RUN echo "Installing Development Dependencies... \n" &&\
    // Add installation steps here...

# Separate layer added for potential changes in Entrypoint
COPY ./entrypoint/develop_entrypoint.sh /usr/local/bin/entrypoint.sh

// More commands and configurations...

VOLUME /home/developer/code
WORKDIR /home/developer/code

ENTRYPOINT /usr/local/bin/entrypoint.sh php-fpm

Focus on resolving the remaining 98 issues (you had 99 ;) ).

PS Still not sure why this issue occurred.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Keeping information saved locally until an internet connection is established

I have a vision to develop a Web app focused on receiving feedback, but the challenge lies in the fact that it will be utilized on a device without an internet connection. The plan is for it to save any user input offline until connectivity is restored. Th ...

Dynamically Calculate Fields Based on Search Conditions in SuiteCRM

I am looking to create a dynamic sum for a specific field, like in the example shown on image ex1.jpg: ex1.jpg When I search with a certain condition, the total number of results is 21 data. However, I only want to calculate the sum of the 20 displayed r ...

Database is being populated with the string "0" instead of the desired value

My challenge lies in the process of attempting to save select-option values into my database using Ajax. The issue arises when instead of inserting the actual selected value, a "0" gets inserted or it returns as a "null" value. Surprisingly, I can successf ...

Is it possible to utilize a JavaScript variable in this particular scenario and if so, what is the

let myVariable = <?php echo json_encode($a[i want to insert the JS variable here]); ?>; Your prompt response would be highly valued. Many thanks in advance. ...

Wordpress: nginx encountered an error

I set up my wordpress website on DigitalOcean, following a tutorial from this site. The next day, my wordpress site went down and I encountered the following error message: "An unexpected error has occurred. Apologies, but the page you are trying to acc ...

Parsing JSON inside a function in PHP involves extracting data from a JSON string and

I found something like this in a *.txt file. function_name({"one": {"id": "id_for_one", "value": "value_for_one"}, ...}); This is how I am accessing the information from the file: $source = 'FILE_NAME.txt'; $json = json_decode(file_get_content ...

The method to obtain a result array using the getJson function in CodeIgniter

Here is the code snippet I am working with: function retrieveAllProcessingTransactions() { $resultSet = $this->db->query("SELECT a.id_transaksi, ETC"); return $resultSet; } In my controller file: public function fetchTransac ...

Regular expressions are not always effective in verifying passwords securely

Can someone please help me troubleshoot an issue with my password validation? I am trying to ensure that passwords only contain English numbers and letters using the regular expression below: if (!preg_match("^[A-Za-z0-9 _]*$^", $_POST['password&apos ...

Plotting graphs with jpgraph and the x-axis can be

I am currently working on a solution using jpGraph. The graph I have includes times on the x-axis, but it also displays numbers like 20, 30, 40, 50, and 60. Is there a way to hide these numbers? Here is the code snippet: <?php require_once ('jpg ...

Leverage the power of Laravel and ReactJS to beautifully display images

Currently, I am working on a project where I am incorporating ReactJS into a Laravel blade file. To get started, I included the React CDN and began writing code within the script tag. Everything seems to be going smoothly so far, however, I have encountere ...

Exploring the benefits of APCu, Zend Cache, and setting up virtual

Recently, I have been experimenting with APCu user data caching in PHP 5.5 using Zend Cache from ZF1, along with Apache virtual hosts (using mod-php). Surprisingly, I encountered some unexpected outcomes during my tests. Interestingly, when I added data t ...

Laravel framework version 5, Homestead environment, authentication for registration and login is not syncing with the database

I've recently transitioned from using localhost to Homestead (homestead.app) with Laravel 5. While everything was working fine with laravel Auth on localhost, I am now facing issues with connecting to the database on Homestead. Are there any configu ...

Add text overlay using the php-vips library

I'm currently working on a PHP project where I need to add text overlays onto images. After analyzing the php-vips library's documentation, I couldn't find any specific function that enables drawing text here. Furthermore, the php-vips docum ...

Preserving information throughout an online browsing session

Is there a way to save the data about which buttons a user clicked on while visiting our website without using a database? The issue is that any array I use gets reset every time the user is redirected from the page. Note: I'm still learning PHP ...

PHP is consistently failing to decode a JSON object generated by JavaScript, with the error code always being 4

In my JavaScript code, I am working on creating a map of key and value pairs. To achieve this, I create an object and store it in a hidden textarea. My intention is to retrieve the data using PHP, decode the object, and ultimately save it to a database. Th ...

Using PHP to download a file

I have successfully uploaded a PDF file to a directory named 'documents' on my web server. Currently, I am populating a table with data from my database, and I want to create links in the forms column that directly link to the associated files w ...

Reached the maximum number of followers allowed by the Instagram API while using PHP

I am facing an issue with retrieving all the information from my Instagram profile. When I have less than 50 followers, everything displays correctly. However, on my test profile with 7-8 followers, and my real profile with over 200 followers, the maximum ...

Troubleshooting Limit Issues in PHP and MySQL

Currently, I am working with PHP code on an IBM i Series server. I have been attempting to restrict the number of records returned by using the LIMIT clause. The following query works perfectly fine without the "LIMIT" specified: $query="SELECT slgrpn,sl ...

Troubleshooting issue with Json and Mysql

Here is my code for processing JSON data in PHP: include("connect.php"); $id = $_GET['lid']; function countRecords($fieldName,$tableName) { $sql = "SELECT * FROM `mail` WHERE confirmed = 'no' AND label_id = '". $id ."'"; $re ...

Updating the default color of selected text within a webpage's content

Is there a way to modify the default blue color that appears when content is selected on a webpage? I am wondering how to change this selection color to a custom color of choice. ...