E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

在laravel项目根目录下找到 ./vendor/laravel/sail/runtimes/[php版本号]/Dockerfile 文件

插入如下内容

FROM ubuntu:22.04
#定义切换源参数 true | false
ARG CHANGE_SOURCE=true
RUN if [ ${CHANGE_SOURCE} = true ]; then \
    sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/' /etc/apt/sources.list && \
    sed -i 's/security.ubuntu.com/mirrors.aliyun.com/' /etc/apt/sources.list \
;fi

保存后执行

 sail build --no-cache
Last modification:February 3rd, 2023 at 02:56 pm
If you think my article is useful to you, please feel free to appreciate