Home Blog Page 937

Getting Started with Docker

cowsayDocker is the excellent new container application that is generating much buzz and many silly stock photos of shipping containers. Containers are not new; so, what’s so great about Docker? Docker is built on Linux Containers (LXC). It runs on Linux, is easy to use, and is resource-efficient.

Docker containers are commonly compared with virtual machines. Virtual machines carry all the overhead of virtualized hardware running multiple operating systems. Docker containers, however, dump all that and share only the operating system. Docker can replace virtual machines in some use cases; for example, I now use Docker in my test lab to spin up various Linux distributions, instead of VirtualBox. It’s a lot faster, and it’s considerably lighter on system resources.

Docker is great for datacenters, as they can run many times more containers on the same hardware than virtual machines. It makes packaging and distributing software a lot easier:

Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries — anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.”

Docker runs natively on Linux, and in virtualized environments on Mac OS X and MS Windows. The good Docker people have made installation very easy on all three platforms.

Installing Docker

That’s enough gasbagging; let’s open a terminal and have some fun. The best way to install Docker is with the Docker installer, which is amazingly thorough. Note how it detects my Linux distro version and pulls in dependencies. The output is abbreviated to show the commands that the installer runs:

$ wget -qO- https://get.docker.com/ | sh
You're using 'linuxmint' version 'rebecca'.
Upstream release is 'ubuntu' version 'trusty'.
apparmor is enabled in the kernel, but apparmor_parser missing
+ sudo -E sh -c sleep 3; apt-get update
+ sudo -E sh -c sleep 3; apt-get install -y -q apparmor
+ sudo -E sh -c apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80
 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
+ sudo -E sh -c mkdir -p /etc/apt/sources.list.d
+ sudo -E sh -c echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c sleep 3; apt-get update; apt-get install -y -q docker-e
The following NEW packages will be installed:
 docker-engine

As you can see, it uses standard Linux commands. When it’s finished, you should add yourself to the docker group so that you can run it without root permissions. (Remember to log out and then back in to activate your new group membership.)

Hello World!

We can run a Hello World example to test that Docker is installed correctly:

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
[snip]
Hello from Docker.
This message shows that your installation appears to be working correctly.

This downloads and runs the hello-world image from the Docker Hub. This contains a library of Docker images, which you can access with a simple registration. You can also upload and share your own images. Docker provides a fun test image to play with, Whalesay. Whalesay is an adaption of Cowsay that draws the Docker whale instead of a cow (see Figure 1 above).

$ docker run docker/whalesay cowsay "Visit Linux.com every day!"

The first time you run a new image from Docker Hub, it gets downloaded to your computer. Then, after that Docker uses your local copy. You can see which images are installed on your system.

$ docker images
REPOSITORY       TAG      IMAGE ID      CREATED       VIRTUAL SIZE
hello-world      latest   0a6ba66e537a  7 weeks ago   960 B
docker/whalesay  latest   ded5e192a685  6 months ago  247 MB

So, where, exactly, are these images stored? Look in /var/lib/docker.

Build a Docker Image

Now let’s build our own Docker image. Docker Hub has a lot of prefab images to play with (Figure 2), and that’s the best way to start because building one from scratch is a fair bit of work. (There is even an empty scratch image for building your image from the ground up.) There are many distro images, such as Ubuntu, CentOS, Arch Linux, and Debian.

docker-hub
We’ll start with a plain Ubuntu image. Create a directory for your Docker project, change to it, and create a new Dockerfile with your favorite text editor.

$ mkdir dockerstuff
$ cd dockerstuff
$ nano Dockerfile

Enter a single line in your Dockerfile:

FROM ubuntu

Now build your new image and give it a name. In this example the name is testproj. Make sure to include the trailing dot:

$ docker build -t testproj .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu
---> 89d5d8e8bafb
Successfully built 89d5d8e8bafb

Now you can run your new Ubuntu image interactively:

