简体   繁体   中英

Docker Swarm: how to do a rolling update on demand?

How can one execute a rolling update on a docker swarm service on demand?

My scenario: I have a Github Action that will test my code, build the docker containers and pull to Docker Hub. After all this I want to do rolling update to a specific swarm service.

How can this be done?

So the question is how to execute the command inside GitHub Actions. I would say just like any other command:

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Execute docker swarm
        run: docker stack deploy -c compose-file.yml
        env:
          DOCKER_HOST: example.com

This requires you to expose your docker daemon to the outside world, which you should probably only do, if you have some kind of authentication in place. One way to do this is documented here . Another way would be to use SSH and execute the command on the server itself, for example with this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM