我有一个用例,其中我们通过docker-compose运行模拟。我们的方案数据当前存储在一个名为
的数据容器中 configs
我们定义一个体积:
volumes:
configs:
在我们的docker-compose.yml
文件中,然后启动configs
容器并将数据“注入”到该卷中:
services:
# The presence of this container is JUST To seed the configs volume
configs:
image: ${REGISTRY}/{$REPO}:latest
# command: tail -f /dev/null
volumes:
- configs:/configs
这一切的工作方式是:
# We take down the old setup and remove volumes
docker-compose down -v
# pull new data
docker-compose pull
# bring up the sim
docker-compose up
它可以很好地工作,但是我必须从实际图像而不是FROM scratch
构建图像,因为据我了解,我需要先“运行然后退出”容器,以使其填充我的共享卷< / p>
是否可以使用其他方法来达到相同的结果?我喜欢的是,非常容易向非技术人员解释该怎么做。而且我们经常更新配置数据....
谢谢