An overview on docker and container technology behind it. Lastly, we discuss few tools that might come handy when dealing with large number of containers management.
9. How about Vagrant + VM + Configuration
Mangement(chef, ansible, puppet, etc.)
• Step in a right direction
• Still too heavy weight and Fragile.
• Time dependent because can
return different minor versions
apt-get install xxx
10.
11. • Docker is a consumer of container based technology
providing lightweight packages for apps.
• Utilises containers for application deployment
(provides illusion that app is running in separate OS),
separating infrastructure.
What is Docker
13. Containers and Linux
2005 2006 20082007 2011 2013
Open VZ CGroups Google +
CGroups
LXC Unification Patch Free
14. Hypervisor vs Container
Shared OSBase Emulate virtual hardware
Hardware
OS
Hypervisor
Guest OS Guest OS
App1 App2
Hardware
OS
Container Container
App1 App2
27. Docker commands
docker images <#>
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
tpires/neo4j latest 0fd121ddd75b 4 days ago 892.8 MB
28. Docker commands
docker run <#>
docker run -i -t -d --name neo4j --cap-add=SYS_RESOURCE -p 7474:7474 tpires/neo4j
29. Docker commands
docker ps <#>
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0fabcaa1e3fe tpires/neo4j "/bin/bash -c /launc 9 minutes ago Up 9 minutes 0.0.0.0:7474->7474/tcp, 1337/tcp neo4j
30. Docker commands
docker diff <#>
docker diff 0fabcaa1e3fe
/etc
C /etc/neo4j
C /etc/neo4j/neo4j-server.properties
A /etc/neo4j/ssl
A /etc/neo4j/ssl/snakeoil.cert
A /etc/neo4j/ssl/snakeoil.key
C /tmp
C /tmp/hsperfdata_root
A /tmp/hsperfdata_root/84
A /tmp/jetty-0fabcaa1e3fe-7474-browser-_browser-any-24337275114314781.dir
A /tmp/jetty-0fabcaa1e3fe-7474-webadmin-html-_webadmin-any-3550160901111854765.dir
C /var
C /var/lib
C /var/lib/neo4j
C /var/lib/neo4j/data
A /var/lib/neo4j/data/dbms
A /var/lib/neo4j/data/dbms/auth
A /var/lib/neo4j/data/graph.db
A /var/lib/neo4j/data/graph.db/index
A /var/lib/neo4j/data/graph.db/lock
A /var/lib/neo4j/data/graph.db/messages.log
A /var/lib/neo4j/data/graph.db/neostore
A /var/lib/neo4j/data/graph.db/neostore.counts.db.a
A /var/lib/neo4j/data/graph.db/neostore.id
A /var/lib/neo4j/data/graph.db/neostore.labeltokenstore.db
A /var/lib/neo4j/data/graph.db/neostore.labeltokenstore.db.id
A /var/lib/neo4j/data/graph.db/neostore.labeltokenstore.db.names
A /var/lib/neo4j/data/graph.db/neostore.labeltokenstore.db.names.id
A /var/lib/neo4j/data/graph.db/neostore.nodestore.db
A /var/lib/neo4j/data/graph.db/neostore.nodestore.db.id
A /var/lib/neo4j/data/graph.db/neostore.nodestore.db.labels
A /var/lib/neo4j/data/graph.db/neostore.nodestore.db.labels.id
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.arrays
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.arrays.id
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.id
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.id
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.keys
A /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.keys.id
31. Docker commands
docker logs <#>
docker logs 0fabcaa1e3fe
Starting Neo4j Server console-mode...
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -XX:+UseCon
2015-08-11 20:04:36.742+0000 INFO [API] Setting startup timeout to: 120000ms based on 120000
2015-08-11 20:04:38.016+0000 INFO [API] Successfully started database
2015-08-11 20:04:38.079+0000 INFO [API] Starting HTTP on port :7474 with 8 threads available
2015-08-11 20:04:38.220+0000 INFO [API] Enabling HTTPS on port :7473
2015-08-11 20:04:38.220+0000 INFO [API] No SSL certificate found, generating a self-signed certificate..
20:04:38.432 [main] INFO org.eclipse.jetty.util.log - Logging initialized @2302ms
2015-08-11 20:04:38.469+0000 INFO [API] Mounting static content at [/webadmin] from [webadmin-html]
2015-08-11 20:04:38.509+0000 INFO [API] Mounting static content at [/browser] from [browser]
20:04:38.512 [main] INFO org.eclipse.jetty.server.Server - jetty-9.2.4.v20141103
20:04:38.531 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.MovedContextHandler@71da109{/,null,AVAILABLE}
20:04:38.575 [main] INFO o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
20:04:38.594 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@6602d014{/webadmin,jar:file:/usr/share/neo4j/system/lib/neo4j-server-2.2.3-static-web.jar!/web
20:04:38.900 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@4e671f1e{/db/manage,null,AVAILABLE}
20:04:39.036 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@4ad697ef{/db/data,null,AVAILABLE}
20:04:39.046 [main] INFO o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /browser, did not find org.apache.jasper.servlet.JspServlet
20:04:39.047 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@60921cf7{/browser,jar:file:/usr/share/neo4j/system/lib/neo4j-browser-2.2.3.jar!/browser,AVAIL
20:04:39.110 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@7929a090{/,null,AVAILABLE}
20:04:39.120 [main] INFO o.e.jetty.server.ServerConnector - Started ServerConnector@5129d373{HTTP/1.1}{0fabcaa1e3fe:7474}
20:04:39.178 [main] INFO o.e.jetty.server.ServerConnector - Started ServerConnector@3938bdec{SSL-HTTP/1.1}{0fabcaa1e3fe:7473}
20:04:39.178 [main] INFO org.eclipse.jetty.server.Server - Started @3052ms
2015-08-11 20:04:39.179+0000 INFO [API] Server started on: http://0fabcaa1e3fe:7474/
2015-08-11 20:04:39.179+0000 INFO [API] Remote interface ready and available at [http://0fabcaa1e3fe:7474/]
32. Docker commands
docker stats <#>
docker stats 0fabcaa1e3fe
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
0fabcaa1e3fe 2.87% 232.9 MB/4.142 GB 5.62% 162.6 kB/3.7 MB
33. Docker Registry
• docker pull jessie translates to docker
pull registry-
1.docker.io/library/jessie
• For internal registry docker pull
companyDomain:port/foo/bar
34. Custom Registry
• Commercial - Docker trusted registry
• Non-commercial - set up your own service
registry (Docker Trusted Registry can help you
get started)
35. Docker useful tools
• Multi container application - Docker Compose
• Container clustering - Docker Swarm
• Third party integration - Yes you can use Chef
and Puppet
36. Cons
• kernel sharing (Different flavours of same OS
rather the different OS)
• You can end up with large number of containers.
(Google launch every week 2 billion container
instances)
39. Summary
• Developer environment should be close to production
• Works on my machine is way too common problem.
• Manual setup is too time consuming , fragile and cumbersome
• Vm are too bulky, fragile and carries lot of additional noise.
• Container technology provides alternative approach(extremely lightweight) and docker
utilises it.
• Docker, build once run anywhere.
• Easy to scale , cloud ready.
• Not possible to run various OS , can run various flavours .
• Provides rich tools for enterprise tasks.
• Tools like Kubernetes can help.
docker pull tpires/neo4j , install the image
Pull an image or a repository from a Docker registry server
List all the images , output depends on your system
Remember container lifecycle is as long as process run
If it becomes daemon container is killed
There are couple of workarounds, we can write loop in bash or perform sleep or Supervision, a python tool docker run imageid supervisior -n , you can create supervision.conf file and attach it to the container
Remember container lifecycle is as long as process run
If it becomes daemon container is killed
There are couple of workarounds, we can write loop in bash or perform sleep or Supervision, a python tool docker run imageid supervisior -n , you can create supervision.conf file and attach it to the container