Skip to content

Commit

Permalink
Rm ssh mounting which didn't work
Browse files Browse the repository at this point in the history
Typically the user from the host won't exist in the container, and the
ssh client seems to care and refuse to work.

The problem was pre-existing but made more apparent by the fact that we
now set HOME to a different place (so we were no longer mount .ssh in
the right place).

Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
  • Loading branch information
mpg committed Dec 11, 2024
1 parent 268b36e commit 13c8538
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion resources/docker_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The helper script `run.sh` can be used to launch a docker image:
```
`run.sh` makes it easier to start images with a suitable working environment. It:
- mounts a local directory on to the container at startup. Hence, a local checkout of Mbed TLS can be used and artefacts produced can be preserved even after exiting the image.
- mounts `~/.ssh` directory to the docker home so that `git` can be used from within the docker.
- configures user ids for the docker user to be same as the host user to preserve the permissions on the files created or modified inside the docker.

## Running the images manually
Expand Down
6 changes: 1 addition & 5 deletions resources/docker_files/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
# created/updated by docker image can be accessible after
# exiting the image.
# Mount dir Mounts a user specified dir to the working dir in the image.
# Mount ~/.ssh Also mounts host's ~/.ssh to ~/.ssh
# in the image. So git can be used.
#
# Usage: ./run.sh mount_dir docker_image_tag
#
Expand All @@ -47,14 +45,12 @@ IMAGE=$2
USR_NAME=`id -un`
USR_ID=`id -u`
USR_GRP=`id -g`
SSH_CFG_PATH=~/.ssh

echo "****************************************************"
echo " Running docker image - $IMAGE"
echo " User ID:Group ID --> $USR_ID:$USR_GRP"
echo " Mounting $SSH_CFG_PATH --> /home/user/.ssh"
echo " Mounting $MOUNT_DIR --> /var/lib/ws"
echo "****************************************************"

sudo docker run --network=host --rm -i -t -u $USR_ID:$USR_GRP -w /var/lib/ws -e HOME=/var/lib/ws -v $MOUNT_DIR:/var/lib/ws -v $SSH_CFG_PATH:/home/user/.ssh --cap-add SYS_PTRACE ${IMAGE}
sudo docker run --network=host --rm -i -t -u $USR_ID:$USR_GRP -w /var/lib/ws -e HOME=/var/lib/ws -v $MOUNT_DIR:/var/lib/ws --cap-add SYS_PTRACE ${IMAGE}

0 comments on commit 13c8538

Please sign in to comment.