<p>I was able to solve this issue by using the following docker image instead of the Dockerfile:</p>
<p><strong>&quot;dxatscale/sfpowerscripts&quot;</strong></p>
<p>Here is an example:</p>
<pre class="lang-java prettyprint-override"><code>pipeline {
    agent {
        docker { image 'dxatscale/sfpowerscripts' }
    }

    stages {
        stage(&quot;build&quot;) {
            steps {
                echo &quot;build step&quot;
                sh 'node --version'
                sh 'npm --version'
                sh &quot;sfdx --version&quot;
                sh &quot;sfdx plugins --core&quot;
                sh &quot;sfdx plugins&quot;
                sh &quot;sfdx commands&quot;
                sh 'sfdx sfpowerkit --help'
            }
        }
    }

}
</code></pre>

CC BY-SA 4.0
2022-10-10T02:02:38.697Z
2022-10-10T02:02:38.697Z
Pietro Zuntini
<p>I have same issue, adding <code>mkdir .local &amp;&amp; chmod g+rwx .local</code> before instalation helped me.</p>
<pre><code>RUN mkdir .local &amp;&amp; chmod g+rwx .local \
&amp;&amp; echo 'y' | sfdx plugins:install sfpowerkit
</code></pre>
<p>or</p>
<p>install it whithin jenkins 'steps'. it might not be very clever or wise but it should work.</p>

