title: Jenkins: Pipeline Docker Job with Jenkins file - Docker groovy syntax
body: <p>I'm an issue finding any proper example of how to build, register, and run a docker image via a jenkinsfile for a Pipeline job. Here is what I have so far: </p>
  
  <pre><code>node {
      def myService
  
      stage('Checkout Project') {
          checkout scm
      }
  
      stage('Build Binary') {
          sh "mvn package -f pom.xml -Dmaven.test.skip=true"
      }
  
      stage('Build Image') {
          sh "pwd"
          myService = docker.build('myService -f ${pwd}/Dockerfile')
      }
  
      stage('Test Image') {
          sh "echo Tests Passed :)"
      }
  
      stage('Run uShip Docker Container') {
          myService.run()
      }
  }
  </code></pre>
  
  <p>first issue I'm is that when the docker.build() fires, it cannot find my docker file which I find odd because the command runs the same directory of the Dockerfile. Next I cannot any consistent example of how to register, push, and run the image. Any help would be greatly appreciated!</p>
  
  <p>UPDATE: Well fixed the issue with docker not being able to locate the docker file. It was a naming issue; my docker file was names "DockerFile" instead of "Dockerfile". Renamed and it worked, but now I'm getting another error: </p>
  
  <p>Invalid repository name (myService), only [a-z0-9-_.] are allowed</p>
  
  <p>Not sure what's this is referring to.</p>
  
  <p>UPDATE: In addition to my initial question, does a docker-compose file have to be of type .yml or can it be a .properties file?</p>