Пример #1
0
sys.path.append("src/utils")
from DockerUtils import run_docker, build_docker

# prefix and tag will be filled by argument parser.

dirname = "devenv"

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description="Run a docker for development of DL workspace")
    parser.add_argument("-p",
                        "--prefix",
                        help="Prefix of the docker name, or [dev]",
                        action="store",
                        default="dev")
    parser.add_argument("-t",
                        "--tag",
                        help="Tag of the docker build, or [current]",
                        action="store",
                        default="latest")
    parser.add_argument("--nocache",
                        help="Tag of the docker build, or [current]",
                        action="store_true")
    args = parser.parse_args()
    dockerprefix = args.prefix
    dockertag = args.tag
    dockername = dockerprefix + ":" + dockertag
    #print args.nocache
    dockername = build_docker(dockername, dirname, nocache=args.nocache)
    run_docker(dockername, "DevDocker", devenv=True)
Пример #2
0
import pwd
import grp
from os.path import expanduser
sys.path.append("src/utils")
from DockerUtils import run_docker, build_docker

# prefix and tag will be filled by argument parser.

dirname = "devenv"

if __name__ == '__main__':
	parser = argparse.ArgumentParser(description = "Run a docker for development of DL workspace")
	parser.add_argument("-p", "--prefix", 
		help="Prefix of the docker name, or [dev]", 
		action="store", 
		default="dev" )
	parser.add_argument("-t", "--tag", 
		help="Tag of the docker build, or [current]", 
		action = "store", 
		default = "current" )
	parser.add_argument("--nocache", 
		help="Tag of the docker build, or [current]", 
		action = "store_true")
	args = parser.parse_args()
	dockerprefix = args.prefix
	dockertag = args.tag
	dockername = dockerprefix + ":" + dockertag
	#print args.nocache
	dockername = build_docker(dockername, dirname, nocache = args.nocache)
	run_docker(dockername, "DevDocker")
Пример #3
0
sys.path.append("../../../utils")
from DockerUtils import run_docker, find_dockers

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description=
        "Run a docker using your own credential at current directory")
    parser.add_argument("dockername",
                        help="docker to be run",
                        action="store",
                        type=str,
                        nargs=1)
    args = parser.parse_args()
    dockers = args.dockername
    if len(dockers) > 1:
        parser.print_help()
        print "Please specify only one dockername to run ... " + dockers
    else:
        for docker in dockers:
            matchdockers = find_dockers(docker)
            if len(matchdockers) > 1:
                parser.print_help()
                print "Multiple docker images match the current name"
                for dockername in matchdockers:
                    print "Docker images ....    " + dockername
                print "Please specify a specific docker to run"
                exit()
            else:
                for dockername in matchdockers:
                    run_docker(dockername)