Posts in Category: docker

Install Docker for Mac using homebrew

Here’s the command I ran:

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 version
Docker version 17.09.0-ce, build afdb6d4

$ docker-compose version
docker-compose version 1.16.1, build 6d1ac21

$ docker-machine --version
docker-machine version 0.12.2, build 9371605

$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.2", GitCommit:"477efc3cbe6a7effca06bd1452fa356e2201e1ee", GitTreeState:"clean", BuildDate:"2017-04-19T20:33:11Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"darwin/amd64"}


Get bash autocompletion working for docker cli on a mac

First install the following formulas:

$ brew install bash-completion
$ brew cask install docker

Next via the gui launcher, find the docker icon and launch it, then follow the prompts.

then restart your bash terminal.

Now run the following command to create a few symbolic links:

ln -s /Applications/ /usr/local/etc/bash_completion.d/docker
ln -s /Applications/ /usr/local/etc/bash_completion.d/docker-machine
ln -s /Applications/ /usr/local/etc/bash_completion.d/docker-compose

Then restart the bash terminal.

Therefore running the above curl commands resulted in the following files being created:

$ pwd
$ cd /usr/local/etc/bash_completion.d/
$ ll | grep docker
-rw-r--r--  1 schowdhury  admin     15 19 Oct 11:18 docker
-rw-r--r--  1 schowdhury  admin     15 19 Oct 11:18 docker-compose
-rw-r--r--  1 schowdhury  admin  10347 19 Oct 11:18 docker-machine
-rw-r--r--  1 schowdhury  admin   1469 19 Oct 11:19 docker-machine-prompt
-rw-r--r--  1 schowdhury															

Docker – An apache ‘hello world’ example

Here we’re going to build a simple docker container that is running apache web server and then access it from your laptop’s web browser.

We will be building our container using the official ubuntu docker image.

First off, pull down the ubuntu image, by running:

$ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
ae79f2514705: Pull complete
5ad56d5fc149: Pull complete
170e558760e8: Pull complete
395460e233f5: Pull complete
6f01dc62e444: Pull complete
Digest: sha256:506e2d5852de1d7c90d538c5332bd3cc33b9cbd26f6ca653875899c505c82687
Status: Downloaded newer image for ubuntu:latest

Then confirm that you have this image now:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED