Skip to content

Instantly share code, notes, and snippets.

@alphapapa
Created September 19, 2020 20:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphapapa/6cc040b5767b4135be26884633e57383 to your computer and use it in GitHub Desktop.
Save alphapapa/6cc040b5767b4135be26884633e57383 to your computer and use it in GitHub Desktop.
Emacs native-comp branch convenience c ode

Emacs native-comp Recipes

For lack of a better term.

Update Docker image

  1. Update Andrea’s image.
    docker pull andreacorallo/emacs-nativecomp:latest
        

  1. Tangle my Dockerfile.
    FROM andreacorallo/emacs-nativecomp:latest
    
    RUN adduser --quiet --uid 1000 --disabled-password me
    RUN apt-get update
    RUN apt-get install -y git install-info texinfo
    
    ENV DISPLAY=:0
    USER me:me
        
  2. Rebuild my image.
    docker build -t ap/emacs-native-comp .
        

Run Docker container

  • Notes
    • Run xhost + to enable GUI sessions.
      • That disables all X session security, AFAIK. Is there a better way?
  • Command
    docker run -v /home/me:/home/me -v /tmp/.X11-unix/:/tmp/.X11-unix --env=DISPLAY=:0 --dns=8.8.8.8 -u me -i -t ap/emacs-native-comp:latest
        
  • Script
    docker run --rm=true -v /home/me:/home/me -v /tmp/.X11-unix/:/tmp/.X11-unix --env=DISPLAY=:0 --dns=8.8.8.8 -u me -i -t ap/emacs-native-comp:latest bash -c 'cd ~; ~/.bin/emacs-sandbox -d ~/tmp/src/emacs/native-comp/.emacs.d'
        
@pataquets
Copy link

pataquets commented Sep 8, 2021

@alphapapa: Tip: You can avoid docker pull by adding the --pull switch to build step.

@alphapapa
Copy link
Author

@pataquets: I don't necessarily want to pull every time I rebuild my local derivative image.

Anyway, today I wanted to build a custom version of Andrea's image, but I can't even get docker build to work anymore. All I get is FATA[0001] Could not reach any registry endpoint, and nothing I've tried fixes it, and Web searching for that message returns nothing useful. I can't get any additional debug information out of Docker, either, so I'm just stuck. Weirdly, I can still pull Andrea's image, and e.g. docker pull debian:latest, but trying to build Andrea's Dockerfile fails at Pulling repository debian, even with --pull=false. So...Docker...

@pataquets
Copy link

Fair enough. I assumed by the steps that you meant to update it. Otherwise, the initial docker pull step is unnecessary, since it will be pulled at the build step.
And for the Docker pull problem, I don't have any clue about the cause. My guess would be to check your docker version, since it looks like it might be trying to use a deprecated endpoint. Image registry API has evolved several time to accomodate new features, and some upgrades were breaking changes. HTH.

@alphapapa
Copy link
Author

@pataquets FYI, you're right that the problem was the Docker version. According to the Docker Hub documentation, my version of Docker was supported, but as best I could figure out, Andrea updated his Dockerfile with syntax that my version of Docker didn't support (but rather than giving some kind of "unrecognized Dockerfile keyword" error, Docker gave that useless message). Since then, I've switched to using GNU Guix to build/install a version of Emacs 28 into my user profile, which is working well. (It's also simpler, as it doesn't require bind-mounting directories and special files, dealing with network bridges to the container, X permissions, etc.)

@pataquets
Copy link

Good to know such weird message. Great to know you've gone the Guix way, since I'm on Bionic also considering going for it or switching to Arch to use AUR. Ditto for Nyxt, btw.
Thanks for sharing all that info, @alphapapa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment