No, it is not impossible to generate a composer.lock file within a Docker container. However, it depends on whether the dependencies are already installed in the container, and whether the composer.json file is present. Here are steps to generate a composer.lock file within a Docker container:
FROM php:7.4-apache
RUN apt-get update \
&& apt-get install -y git unzip \
&& docker-php-ext-install pdo_mysql
COPY composer.json /var/www/html/
RUN cd /var/www/html/ \
&& php -r "readfile('https://getcomposer.org/installer');" | php \
&& php composer.phar install
This command will install the dependencies and generate the composer.lock file.
COPY . /var/www/html/
CMD ["apache2-foreground"]
Now, when you start the container, it will have the composer.lock file generated.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-07-21 11:00:00 +0000
Seen: 11 times
Last updated: Sep 05 '22
What is an Ansible role that includes integrated modules?
How can Yii2 be connected to a remote MySQL database through SSH?
How can records be counted from a category that is retrieved through another PHP and SQL query?
Why is the search function in PHP & MYSQL not providing relevant results?
What is the process to view and make edits to my complete MySQL code?