title: How to copy a file from the repository, into the Docker container used for a job, in gitlab-ci.yml
body: <p>How can I add a file from my project into a Docker using in a <code>gitlab-ci</code> job. Suppose I have below job in my <code>.gitlab-ci.yml</code> .</p>
  
  <pre><code>build:master:
    image: ubuntu:latest
    script:
      - cp sample.txt /sample.txt
    stage: build
    only:
      - master
  </code></pre>
  
  <p>How to copy a sample.txt inside Ubuntu image? I was thinking as it is already a running container so we can't perform copy command directly but have to run</p>
  
  <pre><code>docker cp sample.txt mycontainerID:/sample.txt
  </code></pre>
  
  <p>but again how will I get mycontainerID? because it will be running inside a Gitlab runner and any random id will be assigned for every run. Is my assumption is wrong?</p>