Home > database >  Running mssh: No user exists for uid 1000
Running mssh: No user exists for uid 1000

Time:07-14

My Dockerfile and Jenkinsfile are currently set up like this.

Dockerfile:

FROM python:3.7
RUN pip install ec2instanceconnectcli

Jenkinsfile snippet:

     stage('Initialize Docker'){
        steps{
            script{
            def dockerHome = tool 'myDocker'
            env.PATH = "${dockerHome}/bin:${env.PATH}"
            }
        }
    }

    stage('EC2 Connection'){
       
        agent{
            dockerfile true
            }
 
        steps{
            withAWS(credentials: '********', region: 'us-east-2') {
                   sh 'mssh ************ --region us-east-2'
           }
        }
        
    }
      

I am not sure why I am getting this error:

  mssh ************ --region us-east-2
No user exists for uid 1000

Any suggestions would be greatly appreciated.

CodePudding user response:

The image tag python:3.7 is equivalent to 3.7.13-bullseye, so we are working with the latest version of Debian here. Debian requires use of adduser for adding a new user. We can modify your Dockerfile:

FROM python:3.7
RUN pip install ec2instanceconnectcli && adduser --uid 1000 jenkins

will create the equivalent jenkins user inside the image for the agent. The expected jenkins user for the sh step method will then exist.

Note the jenkins user also has e.g. shell set to /sbin/nologin, and you can incrementally modify for this extra security if it does not break functionality.

  • Related