利用github上的dockerfile一分钟快速创建LAMP开发环境

jopen 9年前

创建mysql镜像及运行容器

git clone https://github.com/tutumcloud/tutum-docker-mysql  docker build -t tutum/mysql 5.6/  docker run -d MYSQL_PASS="mypass" --name db tutum/mysql

创建php apche镜像及运行容器


git clone https://github.com/tutumcloud/tutum-docker-php  docker build -t tutum/apache-php .  docker run -d -p 80:80 --link db:mydb -v /app:/app tutum/apache-php



最后将我的php应用复制到本地/ap p目录中



curl http://localhost/
*注意mysql容器每次启动的ip是动态分派的。php应用中mysql的ip地址为映射的别名mydb,如需要查看可通过如下命令查看



docker exec db ifconfig

来自:http://my.oschina.net/dengyz/blog/373259