15. ElasticSearch Before Docker
> curl -L -O http://download.elasticsearch.org/PATH/TO/VERSION.zip
> unzip elasticsearch-$VERSION.zip
> cd elasticsearch-$VERSION
The only requirement for installing Elasticsearch is a recent version of Java. Preferably,
you should install the latest version of the official Java from www.java.com.
1. Download the jre-8u40-macosx-x64.dmg file.
2. Review and agree to the terms of the license agreement before downloading the
file.
3. Double-click the .dmg file to launch it
4. Double-click on the package icon to launch install Wizard
5. The Install Wizard displays the Welcome to Java installation screen. Click Next
6. Oracle has partnered with companies that offer various products. After ensuring
the desired programs are selected, click the Next button to continue the
installation.
7. After the installation has completed, a confirmation screen appears. Click Close to
finish the installation process.
> ./bin/elasticsearch
16.
17. > docker run -d #Run In Background
dockerfile/elasticsearch #Image Name
https://www.dropbox.com/s/fbe8briq6ayycrh/start-elastic.gif?dl=0
35. > docker run -it #Run In Foreground
scrapbook/app:20150520 #Image Name:Tag
36. > docker run -it
-p 3000 #Bind Random Port to Port 3000
scrapbook/app:20150520
37. > docker run -it
-p 3000:3000 #Bind Known Port
scrapbook/app:20150520
38. > docker ps #List Running Processes
-a #Include Stopped
CONTAINER ID IMAGE
COMMAND CREATED
STATUS PORTS
NAMES
1e5b37b0a2bc scrapbook/app:20150520133000
"npm start" 4 minutes ago
Up 4 minutes 0.0.0.0:49176->3000/tcp
mad_fermi
46. Sidekick Container For Testing
> docker run –d # No need to bind ports
--name es # Friendly Name
dockerfile/elasticsearch
> docker run –it
--link es:es # Link
Container:alias
benhall/curl # Curl Image
curl http://es:9200 # Ping service
> echo $? # Exit Code
0 # Success
47. Schema Management Containers
> docker run –d # No need to bind ports
--name es # Friendly Name
dockerfile/elasticsearch
> docker run –rm
--link es:es # Link
Container:alias
myapp/schema:latest # Schema Image
48.
49. Tagging
ubuntu 15.04 2427658c75a1 12 weeks ago 117.5 MB
ubuntu vivid 2427658c75a1 12 weeks ago 117.5 MB
ubuntu vivid-20150218 2427658c75a1 12 weeks ago 117.5 MB
ubuntu 14.10 78949b1e1cfd 12 weeks ago 194.4 MB
ubuntu utopic-20150211 78949b1e1cfd 12 weeks ago 194.4 MB
ubuntu utopic 78949b1e1cfd 12 weeks ago 194.4 MB
ubuntu latest 2d24f826cb16 12 weeks ago 188.3 MB
ubuntu trusty 2d24f826cb16 12 weeks ago 188.3 MB
ubuntu 14.04 2d24f826cb16 12 weeks ago 188.3 MB
ubuntu 14.04.2 2d24f826cb16 12 weeks ago 188.3 MB
ubuntu trusty-20150218.1 2d24f826cb16 12 weeks ago 188.3 MB
ubuntu 12.04 1f80e9ca2ac3 12 weeks ago 131.5 MB
ubuntu precise 1f80e9ca2ac3 12 weeks ago 131.5 MB
ubuntu precise-20150212 1f80e9ca2ac3 12 weeks ago 131.5 MB
ubuntu 12.04.5 1f80e9ca2ac3 12 weeks ago 131.5 MB
ubuntu 14.04.1 5ba9dab47459 3 months ago 188.3 MB
56. > docker run –it
--name scrapbook-iojs # Name it for future
-v $(pwd):/app
-v $(pwd)/iojs:/app/node_modules # Move location
-w="/app” # Set working directory
--entrypoint /bin/bash # Override entrypoint
iojs
57. GoLang
> cat Dockerfile
FROM golang:onbuild
> cat Makefile
NAME = ocelotuproar/docker-outdated
build:
docker build -t $(NAME) .
run:
docker run --rm --name $(INSTANCE) $(NAME)
> make build # Run Golang Compiler & Build
container
> make run # Run built application
72. 1) Docker raises events when containers start /
stop
2) Registrator listens to events adds the new
container’s details into Consul
3) Consul links container’s IP / Ports to DNS names
& discovery API
> ping redis.service.consul
4) Nginx uses Consul API to write & load config
78. Memory / CPU Usage
> docker run –m 128m –cpu 50 mysql
Space Usage
Linux cgroups…
Bandwidth Usage
> iptables -A OUTPUT -p tcp --sport 80 -m state --
state ESTABLISHED,RELATED -m quota –quota 1310720
-j ACCEPT
79. Log Files
5.8M Mar 29 07:17 /var/lib/docker/containers/0e3bcd1
157M Mar 29 14:25 /var/lib/docker/containers/1922c7a
1.8M Mar 6 07:23 /var/lib/docker/containers/2774be7
32K Jan 14 16:18 /var/lib/docker/containers/38e7c4ae
183K Mar 17 10:00 /var/lib/docker/containers/4a207c6
955M Mar 29 14:25 /var/lib/docker/containers/5408f6a
1.3M Mar 6 10:17 /var/lib/docker/containers/6e41977
1.3M Mar 6 10:11 /var/lib/docker/containers/756f64b
71 Jan 28 11:50 /var/lib/docker/containers/b1a2d887e
509M Mar 29 14:25 /var/lib/docker/containers/c5784ce
16K Feb 2 18:26 /var/lib/docker/containers/daa45ceb
488K Mar 6 10:43 /var/lib/docker/containers/ec80d6a
90. Only tool I use for deployment
• Close gap between development and
production
• Everything is a container!
• Running platforms like Logstash, ElasticSearch,
Redis, EventStore, RavenDB, NancyFX etc?
Consider containers for deployment.