Back Home

Docker

Open suse

# openSUSE 13.1
$ sudo zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/ Virtualization
sudo zypper in docker

Starting the Docker daemon.

$ sudo systemctl start docker
If we want Docker to start at boot, we should also:

$ sudo systemctl enable docker

Add users to the docker group

$ sudo usermod -G docker <username>
Done!

Note: for some reason I had link the device mapper library to get docker to work

sudo ln -s /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.03

Open Suse Server Docker

 
[arun@localhost ~]$ sudo docker info
2014/12/22 11:19:38 Get http:///var/run/docker.sock/v1.15/info: dial unix /var/run/docker.sock: no such file or directory

Debugging revealed that Docker daemon was not running on this VM. It can be easily started as:

 
sudo systemctl start docker

And then enable it to start automatically with every restart of the VM as:

sudo systemctl enable docker

Docker for Windows

  attach    Attach to a running container
    build     Build an image from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders from a container's filesystem to the host path
    create    Create a new container
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    exec      Run a command in a running container
    export    Stream the contents of a container as a tar archive
    history   Show the history of an image
    images    List images
    import    Create a new filesystem image from the contents of a tarball
    info      Display system-wide information
    inspect   Return low-level information on a container or image
    kill      Kill a running container
    load      Load an image from a tar archive
    login     Register or log in to a Docker registry server
    logout    Log out from a Docker registry server
    logs      Fetch the logs of a container
    port      Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
    pause     Pause all processes within a container
    ps        List containers
    pull      Pull an image or a repository from a Docker registry server
    push      Push an image or a repository to a Docker registry server
    rename    Rename an existing container
    restart   Restart a running container
    rm        Remove one or more containers
    rmi       Remove one or more images
    run       Run a command in a new container
    save      Save an image to a tar archive
    search    Search for an image on the Docker Hub
    start     Start a stopped container
    stats     Display a live stream of one or more containers' resource usage statistics
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Lookup the running processes of a container
    unpause   Unpause a paused container
    version   Show the Docker version information
    wait      Block until a container stops, then print its exit code

Docker Tech

Kubernetes

At Dockercon this summer Google's VP of Infrastructure at Google, Eric Brewer, announced Kubernetes, which provides a way to orchestrate a collection of Docker containers across a cluster of machines. It is essentially a scheduler, which means it handles running your containers and ensuring uptime, even in the event of losing machines.

We have seen rapid adoption and interest in Kubernetes that goes beyond the buzz around it being a Google cloud technology. There is a need for orchestration at the Operations level which Kubernetes addresses well. A manifest describing a collection of Docker images can be created and pushed into the cluster which automatically deploys and horizontally scales those containers. Kubernetes also provides a way to define a “service”, which can be consumed by other applications running in the cluster.

Docker Pods

Hand-in-hand with Kubernetes, Eric Brewer also talked about containers and introduced the concept of “pods”. This is a key concept within Kubernetes. He said, “At Google we rarely deploy a single container.” Instead, they group containers together. For instance, an application process often has several side-car processes for logging and other tasks outside of the concern of the application itself.

One issue he noted with Docker containers is the need for constant mapping of internal and external ports - between what the process inside the Docker container sees and what the external world sees. This is an additional layer of complexity that needs to be managed, stored and queried - even between the containers of a pod that has been deployed as a single unit. Therefore, at Google, they ensure that every pod of containers has its own IP address. This means the ports used can be the same inside and outside of a container. The ports can be baked in at design or build time. This does away with the additional layer of complexity of managing port. Now, to find pods running a particular service, you only need the list of IP addresses of those pods.

Google Compute Engine is currently the only cloud infrastructure service that facilitates assigning an IP subnet to a virtual machine - and hence an IP to each Docker pod within it.

Flannel

CoreOS, who are actively involved with Kubernetes, have attempted to solve this problem with something they call Flannel (previously named Rudder). Flannel provides an overlay network on-top of the provided network, which allows for assigning an IP subnet to each machine. There is a performance cost to doing this, but they hope that this will be engineered away as Flannel evolves.

