<p>Setup is Jenkins running in Kubernetes.  I want to lint my code, run my tests, then build a container.  Having trouble getting poetry to install/run in one of my build steps.</p>
<pre><code>podTemplate(inheritFrom: 'k8s-slave', containers: [
    containerTemplate(name: 'py38', image: 'python:3.8.4-slim-buster', ttyEnabled: true, command: 'cat')
  ]) 
{
    node(POD_LABEL) {

        stage('Checkout') {
            checkout scm
            sh 'ls -lah'
        }

        container('py38') {
            stage('Poetry Configuration') {
                sh 'apt-get update &amp;&amp; apt-get install -y curl'
                sh &quot;curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python&quot;
                sh &quot;$HOME/.poetry/bin/poetry install --no-root&quot;
                sh &quot;$HOME/.poetry/bin/poetry shell --no-interaction&quot;
            }

            stage('Lint') {
                sh 'pre-commit install'
                sh &quot;pre-commit run --all&quot;
            }
        }
    }
}
</code></pre>
<p>Poetry install works fine, but when I go to activate the shell, it fails.</p>
<pre><code>+ /root/.poetry/bin/poetry shell --no-interaction
Spawning shell within /root/.cache/pypoetry/virtualenvs/truveris-version-Zr2qBFRU-py3.8

[error]
(25, 'Inappropriate ioctl for device')
</code></pre>

Justin S
<p>The issue here is that Jenkins runs a non-interactive shell and you are trying to start an interactive shell. The <code>--no-interaction</code> option doesn't mean a non-interactive shell but rather the shell not asking you questions:</p>
<pre class="lang-sh prettyprint-override"><code>  -n (--no-interaction)  Do not ask any interactive question
</code></pre>
<p><a href="https://stackoverflow.com/a/54012557/2989261">This answer explains it</a> 🔑🔑.</p>
<p>I would just not call the shell and just use the <code>poetry run</code> 🏃🏃 command:</p>
<pre><code>podTemplate(inheritFrom: 'k8s-slave', containers: [
    containerTemplate(name: 'py38', image: 'python:3.8.4-slim-buster', ttyEnabled: true, command: 'cat')
  ]) 
{
    node(POD_LABEL) {

        stage('Checkout') {
            checkout scm
            sh 'ls -lah'
        }

        container('py38') {
            stage('Poetry Configuration') {
                sh 'apt-get update &amp;&amp; apt-get install -y curl'
                sh &quot;curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python&quot;
                sh &quot;$HOME/.poetry/bin/poetry install --no-root&quot;
            }

            stage('Lint') {
                sh &quot;$HOME/.poetry/bin/poetry run 'pre-commit install'&quot;
                sh &quot;$HOME/.poetry/bin/poetry run 'pre-commit run --all'&quot;
            }
        }
    }
}
</code></pre>
<p>✌️</p>
