Docker Community Forums

Share and learn in the Docker community.

Service that never restarts its container ("restart_policy: condition: none" doesnt work)


(Darkshark) #1

Hello there,

with my application there is a service/container that should run only once. It initialized the database, which means even when the Docker host crashes and must be restarted, I dont want to run it again or else the Database gets reset.

In my .yml-flie i execute with “docker stack deploy” i tried to use the following:

services:
  test:
    image: test:2.0
    deploy:
      restart_policy:
        condition: none

When the container exists it works just fine, but when I restart the docker daemon every single service gets started again, including this test service.

Is this a bug or intended? What else could Í do?
Thanks for your help.