zoukankan      html  css  js  c++  java
  • Docker容器与Linux主机环境获取时间不一致

    最近通过Docker部署了.Net Core项目,发现创建时间和修改时间与实际时间慢8小时,默认不是东八区了,通过同步时间来解决。

    FROM microsoft/dotnet:2.2-aspnetcore-runtime
    FROM mcr.microsoft.com/dotnet/core/sdk:2.2
    WORKDIR /app
    COPY . /app
    WORKDIR /app
    ENV ASPNETCORE_URLS http://+:5002
    ENV ASPNETCORE_ENVIRONMENT=Production
    EXPOSE 5002
    #时区设置
    RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
    RUN echo 'Asia/Shanghai' >/etc/timezone
    #ENV certPassword 123456
    #RUN openssl genrsa -des3 -passout pass:${certPassword} -out server.key 2048
    #RUN openssl rsa -passin pass:${certPassword} -in server.key -out server.key
    #RUN openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=wuzhd'
    #RUN openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
    #RUN openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt -certfile server.crt -passout pass:${certPassword}
    CMD  ["dotnet", "Api.dll"]

    重新build镜像即可。

  • 相关阅读:
    Spark的精简安装步骤---陈楠心血总结
    关于Hadoop的集群环境下虚拟机采用NAT方式连不上网的解决
    size_t总结
    POJ 1852 Ants
    Digital Roots 1013
    1350. Primary Arithmetic
    Word Reversal
    POJ 2876 Cantoring Along
    逆序数的求法
    C++ 中cin
  • 原文地址:https://www.cnblogs.com/ZhengHengWU/p/12883627.html
Copyright © 2011-2022 走看看