dockerfile中安装软件时需要选择地区的问题

 

一个例子

FROM ubuntu:20.04
WORKDIR /root
COPY ./sources.list /etc/apt/sources.list
COPY ./cron-start.sh /opt/cron-start.sh
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
RUN apt-get update && \
    apt-get install -y python3 python3-pip vim cron && \
    pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple playwright && \
    pip3 install -i https://pypi.douban.com/simple pyquery && \
    playwright install chromium && \
    playwright install-deps chromium && \
    sed -i 's/required/sufficient/g' /etc/pam.d/cron && \
    chmod +x /opt/cron-start.sh
ENTRYPOINT ["/opt/cron-start.sh"]
    

加上这两行就行了

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
posted @ 2024-02-20 17:06  坚强的小蚂蚁  阅读(56)  评论(0编辑  收藏  举报