如果您使用docker-compose运行yml,则可以运行
docker-compose up-d它,它将重新创建所有具有更改的容器,并保持所有不变的服务不变。
$ cat docker-compose.env2.ymlversion: '2'services: test: image: busybox # command: env command: tail -f /dev/null environment: - MY_VAR=hello - MY_VAR2=world test2: image: busybox command: tail -f /dev/null environment: - MY_VAR=same ole same ole$ docker-compose -f docker-compose.env2.yml up -d Creating network "test_default" with the default driverCreating test_test_1Creating test_test2_1$ vi docker-compose.env2.yml # edit the file to change MY_VAR$ docker-compose -f docker-compose.env2.yml up -dRecreating test_test_1test_test2_1 is up-to-date
如果您
docker stack deploy -c docker-compose.yml使用版本3文件格式运行容器,则可以对服务进行滚动更新,如果您有多个服务实例在运行,它将防止任何停机。此功能仍是非常新的功能,您需要1.13.1修复某些更新问题,并且与任何新功能一样,错误仍在解决中。



