13. Docker 通⽤用的最佳实践
• 当提交 PR 时, ⾃自动触发 CI / CD ——> build and tag a Docker image and
test it.
• 最好在发布⽣生产环境前是可以分别在 dev, testing, security team 对 image 做签
名
Use CI/CD for testing and deployment
14. Docker 通⽤用的最佳实践
Differences in development and production environments
Development Production
使⽤用 bind mounts 当时将源代码
映射到 container 中
使⽤用 volumes 去管理理 container data.
使⽤用 Docker Desktop for Mac 或
者 Docker Desktop for Windows.
使⽤用 Docker Engine - 最好是企业版, with userns mapping for greater isolation of Docker processes from host
processes.
不不⽤用担⼼心时间问题
需要保证 contianer 内的时间统⼀一,始终在Docker主机和每个容器器进程中运⾏行行NTP客户端,并将它们全部同步到同
⼀一NTP服务器器。如果使⽤用群集服务,还请确保每个Docker节点将其时钟同步到与容器器相同的时间源。