From 826c92faed37669f3ceaa7328c52128d066f6798 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Wed, 28 Oct 2015 04:21:39 -0400 Subject: [PATCH] README.md: fix description for runc with systemd Fix the command and elaborate the instruction. Signed-off-by: Qiang Huang --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 44c7e871f..adedce1e8 100644 --- a/README.md +++ b/README.md @@ -393,6 +393,10 @@ PID USER COMMAND #### Using runc with systemd +To use runc with systemd, you can create a unit file +`/usr/lib/systemd/system/minecraft.service` as below (edit your +own Description or WorkingDirectory or service name as you need). + ```service [Unit] Description=Minecraft Build Server @@ -402,10 +406,23 @@ After=network.target [Service] CPUQuota=200% MemoryLimit=1536M -ExecStart=/usr/local/bin/runc +ExecStart=/usr/local/bin/runc start Restart=on-failure WorkingDirectory=/containers/minecraftbuild [Install] WantedBy=multi-user.target ``` + +Make sure you have the bundle's root directory and JSON configs in +your WorkingDirectory, then use systemd commands to start the service: + +```bash +systemctl daemon-reload +systemctl start minecraft.service +``` + +Note that if you use JSON configs by `runc spec`, you need to modify +`config.json` and change `process.terminal` to false so runc won't +create tty, because we can't set terminal from the stdin when using +systemd service.