docker composer安装laravel报错

报错信息:

        git was not found in your PATH, skipping source download

报错原因通常是因为docker环境中缺少必备的扩展,所以会安装失败,上面的报错是由于缺乏docker git,容器内安装git就行。

解决方案:

1. 切换docker源,命令行输入:

echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" >/etc/apt/sources.list

echo "deb http://mirrors.163.com/debian/ stretch-proposed-updates main non-free contrib" >>/etc/apt/sources.list

echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list

echo "deb-src http://mirrors.163.com/debian/ stretch-proposed-updates main non-free contrib" >>/etc/apt/sources.list

这一步不是必须的,但每个容器默认用的是国外的安装源,速度很慢,经常会出现一些莫名其妙的BUG。

2. 切换安装源,或者新创建容器后需要更新系统软件包:

# 升级

apt-get upgrade

# 更新
apt-get update

# php gd依赖库
apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev

3. 安装docker git

apt-get install zip unzip git

通常来说,安装失败缺少的扩展就是上面三个,如果安装失败,尝试切换镜像或着将其分开安装:

如 :apt-get install zip

你可能感兴趣的:(docker,composer,laravel)