代码之家  ›  专栏  ›  技术社区  ›  Michael Durrant

使用docker时,我应该将bash安装文件放在哪里?

  •  1
  • Michael Durrant  · 技术社区  · 8 年前

    当前,我将dotfiles(在.bashrc中引用)复制到/root 有没有更好的方法来组织他们?

    FROM alpine:latest
    LABEL maintainer="Michael Durrant<junk@snap2web.com>"
    RUN apk add bash git vim
    COPY alpine_bashrc /root/.bashrc
    COPY .bash_functions.sh /root
    COPY .bash_aliases /root
    COPY .git-completion.bash /root
    RUN "/bin/bash"
    
    1 回复  |  直到 8 年前
        1
  •  3
  •   ddavison    8 年前

    COPY 对于每个文件,建议改为使用目录。限制是文件必须按容器中显示的名称命名。

    $ ls .
        Dockerfile
        dotfiles/
          .bashrc
          .git-completion.bash
          .bash_functions.sh
          .bash_aliases.sh
    

    ...
    COPY dotfiles/ root/
    

    每一个 复制 指令在容器中创建新层。通过使用一个指令节省空间/时间。

    推荐文章