docker?build運(yùn)行報(bào)錯(cuò)source:?not?found解決分析
運(yùn)行
FROM python:3.10.10-bullseye RUN . /etc/os-release && cat > /etc/apt/sources.list <<EOF deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME} main contrib non-free deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME}-updates main contrib non-free deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME}-backports main contrib non-free deb http://security.debian.org/debian-security bullseye-security main contrib non-free EOF RUN apt-get update RUN apt-get install -y vim RUN mkdir /code ADD . /code/ WORKDIR /code/PyAV RUN source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make
報(bào)錯(cuò)
─? docker build -t ponponon/pyav:0.0.1 . 2 ↵
[+] Building 3.6s (12/12) FINISHED docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 753B 0.0s
=> [internal] load metadata for docker.io/library/python:3.10.10-bullseye 0.0s
=> [1/8] FROM docker.io/library/python:3.10.10-bullseye 0.0s
=> [internal] load build context 0.5s
=> => transferring context: 3.18MB 0.5s
=> CACHED [2/8] RUN . /etc/os-release && cat > /etc/apt/sources.list <<EOF 0.0s
=> CACHED [3/8] RUN apt-get update 0.0s
=> CACHED [4/8] RUN apt-get install -y vim 0.0s
=> CACHED [5/8] RUN mkdir /code 0.0s
=> [6/8] ADD . /code/ 2.7s
=> [7/8] WORKDIR /code/PyAV 0.0s
=> ERROR [8/8] RUN source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make 0.3s
------
> [8/8] RUN source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make:
0.273 /bin/sh: 1: source: not found
------
Dockerfile:18
--------------------
16 | WORKDIR /code/PyAV
17 | CMD ["/bin/bash"]
18 | >>> RUN source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make
19 |
--------------------
ERROR: failed to solve: process "/bin/sh -c source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make" did not complete successfully: exit code: 127
問題原因
docker build 默認(rèn)使用 sh,而不是 bash
而 sh 是沒有 source 命令的
所以,解決方案就是把 sh 改成 bash
怎么改?加一行 SHELL ["/bin/bash", "-c"]
解決示例
完整的
FROM python:3.10.10-bullseye RUN . /etc/os-release && cat > /etc/apt/sources.list <<EOF deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME} main contrib non-free deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME}-updates main contrib non-free deb http://mirrors.tuna.tsinghua.edu.cn/debian/ ${VERSION_CODENAME}-backports main contrib non-free deb http://security.debian.org/debian-security bullseye-security main contrib non-free EOF RUN apt-get update RUN apt-get install -y vim RUN mkdir /code ADD . /code/ WORKDIR /code/PyAV SHELL ["/bin/bash", "-c"] RUN source scripts/activate.sh && pip install --upgrade -r tests/requirements.txt && ./scripts/build-deps && make
以上就是docker build運(yùn)行報(bào)錯(cuò)source: not found解決分析的詳細(xì)內(nèi)容,更多關(guān)于docker build報(bào)錯(cuò)source: not found的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
刪除docker中沒有被使用的數(shù)據(jù)卷volume
發(fā)現(xiàn)docker占用宿主機(jī)的磁盤空間很大,這個(gè)時(shí)候如何來釋放這些數(shù)據(jù)卷占用的空間呢,通過執(zhí)行相關(guān)命令即可順利解決,下面小編給大家介紹下刪除docker中沒有被使用的數(shù)據(jù)卷volume,感興趣的朋友跟隨小編一起看看吧2023-01-01聊聊使用docker安裝nginx提供web服務(wù)的問題
這篇文章主要介紹了使用docker安裝nginx提供web服務(wù),docker pull nginx命令用于拉取最新版本的nginx鏡像,需要的朋友可以參考下2022-04-04Docker?部署?Minio?對(duì)象存儲(chǔ)服務(wù)器的過程詳解
Minio是一個(gè)輕量級(jí)的應(yīng)用程序,可以在各種環(huán)境中運(yùn)行,包括公共云、私有云和混合云,這篇文章主要介紹了Docker?部署?Minio?對(duì)象存儲(chǔ)服務(wù)器的過程詳解,需要的朋友可以參考下2024-07-07Docker部署Laravel應(yīng)用的實(shí)現(xiàn)示例
這篇文章主要介紹了Docker部署Laravel應(yīng)用的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09借助Docker搭建JMeter+Grafana+Influxdb監(jiān)控平臺(tái)的詳細(xì)教程
這篇文章主要介紹了借助Docker搭建JMeter+Grafana+Influxdb監(jiān)控平臺(tái),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-01-01ubuntu如何在docker容器中安裝strongswan
這篇文章主要介紹了ubuntu如何在docker容器中安裝strongswan,起動(dòng)一個(gè)ubuntu容器,我是用的docker compose啟動(dòng)的,compose的配置文件為ipsec-strongswan.yml,感興趣的朋友跟隨小編一起看看吧2024-04-04基于Docker搭建Redis一主兩從三哨兵的實(shí)現(xiàn)
這篇文章主要介紹了基于Docker搭建Redis一主兩從三哨兵的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09Next.js?Docker鏡像私有部署從零實(shí)現(xiàn)
這篇文章主要為大家介紹了Next.js?Docker鏡像私有部署從零實(shí)現(xiàn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-12-12