Skip to content

Commit

Permalink
Merge pull request projectatomic#282 from rhatdan/path
Browse files Browse the repository at this point in the history
Remove path from docker, so it can be used by alternate directories
  • Loading branch information
rhatdan committed Jan 13, 2016
2 parents c699d13 + ded5d6b commit 4566659
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Atomic/Export.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def export_images(export_location):
tags = " ".join(images[id])
util.writeOut("Exporting image: {0}".format(id[:12]))
with open(export_location + '/images/' + id, 'w') as f:
subprocess.check_call(["/usr/bin/docker", "save", tags], stdout=f)
subprocess.check_call(["docker", "save", tags], stdout=f)

def export_containers(graph, export_location):
"""
Expand Down
2 changes: 1 addition & 1 deletion Atomic/Import.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def import_images(import_location):
for image in images:
util.writeOut("Importing image: {0}".format(image[:12]))
with open(subdir + '/' + image) as f:
subprocess.check_call(["/usr/bin/docker", "load"], stdin=f)
subprocess.check_call(["docker", "load"], stdin=f)

def import_containers(graph, import_location):
"""
Expand Down
32 changes: 16 additions & 16 deletions Atomic/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def find_repo_tag(d, id):


class Atomic(object):
INSTALL_ARGS = ["/usr/bin/docker", "run",
INSTALL_ARGS = ["docker", "run",
"-t",
"-i",
"--rm",
Expand All @@ -68,7 +68,7 @@ class Atomic(object):
"--name", "${NAME}",
"${IMAGE}"]

SPC_ARGS = ["/usr/bin/docker", "run",
SPC_ARGS = ["docker", "run",
"-t",
"-i",
"--rm",
Expand All @@ -84,7 +84,7 @@ class Atomic(object):
"-e", "IMAGE=${IMAGE}",
"${IMAGE}"]

RUN_ARGS = ["/usr/bin/docker", "create",
RUN_ARGS = ["docker", "create",
"-t",
"-i",
"--name", "${NAME}",
Expand Down Expand Up @@ -127,7 +127,7 @@ def force_delete_containers(self):
def update(self):
if self.force:
self.force_delete_containers()
return subprocess.check_call(["/usr/bin/docker", "pull", self.image])
return subprocess.check_call(["docker", "pull", self.image])

def pull(self):
prevstatus = ""
Expand Down Expand Up @@ -285,7 +285,7 @@ def _interactive(self):

def _running(self):
if self._interactive():
cmd = ["/usr/bin/docker", "exec", "-t", "-i", self.name]
cmd = ["docker", "exec", "-t", "-i", self.name]
if self.command:
cmd += self.command
else:
Expand All @@ -297,11 +297,11 @@ def _running(self):
else:
if self.command:
if self.args.display:
return self.writeOut("/usr/bin/docker exec -t -i %s %s" %
return self.writeOut("docker exec -t -i %s %s" %
(self.name, self.command))
else:
return subprocess.check_call(
["/usr/bin/docker", "exec", "-t", "-i", self.name] +
["docker", "exec", "-t", "-i", self.name] +
self.command, stderr=DEVNULL)
else:
if not self.args.display:
Expand All @@ -311,26 +311,26 @@ def _start(self):
if self._interactive():
if self.command:
subprocess.check_call(
["/usr/bin/docker", "start", self.name],
["docker", "start", self.name],
stderr=DEVNULL)
return subprocess.check_call(
["/usr/bin/docker", "exec", "-t", "-i", self.name] +
["docker", "exec", "-t", "-i", self.name] +
self.command)
else:
return subprocess.check_call(
["/usr/bin/docker", "start", "-i", "-a", self.name],
["docker", "start", "-i", "-a", self.name],
stderr=DEVNULL)
else:
if self.command:
subprocess.check_call(
["/usr/bin/docker", "start", self.name],
["docker", "start", self.name],
stderr=DEVNULL)
return subprocess.check_call(
["/usr/bin/docker", "exec", "-t", "-i", self.name] +
["docker", "exec", "-t", "-i", self.name] +
self.command)
else:
return subprocess.check_call(
["/usr/bin/docker", "start", self.name],
["docker", "start", self.name],
stderr=DEVNULL)

def _inspect_image(self, image=None):
Expand Down Expand Up @@ -601,8 +601,8 @@ def uninstall(self):
subprocess.check_call(cmd, env=self.cmd_env, shell=True)

if self.name == self.image:
self.writeOut("/usr/bin/docker rmi %s" % self.image)
subprocess.check_call(["/usr/bin/docker", "rmi", self.image])
self.writeOut("docker rmi %s" % self.image)
subprocess.check_call(["docker", "rmi", self.image])

@property
def cmd_env(self):
Expand Down Expand Up @@ -716,7 +716,7 @@ def get_col_lengths(_images):

enc = sys.getdefaultencoding()
if self.args.prune:
cmd = "/usr/bin/docker images --filter dangling=true -q".split()
cmd = "docker images --filter dangling=true -q".split()
for i in subprocess.check_output(cmd, stderr=DEVNULL).split():
self.d.remove_image(i.decode(enc), force=True)
return
Expand Down

0 comments on commit 4566659

Please sign in to comment.