Docker容器里部署Apache+PHP+MariaDB+phpMyAdmin

栏目: 数据库 · Mysql · 发布时间: 6年前

内容简介:创建Apache+PHP+phpMyAdmin镜像首先启动MariaDB的容器首先创建目录和文件
导读 前面讲到了创建MariaDB,这次在前面的基础上搭建phpMyAdmin服务,以便友好的管理数据库MariaDB。MariaDB的 docker 独立出来,这样方便管理,易于扩展。这次我们基于Dockerfile方式创建剩余的服务,Dockerfile也是官方推荐的创建镜像方法。

创建Apache+PHP+phpMyAdmin镜像

首先启动MariaDB的容器

centos-mariadb:v1   "/root/run.sh"      11 hours ago        Up 3 hours          0.0.0.0:13306->3306/tcp   dreamy_bell
[root@test01 ~]# docker inspect --format '{{ .NetworkSettings.IPAddress }}' 2e78c466919e
172.17.0.3
[root@test01 ~]#

首先创建目录和文件

编辑Dockerfile文件

命令 CMD ["/root/run.sh"]

配置phpmyadmin的配置文件

脚本 来配置,不过比较麻烦,不如这个简单。改动的配置如下

使用 脚本 配置httpd

添加一个 php 测试界面

< ?php
phpinfo();
?>

启动脚本

创建镜像

3afd47092a0e
.
.
省略...
.
.
Step 26 : CMD /root/run.sh
 ---> Using cache
 ---> 19e52b9aceab
Successfully built 19e52b9aceab
[root@test01 phpMyAdmin_dockerfile]#

创建并启动容器

80/tcp      sick_ride
2e78c466919e        liuxin/centos-mariadb:v1      "/root/run.sh"      12 hours ago        Up 4 hours          0.0.0.0:13306->3306/tcp   dreamy_bell
[root@test01 phpMyAdmin_dockerfile]#

验证

打开web浏览器,输入测试的网页

输入phpmyadmin的地址,并输入账号密码,看能否登录

登录成功,大功告成


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Software Engineering for Internet Applications

Software Engineering for Internet Applications

Eve Andersson、Philip Greenspun、Andrew Grumet / The MIT Press / 2006-03-06 / USD 35.00

After completing this self-contained course on server-based Internet applications software, students who start with only the knowledge of how to write and debug a computer program will have learned ho......一起来看看 《Software Engineering for Internet Applications》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具