I'm trying to set up a Lisp development environment inside a Docker container, but I'm facing issues with getting SLIME in Emacs to work correctly with my Lisp configuration. Here are the details of my setup:
Dockerfile:
# Use a base image with Debian Buster
FROM debian:buster
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
ENV TERM xterm
# Install necessary system dependencies
RUN apt-get update && \
apt-get install -y \
emacs-nox \
sbcl \
git
# Install SLIME for Emacs and Quicklisp
RUN sbcl --eval '(ql:quickload :quicklisp-slime-helper)' --quit
# Create the directory for local Quicklisp projects
RUN mkdir -p /root/quicklisp/local-projects
# Clone CodeGrader repository and configure SBCL
RUN git clone https://github.com/marcus3santos/codegrader.git /root/quicklisp/local-projects/codegrader && \
echo '(ql:quickload :rutils)' >> /root/.sbclrc && \
echo '(ql:quickload :codegrader)' >> /root/.sbclrc
# Configure SLIME for Emacs
RUN echo "(setq inferior-lisp-program \"sbcl\")" >> /root/.emacs && \
echo "(require 'slime)" >> /root/.emacs && \
echo "(slime-setup '(slime-repl))" >> /root/.emacs
I've followed the following setup instructions as per my course guidelines:
Configuring SBCL:
~/.sbclrc
file located in my home directory within the Docker container.~/.sbclrc
:(ql:quickload :rutils)
(ql:quickload :codegrader)
Emacs and SLIME Configuration:
emacs
command within the Docker container.Alt
+ x
(or M-x
), typed slime
, and pressed Enter. However, I received a message stating "No match" or "No such command."Issue:
The problem I'm encountering is that SLIME doesn't seem to be available, and there's no match found when I invoke M-x slime
. Additionally, SLIME does not interact correctly with my Lisp environment. Instead of displaying the expected feedback messages and scores, there's no output, and it appears that SLIME is not functioning as expected.
I tried today along and was able to generate a working example.
However, I am using my personal .emacs.d
which is then pulled into Dockerfile.
And there is a compatibility problem between Swank 2.28 and Slime 2.26.1, but if you just choose yes and go on, it will work.
The Dockerfile:
FROM ubuntu:latest
# Set non-interactive mode for apt-get
ENV DEBIAN_FRONTEND=noninteractive
# Create a non-root user named "user"
RUN useradd -ms /bin/bash user
# Update the package list
RUN apt-get update
# Install necessary packages, including bzip2 and make
RUN apt-get install -y \
git \
curl \
bzip2 \
sudo \
make \
zlib1g-dev \
emacs
# grant sudo rights to `user`
RUN echo "user:user" | chpasswd && adduser user sudo
# Clean up after package installation
RUN rm -rf /var/lib/apt/lists/*
# Allow the "user" to run sudo without a password and disable TTY requirement
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user-nopasswd
RUN echo "Defaults !requiretty" >> /etc/sudoers
# Clone your .emacs.d configuration from your GitHub repository as the "user"
USER user
WORKDIR /home/user
RUN git clone https://github.com/gwangjinkim/.emacs.d.git /home/user/.emacs.d
# Download Roswell
RUN curl -sOL $(curl -s https://api.github.com/repos/roswell/roswell/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep 'roswell_' | grep 'amd64.deb')
# Install Roswell
RUN sudo dpkg -i roswell*.deb
RUN rm roswell*.deb
# Update Roswell
RUN ros update
# Set up Roswell's environment variables
ENV PATH=$PATH:/home/user/.roswell/bin
# Install SLIME using Roswell
RUN ros install slime 2.26.1
# Expose the port for SLIME if needed
EXPOSE 4005
# Start Emacs as the "user"
CMD emacs
And you build it in the terminal from the folder where the Dockerfile is placed by:
sudo docker build -t slime-sbcl .
and run the container by:
sudo docker run -it slime-sbcl
I used ubuntu:latest
because this caused least amount of problems.
And the comments should explain what is done.
Once open, you do in emacs:
C-x C-f
and create the file: test.lisp
.
From within it, activate slime by M-x slime
- screen will be splitted and SLIME will start - when asked for the incompativility - just type y
- and it slime will start.
Move cursor from the left to the right buffer and back by C-x o
.