WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: Permission denied

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: Permission denied

docker官网给的docker compose的例子在自己vmware上操作的时候遇到的问题,

首先是报错如下

ERROR: Version in “./docker-compose.yml” is unsupported. You might be seeing this error because you’re using the wrong Compose file version. Eithupported version (e.g “2.2” or “3.3”) and place your service definitions under the services key, or omit the version key and place your servi at the root of the file to use version 1.

For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: Permission denied

这个是docker-compose.yml里面的的python版本有点高,改成3即可,

然后是报这个错WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: Permission denied,这个错误是无法访问官网给的外网,在Dockerfile中加入下列代码

RUN sed -i ‘s/https/http/’ /etc/apk/repositories
RUN apk add curl

Dockerfile修改完内容

FROM python:3.7-alpine
RUN sed -i 's/https/http/' /etc/apk/repositories
RUN apk add curl
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]

当把全部内容复制后,又会出现这个错误,sed: unsupported command �
ERROR: Service ‘web’ failed to build: The command ‘/bin/sh -c sed -i ‘s/https/http/’ /etc/apk/repositories’ returned a non-zero code: 1

这个是由于复制的内容到Dockerfile后出现问题 ‘s/https/http/’,这个需进入Dockerfile文件手动更改

回来,最后再试一次docker-compose run ,经过漫长的等待,发现终于可以了。

Original: https://blog.csdn.net/weixin_46005263/article/details/122005496
Author: weixin_46005263
Title: WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: Permission denied

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/749352/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球