Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the source of a "with-contenv" shebang?

Could someone give me a brief explanation or links to an explanation of this topic? Info on the origination would be dandy. The only information that I could find is related to s6-overlay, which I have not yet used. Is this the origination of this?

of the use of this Shebang:

#!/usr/bin/with-contenv bash

vs. this Shebang:

#!/usr/bin/env bash

The second is what I use most of the time with bash.

The is a bash she-bang (shebang) question about a type of shebang.

#!/usr/bin/with-contenv bash
# your shellscript follows
#!/usr/bin/env bash
# this is my normal way of encoding the she-bang.

# Where to appropriately use?

I should note, that I did read "... just make use of with-contenv helper" and I was wondering if that is the first usage, or if it comes from another source like docker, w3c, or somewhere else.

like image 577
tonecurves Avatar asked Aug 03 '19 22:08

tonecurves


1 Answers

Indeed, this is related, and very specific, to the s6-overlay architecture. This is a tool for using the s6 process supervisor inside of Docker containers.

In some more detail, Docker is otherwise not well-suited to running multiple services and daemons in the same container, and the general architecture of a supervisor is at odds with how Docker wants things. s6-overlay attempts to fix this, so that you can run services inside of a single Docker container.

As explained in the documentation, with-contenv is a wrapper which makes sure the argument is run with the environment variables specific to s6-overlay.

Concretely, it uses s6-envdir to load the environment from /var/run/s6/container_environment before executing its argument (in this case, bash).

like image 187
tripleee Avatar answered Oct 22 '22 14:10

tripleee