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 denieddocker官网给的docker compose的例子在自己vmware上操作的时候遇到的问题,首先是报错如下ERROR: Version in "./docker-compose.yml" is unsupported. You
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/

这个是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 ,经过漫长的等待,发现终于可以了。
更多推荐



所有评论(0)