CC BY-SA 4.0
2021-09-04T16:43:43.670Z
Hi! Thank you for your help! I've tried adding this but it didn't work :(

I don't know if this helps, but I've added the output from the job in the question description.
Pietro Zuntini
CC BY-SA 4.0
2021-09-04T18:33:01.760Z
I updated the answer: install it whithin jenkins 'steps'. it might not be very clever or wise but it should work.
user_pruser
CC BY-SA 4.0
2021-09-16T00:56:35.987Z
No matter what I try, it does not work. If I try installing within the 'steps', it hangs forever on "Installing plugin sfpowerkit...". I'm not sure anymore how to proceed hahaha. Any more ideas?
Pietro Zuntini
CC BY-SA 4.0
2021-09-23T13:27:42.567Z
did you pipe echo 'y' ? so it will installs by itself?
user_pruser
CC BY-SA 4.0
2022-01-07T15:51:44.123Z
@user_pruser what is the meaning of \ in the above command and should this be in a single line?
Pablo Gonzalez
CC BY-SA 4.0
2022-01-11T09:22:55.970Z
@CommonCoreTawan it allows to break longer command to more lines - escaping newline character.
user_pruser
CC BY-SA 4.0
2021-09-02T18:38:50.927Z
2021-09-04T18:32:31.810Z
2021-09-04T18:32:31.810Z
user_pruser
<p>I'm having sort of a weird problem with my Jenkins pipeline. I've defined a Dockerfile which installs some tools I need for my CI/CD pipeline, such as node, npm, sfdx, and sfpowerkit (a plugin for sfdx). This is the Dockerfile:</p>
<pre><code>FROM node:14.14-alpine

#add usefull tools
RUN apk add --update --no-cache  \
  git \
  findutils \
  bash \
  unzip \
  curl \
  wget \
  nodejs-npm \
  openjdk8-jre \
  openssh-client \
  perl \
  jq

# install Salesforce CLI from npm
RUN npm install sfdx-cli --global
RUN sfdx --version

# install sfpowerkit - https://github.com/Accenture/sfpowerkit
RUN echo y | sfdx plugins:install sfpowerkit
RUN sfdx plugins
</code></pre>
<p>My Jenkinsfile is pretty simple as well:</p>
<pre class="lang-java prettyprint-override"><code>pipeline {
    agent {
        dockerfile true
    }

    stages {
        stage(&quot;build&quot;) {
            steps {
                echo &quot;build step&quot;
                sh 'node --version'
                sh 'npm --version'
                sh &quot;sfdx --version&quot;
                sh &quot;sfdx plugins --core&quot;
                sh &quot;sfdx plugins&quot;
                sh &quot;sfdx commands&quot;
                sh 'sfdx sfpowerkit --help' &lt;-- this command fails
            }
        }
    }

}
</code></pre>
<p>The problem is that even though I install the plugin sfpowerkit and it shows on the job output that it was successfully installed, the plugin is not available inside the build stage.</p>
<p>This is during the Dockerfile image construction:</p>
<p><a href="https://i.sstatic.net/AgQXw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AgQXw.png" alt="sfdx plugins command during Dockerfile build" /></a></p>
<p>And this is during the build stage on the pipeline:</p>
<p><a href="https://i.sstatic.net/yHA6P.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yHA6P.png" alt="sfdx plugins command during build stage" /></a></p>
<p>I can't find out what the problem is, and why the plugin is not available after constructing the container through the Dockerfile.</p>
<p>Would anyone be kind to help?</p>
<p>Thank you!!</p>
<hr />
<p><strong>EDIT 4 Sep:</strong></p>
<p>This is the job output: <a href="https://justpaste.it/4jnjn" rel="nofollow noreferrer">https://justpaste.it/4jnjn</a></p>

<docker><jenkins><jenkins-pipeline><dockerfile><jenkinsfile>
Package installed using Dockerfile not available on Jenkins pipeline stage
Pietro Zuntini
# Package installed using Dockerfile not available on Jenkins pipeline stage

(Asked by: username_0 on 2021-08-23)

I'm having sort of a weird problem with my Jenkins pipeline. I've defined a Dockerfile which installs some tools I need for my CI/CD pipeline, such as node, npm, sfdx, and sfpowerkit (a plugin for sfdx). This is the Dockerfile:
FROM node:14.14-alpine

#add usefull tools
RUN apk add --update --no-cache  \
  git \
  findutils \
  bash \
  unzip \
  curl \
  wget \
  nodejs-npm \
  openjdk8-jre \
  openssh-client \
  perl \
  jq

# install Salesforce CLI from npm
RUN npm install sfdx-cli --global
RUN sfdx --version

# install sfpowerkit - https://github.com/Accenture/sfpowerkit
RUN echo y | sfdx plugins:install sfpowerkit
RUN sfdx plugins

My Jenkinsfile is pretty simple as well:
pipeline {
    agent {
        dockerfile true
    }

    stages {
        stage("build") {
            steps {
                echo "build step"
                sh 'node --version'
                sh 'npm --version'
                sh "sfdx --version"
                sh "sfdx plugins --core"
                sh "sfdx plugins"
                sh "sfdx commands"
                sh 'sfdx sfpowerkit --help' <-- this command fails
            }
        }
    }

}

The problem is that even though I install the plugin sfpowerkit and it shows on the job output that it was successfully installed, the plugin is not available inside the build stage.
This is during the Dockerfile image construction:

And this is during the build stage on the pipeline:

I can't find out what the problem is, and why the plugin is not available after constructing the container through the Dockerfile.
Would anyone be kind to help?
Thank you!!

EDIT 4 Sep:
This is the job output: https://justpaste.it/4jnjn

**Tags:** docker, jenkins, jenkins-pipeline, dockerfile, jenkinsfile


---

## 2 answers

### Answer by username_0 on 2022-10-10. Score: 0 | Accepted answer

I was able to solve this issue by using the following docker image instead of the Dockerfile:
"dxatscale/sfpowerscripts"
Here is an example:
pipeline {
    agent {
        docker { image 'dxatscale/sfpowerscripts' }
    }

    stages {
        stage("build") {
            steps {
                echo "build step"
                sh 'node --version'
                sh 'npm --version'
                sh "sfdx --version"
                sh "sfdx plugins --core"
                sh "sfdx plugins"
                sh "sfdx commands"
                sh 'sfdx sfpowerkit --help'
            }
        }
    }

}


---

### Answer by username_1 on 2021-09-02. Score: 0

I have same issue, adding mkdir .local && chmod g+rwx .local before instalation helped me.
RUN mkdir .local && chmod g+rwx .local \
&& echo 'y' | sfdx plugins:install sfpowerkit

or
install it whithin jenkins 'steps'. it might not be very clever or wise but it should work.

> **Comments:**
> **username_0**: Hi! Thank you for your help! I've tried adding this but it didn't work :(  I don't know if this helps, but I've added the output from the job in the question description.  
> **username_1**: I updated the answer: install it whithin jenkins 'steps'. it might not be very clever or wise but it should work.  
> **username_0**: No matter what I try, it does not work. If I try installing within the 'steps', it hangs forever on "Installing plugin sfpowerkit...". I'm not sure anymore how to proceed hahaha. Any more ideas?  
> **username_1**: did you pipe echo 'y' ? so it will installs by itself?  
> **username_2**: @username_1 what is the meaning of \ in the above command and should this be in a single line?  
> **username_1**: @CommonCoreTawan it allows to break longer command to more lines - escaping newline character.  

---

