This is my docker file:

FROM ubuntu:16.04

RUN apt-get update --fix-missing && apt-get install -y emacs npm git nodejs

RUN rm -rf  .emacs .emacs.d
RUN git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

RUN ln -s /usr/bin/nodejs /usr/bin/node

RUN npm install && npm install -g yarn

I tried to start it in daemon mode so I can attach to the process later on

docker run -d spacemacs bash

But it fails to stay resident

CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                      PORTS               NAMES
d4f867eb78f1        spacemacs                 "bash"              3 minutes ago       Exited (0) 3 minutes ago                        loving_turing

Why it is the case? I have run other container in daemon mode before.

docker run -d spacemacs bash

You ran the command bash with no input, so it exited. The same happens if you do this on a normal linux prompt:

$ bash </dev/null
$ echo $?

If you want to later attach to a running bash shell, you can tell docker that the command is interactive so that it keeps stdin open. I'd also recommend allocating a tty:

docker run -dit spacemacs bash

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.