agc-backend镜像制作
/opt/AGC-backend
[root@dadevenv AGC-backend]# ls
agc_setting config eventLog master recipe unit_test
alarm datastore helpers Pipfile requirements.txt user_group
analysis Dockerfile insertParam.py Pipfile.lock SECS
auth eqsetting logger process systemConfig
common equipmentStatus main.py README.txt tools
[root@dadevenv AGC-backend]# cat Dockerfile
FROM python:3.6
COPY . /agc-backend
WORKDIR /agc-backend
# Install app dependencies
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
EXPOSE 5010
[root@dadevenv AGC-backend]# cat requirements.txt
DBUtils
flask
flask-restful
flask_cors
json-rpc
psycopg2
requests
prompt-toolkit
scikit-learn
scipy
numpy
pyjwt
[root@dadevenv AGC-backend]# docker image build -t agc-backend:1.0.0 .
[root@dadevenv ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
agc-backend 1.0.0 83ce0368f03d 3 minutes ago 1.32GB
python 3.6 94b7a322c796 2 days ago 874MB
timescale/timescaledb latest-pg11 5f6d3db88e6c 5 weeks ago 178MB
postgres 11.8 31d22a1554df 2 months ago 282MB
[root@dadevenv ~]# docker save -o agc-backend.tar.gz agc-backend:1.0.0
[root@dadevenv ~]# ls
agc-backend.tar.gz initial-setup-ks.cfg path.py pg118 postgresql11.8.tar PycharmProjects timescaledb11.tar
anaconda-ks.cfg jupyternotebook_start.sh pg114 pgdata postgresql.tar timescale11 timescaledb.tar
https://yq.aliyun.com/articles/727210
https://www.runoob.com/docker/docker-dockerfile.html
https://blog.fundebug.com/2017/05/15/write-excellent-dockerfile/
https://cloud.tencent.com/developer/article/1456990
修改Docker容器时区
https://www.cnblogs.com/zhi-leaf/p/10604574.html
查看linux系统时区和docker容器时区
date -R //查看linux主机时间和时区 date exec [container] date -R // 查看容器时间和时区
[root@dadevenv ~]# date -R
Thu, 22 Oct 2020 14:04:31 +0800
[root@dadevenv ~]# docker exec -it 11c0dd3702f6 bash
root@11c0dd3702f6:/agc-backend# date -R
Thu, 22 Oct 2020 06:09:00 +0000
root@11c0dd3702f6:/agc-backend# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
root@11c0dd3702f6:/agc-backend# date -R
Thu, 22 Oct 2020 14:09:32 +0800
[root@dadevenv ~]# docker restart 11c0dd3702f6
11c0dd3702f6
[root@dadevenv ~]# docker exec 11c0dd3702f6 date -R
Thu, 22 Oct 2020 14:19:44 +0800
[root@dadevenv ~]# docker exec -it 11c0dd3702f6 bash
root@11c0dd3702f6:/agc-backend# date -R
Thu, 22 Oct 2020 14:20:00 +0800