分享

Dockerfile Image命令'/ bin / sh

 中间件 2022-03-07

Your problem is with the line rm -rf /var/lib/apt/lists/*. You are deleting the lists that have been fetched by the apt-get update. You then try to install a package using apt. This will fail.

You need to move rm -rf /var/lib/apt/lists/ after the line that installs mysql-server.

  1. # Download base image ubuntu 16.04
  2. FROM ubuntu:16.04
  3. # Update Ubuntu Software repository
  4. RUN apt-get update
  5. # Install PHP, nginx, mySQL
  6. RUN apt-get install -y nginx php7.0-fpm
  7. # Install MySQL and set default root password
  8. RUN echo 'mysql-server mysql-server/root_password password mypassword' | debconf-set-selections
  9. RUN echo 'mysql-server mysql-server/root_password_again password mypassword' | debconf-set-selections
  10. RUN apt-get install -y mysql-server && rm -rf /var/lib/apt/lists/*
  11. # Define the ENV variable
  12. ENV nginx_vhost /etc/nginx/sites-available/default
  13. ENV php_conf /etc/php/7.0/fpm/php.ini
  14. ENV nginx_conf /etc/nginx/nginx.conf
  15. # Enable php-fpm on nginx virtualhost configuration
  16. COPY default ${nginx_vhost}
  17. RUN sed -i -e 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' ${php_conf} && \
  18. echo "
  19. daemon off;" >> ${nginx_conf}
  20. RUN mkdir -p /run/php && \
  21. chown -R www-data:www-data /var/www/html && \
  22. chown -R www-data:www-data /run/php
  23. # Volume configuration
  24. VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]
  25. # Configure Services and Port
  26. COPY start.sh /start.sh
  27. CMD ["./start.sh"]

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多