30
BEYOND VIRTUALIZATION!

Beyond Virtualisation

Embed Size (px)

Citation preview

BEYOND VIRTUALIZATION!

CORE IDEAS

Containers vs virtual machines

What is docker?

Docker architecture

docker jargonImage:

A Docker image is a read-only template. For example, an image could contain an Ubuntu operating system with Apache and your web application installed. Images are used to create Docker containers.

docker jargonContainer:

A Docker container holds everything that is needed for an application to run. Each container is created from a Docker image. Docker containers can be run, started, stopped, moved, and deleted. Each container is an isolated and secure application platform.

docker jargonRegistry:

Docker registries hold images. These are public or private stores from which you upload or download images.

Default registry -> https://hub.docker.com/

Installing DOCKER

Docker is supported in a broad range of OS.

https://docs.docker.com/installation/

show me the code

listing my local images

> docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

listing my running containers

> docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

starting our very first container

> docker run ubuntu:14.04 /bin/echo 'Hello world'

Hello world

starting our very first container

> docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu 14.04 91e54dfb1179 6 weeks ago 188.4 MB

starting our very first container

> docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

second try. Interactive containers

> docker run -t -i ubuntu:14.04 /bin/bash

root@433bacbdbcb7:/#

Lucky third. application containers

> docker run -d -P training/webapp python app.py

2e32450e554a9f969af74e955b0639ea988436b14983dd26802800143ac8

Lucky third. application containers

> docker run -d -P training/webapp python app.py

2e32450e554a9f969af74e955b0639ea988436b14983dd26802800143ac8

Lucky third. application containers

> docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES2e32450e554a training/webapp "python app.py" 7 minutes ago Up 7 minutes 0.0.0.0:32772->5000/tcp hungry_khorana

building images

A SIMPLE DOCKERFILEFROM centos:6.7MAINTAINER Javier Lopez <[email protected]>

EXPOSE 9324

ADD https://s3-eu-west-1.amazonaws.com/elasticmq-server-0.8.11.jar /usr/share/elasticmq-server-0.8.11.jarRUN yum install -y java-1.7.0-openjdk

CMD ["java", "-jar", "/usr/share/elasticmq-server-0.8.11.jar"]

available instructions

ENV

ADD

COPY

WORKDIR

EXPOSE

VOLUME

USER

COPY

ENTRYPOINT

MAINTAINER

CMD

FROM

creating an image

> docker build -t rightster/elasticmq:0.8.11 .

publishing our image

> docker login

> docker push rightster/elasticmq:0.8.11 .

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

more than one container

LINKING CONTAINERS> docker run -d

--name my-db

-e MYSQL_ROOT_PASSWORD=my-secret-pw

mysql:5.5

> docker run -d -p 80

--name phpmyadmin

--link my-db:mysql

-e MYSQL_USERNAME=root

corbinu/docker-phpmyadmin

docker composemysql: image: mysql:5.5 environment: - MYSQL_ROOT_PASSWORD=my-secret-pwphpmyadmin: image: corbinu/docker-phpmyadmin environment: - MYSQL_USERNAME=root links: - mysql expose: - "80"

docker-compose.yml

docker compose

> docker-compose up

more than a few containers

quick overview of kubernetes