$ docker run -it ubuntu
root@fc21879c961d:/#

And there you are at the root prompt of your image, which in this example is a minimal Ubuntu installation that you can run just like any Ubuntu system. You can see all of your local images:

$ docker images
REPOSITORY       TAG       IMAGE ID        CREATED        VIRTUAL SIZE
testproj         latest    89d5d8e8bafb    6 hours ago    187.9 MB
ubuntu           latest    89d5d8e8bafb    6 hours ago    187.9 MB
hello-world      latest    0a6ba66e537a    8 weeks ago    960 B
docker/whalesay  latest    ded5e192a685    6 months ago   247 MB

The real power of Docker lies in creating Dockerfiles that allow you to create customized images and quickly replicate them whenever you want. This simple example shows how to create a bare-bones Apache server. First, create a new directory, change to it, and start a new Dockerfile that includes the following lines.

FROM ubuntu

MAINTAINER DockerFan version 1.0

ENV DEBIAN_FRONTEND noninteractive

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

RUN apt-get update && apt-get install -y apache2

EXPOSE 8080

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

Now build your new project:

$ docker build -t apacheserver  .

This will take a little while as it downloads and installs the Apache packages. You’ll see a lot of output on your screen, and when you see “Successfully built 538fea9dda79” (but with a different number, of course) then your image built successfully. Now you can run it. This runs it in the background:

$ docker run -d  apacheserver
8defbf68cc7926053a848bfe7b55ef507a05d471fb5f3f68da5c9aede8d75137

List your running containers:

$ docker ps
CONTAINER ID  IMAGE        COMMAND                 CREATED            
8defbf68cc79  apacheserver "/usr/sbin/apache2ctl"  34 seconds ago

And kill your running container:

$ docker kill 8defbf68cc79

You might want to run it interactively for testing and debugging:

$ docker run -it  apacheserver /bin/bash
root@495b998c031c:/# ps ax
 PID TTY      STAT   TIME COMMAND
   1 ?        Ss     0:00 /bin/bash
  14 ?        R+     0:00 ps ax
root@495b998c031c:/# apachectl start
AH00558: apache2: Could not reliably determine the server's fully qualified
domain name, using 172.17.0.3. Set the 'ServerName' directive globally to
suppress this message
root@495b998c031c:/#

A more comprehensive Dockerfile could install a complete LAMP stack, load Apache modules, configuration files, and everything you need to launch a complete Web server with a single command.

We have come to the end of this introduction to Docker, but don’t stop now. Visit docs.docker.com to study the excellent documentation and try a little Web searching for Dockerfile examples. There are thousands of them, all free and easy to try.

IBM Adds to Watson IoT Arsenal with New APIs, “Experience Centers”

ibm-sign-100625227-primary.idgeStrengthening its push into the Internet of Things, IBM is making a range of application programming interfaces (APIs) available through its Watson IoT unit and opening up new facilities for the group. The unit, formed earlier this year with a US$3 billion investment into IoT, will have its global headquarters in Munch, IBM announced Tuesday. 

IoT will soon be the largest source of data in the world but, IBM officials point out, almost 90 percent of that information is never acted on — at least not yet. Many vendors are jumping on the IoT bandwagon and IBM faces a variety of competitors,…

Read more at IT World

AMD Embraces Open Source to Take On Nvidia’s GameWorks

AMD’s position in the graphics market continues to be a tricky one. Although the company has important design wins in the console space—both the PlayStation 4 and Xbox One are built around AMD CPUs with integrated AMD GPUs—its position in the PC space is a little more precarious. Nvidia currently has the outright performance lead, and perhaps more problematically, many games are to a greater or lesser extent optimized for Nvidia GPUs. One of the chief culprits here is Nvidia’s GameWorks software, a proprietary library of useful tools for game development…

To combat this, AMD is today announcing GPUOpen, a comparable set of tools to GameWorks. As the name would suggest, however, there’s a key difference between GPUOpen and GameWorks: GPUOpen will, when it is published in January, be open source. 

