https://blog.alexellis.io/linux-desktop-on-mac/

1. Install an X11 server

An X11 server exists for MacOS which allows applications like XTerm to run and display output on your local computer. It's packaged up as the XQuartz project and can be installed with brew:

$ brew install Caskroom/cask/xquartz

==> brew cask install Caskroom/cask/xquartz

==> Creating Caskroom at /usr/local/Caskroom

==> Downloading https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg

################################## 100.0%

2. Build your Dockerfile

Once you have XQuartz set up you can then install your favourite graphical Linux apps into a Debian container or whichever distribution you prefer.

FROM debian:stretch

ENV LC_ALL en_US.UTF-8  
ENV LANG en_US.UTF-8

RUN apt-get update && apt-get install -y \  
    apt-transport-https \
    ca-certificates \
    curl \
    gconf2 \
    gconf-service \
    gvfs-bin \
    hunspell-en-us \
    libasound2 \
    libgtk2.0-0 \
    libnotify4 \
    libnss3 \
    libxss1 \
    libxtst6 \
    locales \
    python \
    xdg-utils \
        libgnome-keyring0 \
        gir1.2-gnomekeyring-1.0 \
        libappindicator1 \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \  
    && locale-gen en_US.utf8 \
    && /usr/sbin/update-locale LANG=en_US.UTF-8

ADD ./slack-desktop-2.1.0-amd64.deb ./  
RUN dpkg -i slack-desktop-2.1.0-amd64.deb

ENTRYPOINT ["slack"]

3. Set up XQuartz for network connections

By default XQuartz will listen on a UNIX socket, which is private and only exists on local our filesystem. This means Docker won't be able to access it.

Install and runsocatto create a tunnel from an open X11 port (6000) through to the local UNIX socket where XQuartz is listening for connections:

$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

This will block, so open a new tab or terminal.

4. Start the application

Build your Dockerfile, then start it by passing in an environmental variable for theDISPLAYso your graphical application knows where to show itself. Change the IP address of 192.168.0.15 to whatever you see onifconfig.

$ wget https://downloads.slack-edge.com/linux_releases/slack-desktop-2.1.0-amd64.deb
$ docker build -t slack:2.1.0
$ docker run -e DISPLAY=192.168.0.15:0 --name slack -d slack:2.1.0

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 25.0px Helvetica; color: #2e2e2e; -webkit-text-stroke: #2e2e2e}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; color: #3a4145; -webkit-text-stroke: #3a4145}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.2px Courier; color: #3a4145; -webkit-text-stroke: #3a4145; background-color:

4.1 Note on proxies:

If you want an app such as Slack to use a HTTP_PROXY then you can pass in the environmental variable at runtime. Here's an example with adocker-compose.ymlfile for convenience:

version: "2.0" 
services: 
 slack:
 image: slack:2.1.0
 environment:
 - HTTP_PROXY=http://192.168.0.10:8080
 - HTTPS_PROXY=http://192.168.0.10:8080
 - DISPLAY=192.168.0.10:0
 volumes:
 - .slack_config:/root/.config/Slack
 networks:
 - default

results matching ""

    No results matching ""