title: GitLab CI/CD: How to deploy app with docker-compose?
body: <p>I'm a total newbie when it comes to CI/CD, so I'm asking your pardon in advance for not using the right terms/doing stupid things.</p>
  <p>I have a docker-compose file which I can use to start my application with <code>sudo docker-compose up -d</code>. Works fine locally, but I also have a remote Virtual Machine, which I want to use to test my application.</p>
  <p>I want to run some tests (I will implement them later on) and deploy the app if everything is ok with every push to my repoistory. I looked into the docs, installed gitlab-runner, and tried this for a <code>.gitlab-ci.yml</code> file:</p>
  <pre><code>build-job:
    stage: build
    script:
      - echo &quot;Hello, $GITLAB_USER_LOGIN!&quot;
  
  test-job1:
    stage: test
    script:
      - echo &quot;This job tests something&quot;
  
  
  deploy-prod:
    stage: deploy
    script:
      - echo &quot;Restaring containers..&quot;
      - cd /path/too/app/repo
      - git pull
      - sudo docker-compose down &amp;&amp; sudo docker-compose up -d
  </code></pre>
  <p>However, when I tried the docker runner, it gave me an error saying it could not find the path to the directory. I understand that this is caused by the fact that it runs every stage in a separate container. How can I restart my application containers (preferably with compose) on the VM? Is there a better approach to achieve what I want to do?</p>