docker alpine system set time zone

Use emqx container in the test

docker run -itd --name emq emqx/emqx:4.2.7

(1) Enter the container as root

1. docker exec -it -u root emq /bin/bash

2. whoami (check the user name, make sure it is root)

(2) Change the time zone

1. apk add -U tzdata (install extension package)

2. cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime (copy files)

3. echo "Asia/Shanghai" > /etc/timezone

4. apk del tzdata (delete unnecessary time zone files)

5. date (verification effect)

 

 

 

(3) Copy the file out

docker cp emq:/etc/timezone /home/emq

docker cp emq:/etc/localtime /home/emq

(4) Save the container as a mirror image

docker commit emq eqm:4.2.7

(5) Export and import images

docker save emq:4.2.7 -o  /home/emq-4.2.7.image

docker load -i /home/emq-4.2.7.image

(Mirror) Lanzous Cloud: https://wws.lanzous.com/iVHEMmiivuj

Guess you like

Origin blog.csdn.net/u013595395/article/details/114386192