Read more at Ars Technica

Ansible Offers Starring Roles for All in Reworked Galaxy

Ansible has unveiled an update of its Galaxy App store, kicking off a beta release of the hub for pre-packaged automation modules for its configuration platform. Galaxy 2.0 will feature tighter integration with GitHub, allowing users to import all their repositories, while allowing roles – those prepackaged modules – to be namespaced by GitHub users. To avoid confusion, Ansible said existing roles would remain associated with Galaxy user names.

Ansible will also use the GitHub API to allow users to view their repositories and detect which ones include Ansible roles, 

Read more at The Register

ownCloud and Collabora Announce LibreOffice Online for ownCloud Server

owncloud-and-collaboraToday, December 15, ownCloud, Inc. and Collabora have just announced a partnership to bring a new tool for LibreOffice and ownCloud users, based on the LibreOffice Online project and the robust, open-source ownCloud Server self-hosting cloud storage solution.

The two companies have been proud to announce the first preview of CODE (Collabora Online Development Edition), a tool designed to offer users a virtual machine containing the LibreOffice Online and ownCloud Server project, allowing them to edit office documents, such as word, spreadsheets, and presentations via the web-based interface of ownCloud.

Why It Took So Long For Linux To Properly Handle 2.1 Speaker Systems

Canonical’s David Henningsson wrote a blog post today explaining why it’s taken until this year for Linux to properly support 2.1 speaker systems (two speakers and a subwoofer) with ALSA and PulseAudio. While the open-source Linux sound stack has supported more complicated surround sound setups with a greater number of speakers…

Read more at Phoronix

Linux Kernel 4.3.3 Is Now the Most Advanced Stable Version Available

The latest iteration of the stable Linux kernel, 4.3.3, has been released by Greg Kroah-Hartman, making this the latest and best version available right now.

The 4.3 branch of the Linux kernel is a really popular one and it’s been adopted by many distros. From the looks of it, the maintainers will continue to provide support for it, but it’s not clear for how long. There is already a 4.1.15 version that has been declared long-term, so it’s difficult to say if another branch will be tagged LTS as well, after such a short time.

As you would expect, Linux kernel 4.3.3 is not a huge update…

Top 10 Open Source Projects of 2015

top10 projects leadEvery year we look back at 10 of the hot open source projects from the past 12 months. (Last year’s list made a splash!) And, we expect more great things from these projects in 2016.

Top 10 open source projects of 2015

Apache Spark

When it comes to open source big data processing, Hadoop is no longer the only name in the game. Apache Spark is a general purpose distributed data processing tool…

Read more at OpenSource.com

10 Killer Media Applications Enabled by “Virtual Reality” Headsets

290x195CardboardAppsVirtNEWS ANALYSIS: Virtual reality headsets can do much more than ‘virtual reality,’ a technical term that is badly defined in most news reports. Here are 10 rapidly developing applications.

Virtual reality headsets are about to become part of your arsenal of gadgets. No, really! A year ago, pretty much nobody had what are generally referred to as VR goggles or headsets. But a year from now, I predict that pretty much all serious tech fans, gamers, media consumers and social media users will own and use a pair.

We’re right smack-dab in the middle of a full-fledged gadget revolution.

Read more at eWeek

New U.S. FAA Rule Requires Drone Owners to Register by Feb 19

The Federal Aviation Administration, responding to heightened concerns about rogue drone flights near airports, unveiled a pre-Christmas rule on Monday requiring drone hobbyists as young as 13 years old to register their unmanned aircraft.

The new online registry will require current drone owners to register by Feb. 19, while anyone who acquires aircraft after Dec. 21 would need to register before their first outdoor flight. After registering, drone owners will receive an FAA identification number that they must display on aircraft weighing between 0.55 pounds (250 grams) and 55 pounds (25 kgs).

Read more at Reuters