How to install and use Docker (32bits/X86 included)

Docker allows you to create disk images that you can share with others. Using tools like SaltStack, Chef or Puppet you can create and automate your image distribution model for server.

This tool allows you to have a similar environment as you have on your server that you can use in you laptop for example.

You can also use Docker’s central repository of disk images that allows you to create and run different OS (Ubuntu, Centos, Fedora ..etc)

It can be used as a version control system for your application’s OS

In general, Docker helps you work with a unique image of an OS/app through dev/test/qa/prod environments, which is great for creating a continuous integration/delivery process.

Write once, run everywhere!

Let’s see how it works.

32Bits/X86/i386

Please note that Docker is only supported on amd64 platforms. In this case, please follow this tutorial.

If you had any problems/bugs, you can also try to use this script.

The next installation procedure concerns 64bit CPUs and we are going to try Docker using an Ubunut/Debian system.

If you installed Docker on your 32bit machine, skip the installation part.

Installation

Note that if you are using Trusty 14.04 you will not have any requirements.
Some Ubuntu OS versions require a kernel version higher than 3.10 to run Docker, see the prerequisites on this page that apply to your Ubuntu version.
Check your kernel :

for me it is :

And I upgraded my Linux Mint and I am using Ubuntu trusty repositories for the next steps.

Please refer to this page, for more details.

Start by upgrading your system:

Then type

And reboot your host.

Good, we are able to install Docker:

You can also use the repository:

Next steps

If you have finished the installation (for both 32 and 64bits), try to verify if everything is fine, check the version of Docker:

You will be able to see something like the similar output:

If you want Docker help, enter:

You will see a list of commands and their description:

Docker: Hello World!

Type:

This will pull the repository “hello-world”. You have now a container for testing purposes.

Optional configurations on Ubuntu:

According to the official documentation of Docker:

The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user.

So Docker suggests the following:

To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

But please take a look at the security impacts of what we are going to do right now.

Follow now the steps in this page.

This will let you :

  • Create a docker group
  • Adjust memory and swap accounting
  • Enable UFW forwarding
  • And configure a DNS server for use by Docker

Searching for an image

Let’s suppose you are looking for an Ubuntu image.

Type:

You will have this output from the images repository as a response to your query:

Selection_664

In order to download or pull the official Ubuntu image (see the first element in the list):

Wait for the download and the install, it could take time.

After that, you will be able to see your image, and the list of all local images (you will find “hello-world” image already listed if you followed this tutorial from its beginning ):

Every listed image has its own “IMAGE ID”. Note that we are going to use this id to commit any changes to the Docker image:

Committing a change to a Docker image

Like Git, you can have some changes that you’ve done in you local image, you can then push it to the images repository and have your own “fork”.

Example:

Create an account at: hub.docker.com/account/signup

and push the changes:

Type then your password.

This is very similar to Git or when using Github.

Well, it was the first tutorial, next ones will cover more important subjects and more advanced topics.

Happy hacking !

You may also like...