Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5979

unable to start cronservice as www-data user

$
0
0

I am trying to start cron-service using www-data user in Docker, it says Starting periodic command scheduler: cronseteuid: Operation not permittedfailed!

Below is the Dockerfile

FROM php:8.2.12-fpm@sha256:2aa938b6d62f7415e9c84d867d9ceed18ef8ec3cf3944d389e088c93f9678a84 as base # Set environment variablesENV DOC_ROOT /var/www/htmlENV COMPOSER_HOME=/tmp/composer# Install required packagesRUN apt-get update && apt-get install -y --no-install-recommends \    gnupg \    netcat-openbsd \    supervisor \    openssl \    nginx \    wget \    telnet \    traceroute \    net-tools \    ca-certificates \    sudo \    libicu-dev \    libfreetype6-dev \    libjpeg-dev \    libpng-dev \    libsodium-dev \    libxml2-dev \    libxslt-dev \    libzip-dev \    rsync \    unzip \    cron \    default-mysql-client \    git \    gnupg \    gzip \    libbz2-dev \    libjpeg62-turbo-dev \    libmagickwand-dev \    libmcrypt-dev \    libonig-dev \    libsodium-dev \    libssh2-1-dev \    libwebp-dev \    libxslt1-dev \    lsof \    mailutils \    msmtp \    procps \    vim \    zip \&& rm -rf /var/lib/apt/lists/*# Install APCu and other PHP extensionsRUN pecl install apcu-5.1.22 \&& docker-php-ext-configure \        gd --with-freetype --with-jpeg --with-webp \&& docker-php-ext-install \        bcmath \        bz2 \        calendar \        exif \        gd \        gettext \        intl \        mbstring \        mysqli \        opcache \        pcntl \        pdo_mysql \        soap \        sockets \        sodium \        sysvmsg \        sysvsem \        sysvshm \        xsl \        zip # Create necessary directories and set permissionsRUN mkdir -p /var/run \&& chown -R www-data:www-data /var/run \&& mkdir -p /var/lib/nginx/{body,fastcgi} \&& chown -R www-data:www-data /var/lib/nginx \&& touch /var/run/crond.pid \&& chown www-data:www-data /var/run/crond.pid \&& touch /run/nginx.pid \&& chown www-data:www-data /run/nginx.pid \&& chown www-data:www-data /var/log/nginx/error.log \&& chown www-data:www-data /var/log/nginx/access.log# Copy cronjob configuration and set permissionsCOPY  magento /etc/cron.d/cronjobRUN chown www-data:www-data /etc/cron.d/cronjob \&& chmod 0644 /etc/cron.d/cronjob# Set up cron loggingRUN touch /var/log/cron.log \&& chown www-data:www-data /var/log/cron.log # Set root passwordRUN echo 'root:Login#22' | chpasswd# Install XdebugRUN pecl install xdebug \&& docker-php-ext-enable xdebug# Set PHP configurationRUN echo "memory_limit=1G" >> /usr/local/etc/php/conf.d/zz-memory-limit-php.ini \&& echo "apc.enable=1" >> /usr/local/etc/php/conf.d/zz-apcu.ini \&& echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/zz-apcu.ini \&& echo "opcache.memory_consumption=512MB" >> /usr/local/etc/php/conf.d/zz-opcache.conf \&& echo "opcache.max_accelerated_files=60000" >> /usr/local/etc/php/conf.d/zz-opcache.conf \&& echo "opcache.consistency_checks=0" >> /usr/local/etc/php/conf.d/zz-opcache.conf \&& echo "opcache.validate_timestamps=0" >> /usr/local/etc/php/conf.d/zz-opcache.conf \&& echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/zz-opcache.confFROM base as build# Install and configure supervisordCOPY etc/nginx /etc/nginxCOPY etc/supervisord.conf /etc/supervisor/supervisord.confRUN mkdir -p /var/log/supervisor \&& chown www-data:www-data /var/log/supervisor# Switch to www-data userUSER www-dataWORKDIR /var/www/html# Copy Magento application files and entrypoint scriptCOPY --from=composer:2.2 /usr/bin/composer /usr/bin/composerCOPY --chown=www-data magentoapps/magento .COPY --chown=www-data bin bin COPY bin/entrypoint.sh /usr/local/bin/docker-php-entrypoint# Create temporary directoryRUN mkdir /tmp/app# Install dependencies and set up Magento applicationRUN composer install \&& bin/magento sampledata:deploy \&& bin/magento module:enable --all \&& cp -r app /tmp/app # Expose port 8080EXPOSE 8080# Set Magento mode to developerENV MAGE_MODE=developer

below is the supervisorfile

[unix_http_server]file=/tmp/supervisor.sockchmod=0700[supervisord]nodaemon=trueuser=www-dataloglevel=infologfile=/tmp/supervisord.logpidfile=/tmp/supervisord.pid[rpcinterface:supervisor]supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface[supervisorctl]serverurl=unix:///tmp/supervisor.sock[program:php-fpm]command=php-fpm -Fstdout_logfile=/dev/stdoutstdout_logfile_maxbytes=0stderr_logfile=/dev/stderrstderr_logfile_maxbytes=0autorestart=falsestartretries=0redirect_stderr=true[program:nginx]command=nginx -g 'daemon off;'stdout_logfile=/dev/stdoutstdout_logfile_maxbytes=0stderr_logfile=/dev/stderrstderr_logfile_maxbytes=0autorestart=falsestartretries=0[program:cron]command=/usr/sbin/cron -fstdout_logfile=/dev/stdoutstdout_logfile_maxbytes=0stderr_logfile=/dev/stderrstderr_logfile_maxbytes=0autorestart=falsestartretries=0

Tried manually running the command it failed, but with root its running

Tried to set all the permission for /usr/sbin/cron.d

Tried manually running the command it failed, but with root its running

Tried to set all the permission for /usr/sbin/cron.d


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>