Trying to automate Jenkins

Hi,

I don’t have a programming backgroud, but I need some help to bug this code. Can anyone help me?

Code:
version: ‘3.1’

services:

main:
image: shannonagarwal/jenkins
ports:
- 8000:8000
- 50000:50000
secrets:
- jenkins-user
- jenkins-pass

secrets:
jenkins-user:
external: true
jenkins-pass:
external: true

When I try to deploy this code, I am getting this error:

root@vultr:~/docker_jenkins# docker stack deploy -c jenkins.yml jenkins
Creating service jenkins_main
failed to create service jenkins_main: Error response from daemon: rpc error: code = InvalidArgument desc = port ‘8000’ is already in use by service ‘jenkins’ (nd093afesb3kwysc2gwt0rwkj) as an ingress port
root@vultr:~/docker_jenkins#

This is what is in the security.groovy file:

#!groovy

import jenkins.model.*
import hudson.security.*
import jenkins.security.s2m.AdminWhitelistRule

def instance = Jenkins.getInstance()

def user = new File("/run/secrets/jenkins-user").text.trim()
def pass = new File("/run/secrets/jenkins-pass").text.trim()

def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount(user, pass)
instance.setSecurityRealm(hudsonRealm)

def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
instance.setAuthorizationStrategy(strategy)
instance.save()

Jenkins.instance.getInjector().getInstance(AdminWhitelistRule.class).setMasterKillSwitch(false)