Docker for Developers Michael Hrivnak Principal Software Engineer - - - PowerPoint PPT Presentation

docker for developers
SMART_READER_LITE
LIVE PREVIEW

Docker for Developers Michael Hrivnak Principal Software Engineer - - - PowerPoint PPT Presentation

Docker for Developers Michael Hrivnak Principal Software Engineer - Red Hat Inc. @michael_hrivnak Docker is Popular Deployment gets most of the attention. 1 Developer 1 Laptop 3 Skills Exit Codes $ sudo docker run -it --rm centos:centos7


slide-1
SLIDE 1

Docker for Developers

Michael Hrivnak Principal Software Engineer - Red Hat Inc.

@michael_hrivnak

slide-2
SLIDE 2

Docker is Popular

Deployment gets most of the attention.

slide-3
SLIDE 3

1 Developer 1 Laptop

slide-4
SLIDE 4

3 Skills

slide-5
SLIDE 5

Exit Codes

$ sudo docker run -it --rm centos:centos7 true $ echo $? $ sudo docker run -it --rm centos:centos7 false $ echo $? 1

slide-6
SLIDE 6

Bind Mounts

$ mkdir foo && echo 'Hello, FOSDEM!' > foo/hello $ sudo docker run -it --rm -v /home/mhrivnak/foo:/foo centos:centos7 bash # cat /foo/hello Hello, FOSDEM!

slide-7
SLIDE 7

Links

$ sudo docker run -d --name crane pulp/crane $ sudo docker ps CONTAINER ID IMAGE COMMAND PORTS NAMES 33e0e1d2b9ed pulp/crane "/usr/sbin/httpd -D F" 80/tcp crane $ sudo docker run -it --rm --link crane centos:centos7 bash [root@f33ce29ade3d /]# curl -i http://crane/v1/_ping HTTP/1.1 200 OK Date: Fri, 29 Jan 2016 16:25:56 GMT Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 Content-Length: 4 X-Docker-Registry-Standalone: True X-Docker-Registry-Version: 0.6.6 X-Docker-Registry-Config: common Content-Type: application/json

slide-8
SLIDE 8

Environment Variables

$ sudo docker run -it --rm -e FOO=hello centos:centos7 bash [root@1d890689611a /]# env | grep FOO FOO=hello

slide-9
SLIDE 9

Basic Skills

  • Bind Mounts
  • Links
  • Environment Variables
slide-10
SLIDE 10

Unit T ests

Problem: Large T est Matrix Solution: Docker image for each combination

slide-11
SLIDE 11

Dockerfjle

FROM centos:centos7 MAINTAINER Pulp Team <pulp-list@redhat.com> # Install dependencies RUN yum -y install epel-release && yum -y update && yum install -y python-flask \ python-pip python-mock python-nose python-coverage python-flake8 python-rhsm \ python-unittest2 && yum clean all # Setup RUN mkdir -p /var/lib/crane/metadata/ # Run tests CMD cd /code/ && python setup.py test

slide-12
SLIDE 12

Network T

  • pologies

AMQP Broker router router router router client client client

client client client client client

slide-13
SLIDE 13

Simulate Load

client client client client client

A P I

client

slide-14
SLIDE 14

DB State Reset

Problem: Need to quickly reset database state Solution: Start a new container to reset state

  • Optionally keep a pool of fresh containers
slide-15
SLIDE 15

Demo of Your App

Containerizing your app is hard to do right Embrace doing it wrong!

slide-16
SLIDE 16

Make T

  • ols
  • MTA to capture sent emails
  • Proxies
  • Fake APIs
  • Data Migration T

est

slide-17
SLIDE 17

Next Steps

  • http://docs.docker.com/linux/started/
  • Red Hat Registry
  • https://registry.hub.docker.com/repos/fedora/