Git Product home page Git Product logo

docker-systemd-shim's Introduction

docker-systemd-shim

This Go program is a compatibility shim to allow the easy control of docker containers via systemd service units.

Build Status GoDoc

Installation

You basically have two options to install this Go program package:

  1. If you have Go installed and configured on your PATH, just do the following go get inside your GOPATH to get the latest version:
go get -u github.com/mback2k/docker-systemd-shim
  1. If you do not have Go installed and just want to use a released binary, then you can just go ahead and download a pre-compiled Linux amd64 binary from the Github releases.

Finally put the docker-systemd-shim binary onto your PATH and make sure it is executable.

Usage

The following is an example of a systemd.service unit file which uses this shim to control a container:

[Unit]
Description=Docker container: your-container-name
Wants=network.target
After=docker.service
Requires=docker.service
# You could also specify dependencies on other units, including those managed with this shim
#After=your-other-container.service
#Requires=your-other-container.service

[Service]
Type=notify
ExecStart=/usr/local/sbin/docker-systemd-shim -container your-container-name
Environment=DOCKER_API_VERSION=1.38
Restart=on-failure
PrivateTmp=true
ProtectHome=true
ProtectSystem=full

[Install]
# You could either make this service start, stop and restart together with docker
WantedBy=docker.service
# or make it just start and stop with the system, but not restart with docker
#WantedBy=multi-user.target

Replace your-container-name with the name of the container you want to control with this unit file.

Disclaimer

This tool is meant as a supplement to standalone or unmanaged Docker containers and not as a replacement for Kubernetes, Docker Swarm or the docker run CLI command. This tool can only control previously created and already existing docker containers.

I personally use this tool to manage pre-requisite containers for my Docker Swarm cluster, for example ndppd and tinc running inside containers managed via Ansible.

License

Copyright (C) 2018 Marc Hoersken [email protected]

This software is licensed as described in the file LICENSE, which you should have received as part of this software distribution.

All trademarks are the property of their respective owners.

docker-systemd-shim's People

Contributors

mback2k avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.