Docker下用composer国内镜像安装Laravel

发布日期: 2019-05-11 14:49:24 作者: Stephen 评论: 0

自己在docker拉取了composer镜像,如何在docker上启动composer容器,使用composer国内镜像安装包呢?

composer国内镜像和composer安装包的命令就不多说了,我直接说下在docker下的用法

命令:

docker run  -it -v {宿主机目录}:/app --privileged=true composer命令
因此,docker下composer国内镜像方法:

docker run -it -v /data/www:/app --privileged=true composer config -g repo.packagist composer https://packagist.phpcomposer.com
docker下composer安装包的命令,以Laravel为例:

docker run -it -v /data/www:/app --privileged=true composer create-project --prefer-dist laravel/laravel blog
合并后,docker下composer国内镜像安装Laravel:

docker run -it -v /data/www:/app --privileged=true composer config -g repo.packagist composer https://packagist.phpcomposer.com && docker run -it -v /data/www:/app --privileged=true composer create-project --prefer-dist laravel/laravel blog
说明:

/data/www:宿主机中需要安装Laravel的目录,也是我nginx环境的web目录

快来抢沙发