Fix error message + fix some formatting
@@ -334,7 +334,7 @@ class Repo2Docker(Application):
if args.volumes and not args.run:
# Can't mount if we aren't running
- print("Can not mount volumes when not running container")
+ print("To Mount volumes with -v, you also need to run the container")
sys.exit(1)
for v in args.volumes:
@@ -373,8 +373,6 @@ class Repo2Docker(Application):
def run_image(self):
client = docker.from_env(version='auto')
- api_client = docker.APIClient(version='auto',
- **docker.utils.kwargs_from_env())
port = self._get_free_port()
if not self.run_cmd:
port = str(self._get_free_port())
@@ -386,6 +384,10 @@ class Repo2Docker(Application):
ports = {}
container_volumes = {}
if self.volumes:
+ api_client = docker.APIClient(
+ version='auto',
+ **docker.utils.kwargs_from_env()
+ )
image = api_client.inspect_image(self.output_image_spec)
image_workdir = image['ContainerConfig']['WorkingDir']
