自己在docker拉取了composer镜像,如何在docker上启动composer容器,使用composer国内镜像安装包呢?
composer国内镜像和composer安装包的命令就不多说了,我直接说下在docker下的用法
命令:
代码语言:javascript复制docker run -it -v {宿主机目录}:/app --privileged=true composer命令
因此,docker下composer国内镜像方法:
代码语言:javascript复制docker run -it -v /data/www:/app --privileged=true composer config -g repo.packagist composer https://packagist.phpcomposer.com
docker下composer安装包的命令,以Laravel为例:
代码语言:javascript复制docker run -it -v /data/www:/app --privileged=true composer create-project --prefer-dist laravel/laravel blog
合并后,docker下composer国内镜像安装Laravel:
代码语言:javascript复制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目录