Book Image

Build Your Own PaaS with Docker

By : Oskar Hane
Book Image

Build Your Own PaaS with Docker

By: Oskar Hane

Overview of this book

<p>Docker is a great tool in many ways for developers and people in DevOps.</p> <p>We begin by learning how easy it is to create and publish your own customized Docker images and making them available to everyone. We also see how practical it is to separate every service to its own container. When you have published separated service containers, the process of running all kinds of platforms in the same server for easier cloud computing is a walk in the park.</p> <p>This book walks you through a use case project that will teach you how to customize and create your own Docker image, allowing you to run any platform you want. The project evolves throughout the book and emerges as a complete three containers Wordpress/MySQL platform when finished.</p> <p>By the end of the book, you will know how to create such a container on a Wordpress/MySQL platform, among others.</p>
Table of Contents (15 chapters)
Build Your Own PaaS with Docker
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Docker on Mac OS X


To be able to use Docker on Mac OS X, we have to run the Docker service inside a virtual machine (VM) since Docker uses Linux-specific features to run. We don't have to get frightened by this since the installation process is very short and straightforward.

Installation

There is an OS X installer that installs everything we need, that is, VirtualBox, boot2docker, and Docker.

VirtualBox is a virtualizer in which we can run the lightweight Linux distribution, and boot2docker is a virtual machine that runs completely in the RAM and occupies just about 27 MB of space.

Note

The latest released version of the OS X installer can be found at https://github.com/boot2docker/osx-installer/releases/latest.

Now, let's take a look at how the installation should be done with the following steps:

  1. Download the installer by clicking on the button named Boot2Docker-1.3.0.pkg to get the .pkg file, as shown in the following screenshot:

  2. Double-click on the downloaded .pkg file and go through with the installation process.

  3. Open the Finder window and navigate to your Applications folder; locate boot2docker and double-click on it. A terminal window will open and issue a few commands, as shown here:

    This runs a Linux VM, named boot2docker-vm, that has Docker pre-installed in VirtualBox. The Docker service in the VM runs in daemon (background) mode, and a Docker client is installed in OS X, which communicates directly with the Docker daemon inside the VM via the Docker Remote API.

  4. You will see a screen similar to the following screenshot, which tells you to set some environment variables:

    We open up the ~/.bash_profile file and paste three lines from our output, as follows, at the end of this file:

    export DOCKER_HOST=tcp://192.168.59.103:2376
    export.DOCKER_CERT_PATH=/Users/xxx/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1
    

    The reason why we do this is so that our Docker client knows where to find the Docker daemon. If you want to find the IP in the future, you can do so by executing the boot2docker ip command. Adding the preceding lines will set these variables every time a new terminal session starts. When you're done, close the terminal window. Then, open a new window and type echo $DOCKER_HOST to verify that the environment variable is set as it should be. You should see the IP and port your boot2docker VM printed.

  5. Type docker version to verify that you can use the Docker command. An output that looks similar to the last few lines of the preceding screenshot will mean that we have succeeded.

Upgrading Docker on Mac OS X

Since Docker is relatively new, there could be a lot happening in every update, so make sure that you check for updates on a regular basis. From time to time, go to the Mac OS X installer download page and check whether there is an upgrade available. If there is, execute these commands to update it:

boot2docker stop
boot2docker download
boot2docker start