jlesage / docker-apps

Portal for my docker container applications
https://jlesage.github.io/docker-apps/
16 stars 5 forks source link

Emacs #23

Open loochao opened 1 month ago

loochao commented 1 month ago

I really appreciate your Docker images—they're lightweight and the initialization process is well-designed. I would like to suggest adding Emacs, as it's widely popular and powerful; having Emacs would enable me to accomplish most of my tasks effectively.

I attempted to add emacs from your Alpine-based image myself but encountered an unknown issue. To troubleshoot this, one needs to understand the specifics of how you construct jlesage-baseimage-gui, so it would be incredibly helpful if you could provide some insights. Below are my dockerfile and error message

FROM jlesage/baseimage-gui:alpine-3.20-v4

RUN add-pkg sudo bash xterm git
RUN echo app'     ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN add-pkg font-terminus font-dejavu
RUN add-pkg emacs-x11

# Copy the start script.
COPY startapp.sh /startapp.sh

ENV HOME /config
WORKDIR /config

# Set the name of the application.
RUN set-cont-env APP_NAME "xterm"

# More fonts
# font-inconsolata font-noto font-noto-cjk font-awesome font-noto-extra

# ~/.Xdefaults
# XTerm*Font: -*-terminus-bold-r-*-*-24-*-*-*-*-*-*-*
# XTerm*Background: black
# XTerm*Foreground: white

My startapp.sh

#!/bin/sh
exec /usr/bin/xterm

I successfully built the container and connected to it remotely via VNC. When I attempted to start Emacs after launching xterm (which starts automatically), I encountered an error message. This issue appears to be specific to your baseimage, possibly due to its uniquely designed startup processes.

$emacs
Warning: arch-dependent data dir '/usr/lib/emacs/29.4/x86_64-alpine-linux-musl/': Operation not permitted
Warning: arch-independent data dir '/usr/share/emacs/29.4/etc/': Operation not permitted
Warning: game dir '/var/games/emacs': Operation not permitted
Warning: Lisp directory '/usr/share/emacs/29.4/lisp': Operation not permitted
Error: /usr/share/emacs/29.4/etc/charsets: Operation not permitted
Emacs will not function correctly without the character map files.
Please check your installation!

It seems to me that there might be a permission issue. I attempted to run the Docker container with root privileges, but the issue persists.

eastpyne commented 1 month ago

Update:

The issue has been resolved by using a newer version of Docker. I encountered problems when using Mint 21:

# The docker version, which causes problems
$ docker -v
Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1

but after switching to Arch Linux and upgrading all components to the latest versions (sudo pacman -Syu), the installation of buildx (sudo pacman -Sy docker-buildx), then the docker build worked. Although the exact cause is unclear, it's worth noting this for anyone starting with this Docker series.

# This is the docker version actually working:
$ docker -v
Docker version 27.0.3, build 7d4bcd863a

Suggestion: Including a Makefile can help others know which commands to use when building the image. Below are the ones works for me:

# In Arch Linux, as it has more up-to-date packages than Ubuntu/Debian/Fedora
sudo pacman -Syu
sudo pacman -Sy docker-buildx
DOCKER_BUILD_KIT=1 DOCKER_CLI_EXPERIMENTAL=enabled docker build . -t jlesage/baseimage-gui
# In Dockerfile:
RUN apk add --no-cache emacs-x11
# or use add-pkg, a nice wrapper included by jlesage series

Please marked this issue as closed.