CSIT-841 Optimize creating of vnf-agent docker image Part I
[csit.git] / resources / tools / scripts / topo_container_copy.py
index d243182..088b7a4 100644 (file)
@@ -122,11 +122,16 @@ def main():
                     ssh.scp(local_path=image, remote_path=directory)
 
                 # Load image to Docker.
-                cmd = "for f in {directory}/*.tar.gz; do zcat $f | "\
-                    "sudo docker load; done".format(directory=directory)
+                cmd = "for f in {directory}/*.tar.gz; do "\
+                    "sudo docker load -i $f; done".format(directory=directory)
                 stdout = ssh_no_error(ssh, cmd)
                 print("###TI {}".format(stdout))
 
+                # Remove <none> images from Docker.
+                cmd = "docker rmi $(sudo docker images -f 'dangling=true' -q)"
+                stdout = ssh_no_error(ssh, cmd, sudo=True)
+                print("###TI {}".format(stdout))
+
 
 if __name__ == "__main__":
     sys.exit(main())

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.