Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Docker

You're reading from   Learning Docker Optimize the power of Docker to run your applications quickly and easily

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781784397937
Length 240 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with Docker FREE CHAPTER 2. Handling Docker Containers 3. Building Images 4. Publishing Images 5. Running Your Private Docker Infrastructure 6. Running Services in a Container 7. Sharing Data with Containers 8. Orchestrating Containers 9. Testing with Docker 10. Debugging Containers 11. Securing Docker Containers Index

Installing the Docker engine

The Docker engine is built on top of the Linux kernel and it extensively leverages its features. Therefore, at this point in time, the Docker engine can only be directly run on Linux OS distributions. Nonetheless, the Docker engine could be run on the Mac and Microsoft Windows operating systems by using the lightweight Linux VMs with the help of adapters, such as Boot2Docker. Due to the surging growing of Docker, it is now being packaged by all major Linux distributions so that they can retain their loyal users as well as attract new users. You can install the Docker engine by using the corresponding packaging tool of the Linux distribution; for example, by using the apt-get command for Debian and Ubuntu, and the yum command for RedHat, Fedora, and CentOS.

Note

We have chosen the Ubuntu Trusty 14.04 (LTS) (64-bit) Linux distribution for all practical purposes.

Installing from the Ubuntu package repository

This section explains the steps involved in installing the Docker engine from the Ubuntu package repository in detail. At the time of writing this book, the Ubuntu repository had packaged Docker 1.0.1, whereas the latest version of Docker was 1.5. We strongly recommend installing Docker version 1.5 or greater by using any one of the methods described in the next section.

However, if for any reason you have to install the Ubuntu packaged version, then please follow the steps described here:

  1. The best practice for installing the Ubuntu packaged version is to begin the installation process by resynchronizing with the Ubuntu package repository. This step will essentially update the package repository to the latest published packages, thus we will ensure that we always get the latest published version by using the command shown here:
    $ sudo apt-get update
    

    Tip

    Downloading the example code

    You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

  2. Kick-start the installation by using the following command. This setup will install the Docker engine along with a few more support files, and it will also start the docker service instantaneously:
    $ sudo apt-get install -y docker.io
    

    Note

    The Docker package is called docker.io because an older version of the Ubuntu package was called docker. As a result, all the files with the name docker are installed as docker.io.

    Examples are /usr/bin/docker.io and /etc/bash_completion.d/docker.io.

  3. For your convenience, you can create a soft link for docker.io called docker. This will enable you to execute Docker commands as docker instead of docker.io. You can do this by using the following command:
    $ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
    

    Note

    The official Ubuntu package does not come with the latest stable version of docker.

Installing the latest Docker using docker.io script

The official distributions might not package the latest version of Docker. In such a case, you can install the latest version of Docker either manually or by using the automated scripts provided by the Docker community.

For installing the latest version of Docker manually, follow these steps:

  1. Add the Docker release tool's repository path to your APT sources, as shown here:
    $ sudo sh -c "echo deb https://get.docker.io/ubuntu \
        docker main > /etc/apt/sources.list.d/docker.list"
    
  2. Import the Docker release tool's public key by running the following command:
    $ sudo apt-key adv --keyserver \
        hkp://keyserver.ubuntu.com:80 --recv-keys \
        36A1D7869245C8950F966E92D8576A8BA88D21E9
    
  3. Resynchronize with the package repository by using the command shown here:
    $ sudo apt-get update
    
  4. Install docker and then start the docker service.
    $ sudo apt-get install -y lxc-docker
    

Note

The lxc-docker command will install the Docker image using the name docker.

The Docker community has taken a step forward by hiding these details in an automated install script. This script enables the installation of Docker on most of the popular Linux distributions, either through the curl command or through the wget command, as shown here:

  • For curl command:
    $ sudo curl -sSL https://get.docker.io/ | sh
    
  • For wget command:
    $ sudo wget -qO- https://get.docker.io/ | sh
    

Note

The preceding automated script approach enforces AUFS as the underlying Docker file system. This script probes the AUFS driver, and then installs it automatically if it is not found in the system. In addition, it also conducts some basic tests upon installation for verifying the sanity.

You have been reading a chapter from
Learning Docker
Published in: Jun 2015
Publisher:
ISBN-13: 9781784397937
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image