-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-ssh-demo.bash
More file actions
executable file
·36 lines (26 loc) · 937 Bytes
/
run-ssh-demo.bash
File metadata and controls
executable file
·36 lines (26 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -e
echo " * Build container..."
docker build . -t mageops/centos-systemd
echo " * Run container..."
! docker top centos-systemd 2>/dev/null 1>/dev/null || docker kill centos-systemd
docker run \
--rm \
--detach \
--interactive \
--tty \
--publish 322:22 \
--tmpfs /tmp:exec \
--tmpfs /run \
--volume /sys/fs/cgroup:/sys/fs/cgroup:ro \
--name centos-systemd \
mageops/centos-systemd
echo " * Wait until container is healthy..."
while ! docker ps --filter name=centos-systemd --filter health=healthy --format '{{ .Names }}' | grep centos-systemd >/dev/null; do
echo " * Status: $(docker ps --filter name=centos-systemd --format '{{ .Status }}')"
sleep 1s
done
echo " * SSH into the container..."
echo -e "\n !!! Enter SSH password: centos !!! \n"
unset SSH_AUTH_SOCK
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@127.0.0.1 -p 322