Getting started with Docker for Mac

EchoNest sold out to Spotify and closed down their API.

Now InfiniteGlitch doesn’t have a process for analyzing MP3s to reassemble them.

Peter Sobot hipped me to a QM Vamp Plugin which it looks like will give us the data we need without leaving the comfort of our own server.

I’ve been working in a VirtualEnvironment on the Mac, but for this I want to try Docker, who just this year released Docker for Mac. This review by Benny Cornellison was pretty helpful.

But port 80 wasn’t available. To which I found the answer in the GitHub issues.

lsof -nP +c 15 | grep LISTEN

# outputs
Dropbox             384  IPv4 0x82c      TCP 127.0.0.1:17600 (LISTEN)
com.docker.slirp   6218  IPv4 0x82c      TCP *:5432 (LISTEN) <<<MOSTLY THE PROBLEM
Python             6268  IPv4 0x82c      TCP 127.0.0.1:51617 (LISTEN)

# then kill the com.docker.slirp process id if it's the one causing the problem
kill -9 6218

UPDATE:
I was also able to reproduce this issue (multiple times)… start a service locally that is listening to port XXX and start a container that exposes the same XXX port…
it’ll fail to run docker-compose up and the com.docker.slirp process will not be killed causing the problem to persist till the com.docker.slirp process killed manually ( I even added an alias to do so alias portfix='pkill com.docker.slirp')

I also had to turn off MAMP (old fashioned, I know) so that port 80 was available.

Now I can run docker run -d -p 80:5000 training/webapp python app.py and on URL localhost see the Hello World output. Good.

It looks like there had been a tool called pinata which was useful for IP management, but it’s been removed. If I’m understanding correctly, Docker for Mac sets a single IP address for the Guest/VM which gets returned by docker-machine ip. On this install it’s 192.168.99.100.

Apparently there’s an OSX utility called screen that you are recommended to use to SSH into your Docker container:

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

Hit Return.

Welcome to Moby alpha
Kernel 4.4.15-moby on an x86_64 (/dev/ttyS0)

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

moby login: root
Welcome to the Moby alpha, based on Alpine Linux.
moby:~# ls
moby:~# ls ../
Database         home             port             srv
Users            host_docker_app  private          sys
Volumes          init             proc             tmp
bin              lib              root             usr
dev              linuxrc          run              var
etc              media            sbin
moby:~# python
-ash: python: not found

docker images and docker ps as well as docker ps -a, docker rmi -f image-name, docker rm container-name and docker rm container-name all key commands.

Continuing through the tutorials.

To get into a terminal within a container I can run docker run -t -i image-name /bin/bash.

First attempt at building from a Dockerfile:

FROM debian:latest
MAINTAINER Mike iLL <mike@mzoo.org>

RUN apt-get -y update && $(grep -vE "^\s*#" aptpackages  | tr "\n" " ")

RUN pip install -r requirements.txt

RUN wget qm-vamp-plugins-linux64-v1.7.1.tar.bz2

RUN wget http://code.soundsoftware.ac.uk/attachments/download/670/vampy-2.0-amd64-linux.tar.bz2

CMD echo "Maybe that worked."

In the command line

docker build -t mikeill/vamptest:v1 .

Downloading Debian Jessie (latest). Going to bed.

Above dockerfile failed: grep: aptpackages: No such file or directory. Added single line items for apt packages.