I use a docker container in my gitlab ci to login into a server via ssh. When I login into the server via my computer is it possible to run php70
or /usr/bin/php71
without errors. Also there is the typical user@pc:path on the left side.
When I use the ssh client in the docker container and I'm logged in into the server there is only "$" and no user@pc:path and commands like php70
or /usr/bin/php71
are not found. My first idea was ,that I use a diferent shell but echo $SHELL is at both /bin/bash
. My gitlab-ci.yml code is this:
image: ruby:2.1
stage: on_server
environment: production
before_script:
# install ssh-agent
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# run ssh-agent
- eval $(ssh-agent -s)
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_KEY_PRIVATE")
# disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
# WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- ssh $SSH_USER_PRODUCTION@$FTP_HOST_PRODUCTION "bash -l"
- bash
- echo $SHELL
- echo $PATH
- SYMFONY_ENV=prod php71 composer.phar install --no-dev --optimize-autoloader --ignore-platform-reqs
- SYMFONY_ENV=prod php71 app/console doctrine:migrations:migrate
- SYMFONY_ENV=prod php71 app/console cache:clear --env=prod
Does anybody know where this behavoir came from?