docker 撰写 - 添加 python 到 LAMP
docker compose - add python to LAMP
在 linux 中,我构建了一个基于 mysql、apache2 和 php 的博客应用程序。但是我为此使用了一些 python 。 python 用于改编那里描述的 python Pygments https://davidwalsh.name/pygments-php-wordpress .
我准备了 docker compose 阶段,它运行良好,但 python 在其中不起作用。如何将 python 添加到 docker 撰写?
这是我的文件:
root@debian:/usr/local/share/a22php7m55# cat docker-compose.yml
version: "2.1"
services:
apachephp:
build: ./a22php7/
ports:
- 8888:80
volumes:
- "/etc/passwd:/etc/passwd:ro"
- "/etc/group:/etc/group:ro"
- "${PROJECT_ROOT}:/var/www/html"
networks:
- database
- server
depends_on:
- mysql
container_name: ap47
mysql:
image: mariadb:5.5
volumes:
- ${MYSQL_DATA}:/var/lib/mysql
networks:
- database
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
MYSQL_DATABASE: "${MYSQL_NAME}"
MYSQL_USER: "${MYSQL_USERNAME}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
container_name: maria47
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
networks:
- database
depends_on:
- mysql
environment:
PMA_HOST: mysql
container_name: pma47
volumes:
mariadb:
networks:
database:
server:
root@debian:/usr/local/share/a22php7m55# cat a22php7/
root@debian:/usr/local/share/a22php7m55# cat a22php7/Dockerfile
FROM php:7.1.3-apache
RUN docker-php-ext-install pdo pdo_mysql
root@debian:/usr/local/share/a22php7m55#
查看 php:7.1.3-apache 的基础镜像,我们发现它构建于 debian:jessie 之上,因此我们可以通过将这些行添加到您的 Dockerfile 来安装 python、pip 和 pygments:
RUN apt-get update && apt-get install -y python python-pip
RUN pip install pygments
在 linux 中,我构建了一个基于 mysql、apache2 和 php 的博客应用程序。但是我为此使用了一些 python 。 python 用于改编那里描述的 python Pygments https://davidwalsh.name/pygments-php-wordpress .
我准备了 docker compose 阶段,它运行良好,但 python 在其中不起作用。如何将 python 添加到 docker 撰写?
这是我的文件:
root@debian:/usr/local/share/a22php7m55# cat docker-compose.yml
version: "2.1"
services:
apachephp:
build: ./a22php7/
ports:
- 8888:80
volumes:
- "/etc/passwd:/etc/passwd:ro"
- "/etc/group:/etc/group:ro"
- "${PROJECT_ROOT}:/var/www/html"
networks:
- database
- server
depends_on:
- mysql
container_name: ap47
mysql:
image: mariadb:5.5
volumes:
- ${MYSQL_DATA}:/var/lib/mysql
networks:
- database
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
MYSQL_DATABASE: "${MYSQL_NAME}"
MYSQL_USER: "${MYSQL_USERNAME}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
container_name: maria47
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
networks:
- database
depends_on:
- mysql
environment:
PMA_HOST: mysql
container_name: pma47
volumes:
mariadb:
networks:
database:
server:
root@debian:/usr/local/share/a22php7m55# cat a22php7/
root@debian:/usr/local/share/a22php7m55# cat a22php7/Dockerfile
FROM php:7.1.3-apache
RUN docker-php-ext-install pdo pdo_mysql
root@debian:/usr/local/share/a22php7m55#
查看 php:7.1.3-apache 的基础镜像,我们发现它构建于 debian:jessie 之上,因此我们可以通过将这些行添加到您的 Dockerfile 来安装 python、pip 和 pygments:
RUN apt-get update && apt-get install -y python python-pip
RUN pip install pygments