Skip to content
Snippets Groups Projects
Commit e7eea7c3 authored by Darren Shepherd's avatar Darren Shepherd
Browse files

Add instructions for CoreOS

parent 7425470f
Branches
No related tags found
No related merge requests found
...@@ -93,6 +93,35 @@ By default `systemd-docker` will send READY=1 to the systemd notification socket ...@@ -93,6 +93,35 @@ By default `systemd-docker` will send READY=1 to the systemd notification socket
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 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
Running on CoreOS
=================
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.
`ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker`
That command will install systemd-docker to /opt/bin. The full nginx example that is above would now be as below.
```ini
[Unit]
Description=Nginx
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
ExecStart=/opt/bin/systemd-docker run --rm --name %n nginx
Restart=always
RestartSec=10s
Type=notify
NotifyAccess=all
TimeoutStartSec=120
TimeoutStopSec=15
[Install]
WantedBy=multi-user.target
```
License License
------- -------
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
[Unit]
Description=Nginx
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker
ExecStart=/opt/bin/systemd-docker run --rm --name %n nginx
Restart=always
RestartSec=10s
Type=notify
NotifyAccess=all
TimeoutStartSec=120
TimeoutStopSec=15
[Install]
WantedBy=multi-user.target
FROM busybox:latest
ADD systemd-docker /
ADD startup.sh /
RUN mkdir -p /opt/bin
CMD ["/startup.sh"]
#!/bin/sh
checksum()
{
md5sum $1 | awk '{print $1}'
}
if [ ! -e /opt/bin/systemd-docker ] || [ "$(checksum /opt/bin/systemd-docker)" != "$(checksum /systemd-docker)" ]; then
echo "Installing systemd-docker to /opt/bin"
cp -pf /systemd-docker /opt/bin
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment