0

I am trying to setup data persistence in startFabric example, hyperledger fabric 1.4.2

I set live-restore: true in daemon.json and

 volumes:
      - /var/hyperledger/couchdb0:/opt/couchdb/data

in docker-compose-couch.yaml

After I restart docker service it works, but when I reboot server all containers have status exited with code 255. However if I restart containers manually using command docker restart container_id, it works again.

LinPy
  • 16,987
  • 4
  • 43
  • 57
mikhail
  • 26
  • 2
  • what do you expect when restarting the server ? that is the normal since the containers are killed – LinPy Aug 15 '19 at 11:07
  • Try adding restart policy on your stack like so: --restart always – TreantBG Aug 15 '19 at 11:29
  • @LinPy According docker docs [https://docs.docker.com/config/containers/live-restore/] Starting with Docker Engine 1.12, you can configure the daemon so that containers remain running if the daemon becomes unavailable. – mikhail Aug 15 '19 at 12:03

1 Answers1

1

From the Docs:

Live restore upon restart

The live restore option only works to restore containers if the daemon options, such as bridge IP addresses and graph driver, did not change. If any of these daemon-level configuration options have changed, the live restore may not work and you may need to manually stop the containers.

beside the live restore meant to keep Containers up when the daemon is down not when restarting the Server (the containers will be down)

so you need to take a look at this it seems that what you need.

LinPy
  • 16,987
  • 4
  • 43
  • 57
  • Thank you @LinPy. [This is detailed description of restart policy](https://blog.codeship.com/ensuring-containers-are-always-running-with-dockers-restart-policy/) and [how to change restart policy for existing container](https://stackoverflow.com/questions/29603504/how-to-restart-an-existing-docker-container-in-restart-always-mode) – mikhail Aug 16 '19 at 10:12