I am trying o understand Docker multi-stage builds. I have Docker toolbox 18.03 so I am able to run them. My first attempt after looking at the docs was to build an image with Python 3.7 and Php-apache. So I wrote this Dockerfile:
FROM python:3.7.0-stretch
FROM php:7-apache-stretch
RUN docker-php-ext-install mbstring mysqli pdo pdo_mysql
RUN a2enmod rewrite
# Enable SSL
RUN a2enmod ssl
RUN mkdir /etc/apache2/ssl
ADD server.crt /etc/apache2/ssl/
ADD server.key /etc/apache2/ssl/
ADD default-ssl.conf /etc/apache2/sites-available/
RUN a2ensite default-ssl
EXPOSE 443
RUN echo 'log_errors = On' >> /usr/local/etc/php/php.ini
Then I run docker build .
and it built it successfully:
Sending build context to Docker daemon 12.29kB
Step 1/12 : FROM python:3.7.0-stretch
---> 825141134528
Step 2/12 : FROM php:7-apache-stretch
---> 5e5a59788e34
Step 3/12 : RUN docker-php-ext-install mbstring mysqli pdo pdo_mysql
---> Using cache
---> bf6b095ac6d3
Step 4/12 : RUN a2enmod rewrite
---> Using cache
---> d3443d0e8d97
Step 5/12 : RUN a2enmod ssl
---> Running in edd0a15406db
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
service apache2 restart
Removing intermediate container edd0a15406db
---> a301c3a3ca78
Step 6/12 : RUN mkdir /etc/apache2/ssl
---> Running in 59621555d753
Removing intermediate container 59621555d753
---> db74733784c3
Step 7/12 : ADD server.crt /etc/apache2/ssl/
---> db3715192748
Step 8/12 : ADD server.key /etc/apache2/ssl/
---> f6206d6b2d5e
Step 9/12 : ADD default-ssl.conf /etc/apache2/sites-available/
---> 0fa5dd62c854
Step 10/12 : RUN a2ensite default-ssl
---> Running in 7ab353bca552
Enabling site default-ssl.
To activate the new configuration, you need to run:
service apache2 reload
Removing intermediate container 7ab353bca552
---> 53336ee4133d
Step 11/12 : EXPOSE 443
---> Running in 0530749e96b3
Removing intermediate container 0530749e96b3
---> 53b56723dd81
Step 12/12 : RUN echo 'log_errors = On' >> /usr/local/etc/php/php.ini
---> Running in 8bd7c50715c3
Removing intermediate container 8bd7c50715c3
---> d456abb9ee67
Successfully built d456abb9ee67
Then I created the container for it and run. It started and remained up, so I tried to enter into the bash of the container and there is the surprise, php and apache work fine, python doesn't even exist. What am I missing in the Dockerfile?