gpt4 book ai didi

php - 如何使用 Dockerfile 以基于 Ubuntu 镜像的 php-fpm 启动 Nginx?

转载 作者:行者123 更新时间:2023-12-02 18:33:26 24 4
gpt4 key购买 nike

我有 Dockerfile有几个命令:

FROM ubuntu
RUN apt-get install -y nginx php5 php5-fpm
ADD . /code

当我运行 docker build .命令我得到下一个错误:
E: Package 'php5-fpm' has no installation candidate
INFO[0006] The command [/bin/sh -c apt-get install nginx php5 php5-fpm] returned a non-zero code: 100

如何开始 Nginxphp-fpm基于 Ubuntu图片?

最佳答案

你可以看到更多complete example here对于 NGiNX :

# Install Nginx.
RUN \
add-apt-repository -y ppa:nginx/stable && \
apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/* && \
echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
chown -R www-data:www-data /var/lib/nginx

对于 php-fpm , 你有 this example :
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys E5267A6C; \
echo 'deb http://ppa.launchpad.net/ondrej/php5/ubuntu trusty main' > /etc/apt/sources.list.d/ondrej-php5-trusty.list; \
apt-get update ; \
apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-curl php5-cli php5-gd php5-pgsql php5-sqlite php5-common php-pear curl php5-json php5-redis redis-server memcached php5-memcache ; \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

在这两种情况下,请注意以下用途:
  • add-apt-repository为了添加这些软件包的相关存储库以安装
  • apt-get update , 为了 downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies .
  • 关于php - 如何使用 Dockerfile 以基于 Ubuntu 镜像的 php-fpm 启动 Nginx?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29875951/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com