Skip to content

Commit

Permalink
docker-for-win: Make sure container is terminated #106
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Jan 22, 2019
1 parent 920dec0 commit dc2ab46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Project website: https://github.com/mviereck/x11docker
- `-t, --tty`: Long option was not parsed.
- Fixed IP check on MS Windows
[(#102)](https://github.com/mviereck/x11docker/issues/102)
- docker-for-win: Make sure container is terminated.
[(#106)](https://github.com/mviereck/x11docker/issues/106)
- docker-for-win: `--interactive` support with `winpty`.
[(#87)](https://github.com/mviereck/x11docker/issues/87)


## [5.3.3](https://github.com/mviereck/x11docker/releases/tag/v5.3.3) - 2018-11-17
Expand Down
8 changes: 6 additions & 2 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ $(cat $Bgpidfile 2>/dev/null)"
verbose -d "Container still running. Executing 'docker stop'."
$Sudo $Dockerexe stop $Containername >>$Containerlogfile 2>&1 || verbose -d "docker stop failed"
}
[ "$Winsubsystem" ] && $Dockerexe ps -a | grep -q $Containername && {
verbose -d "Container still running. Executing 'docker stop'."
$Dockerexe stop $Containername >>$Containerlogfile 2>&1 || verbose -d "docker stop failed"
}
;;
*) # should never happen (tm)
note "Found remaining background process $Line
Expand Down Expand Up @@ -3370,7 +3374,7 @@ check_containeruser() { # check container user and shared home folder (a
Containerusergid="$(echo $Containeruser | cut -d: -f2)"
Containeruser="$(echo $Containeruser | cut -d: -f1)"
}
[ -n "$(getent passwd $Containeruser)" ] && { # user exists on host
[ -n "$(getent passwd $Containeruser)" ] && { # user exists on host
Containeruser=$(getent passwd $Containeruser | cut -d: -f1) # can be name or uid -> now name
Containeruseruid=$(getent passwd $Containeruser | cut -d: -f3)
[ -z "$Containerusergid" ] && Containerusergid=$(getent passwd $Containeruser | cut -d: -f4)
Expand Down Expand Up @@ -4255,7 +4259,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
[ "$Showcontainerpid1pid" = "yes" ] && echo "stdout \$Pid1pid"
echo ""
echo "# get PID of container"
echo "Containerpid=\$(ps -o ppid \$Pid1pid 2>/dev/null || echo unkown | tail -n1)"
echo "Containerpid=\$(ps -o ppid \$Pid1pid 2>/dev/null || echo unknown | tail -n1)"
echo "verbose -d \"Container PID: \$Containerpid\""
echo "echo \$Containerpid >> $Containerpidfile"
echo ""
Expand Down

0 comments on commit dc2ab46

Please sign in to comment.