gpt4 book ai didi

mysql - Docker配置文件导入,带有apache和mysql的生产配置

转载 作者:行者123 更新时间:2023-11-29 10:31:27 24 4
gpt4 key购买 nike

我收到了 02 个 docker 文件作为存储库中 env 配置的一部分。对于 Apache 对于 mysql

代码打印在下面。

我想在我的 Windows 7 64 位系统中导入并设置相同的环境。我已经在我的机器上安装了 DockerToolbox,但不知道如何导入这些配置。

欢迎提出想法,并提前致谢

1. FROM centos:7

RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm && \
yum install -y yum-utils && \
yum-config-manager --enable remi-php56 && \
yum update -y && \
yum install -y php httpd php-common php-cli php-pdo php-mysqlnd \
php-gd php-xml php-ldap php-opcache php-soap php-zip && \
yum clean all && \
rm -rf /var/www && \
mkdir /var/www && \
groupadd -f www-data && \
useradd --no-log-init --no-create-home --shell /usr/sbin/nologin -g www-data www-data && \
mkdir /tmp/session && \
chmod 0777 /tmp/session

COPY ["./docker/config/httpd/httpd.conf", "/etc/httpd/conf"]
COPY ["./docker/config/httpd/httpd-foreground", "/usr/bin/"]
COPY ["./docker/config/httpd/vhost.conf", "/etc/httpd/conf.d/marcopolo.conf"]

EXPOSE 80
CMD ["httpd-foreground"]

2. FROM mysql:5.6

EXPOSE 3306

最佳答案

我找到了 docker-compose.yml

添加为:

version: '2'
services:

httpd:
build:
context: ./
dockerfile: ./docker/Dockerfile.httpd
image: project-httpd
container_name: my-httpd
tty: true
depends_on:
- mysql
environment:
SYMFONY__DATABASE__HOST: "mysql"
SYMFONY__DATABASE__PORT: "3306"
SYMFONY__DATABASE__NAME: "mydb"
SYMFONY__DATABASE__USER: "root"
SYMFONY__DATABASE__PASSWORD: "root_pw"
SYMFONY__APPLICATION__SECRET: "yoursec"
SYMFONY__APPLICATION__DEBUG: "true"
SYMFONY__LOG__FILENAME: "php://stdout"
SYMFONY__DATASTORAGE__PATH: "/tmp"
SYMFONY__DATASTORAGE__PATH_PUBLIC: "/tmp"
REMOTE_USER: "testuse"
volumes:
- ./:/var/www:z
- ./docker/config/httpd/php-d-ovveride.ini:/etc/php.d/zz-php-d-ovveride.ini
ports:
- 80:80
networks:
- default

mysql:
build:
context: ./
dockerfile: ./docker/Dockerfile.mysql
image: my-mysql
container_name: my-mysql
entrypoint: docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: "root_pw"
MYSQL_DATABASE: "mydb"
MYSQL_USER: "db_user"
MYSQL_PASSWORD: "db_user_pw"
volumes:
- ./:/var/www:z
- mysql-volume:/var/lib/mysql:z
networks:
- default

volumes:
mysql-volume:

networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.10.105.0/24
gateway: 10.10.105.1

然后启动 docker-compose up,它就可以工作了。

但在我看来 Centos-7 有点重,正在努力用 Apline 取代它

关于mysql - Docker配置文件导入,带有apache和mysql的生产配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47353694/

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