I'm developing a workspace that uses Alpine and Php 7.2 as it's main components. I have a Dockerfile that uses the php:7.2-fpm-alpine
distro for that matter, it builds and composes normally when performing docker compose up -d
, but when I try to open it in a Remote Container, the following error appears:
I browsed the net only to see my problem seems to be very poorly documented, the only relevant instance of my problem is the Visual Studio Code's official Github project that has the following file check-requirements-linux.sh. Obviously I could use another image, but it is imperative for it to be an Alpine distro (so anything that is php:7.2-<ALPINE DISTRO>
), so I'd like to know if there is a way to ignore this, either by skipping the script check, or any other way that makes work without worrying about it, something that suddenly closes the Dev Container and makes me unable to open it and program in.
A popular workaround to this problem (that works) is to downgrade the Visual Studio Code version to v.1.8.5, as mentioned in the Github thread, but it is wildly unpractical, and only a temporary solution.
If it helps, this is my current Dockerfile that I'm building (that builds without any problem). Dockerfile
#USE this Dockerfile if you want to test the image
ARG PHP_VERSION=7.2
ARG PHP_IMAGE=php:${PHP_VERSION}-fpm-alpine3.12
ARG PHP_PHALCON_VERSION=3.4.x
ARG PHP_COMPOSER_VERSION=2.1.8
ARG COMPOSER_IMAGE=composer:${PHP_COMPOSER_VERSION}
ARG AMQP_VERSION=amqp-1.10.2
ARG PHP_XDEBUG_VERSION=xdebug-3.1.0
FROM ${PHP_IMAGE} AS php
ARG AMQP_VERSION
ARG PHP_PHALCON_VERSION
ARG PHP_XDEBUG_VERSION
ENV PHP_ZLIB_DIR=/usr/
# Fix timezone issue
ENV TZ=Europe/Lisbon
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
; \
apk upgrade --update-cache --available && \
apk add --update --no-cache \
autoconf bash g++ coreutils gcc make git openssh-client \
libressl-dev patch pkgconfig subversion tini \
#dep for php ext: gettext
gettext-dev \
#dep for php ext: bz2
bzip2-dev \
#dep for php ext: xsl + soap
libxslt-dev \
#dep for php ext: mongodb
mongodb-tools \
#dep for php ext: msgpack
msgpack-c \
#dep for php ext: zip
unzip zip \
; \
apk add --no-cache --virtual .build-deps \
#dep for php ext: intl
icu-dev \
; \
docker-php-source extract \
# && docker-php-ext-install -j$(nproc) \
&& docker-php-ext-install \
bcmath \
bz2 \
calendar \
exif \
gettext \
intl \
# process control ?
# pcntl \
pdo_mysql \
# shared memory ?
# shmop \
soap \
sockets \
# WDDX ?
# wddx \
xsl \
zip \
; \
pecl channel-update pecl.php.net \
&& pecl install igbinary \
&& pecl install msgpack \
&& pecl install mongodb-1.10.0 \
&& echo "php_ini = /usr/local/etc/php/php.ini" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& pecl install ${PHP_XDEBUG_VERSION} \
#dep for php ext: yaml
&& apk add --update --no-cache yaml-dev \
&& pecl install yaml \
#dep for php ext: memcached
&& apk add --update --no-cache libmemcached-dev zlib-dev libpng-dev \
&& pecl install memcached --with-zlib-dir=$PHP_ZLIB_DIR \
# && echo "extension=memcached.so" > /usr/local/etc/php/conf.d/memcached.ini \
#dep for php ext: rabbitmq / amqp
&& apk add --update --no-cache rabbitmq-c-dev \
&& printf "\n" | pecl install ${AMQP_VERSION} \
&& printf "\n" | pecl install redis-5.3.2 \
&& docker-php-ext-enable igbinary msgpack mongodb xdebug yaml memcached redis \
# enabling amqp ext this way avoids coflicts loading dependecies (sockets)
&& echo "extension=amqp" > /usr/local/etc/php/conf.d/40-amqp.ini \
# && pecl bundle redis \
# && docker-php-ext-configure redis --enable-redis-igbinary \
# && docker-php-ext-install redis \
&& docker-php-source delete \
&& apk del --purge .build-deps \
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
## Composer
ARG COMPOSER_IMAGE
FROM ${COMPOSER_IMAGE} AS composer
FROM php AS phalcon
ARG PHP_PHALCON_VERSION
#phalcon
RUN cd ~ && git clone --depth=1 -b ${PHP_PHALCON_VERSION} git://github.com/phalcon/cphalcon.git \
&& cd ~/cphalcon/build \
&& ./install \
&& echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/50-phalcon.ini \
&& rm -rf ~/cphalcon \
; \
# clean up
apk del autoconf bash check-dev cyrus-sasl-dev g++ gcc \
imagemagick-dev libc-dev libssh2-dev libsodium-dev \
m4 make musl-dev openssl-dev perl pkgconfig \
tzdata \
&& rm -rf /var/cache/apk/* && rm -rf /tmp/*
# RUN php -r "echo Phalcon\Version::get();"
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /app
You can skip the requirements check by creating the file /tmp/vscode-skip-server-requirements-check
, see the start of the check-requirements-linux.sh
script.
But as the error message tells you the version of alpine
you used is not supported by vscode, see https://aka.ms/vscode-remote/linux: vscode requires alpine
3.16+ with musl
>= 1.2.3
The image you use - php:7.2-fpm-alpine3.12
- is based on alpine
3.12 which uses musl
1.1.24.
So you could skip the check but would then most probably run into other issues afterwards.
Instead you should use a base image with a supported alpine
version, e.g., php:7.4-fpm-alpine
, or if no appropriate image is available on the docker registry build your own from scratch.