New to Docker.
Is there a possible way to create docker image with some helper files which will be permanent in the volume of the image under container certain folder, without dependency to copy them each build time from the host machine where we build the image, since I may have host which down't contain these files.
Any help will be greatly appreciated
答案 0 :(得分:1)
是的,您可以创建第一个放置这些文件的base
图像。您需要将此图像推送到存储库。之后,您可以根据第一张图片创建其他图像。
我试着在例子中解释一下这个想法。
基本图片有 Dockerfile
FROM ubuntu:16.04
...
COPY /my_big_files /my_big_files/
使用标记my_image_with_files:latest
构建此图像并将其推送到存储库
基于第一张图像的其他图像可以在另一台PC上进行购买。
Dockerfile
FROM my_image_with_files:latest
...
RUN ls /by_big_files/ # <- your files already there!