From 8e103fa80b0b17484f7cdffd6bad8d4544dfa6b2 Mon Sep 17 00:00:00 2001 From: Savinda Senevirathne Date: Thu, 17 Jun 2021 10:48:44 +0530 Subject: [PATCH] Adding restart policy unless-stopped to hp containers (#11) --- src/hp_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hp_manager.cpp b/src/hp_manager.cpp index 58a602f..d017976 100644 --- a/src/hp_manager.cpp +++ b/src/hp_manager.cpp @@ -168,13 +168,14 @@ namespace hp */ int run_container(const std::string &folder_name, const ports &assigned_ports) { + // We instruct the demon to restart the container automatically once the container exits except manually stopping. const std::string command = "docker run -t -i -d --network=hpnet --stop-signal=SIGINT --name=" + folder_name + " \ -p " + std::to_string(assigned_ports.user_port) + ":" + std::to_string(assigned_ports.user_port) + " \ -p " + std::to_string(assigned_ports.peer_port) + ":" + std::to_string(assigned_ports.peer_port) + " \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ - --mount type=bind,source=" + + --restart unless-stopped --mount type=bind,source=" + conf::cfg.hp.instance_folder + "/" + folder_name + ",target=/contract \ hpcore:latest run /contract";