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
問(wèn)題原因
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í)現(xiàn)在線集成開發(fā)環(huán)境實(shí)例詳解
這篇文章主要介紹了Docker 實(shí)現(xiàn)在線集成開發(fā)環(huán)境實(shí)例詳解的相關(guān)資料,這里對(duì)實(shí)現(xiàn)在線集成開發(fā)環(huán)境,進(jìn)行了詳細(xì)的介紹及實(shí)現(xiàn),需要的朋友可以參考下2016-11-11
在Windows系統(tǒng)下安裝docker窗口的配置過(guò)程
相信大家都知道Docker有很多種安裝的選擇,其中支持最好的是Ubuntu系統(tǒng)。而且docker如果想在windows上運(yùn)行必須借助docker-machine,這篇文章將給大家詳細(xì)的介紹在Windows系統(tǒng)上安裝docker窗口的配置過(guò)程,有需要的朋友們可以參考借鑒。2016-10-10
docker容器訪問(wèn)宿主機(jī)的MySQL操作
這篇文章主要介紹了docker容器訪問(wèn)宿主機(jī)的MySQL操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2021-03-03
Docker?/?K8s環(huán)境下的Dubbo服務(wù)部署實(shí)踐教程
Docker和Kubernetes(通??s寫為k8s)是容器化應(yīng)用程序的兩個(gè)主要工具,這篇文章主要介紹了Docker/K8s環(huán)境下的Dubbo服務(wù)部署的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2026-04-04
解決docker使用GDB,無(wú)法進(jìn)入斷點(diǎn)的問(wèn)題
這篇文章主要介紹了解決docker使用GDB,無(wú)法進(jìn)入斷點(diǎn)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-11-11
Docker實(shí)現(xiàn)發(fā)布一個(gè)springboot項(xiàng)目
文章介紹了使用Docker打包SpringBoot項(xiàng)目的過(guò)程,包括基本用法、maven源碼打包法、使用maven插件打包和docker-maven-plugin插件打包,并詳細(xì)講述了每種方法的操作步驟和配置細(xì)節(jié),最后總結(jié)了使用插件打包的優(yōu)勢(shì)2026-04-04
基于Docker的MongoDB實(shí)現(xiàn)授權(quán)訪問(wèn)的方法
這篇文章主要介紹了基于Docker的MongoDB實(shí)現(xiàn)授權(quán)訪問(wèn)的方法,需要的朋友可以參考下2017-03-03