Docker For Windows

Recently, Microsoft joined the Docker bandwagon, saying they intended to build a containerization solution for Windows and provide a Docker compatible API on-top of this. Although, Docker images will unlikely ever be portable between Linux and Windows containers, it does mean that the tooling being built above the Docker API layer will be usable across these operating systems.

Large enterprises are heavily invested in Windows, so this announcement is a major win for the IT departments wanting to steer their ship in the direction of Docker adoption.

Cloud Foundry Diego

A major focus of ActiveState is the Cloud Foundry open-source PaaS project. We were the first adopters of this project when VMware announced it. While our solution, Stackato, already uses Docker under the hood, we think the Docker integrations arising from the Diego project is bringing the rest of the ecosystem in right direction.

Like Kubernetes, Diego is a scheduler, but unlike Kubernetes it is runtime environment agnostic and it is built to work primarily with Cloud Foundry. Docker is only one integration for Diego, but it is the sole focus of the developers working on Diego at IBM. We are also seeing Windows .NET integration with Diego from folks such as Uhuru and when Docker for Windows becomes a reality, I am sure we will see these technologies coalesce.

The PaaS integrations with Docker are very important for the future of Docker. We have seen developers being a major driving-force in the rise of Docker. The ability to easily express the environment that their applications should run in has been very powerful for developers. Also, knowing that anyone can pick up those Dockerized applications and immediately run them has filled a void for which a solution did not previously exist. PaaS is an extension of that with an even greater focus on developers, whereas we are seeing other technologies moving Docker away from developers and more into the realm of

Monitoring

Operating System Cores

  • smartos Solaris based with ZFS, DTrace, Zones and KVM.
  • java:alpine - This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

Creating a custom Image - ubuntu with Java

Custom docker files can be specified in a Docker (no extension) file. To create a docker image form ubuntu with java do the following.

Create a folder (ubuntJava) with the following Docker file in it:

FROM ubuntu:16.04
MAINTAINER Richard Donovan, https://github.com/newgeekorder
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y  software-properties-common && \
    add-apt-repository ppa:webupd8team/java -y && \
    apt-get update && \
     echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
    apt-get install -y oracle-java8-installer && \
    apt-get clean

Then when inside the same directory build he docker file

docker build -t ubuntu_java .

List the tagged docker images

docker images

that show show the ubuntu_java

and run the new image as normal

 winpty docker run -it ubuntu_java bash

Docker Redhat Mq-Q

Connect to a Running Instance

To list the running instances

docker ps

to connect to a running instance

docker exec -i -t 98ccf1fb2ebc bash

for windows consoles one needs to add winpty to the front of the command.

Rancher

Rancher is a tool for managing docker instances .. it can be run as it's own docker instance

docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

Add an ip key to local security

2. Adding a Host For linux/Ubuntu host it is (currently) required to

  • go to admin→settings and add the actual ip addres
  • then infastructure→hosts to add the local machine as a host (using the static ip address) that will generate a code like
udo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.5 http://192.168.0.16:8080/v1/scripts/686421D9068F70315452:1483142400000:BmCMaiY3hETCs60GLh9UozwkDfU

Rancher Command line

  • Rancher-Gen is a Python utility that listens for service changes in Rancher and renders a user-specified Jinja2 template. This allows a user to generate configuration files for existing services based on those changes. In addition, it provides a mechanism to run a notification command after the template has been rendered.

* Nodejs rancher-cli

Misc

Other Tools

* Docker userguide

Windows git has a funny means to mount directories:

winpty docker run  -p 9000:9000 -v //c/Users/rdono/dockerShare:/opt/mule/apps2 -it ubuntu_java_mule bash

using this for mule we can start mule with mule & and copy apps to the deploy directory

cp /opt/mule/apps2/testGradle.zip /opt/mule/apps
 
virtualization.txt · Last modified: 2017/08/05 08:10 by root
 
RSS - 200 © CrosswireDigitialMedia Ltd