Gdg using docker to streamline development
-
Upload
trond-marius-ovstetun -
Category
Technology
-
view
109 -
download
0
Transcript of Gdg using docker to streamline development
![Page 1: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/1.jpg)
© Mesan AS
Streamline Your Development
Process with Docker
Trond Marius Ø[email protected]
GDG DevFest 2014
![Page 2: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/2.jpg)
© Mesan AS
Streamline with Docker
![Page 3: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/3.jpg)
© Mesan AS
About me
• Trond Marius Øvstetun
• CTO in Mesan
• Developer, Architect, Tech-lead+++
• 10+ years of experience building applications
![Page 4: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/4.jpg)
© Mesan AS
How we build systems
Modern challenges
![Page 5: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/5.jpg)
© Mesan AS
![Page 6: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/6.jpg)
© Mesan AS
Challenges
• One big lump of software
• Scales as one
• Deploys as one
• Updates as one
• Develops as one
![Page 7: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/7.jpg)
© Mesan AS
Breaking the Monolith
![Page 8: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/8.jpg)
© Mesan AS
![Page 9: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/9.jpg)
© Mesan AS
![Page 10: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/10.jpg)
© Mesan AS
A new set of challenges
• Interdependencies
• Implicit ones - keys shared across systems
![Page 11: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/11.jpg)
© Mesan AS
From a developers perspective
• Dependencies change
• add more systems
• systems change
• different kinds of deps
• search/messaging/storage/caching…
• How do we deal with this?
• try to run deps locally?
• export/import data
• the “shared development environment”
• moar, moar environments
![Page 12: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/12.jpg)
© Mesan AS
![Page 13: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/13.jpg)
© Mesan AS
What is Docker?
“Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.”
• Deploying and shipping software consistently is too hard
• Dependencies, libraries, configuration
• Consistency across environments (local, test, QA, production)
• A new abstraction – introduce the Container
![Page 14: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/14.jpg)
© Mesan AS
What is a container?
![Page 15: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/15.jpg)
© Mesan AS
What is a container?
• Lightweight linux environment
• Hermetically sealed, deployable
• Isolation
• Portability
• Raising the level of abstraction
• VMs = Idealized hardware
• Container = Idealized OS (+hardware)
![Page 16: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/16.jpg)
© Mesan AS
Demos
![Page 17: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/17.jpg)
© Mesan AS
Basic examples
• Docker Hello World!
$ docker run hello-world
• Interactive running in a container (or two!)
$ docker run -it ubuntu bash
• Running basic nginx in a container
$ docker run -d nginx
![Page 18: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/18.jpg)
© Mesan AS
Building a container manually
• Run commands in interactive mode
• Commit changes
• Takes time –boring, manual & error prone
• What about reproducability?
$ docker run -i -t ubuntu bash
root@171950c2cf9d:/# touch my.conf
root@171950c2cf9d:/# vi my.conf
root@171950c2cf9d:/# apt-get install my-package
Reading package lists... Done
Building dependency tree
Reading state information... Done
$ docker commit 171950c2cf9d ovstetun/my
![Page 19: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/19.jpg)
© Mesan AS
Dockerfile
my
Dockerfile + env
$ docker build .
$ docker build -t mynginx .
![Page 20: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/20.jpg)
© Mesan AS
Exposing ports as Services
• Expose ports from a containerin the Dockerfile
EXPOSE 3000
• Open ports on the server
$ docker run -p 4000:3000 mynginx
![Page 21: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/21.jpg)
© Mesan AS
Linking containers
• Declare dependency and link
docker run --link 1bc1:mysql nginx
• Available as environment variables
MYSQL_PORT_3306_TCP_ADDR=xxx
MYSQL_PORT_3306_TCP_PORT=xxx
![Page 22: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/22.jpg)
© Mesan AS
Sharing containers
• Docker Hub
• Official reusable images
• Your own!
$ docker push ovstetun/mynginx
![Page 23: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/23.jpg)
© Mesan AS
Developing using Docker
Exemplifying a workflow and setup
![Page 24: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/24.jpg)
© Mesan AS
Example system
![Page 25: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/25.jpg)
© Mesan AS
Setting up your system for Docker
• Depend on Services, not Resources or computers
• Run the same, identical container everywhere
• Docker links to Services
• Automate changes
• Database refactorings
• Search index updates
• …
![Page 26: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/26.jpg)
© Mesan AS
Setting up your system for Docker
• One process per container
• Reuse (your own) base images
• Repeatable builds – use Dockerfiles
• Automate everything
![Page 27: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/27.jpg)
© Mesan AS
Workflow
![Page 28: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/28.jpg)
© Mesan AS
Working with dependencies
• Do some work in Ingredients module
• Run dependencies in Docker
• search + database
$ docker run -p 3306:3306 --name some-mysql \\
-e MYSQL_ROOT_PASSWORD=pwd -d o/ftdb:2
$ docker run -p 9300:9300 --name elastic \\
-d o/ftelastic:2
![Page 29: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/29.jpg)
© Mesan AS
• Automatic linkingand management
• Simple configuration
![Page 30: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/30.jpg)
© Mesan AS
Demo
![Page 31: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/31.jpg)
© Mesan AS
Deploying to the Cloud
![Page 32: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/32.jpg)
© Mesan AS
![Page 33: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/33.jpg)
© Mesan AS
Kubernetes
• Master & Minions
• Pods
• collection of containers, run as a unit
• ReplicationControllers
• controllable
• Services
• proxy layer and load balancing – “dynamic Docker links”
![Page 34: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/34.jpg)
© Mesan AS
Kubernetes
![Page 35: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/35.jpg)
© Mesan AS
The future?
• The future lies in containers
• continue to see more examples of use cases
• Docker is the leader today
• The momentum is gigantic
• google, Microsoft, RedHat, Rackspace +++
![Page 36: Gdg using docker to streamline development](https://reader031.fdocuments.in/reader031/viewer/2022032010/55a2c4f41a28ab77158b4694/html5/thumbnails/36.jpg)
© Mesan AS
Q & A