Magit无法连接到docker内的emacsclient?

Pus*_*dre 5 emacsclient magit docker

我在docker中运行emacs24.5.1(基本映像是Ubuntu).我通过apt-get安装了emacs.此外,我通过melpa(magit version magit-20170702.858)安装了magit,它很棒.但是,当我尝试提交某些内容时,magit会遇到以下错误:

1 git ? commit -- 
  /usr/bin/emacsclient.emacs24: connect: Connection refused 
  /usr/bin/emacsclient.emacs24: error executing alternate editor 
    "sh -c 'echo "WITH-EDITOR: $$ OPEN $0"; sleep 604800 & sleep=$!; trap "kill $sleep; exit 0" USR1; trap "kill $sleep; exit 1" USR2; wait $sleep'"
error: There was a problem with the editor 
  '/usr/bin/emacsclient.emacs24 --socket-name=/root/.emacs.d/server/server'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)

当我尝试手动启动emacsclient时,emacsclient有错误:

/usr/bin/emacsclient.emacs24 --socket-name=/root/.emacs.d/server/server tmp.make
/usr/bin/emacsclient.emacs24: connect: Connection refused
/usr/bin/emacsclient.emacs24: error accessing socket "/root/.emacs.d/server/server"
Run Code Online (Sandbox Code Playgroud)

这表明它不是一个真正的magit错误,但一个emacsclient错误,真的它可能正在发生,因为我泊坞窗内运行,虽然我不知道这一点.

有没有人知道如何启动emacsclient或绕过magit内部的emacsclient的要求.曾经有一个插件模式绕过内部magit emacsclient,但被弃用,较早前从melpa删除,所以我不是想它太热衷.

UPDATE emacs --daemon在docker中没有问题,但是magit commit仍然无法工作,所以也许它不是一个docker问题呢?

emacs --daemon                                                                         

 Warning: due to a long standing Gtk+ bug                                               
 http://bugzilla.gnome.org/show_bug.cgi?id=85715                                        
 Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost. 
 Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.      
 Loading 00debian-vars...                                                               
 Loading 00debian-vars...done                                                           
 Loading /etc/emacs/site-start.d/50cmake-data.el (source)...                            
 Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done                        
 Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...                   
 Loading debian-ispell...                                                               
 Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...           
 Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done       
 Loading debian-ispell...done                                                           
 Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...             
 Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done         
 Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done               
 Loading /root/.emacs.d/init_func.el (source)...                                        
 Loading /root/.emacs.d/init_func.el (source)...done                                    
 Loading flymake...                                                                     
 Loading flymake...done                                                                 
 Loading company...                                                                     
 Loading company...done                                                                 
 Loading linum...                                                                       
 Loading linum...done                                                                   
 [yas] Prepared just-in-time loading of snippets successfully.                          
 Loading /root/.emacs.d/recentf...                                                      
 Loading /root/.emacs.d/recentf...done                                                  
 Cleaning up the recentf list...                                                        
 Cleaning up the recentf list...done (0 removed)                                        
 Starting Emacs daemon.                                                                 
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 3

仔细检查您的基础图像:此线程报告看到相同的错误消息:

我设法找出问题所在。我用 emacs24 对 emacs 代码进行了字节编译,然后将其加载到 emacs23 中导致一切崩溃。
使用匹配版本的 emacs 完成字节编译后,测试套件通过了。

您可以在此处找到使用来自各种发行版(包括 Ubuntu 16.04)的 emacs构建 docker 映像的示例。 Emacs(23,用您的版本替换它)安装为

export DEBIAN_FRONTEND=noninteractive
test $1 = 7.11 && emacs=emacs23-nox || emacs=emacs-nox
apt-get update
apt-get install -y -q build-essential git \
    libxapian-dev libgmime-2.6-dev libtalloc-dev \
    zlib1g-dev python-sphinx man dtach $emacs gdb gpgsm
apt-get -y autoremove
apt-get -y clean
rm -rf /var/lib/apt/lists/
Run Code Online (Sandbox Code Playgroud)