Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit e7eea7c

Browse files
Add instructions for CoreOS
1 parent 7425470 commit e7eea7c

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,35 @@ By default `systemd-docker` will send READY=1 to the systemd notification socket
9393

9494
What this will do is setup a bind mount for the notification socket and then set the NOTIFY_SOCKET environment variable. If you are going to use this feature of systemd take some time to understand the quirks of it. More info in this [mailing list thread](http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/18649). In short, systemd-notify is not reliable because often the child dies before systemd has time to determine which cgroup it is a member of
9595

96+
Running on CoreOS
97+
=================
98+
99+
If you are running on CoreOS, it may be more problematic to install `systemd-docker` to `/opt/bin`. To make this easier add the following line to your unit file.
100+
101+
`ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker`
102+
103+
That command will install systemd-docker to /opt/bin. The full nginx example that is above would now be as below.
104+
105+
```ini
106+
[Unit]
107+
Description=Nginx
108+
After=docker.service
109+
Requires=docker.service
110+
111+
[Service]
112+
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
113+
ExecStart=/opt/bin/systemd-docker run --rm --name %n nginx
114+
Restart=always
115+
RestartSec=10s
116+
Type=notify
117+
NotifyAccess=all
118+
TimeoutStartSec=120
119+
TimeoutStopSec=15
120+
121+
[Install]
122+
WantedBy=multi-user.target
123+
```
124+
96125
License
97126
-------
98127
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

example/coreos-nginx.service

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Nginx
3+
After=docker.service
4+
Requires=docker.service
5+
6+
[Service]
7+
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
8+
ExecStart=/opt/bin/systemd-docker run --rm --name %n nginx
9+
Restart=always
10+
RestartSec=10s
11+
Type=notify
12+
NotifyAccess=all
13+
TimeoutStartSec=120
14+
TimeoutStopSec=15
15+
16+
[Install]
17+
WantedBy=multi-user.target

image/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM busybox:latest
2+
3+
ADD systemd-docker /
4+
ADD startup.sh /
5+
RUN mkdir -p /opt/bin
6+
CMD ["/startup.sh"]

image/startup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
checksum()
4+
{
5+
md5sum $1 | awk '{print $1}'
6+
}
7+
8+
if [ ! -e /opt/bin/systemd-docker ] || [ "$(checksum /opt/bin/systemd-docker)" != "$(checksum /systemd-docker)" ]; then
9+
echo "Installing systemd-docker to /opt/bin"
10+
cp -pf /systemd-docker /opt/bin
11+
fi

0 commit comments

Comments
 (0)