pyVision
A Machine Learning and Signal Processing toolbox

Download .zip Download.tar.gz View on GitHub


Docker Installation and setup on ubuntu OS

Introduction

Docker is the world’s leading software container platform

An image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and config files.

A container is a runtime instance of an image – what the image becomes in memory when actually executed. It runs completely isolated from the host environment by default, only accessing host files and ports if configured to do so.

Using containers has a lot of advantages especially from DevOps point of view

  • Using containers, everything required to make a piece of software run is packaged into isolated containers. Which makes replication of creation of run time environment for application very easy

  • The purpose of containers is to provide efficient and lightweight self contained system which gurantees that the software will run regardless of where ever it is deployed.

  • The container creation process also gurantees that several created containers are exactly identical.

  • Images can be created from containers which stores the container state in its enterity

  • The purpose of containers is not to bundle full operating system though you can do the same within a container.Which can be user to replicate the container instances

  • The containers run applications natively on the hosts machine kernel each one running in a discrete process taking no more resources than any other executables.

Install Docker

Unistall old version

Uninstall older versions of Docker were called docker or docker-engine.

$ sudo apt-get remove docker docker-engine

The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker CE package is now called docker-ce, and the Docker EE package is now called docker-ee

Recommended extra packages for Trusty 14.04.

Install the linux-image-extra-* packages, which allow Docker to use the aufs storage drivers.

$ sudo apt-get update

$ sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

Install Pre Requisites softwares

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

and verify that the key fingerprint is

9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

by running the following command

sudo apt-key fingerprint 0EBFCD88

Adding the apt repository for docker

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
		
sudo apt-get update

Install docker

sudo apt-get install docker-ce=<VERSION>

**Verify the docker installation **

Verify that Docker CE or Docker EE is installed correctly by running the hello-world image.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Uninstall docker

To uninstall docker run the following command

sudo apt-get purge docker-ce

Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

$ sudo rm -rf /var/lib/docker

Manage Docker as a non-root user

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 only access it using sudo. The docker daemon always runs as the root user.

If you don’t want 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.

Create Docker Group

To create the docker group and add your user:

sudo groupadd docker
sudo usermod -aG docker $USER

Verify that you can run docker commands without sudo.

$ docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Docker Boot configuration

Most current Linux distributions (RHEL, CentOS, Fedora, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. Ubuntu 14.10 and below use upstart.

To enable or disable docker start at boot for systemd run the following commands respectively

$ sudo systemctl enable docker
$ sudo systemctl disable docker

Docker is automatically configured to start on boot using upstart

To disable the behavior run the following command

echo manual | sudo tee /etc/init/docker.override
sudo chkconfig docker on

Docker service

To start and stop the docker daemon run the following commands

sudo service docker stop
sudo service docker start

or 

sudo systemctl start docker
sudo systemctl stop docker

References

  • https://www.docker.com/what-docker
  • https://docs.docker.com/get-started/#a-brief-explanation-of-containers
  • https://docs.docker.com/engine/installation/linux/ubuntu/#uninstall-docker
  • https://docs.docker.com/engine/installation/linux/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities
  • https://docs.docker.com/get-started/#setup
blog comments powered by Disqus