Docker Mac Brew



  1. Docker Start Daemon Mac Brew

This is a short guide explaining how to run GUI applications from within Docker on Mac. This uses XQuartz to enable to set the DISPLAY variable within the container.

Install XQuartz

You can install XQuartz using homebrew with brew cask install xquartz or directly from the website here. At the time of writing, I had 2.7.11 installed on my machine with OSX El Capitan. After installing XQuartz restart your machine.

Install Docker for Mac

Install docker using brew cask install docker or directly from the website here.

Docker Mac Brew

Brew install docker-compose Everything related to Docker and its environment is installed now. Let's get started with using it. First, create an engine for Docker on MacOS.

Run XQuartz

  • Brew install bash-completion brew cask install docker brew install kubectl brew cask install minikube Then go to the gui launcher and start up docker, and follow the prompts. Then open a terminal and you should fine the following cli tools installed.
  • Docker on Mac is a GUI tool, so you need to use Homebrew Cask for the installation. But let’s take a step back and answer why you’d use Homebrew in the first place. As I mentioned earlier, the standard way of installing GUI tools (including Docker) requires you to perform a few steps. First, find a Docker package on the internet.
  • Homebrew’s package index. Names: Docker Desktop, Docker Community Edition, Docker CE App to build and share containerized applications and microservices.
  • Brew install docker-compose Everything related to Docker and its environment is installed now. Let's get started with using it. First, create an engine for Docker on MacOS.

Start XQuartz from command line using open -a XQuartz. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients” ticked:

Host Machine IP

Docker

IP=$(ifconfig en0 | grep inet | awk '$1'inet' {print $2}') should set the IP variable as the ip of your local machine. If you’re on wifi you may want to use en1 instead of en0, check the value of the variable using echo $IP.

Now add the IP using Xhost with xhost + $IP. If the xhost command is not found check /usr/X11/bin/xhost as that might not be in your path.

Running a container

You can now try running firefox in your container with:

or run octave using:

Browsh’s prerequisites are a current (57+) version of Firefox and a terminal client that supports true colour. Once you have those you can download the appropriate binary or package for your system.

Note that the following examples all use x64 packages. Please use the proper package for your architecture.

Debian/Ubuntu

Redhat/Fedora

Mac

Packages such as the .deb and .rpm versions provide a new browsh command.So too does the Homebrew command (for OSX users only).

Static Binary

Docker

The static binaries need to first be made executable; chmod a+x browsh_1.6.4_linux_amd64. You will then be able to run the Browsh TTY client with: ./browsh_1.6.4_linux_amd64.

Docker

Docker Start Daemon Mac Brew

A Docker image is available that bundles an up to date version of Firefox, so that everything you need to run Browsh is self-contained. You can pull and run the TTY client with:
docker run -it --rm browsh/browsh