我的应用程序有这个Dockerfile
:
FROM php:8.0.5-fpm-alpine
WORKDIR /var/www
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN apk update && apk add \
build-base \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
# Install Redis Extension
RUN apk add autoconf && pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis && apk del autoconf
# Copy config
COPY ./config/php/local.ini /usr/local/etc/php/conf.d/local.ini
RUN addgroup -g 1000 -S www && \
adduser -u 1000 -S www -G www
USER www
COPY --chown=www:www . /var/www
RUN ["chmod", "+x", "./start_script.sh"]
EXPOSE 9000
CMD ./start_script.sh
当我运行docker-compose up
时,它向我显示了这个错误:
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable multibyte string support... yes, shared
checking whether to enable multibyte regex support (requires oniguruma)... yes
checking for oniguruma... no
configure: error: Package requirements (oniguruma) were not met:
Package 'oniguruma', required by 'virtual:world', not found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'app' failed to build: The command '/bin/sh -c docker-php-ext-install pdo_mysql mbstring zip exif pcntl' returned a non-zero code: 1
我试图研究如何解决这个问题,我认为这与mbstring
的mbstring
扩展有关,而这个mbstring
扩展在Laravel中是必需的。因此,在进一步的研究中,我试图添加apk add libonig-dev
,但随后它向我展示了这个新错误:
---> Running in 5cb4450da35b
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.10-66-geb1876c618 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.10-63-g29cc5622fc [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13914 distinct packages available
ERROR: unable to select packages:
libonig-dev (no such package):
required by: world[libonig-dev]
ERROR: Service 'app' failed to build: The command '/bin/sh -c apk update && apk add build-base libonig-dev freetype-dev libjpeg-turbo-dev libpng-dev libzip-dev zip jpegoptim optipng pngquant gifsicle vim unzip git curl' returned a non-zero code: 1
我真的被困在这里了,我对码头不太熟悉。
发布于 2022-07-01 10:06:06
您可以在下面的文件中定义您的CMD,希望您能解决您的问题…!
CMD "./start_script.sh"
或
CMD ["bash", "start_script.sh"]
https://stackoverflow.com/questions/72826455
复制相似问题