From ded5d6b2af0fdf05610442d92e3087e8917cc242 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Wed, 13 Jan 2016 15:00:31 -0500 Subject: [PATCH] Remove path from docker, so it can be used by alternate directories --- Atomic/Export.py | 2 +- Atomic/Import.py | 2 +- Atomic/atomic.py | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Atomic/Export.py b/Atomic/Export.py index 66cab247..88b620cb 100644 --- a/Atomic/Export.py +++ b/Atomic/Export.py @@ -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): """ diff --git a/Atomic/Import.py b/Atomic/Import.py index fb60d00f..bfc3bd26 100644 --- a/Atomic/Import.py +++ b/Atomic/Import.py @@ -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): """ diff --git a/Atomic/atomic.py b/Atomic/atomic.py index 8b3b4024..55aa496f 100644 --- a/Atomic/atomic.py +++ b/Atomic/atomic.py @@ -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", @@ -68,7 +68,7 @@ class Atomic(object): "--name", "${NAME}", "${IMAGE}"] - SPC_ARGS = ["/usr/bin/docker", "run", + SPC_ARGS = ["docker", "run", "-t", "-i", "--rm", @@ -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}", @@ -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 = "" @@ -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: @@ -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: @@ -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): @@ -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): @@ -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