Emacs in Docker container can't connect to MELPA

I'm currently facing the problem of Emacs not being able to connect to MELPA. When researching this problem, I found out that this problem is discussed in many topics. However, every suggested solution I tried didn't work for me, beside that, the way I've set up my Emacs instance makes me think the root of the problem might be somewhere else (not emacs related itself).

So let me explain my setup: I have a Windows 10 host, and I'm trying to get GUI Emacs for Linux running on that host. I've tried various methods (VMs, Emacs for Windows, ...). Currently I'm trying to run Emacs inside a Docker container with X11 forwarding with XMing on my host.

Docker version on host: Docker version 19.03.2, build 6a30dfc I'm using this docker container as a base. However I modified the Dockerfile a bit to fit my needs (I should mention that I've never worked with docker before):

FROM alpine:edge
MAINTAINER Daniel Guerra <[email protected]>

ARG authorizedKeys=authorized_keys

RUN apk add --update openssh util-linux dbus ttf-freefont xauth xf86-input-keyboard emacs-x11 bash git sudo\
&& rm  -rf /tmp/* /var/cache/apk/*

RUN addgroup alpine \
&& adduser  -G alpine -s /bin/bash -D alpine \
&& echo "alpine:alpine" | /usr/sbin/chpasswd \
&& echo "alpine    ALL=(ALL) ALL" >> /etc/sudoers

RUN cp -r /etc/ssh /ssh_orig
RUN rm -rf /etc/ssh/*

ADD etc /etc
ADD docker-entrypoint.sh /usr/local/bin

VOLUME ["/etc/ssh"]

RUN mkdir -p /home/alpine/.ssh
ADD $authorizedKeys /home/alpine/.ssh/authorized_keys

RUN mkdir -p /home/alpine/.config
RUN git clone https://github.com/minikN/dotemacs.git /home/alpine/.config/emacs/

RUN mkdir -p /home/alpine/.emacs.d
RUN ln -s /home/alpine/.config/emacs/init.el /home/alpine/.emacs.d/init.el
RUN ln -s /home/alpine/.config/emacs/config.el /home/alpine/.emacs.d/config.el
RUN ln -s /home/alpine/.config/emacs/config.org /home/alpine/.emacs.d/config.org

RUN chown -R alpine:alpine /home/alpine/.emacs.d

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/usr/sbin/sshd","-D"]

I basically copy my hosts authorized_keys to the container. I do this because I'm using Putty and it's ssh-agent to connect to the machine via SSH.

After that I just copy my emacs config from my GitHub to the container. You can find the emacs config here.

If I now start the container connect to it via SSH and start emacs, it opens in XMing. However it just hangs (in fact the whole container hangs up), I just see a white screen. Upon restarting the container and running emacs --daemon I can see that it hangs at

alpine-sshdx:~$ emacs --daemon
Contacting host: melpa.org:443

BTW I've checked several mirrors. melpa.org:443 is just the latest try. Also tried both HTTP/HTTPS.

However doing ping 8.8.8.8 works just fine.

I have absolutely no idea what the cause of this is. But I believe it's something in the container.

Would appreciate any help.

Upvotes: 1

Views: 393

Answers (0)

Related Questions