diff --git a/x11docker b/x11docker index 5cbde63f..73e29956 100755 --- a/x11docker +++ b/x11docker @@ -935,6 +935,7 @@ cleanup() { # --cleanup : check for non-removed containers and left grep -q .cache/x11docker <<<$Cachebasefolder && Orphanedfolders=$(find "$Cachebasefolder" -mindepth 1 -maxdepth 1 -type d | sed s%$Cachebasefolder/%% | grep -v x11docker-gui) [ "${X11DOCKER_LASTCLEANFOLDER:-}" ] && Orphanedfolders="$(echo "$Orphanedfolders" | grep -v $X11DOCKER_LASTCLEANFOLDER)" Orphanedcontainers="$(docker ps -a --filter name=x11docker_X --format "{{.Names}}")" + Orphanedcontainers="$Orphanedcontainers $(find "$Cachebasefolder" -mindepth 2 -maxdepth 2 -type f -name 'container.id' -exec cat {} \;)" Orphanedcontainers="$(env IFS='' echo $Orphanedcontainers)" [ -z "$Orphanedcontainers$Orphanedfolders" ] && { @@ -1527,7 +1528,7 @@ stdout() { Longoptions="$Longoptions,starter,cleanup,license,licence,help,version,install,update,update-master,remove,wmlist" # special options without starting X server Longoptions="$Longoptions,xhost:,no-auth,vt:,display:,xtest,no-xtest,env:,showenv,showid,showpid1" # X and environment options Longoptions="$Longoptions,verbose,silent,debug,stdout,stderr,stdin" # verbose options - Longoptions="$Longoptions,hostipc,hostnet,ps,cache,cap-default,no-entrypoint,sudouser,hostuser:,group-add:" # capabilities, users + Longoptions="$Longoptions,hostipc,hostnet,ps,cache,cap-default,no-entrypoint,sudouser,hostuser:,group-add:,name:" # capabilities, users Longoptions="$Longoptions,cachedir:,homedir:,westonini:,sharedir:,keymap:,runfromhost:,runasroot:,sharessh" # developer options Parsedoptions="$(getopt --options $Shortoptions --longoptions $Longoptions --name "$0" -- "$@" 2>/tmp/x11docker_parsererror)" @@ -1674,6 +1675,7 @@ $Customenvironment" ; shift ;; # set custom environm --hostipc) Sharehostipc="yes" ;; # docker run option --ipc=host --hostnet) Sharehostnet="yes" ;; # docker run option --net=host --cap-default) Capdropall="no" ;; # don't use --cap-drop=ALL + --name) Containername="${2:-}" ; shift ;; # set container name ## miscellaneous --ps) Preservecachefiles="yes" ;; # preserve container instead of removing it with 'docker run --rm' @@ -4187,7 +4189,7 @@ DefaultEnvironment=DISPLAY=$Newdisplay XAUTHORITY=$Cshare/Xclientcookie $(IFS=$' run) Dockercommand="docker run -d --tty" [ "$Preservecachefiles" = "no" ] && Dockercommand="$Dockercommand --rm" - Containername="x11docker_X${Newdisplaynumber}_${Mycookie}_$Imagenametr" + [ -z "$Containername" ] && Containername="x11docker_X${Newdisplaynumber}_${Mycookie}_$Imagenametr" Dockercommand="$Dockercommand --name=$Containername" verbose "Container name: $Containername"