1

I have a docker Image with the following Entrypoint.

ENTRYPOINT [ "sh", "-c", "/var/www/html/app/Console/cake schema update -y && /var/www/html/app/Console/cake migration && apache2-foreground"]

Now I want to use portainer.io to manage docker swarm. I created a new service to where I want to set the entrypoint (instead of in the Image). So I deleted the entrypoint In the dockerfile, and added it into "Image" > "Entrypoint". I added:

sh -c /var/www/html/app/Console/cake schema update -y && /var/www/html/app/Console/cake migration && apache2-foreground

However, the containers of the service are failing to start. Without the entrypoint, the containers are starting. Here is an example of the Dockerfile, where the Entrypoint is set.

#start with base Image from php
FROM php:7.3-apache

#install system dependencies and enable PHP modules

RUN apt-get update && apt-get install -y \
      libicu-dev \
      libpq-dev \
      libmcrypt-dev \
      mysql-client \
      git \
      zip \
      unzip \
      libzip-dev \
    && docker-php-ext-configure zip --with-libzip \
    && docker-php-ext-install zip \
    && rm -r /var/lib/apt/lists/* \
    && docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
    && docker-php-ext-install \
      intl \
      mbstring \
      pcntl \
      pdo_mysql \
      pdo_pgsql \
      pgsql \
      opcache \
      gettext

#     zip \
#     mcrypt \

#configure imap for mails
RUN apt-get update && \
    apt-get install -y \
        libc-client-dev libkrb5-dev && \
    rm -r /var/lib/apt/lists/*

RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install -j$(nproc) imap


#install mcrypt
RUN apt-get update \
    && apt-get install -y libmcrypt-dev \
    && rm -rf /var/lib/apt/lists/* \
    && pecl install mcrypt-1.0.2 \
    && docker-php-ext-enable mcrypt

#install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

#change uid and gid of apache to docker user uid/gid
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data

# enable apache module rewrite
RUN a2enmod rewrite

#change ownership of our applications
RUN chown -R www-data:www-data /var/www/html

#Copy file to start schema update on startup
ENTRYPOINT [ "sh", "-c", "/var/www/html/app/Console/cake schema update -y && /var/www/html/app/Console/cake migration && apache2-foreground"]

EXPOSE 80

How do I have to set the Entrypoint? When I set it a portainer, it is later shown under the section CDM.

DS87
  • 536
  • 3
  • 9
  • 29
  • 2
    The quoting in your two invocations is different; does that matter? Can you let it fall back to the entrypoint declared in the image? What actually happens when you launch it? – David Maze Aug 27 '19 at 14:00
  • I kept the entrypoint in the image definition and it is running fine. – DS87 Aug 28 '19 at 12:38
  • I just run into the same issue. Instead of creating a container in portainer directly, as a workaround I created a stack with one container only. That spins up the container and let me set the entrypoint however I like. – pnbecker Aug 29 '23 at 08:04

0 Answers0