0

我有一个带有以下入口点的 docker Image。

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

现在我想使用 portainer.io 来管理 docker swarm。我在要设置入口点的位置(而不是在图像中)创建了一个新服务。所以我删除了dockerfile中的入口点,并将其添加到“Image”>“Entrypoint”中。我补充说:

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

但是,服务的容器无法启动。没有入口点,容器就会启动。这是 Dockerfile 的示例,其中设置了入口点。

#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

如何设置入口点?当我将它设置为搬运工时,它稍后会显示在 CDM 部分下。

4

0 回答 0