代码之家  ›  专栏  ›  技术社区  ›  Vinay

如何从Docker容器创建图像?

  •  1
  • Vinay  · 技术社区  · 6 年前

    2 回复  |  直到 6 年前
        1
  •  2
  •   Victor Wong    6 年前

    你可以用 docker commit .

    Docker commit official documentation :

    docker提交[OPTIONS]容器[REPOSITORY[:TAG]]

    --作者,-作者(如约翰·汉尼拔·史密斯)hannibal@a-team.com)

    --更改,-c对创建的映像应用Dockerfile指令

    --pause,-p true提交期间暂停容器

    注意这句重要的话:

    默认情况下,正在提交的容器及其进程将在提交映像时暂停。这降低了在创建提交的过程中遇到数据损坏的可能性。

    但是,这不是最佳做法。

        2
  •  0
  •   Tryph    6 年前

    docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

    看到了吗 the doc 更详细的解释


    除非你有特别的需要 Dockerfile 为了树立你的形象,你应该选择 Dockerfile文件 docker build 命令