12月 112019
 

通常来讲,容器为了更小,是不会带编辑器的,但是,利用docker cp 命令copy出来,编辑后再copy进去显得又比较麻烦,于是:

上一个简单的脚本:docker-vim

用法:

注意:

  1. 脚本中没有直接vim /proc/$pid/root/$file  ,因为这个可以read到文件内容,但是write会失败; 所以,先cd到/proc/$pid/root ,再vim $file 这样是正常的
  2. 该方法 仅适用于运行这的容器,(通常这可能并不是问题),可能有更好的编辑文件的办法
    1. 将容器文件系统挂载到宿主机的某个位置
    2. 让容器动态挂载一个有编辑器程序的volume
    3. 做一个非常简易的无依赖的编辑器程序copy到容器里面
 Posted by at 下午 1:53

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据