docker fragmentary knowledge

First, on the time zone of the container configuration:

docker in time zone if unchecked, will use the default GMT time for the East District 8, it needs to be modified, there are several modifications:

1, modified in Dockerfile

CentOS the FROM: . 7 
the MAINTAINER on Cabel 
# use area set RUN command 
RUN CP / usr / Share / zoneinfo / Asia / of Shanghai / etc / localtime \
   && echo  ' Asia / of Shanghai ' > / etc / TimeZone

2, when the region configuration docker-compose.yaml

method one:

environment:
  - SET_CONTAINER_TIMEZONE=true
  - CONTAINER_TIMEZONE=Asia/Shanghai

Second way:

environment:
  - TZ=Asia/Shanghai

 

Guess you like

Origin www.cnblogs.com/caibao666/p/12070198.html