I'm working on setting up a script in my .gitlab-ci.yml file so that I'm able to deploy a newly built Docker image to my server.

Here is how it looks so far:

- ssh deploy@my.private.vps '/bin/sh -c "cd /home/project/some/directory &&
export PATH=/bin:/usr/bin:/usr/local/bin && \
docker-compose stop web && \
docker-compose rm -f web && \
docker-compose up -d web && \
docker-compose exec web php artisan storage:link && \ 

However, I keep getting "docker-compose: command not found" when running the command. Of course, docker-compose is install and available for the user 'deploy' when I log in with the user.

I found during my researches that it was because SSH doesn't load usr/local/bin by default. I tried to solve this issue by enabling the user's profile in the /etc/ssh/sshd_config file, and to export the PATH when running the script.

I'm running out of ideas on what I should try next.

What should I do?

Any idea welcome



which docker-compose


whereis docker-compose

to find out what is its absolute path.

Make sure this path is added to your PATH env.

You can also just change your docker-compose into fullpath commands:

/usr/local/bin/docker-compose stop web (...)

  • That's a good idea, I ended up running commands such as /usr/local/bin/docker-compose exec <some command> – Jaeger Apr 29 '19 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.