'Issue with ext-sockets in Docker

I have this Dokerfile:

FROM php:8.0

RUN apt update && apt install -y nano supervisor cron curl && docker-php-ext-install sockets && docker-php-ext-enable sockets 

COPY docker/crontab /etc/cron.d/crontab
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
COPY docker/supervisord-programs.conf /etc/supervisor/conf.d/app.conf
COPY . /home/mysignature/app

RUN chmod 0644 /etc/cron.d/crontab

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
    && php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
    && php composer-setup.php \
    && php -r "unlink('composer-setup.php');" \
    && mv composer.phar /usr/local/bin/composer

WORKDIR /home/mysignature/app

RUN composer install

RUN crontab /etc/cron.d/crontab

CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

And I have an error:

/usr/src/php/ext/sockets/sendrecvmsg.c: In function 'init_ancillary_registry': /usr/src/php/ext/sockets/sendrecvmsg.c:128:19: error: invalid application of 'sizeof' to incomplete type 'struct cmsgcred' 128 | PUT_ENTRY(sizeof(struct cmsgcred), 0, 0, from_zval_write_ucred, | ^~~~~~ /usr/src/php/ext/sockets/sendrecvmsg.c:99:17: note: in definition of macro 'PUT_ENTRY' 99 | entry.size = sizev;
| ^~~~~ /usr/src/php/ext/sockets/sendrecvmsg.c:129:36: error: 'SCM_CREDS' undeclared (first use in this function) 129 | to_zval_read_ucred, SOL_SOCKET, SCM_CREDS); | ^~~~~~~~~ /usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY' 105 | key.cmsg_type = type;
| ^~~~ /usr/src/php/ext/sockets/sendrecvmsg.c:129:36: note: each undeclared identifier is reported only once for each function it appears in 129 | to_zval_read_ucred, SOL_SOCKET, SCM_CREDS); | ^~~~~~~~~ /usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY' 105 | key.cmsg_type = type;
| ^~~~ make: *** [Makefile:216: sendrecvmsg.lo] Error 1



Solution 1:[1]

Using this php image is a bad way because it doesn't have last updates? so I just use ubuntu image and installed php manually

FROM ubuntu

RUN apt-get update && apt install -y software-properties-common \
    && add-apt-repository ppa:ondrej/php \
    && apt-get update \
    && apt install -y nano supervisor cron curl php8.0 php8.0-common php8.0-xml php8.0-dom

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jonny Manowar