I'm trying to build and then run a docker image on Jenkins. I have set up Jenkins on ubuntu on an AWS ec2 server. When I try to build I get this error:
For reference, I have also attached my JenkinsFile.
pipeline {
    agent any
    stages {
        stage('Start') {
        steps {
            echo 'Starting to build the docker-react-app.'
        }
        }
        stage('building docker image') {
        steps {
            sh 'sudo docker build -t docker-react-app .'
        }
        }
        stage('runing docker image') {
        steps {
            sh 'sudo docker run -dp 3001:3000 docker-react-app'
        }
        }
    }
}
I am using Jenkins with the default administrator account.
I have also added the Jenkins user to the docker group. But it is hasn't solved the issue. I have also verified that by running:
cat /etc/group | grep docker
Which outputs:
docker:x:998:ubuntu,jenkins
Let me know if you need any further information.

 
     
    