forked from alankent/magento2devbox-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 1
/
m2ssh
21 lines (16 loc) · 674 Bytes
/
m2ssh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
if [[ ! -f docker-compose.yml ]]; then
echo "Warning: No `docker-compose.yml` file found."
echo "Are you running this script from the correct directory?"
exit 1
fi
SSH_HOST=$(docker-compose port web 22 | awk -F: '{
host = $1
if (host == "") host = "localhost"
if (host == "0.0.0.0") host = "localhost"
print host
}')
SSH_PORT=$(docker-compose port web 22 | awk -F: '{print $2}')
exec ssh -p ${SSH_PORT} magento2@${SSH_HOST} $*
# The following version quietens more messages due to recreating containers
exec ssh -o LogLevel=error -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${SSH_PORT} magento2@${SSH_HOST} $*