我想用PHPImage&ApacheImage创建一个Docker容器,这里是我的dockerfile。
文件名:单容器.Docker
# PHP image from docker hub
FROM php:7.2-cli
# Apache image from docker hub
FROM httpd:2.4
# public-html is path for my local codebase
COPY ./public-html/ /usr/local/apache2/htdocs/在docker中运行以下命令:docker build -f single-container.dockerfile . -t mysinglecontainer:latest
,我的错误越来越少。

请提出建议,需要修改哪些更改?
发布于 2019-09-19 08:42:17
找到了解决方案
这里是我的Github:https://github.com/yogig/dockercron/
FROM php:7.2-fpm-alpine
LABEL maintainer="xxx@xxx.de" \
muz.customer="xxx" \
muz.product="xxx" \
container.mode="development"
#https://pkgs.alpinelinux.org/packages
RUN apk add --no-cache --virtual .deps autoconf tzdata build-base libzip-dev mysql-dev gmp-dev \
libxml2-dev libpng-dev zlib-dev freetype-dev jpeg-dev icu-dev openldap-dev libxslt-dev &&\
docker-php-ext-install zip xml mbstring json intl gd pdo pdo_mysql iconv soap \
dom gmp fileinfo sockets bcmath mysqli ldap xsl &&\
echo 'date.timezone="Europe/Berlin"' >> "${PHP_INI_DIR}"/php.ini &&\
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime &&\
echo 'Europe/Berlin' > /etc/timezone &&\
curl -s https://www.phing.info/get/phing-latest.phar > /bin/phing &&\
chmod a+x /bin/phing &&\
ln -s /bin/phing /usr/local/bin/phing &&\
ln -s /bin/phing /usr/local/phing &&\
ln -s /bin/phing /usr/bin/phing &&\
apk del .deps &&\
apk add --no-cache libzip mysql libxml2 libpng zlib freetype jpeg icu gmp git subversion libxslt openldap \
apache2 apache2-ldap apache2-proxy libreoffice openjdk11-jre ghostscript msttcorefonts-installer \
terminus-font ghostscript-fonts &&\
ln -s /usr/lib/apache2 /usr/lib/apache2/modules &&\
ln -s /usr/sbin/httpd /etc/init.d/httpd &&\
update-ms-fonts
# copy crontabs for root user
COPY crontab.txt /etc/crontabs/root
#https://github.com/docker-library/httpd/blob/3ebff8dadf1e38dbe694ea0b8f379f6b8bcd993e/2.4/alpine/httpd-foreground
#https://github.com/docker-library/php/blob/master/7.2/alpine3.10/fpm/Dockerfile
CMD ["/bin/sh", "-c", "rm -f /usr/local/apache2/logs/httpd.pid && httpd -DBACKGROUND && php-fpm"]
将安装PHP阿尔卑斯映像
(1) FROM php:7.2-fpm-alpineApache的
配置
(2) apk add --no-cache libzip mysql libxml2 libpng zlib freetype jpeg icu gmp git subversion libxslt openldap \
apache2 apache2-ldap apache2-proxy libreoffice openjdk11-jre ghostscript msttcorefonts-installer \
terminus-font ghostscript-fonts最后一个:在Docker中,我运行命令docker-compose up,现在在我的单个容器中,两个docker-compose up都成功运行。
注意:要查看docker-compose.yaml文件的内容,请访问https://github.com/yogig/dockercron
发布于 2019-09-18 10:43:51
将.移到末尾
docker build -f httpd.Dockerfile -t mysinglecontainer:latest .确保在命令中使用正确的Dockerfile名称--名称是single-container.dockerfile
所以命令是:
docker build -f single-container.dockerfile -t mysinglecontainer:latest .https://stackoverflow.com/questions/57990866
复制相似问题