Comments (7)
@gzoller I had a similar requirement, I ended up creating an wrapper for the /init
script with the following content
#!/bin/bash
if [ "${1:0:1}" = '-' ]; then
export EXTRA_OPTIONS="$@"
set --
fi
exec /init "$@"
The script exports a variable named EXTRA_OPTIONS
with all user specified command line options, removes all the args from the command line and launches the /init
script of s6-overlay
Now in your services run
script you can use the EXTRA_OPTIONS
variable. eg.
#!/usr/bin/with-contenv bash
set -e
exec /usr/bin/mydaemon ${EXTRA_OPTIONS:+"$EXTRA_OPTIONS"}
P.S. I am not aware if s6-overlay has any built-in option for this.
from s6-overlay.
I may have discovered something... If you pass other commands to /init on the command line they seem to go right through to execution. So as long as my derived Dockers always set an ENDPOINT [/init, whatever] then it may work. (At least it worked in the application I tried.) I'll have a look at the wrapper script idea too, just in case I'm misusing /init in this way.
I don't mind much if derived dockers have to follow a convention of running /init, because that's pretty generic. I just don't want them having to know about or start a bunch of specific services.
from s6-overlay.
@gzoller that is true. any command specified to /init
will get executed in addition to the services you may have configured. This is mostly useful for debugging, for example you can launch bash
and debug stuff. Another neat feature of s6 is that it will reap zombie processes created by commands launched in this manner.
Note that when the command exits, the container exits as well.
from s6-overlay.
@gzoller yep - that's one of the features of the s6-overlay
, it helps for those some reasons @sameersbn mentioned. The overall idea is, even with the s6-overlay
setup (so downloaded and ENTRYPOINT
configured), your images should still generally behave the same as the default images, up until you start adding services.
@gzoller I'd also recommend just using an environment variable to store your arguments and referencing it in your run
script. So the user would run something like:
docker run -e MY_DAEMON_ARGS="-f /some/file -p -i ..." myimage
Then in your run script:
#!/usr/bin/with-contenv sh
exec /usr/bin/my-daemon $MY_DAEMON_ARGS
@sameersbn's wrapper script is a pretty good idea, though!
from s6-overlay.
@gzoller I'm with @jprjr, use environment variables to customize your daemon behaviour, IMO, it's the most configurable way of handling parameters. I usually do and it works pretty well for all kind of situations.
from s6-overlay.
@gzoller can we close this?
from s6-overlay.
Yes please. Responses were very helpful :-)
Sent from my iPhone
On Dec 3, 2015, at 4:56 AM, Gorka Lerchundi Osa [email protected] wrote:
@gzoller can we close this?
—
Reply to this email directly or view it on GitHub.
from s6-overlay.
Related Issues (20)
- `S6_CMD_WAIT_FOR_SERVICES=1` makes no diference HOT 15
- `/command` not present in PATH HOT 7
- systemd notify service conversion exmaple HOT 4
- s6-notifyoncheck: fatal: s6-supervise not running. HOT 3
- Installing S6 on official php-fpm container shows no log output from S6 HOT 5
- Issue with s6-overlay in Cattr project when deployed on Kubernetes HOT 6
- `UID not set` error HOT 10
- Question: pass args to the underlying service HOT 6
- s6-overlay v3 only sends SIGTERM to `/etc/services.d` after `S6_SERVICES_GRACETIME` HOT 8
- Setting S6_READ_ONLY_ROOT does not copy `/etc` to `/run/s6/etc` HOT 3
- Service is started, but reported as "normally down", seemingly by default HOT 11
- 3.1.6.1 hangs at the very end of shutdown for more than a minute HOT 3
- In some rare occasions s6-overlay hangs at shutdown for undefined amount of time HOT 4
- Using s6-overlay with ECS Exec HOT 8
- How to create something similar like cont-init if this one is deprecated ? HOT 3
- Best practice for redirecting output from app1 to app2 HOT 5
- Problem using S6_STAGE2_HOOK to run shell script HOT 2
- s6-linux-init: warning: parent wrote to fd 3! HOT 9
- How to read ENV variables from a file for the main process (defined in CMD) HOT 4
- Shutdown container during s6-rc startup leads to deadlock HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from s6-overlay.