I want to execute shell thru SSH with gitlab-ci and I encounter errors.

Variables have these values :

```
DEV_SERVER=myserver.domain.com
CODE_APP=4A
CI_COMMIT_REF_SLUG=pretorien-feature-ci

```

part of gitlab-ci.yml looks like that :

```
review_app:
    stage: review
    before_script:
        # SSH key configuration
        # ...
    script:
        - ssh dev@${DEV_SERVER} \
                "CONTAINER_PORT=$(docker port app_${CODE_APP}-${CI_COMMIT_REF_SLUG} 80 | cut -d ':' -f2)" \
                "&& echo 'My container port : ${CONTAINER_PORT}' > result.txt"

```

Gitlab CI return this error `/usr/bin/bash: line 109: docker: command not found`

I tried to change the docker command with docker binary path (/usr/bin/docker) or $(which docker) but I have the same issue.

So, I decided to use a different approach :

```
review_app:
    stage: review
    before_script:
        # SSH key configuration
        # ...
    script:
        - ssh dev@${DEV_SERVER} \            
            "{ read CONTAINER_PORT _; } < <(docker port app_${CODE_APP}-${CI_COMMIT_REF_SLUG} 80 | cut -d ':' -f2)" \
            "&& echo 'My container port : ${CONTAINER_PORT}' > result.txt"

```

But, in this case, the file result.txt is **empty** and the variable CONTAINER\_PORT too.

In both cases I checked commands directly in a shell, the result was good and I can read the CONTAINER\_PORT value in result.txt