Edge computing provides efficient and low-latency computing services for Internet of Things applications. Container virtualization technology is widely used as an indispensable key technology in edge computing. However, the creation of the container requires reading the corresponding image file. If the image file is not stored locally, it will take a lot of time to download, which increases the user’s extremely high service delay. Aiming at decreasing the download time of image files, we develop a two-stage optimization storage strategy of image files to decrease its download time based on edge computing. This strategy optimizes the image file placement in the initialization stage and the runtime stage, respectively. In the initialization stage, we propose a pseudo-polynomial time algorithm to filter all image files and select the image file combination, which best meets the capacity of the edge node for placement. In the runtime stage, we continue to optimize the local image repository based on the historical access records of the edge node. This operation can reduce the number of downloads of image files, thereby further reducing the user’s service delay. In addition, we created a real data set according to the service requirements and the structure of image files on the smart factory and the access records on the DockerHub. A large number of experiments are carried out based on the data set. Experimental results show that the two-stage optimization storage strategy can greatly reduce the download time of image files, thus reducing the service delay of edge nodes and improving the service quality of edge nodes.