running the oracle soa suite environment in a docker container
TRANSCRIPT
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH
Running the Oracle SOA Suite Environment in a Docker ContainerOracle Open World 2015
Guido Schmutz
Guido Schmutz
Working for Trivadis for more than 19 yearsOracle ACE Director for Fusion Middleware and SOACo-Author of different booksConsultant, Trainer Software Architect for Java, Oracle, SOA and Big Data / Fast DataTechnology Manager @ Trivadis
More than 25 years of software development experience
Contact: [email protected]: http://guidoschmutz.wordpress.comSlideshare: http://de.slideshare.net/gschmutzTwitter: gschmutz
2
Agenda
1. Introduction2. Docker in Action3. Docker and SOA Suite4. Docker Product Familiy5. Summary
http://bit.ly/1MtShoR
Introduction
Why Docker ?
A stevedore, dockworker and/or dockeris a waterfront manual laborer who is involved in loading and unloading ships.
Today, the vast majority of non-bulk cargo is transported in intermodal containers
Docker – Modeled on the success of shipping containers
Multip
licity
ofgoo
dsMultip
licityofm
ethods
fortranspo
rt/Storin
g
A standard container that is loaded with virtually any goods and stays sealed until it reaches its final delivery.
Can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another.
Docker – Modeled on the success of shipping containers
Multip
licity
ofstacks
Multip
licityofh
ardw
are
environm
ents
An engine that enables any payload to be encapsulated as a lightweight, portable, self-sufficient container…
… that can be manipulated using standard operations and run consistently on virtually any hardware platform.
WebApplication Database Queue MobileApplication
DevelopentVM
DevelopmentNotebook
DataCenter PublicCloud
VM vs. ContainerVirtual Machines includes not only the application (which may be only 10s of MB) but also an entire guest operating system (which may be 10s of GB)
Docker Containers are isolated, but share OS kernel and, where appropriate, bins and libs. • Result in significally faster deployment, much less
overhead, easier migration and faster boot times
Docker Architecture
Docker uses a client/server architecture
Docker Client talks to the Docker Daemon
Docker Client and Docker Daemon• can run on the same machine or • Client can connect to a remote Daemon
Docker Client and Daemon communicate via sockets or through RESTful API
Docker Registries hold images (private or public)• Public Docker registry is provided with Docker Hub• Holds a huge collection of existing images
Image Registries
Images can be published to private or public registries
• Docker Hub hosts the main image registry• Provides official images
• enables people to upload and share their own images (both in public an private repositories)
• Docker provides an image for setting up one's dedicated registry
• The Docker engine itself has an internal registry of downloaded images
https://hub.docker.com/
Docker in Action
Installing Docker
Linux• best to use the package repositories listed on Docker
website• Installation process is easy as using apt-get or yum• All required packages are automatically downloaded
and installed
Mac OS-X / Windows• Because Docker daemon uses Linux-specific kernel
features, you can't run it natively in OS-X and Windows• Use docker-machine to create VM's to run Docker
daemon within • Easiest way to get an environment is through Docker
Toolbox
LinuxDocker Host
Docker Client
Docker Daemon
OS-X/Win
LinuxVMDocker Daemon
Docker Host
Docker Client
Running the Docker Client
The default usage of docker is throught the command line docker <command>
• $ docker help shows the available commands• $ docker <command> --help shows the command-releated documentation
Some of the commands are
• build build an image from a Dockerfile• exec run a command in a running container• images list images• inspect return low-level information on a container or image• ps list containers• pull pull an image or a repository from a registry• run run a command in a new container• search search Docker Hub for an image
(https://docs.docker.com/reference/commandline/cli/)
Demo 1: Make sure Docker is ready
$ docker infoContainers: 6Images: 6Storage Driver: aufsRoot Dir: /mnt/sda1/var/lib/docker/aufsBacking Filesystem: extfsDirs: 78
Execution Driver: native-0.2Logging Driver: json-fileKernel Version: 4.1.10-boot2dockerOperating System: Boot2Docker 1.8.3 (TCL 6.4); master : af8b089 - Mon Oct 12 18:56:54 UTC 2015CPUs: 1...
Docker RUN Command
Most straightforward way to create a container is the docker run command
docker run --rm ubuntu echo 'hello world'
• Retrieves the latest from DockerHub (if it's not yet locally available)
• Executes the echo command available in the ubuntu image
• Prints the out to the hosts terminal• --rm to remove the container once the
related process (echo) is completed• --name to give the container a user-
defined nameMyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
run
DockerRegistry
ubuntu
xsfdsfd
Demo 2: "Echo Hello World"
Runs the echo statement
$ docker run --rm ubuntu echo 'Hello World'Unable to find image 'ubuntu:14.04' locally14.04: Pulling from library/ubuntuc63fb41c2213: Pull complete99fcaefe76ef: Pull complete5a4526e952f0: Pull complete1d073211c498: Pull completeDigest: sha256:d4b37c2fd31b0693e9e446e56a175d142b098b5056be2083fb4afe5f97c78fe5Status: Downloaded newer image for ubuntu:14.04 Hello World
Demo 2: "Hello World daemonized and show logs"
In addition to interactive containers, we can create longer-running containers by running im them daemonized
$ docker run --name my-daemon -d ubuntu /bin/bash -c "whiletrue; do echo Hello World; sleep 1; done"
$ docker logs –f my-daemonHello world!Hello world!
Docker LOGS Command
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
my-container
Docker redirects stdout and stderr of every container both to the current terminal and to Docker's internal logs
$ docker logs <my-container>
Outputs the stdout and stderr log for the given container
Important parameters are• -f to keep the log visible and updated in real-
time• --tail=N where N is the number of most recent
lines to show
logs
Docker IMAGES and PS Command
To list the images available in the internal registry:$ docker images
To show all the containers running:$ docker ps
Using a go template to format$ docker ps –-format '<go-template>'
To also show stopped containers:$ docker ps -a
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
ubuntu
ps
image
my-container
Demo 3: "Show running containers"
list the conainers which are currently started
Use the --format option to only show part of the information
$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0bc0fb64631b ubuntu "/bin/bash -c 'while\n" 6 minutes ago Up 6 minutes my-daemon
$ docker ps --format '{{.ID}} => {{.Names}}'1d1ca35746d6 => my-daemon
Demo 4: "Show local images"
list all images available in the local registry
$ docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu latest a5a467fddcb8 3 days ago 187.9 MB
Docker INSPECT Command
To show very detailed information, in JSON format, about a container and its processes
$ docker inspect my-container
Inspection is available for both active and stopped containers
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
ubuntu
xsfdsfdinspect
Docker STOP and START Command
A container stops automatically as soon as the process stops
A container can also be stopped from the command line
$ docker stop my-container
A container can be re-executed via
$ docker start my-container
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
ubuntu
my-container stopstart
Docker RM and RMI Command
Removing a stopped container
$ docker rm my-container• Use –f to force deletion, even active
containers!
To remove all the containers on the host
$ docker rm –f $(docker ps –aq)
To remove an image on the host
$ docker rmi ubuntuMyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
ubuntu
my-containerrm
rmi
Demo 5: "Stopping the container and removing it"
$ docker stop my-daemonmy-daemon
$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -a --format '{{.Status}} : {{.Names}}'Exited (137) 4 minutes ago : my-daemon
$ docker rm my-daemonmy-daemon
$ docker ps -a --format '{{.Status}} : {{.Names}}'
Docker PULL Command
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
ubuntu
pull
Images are automatically downloaded by Docker when needed
It's also possible to manually download images via
$ docker pull ubuntu
If the tag is missing in <image-name>, latest will be downloaded
How to create my own image ?
Docker images can be created in 2 different ways:
1. By editing a Dockerfile in the host filesystem and executing docker build
2. By working on a container, then saving it by executing docker commit command (not recommended)
• Mainly for specific or debugging purposes
Docker COMMIT Command
Creating a new image from the containers changes:
$ docker commit my-container my-image
Generally, it is better to use Dockerfiles to manage your images in a documented and maintainable way.
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containerscommit
run
(pull)
DockerRegistry
my-container
my-imageubuntu
Demo 6: "Commiting Hello World Shellscript"$ docker run -ti --name my-container ubuntu bashroot@e5487f4dd8c6:/# apt-get install nanoReading package list …
root@e5487f4dd8c6:/# nano helloworld.sh#!/bin/bash while true; echo Hello World; sleep 1; do
root@e5487f4dd8c6:/# chmod +x helloworld.sh
$ docker commit my-container gschmutz/helloworld$ docker run -ti gschmutz/helloworld /bin/bash helloworld.shHello WorldHello World
Docker BUILD Command
The steps are simple and standard1. Create a directory having a file
named Dockerfile2. Edit the Dockerfile according to the
related syntax3. Add any supporting file/directory as
demanded by the image, added to the image vai the ADD and COPY instructions
$ docker build –t <image-name> <directory with Dockerfile>
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
Dockerfile
build
DockerRegistry
my-imageubuntu
Dockerfile
Dockerfile instructs on how to buid the image automatically
Dockerfile Syntax (INSTRUCTION arguments)
• FROM – defines base image• RUN – execute arbitrary command• ENV – sets environment• EXPOSE – exposes a port• ADD – add local file to the new image• CMD – default command to execute• MAINTAINER – author information
(https://docs.docker.com/reference/builder/)
Demo 7: "Building with Dockerfile" (I)
$ nano helloworld.sh
#!/bin/bashwhile true; do echo Hello World!; sleep 1; done
$ nano DockerfileFROM ubuntu
MAINTAINER Guido Schmutz [email protected]
COPY helloworld.sh /RUN chmod +x helloworld.shCMD ["sh", "/helloworld.sh"]
Demo 7: "Building with Dockerfile" (II)
$ docker build -t gschmutz/helloworld:1.0 .
$ docker run –ti --name helloworld-1 gschmutz/helloworld:1.0Hello WorldHello WorldHello World
Demo 7: "Building with Dockerfile" (III)
$ nano helloworld.sh
#!/bin/bashwhile true; do echo Hello Oracle Open World; sleep 1; done
$ docker build -t gschmutz/helloworld:2.0 .
$ docker run –ti --name helloworld-2 gschmutz/helloworld:2.0Hello Oracle Open WorldHello Oracle Open World...$ docker stop helloworld-1 helloworld-2$ docker rm helloworld-1 helloworld-2
Docker PUSH Command
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistrypushTo publish an image to the public
Docker registry (Docker Hub):
$ docker push gschmutz/my-image
• You have do register to Docker Hub• Image name has to include username =>
<username>/<image-base-name>
Images can also be published to private registries• Image name has to include the host =>
<registry-host>:<registry-port>/<image-base-name>
my-image
Docker Networking
All the containers inside a host share the same network
They can communicate and can open connections to each other's port
Every container has a hostname, by default based on it's id and shown by hostname• It can be set using the –h argument of docker run
The know the exact address of a container• enter it (by starting a bash shell using docker exec) and consult ifconfig• Use docker inspect
The container's hostname is invisible to other containers
Demo 8: "Inspect Network Setting of container" (I)
$ docker run -ti ubuntu bashroot@2ec74fcaab29:/#
root@2ec74fcaab29:/# hostname2ec74fcaab29
root@2ec74fcaab29:/# cat /etc/hosts172.17.0.21 2ec74fcaab29127.0.0.1 localhost172.17.0.21 cocky_mclean172.17.0.21 cocky_mclean.bridge2ec74fcaab29:/#
Demo 8: "Inspect Network Setting of container" (II)root@2ec74fcaab29:/# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue stateUNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever45: eth0@if46: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdiscnoqueue state UP group default link/ether 02:42:ac:11:00:15 brd ff:ff:ff:ff:ff:ffinet 172.17.0.21/16 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe11:15/64 scope link valid_lftforever preferred_lft foreverroot@2ec74fcaab29:/#
MyComputer(Mac/Windows)
Docker Networking – Expose Ports
By default Docker containers to not bind to host ports
The –P option of docker run binds the container's exposed prots (declared by the EXPOSE command in the image's Dockerfile) to random available ports of the host
You can bind any port of the container (even non-exposed ones) by using the –p parameter on docker run
-p <host port>:<container port>Docker Engine(inVM)
DockerRegistry
Images
Containersdb1521
49161
Demo 9: "Expose Ports" (I)
$ docker run -d -p 48080:8080 -p 49161:1521 --name db-server // sath89/oracle-xe-11g
5dd1d49633f540dc18c6934d9949f46ebd7bc92339a5706404164c299cb203f8
$ docker ps --format '{{.Names}} => {{.Ports}}'db-server 8080/tcp, 0.0.0.0:49160->22/tcp, 0.0.0.0:49161->1521/tcp
$ docker run -d –P --name db-server2 sath89/oracle-xe-11g5dd1d49633f540dc18c6934d9949f46ebd7bc92339a5706404164c299cb203f8
$ docker ps --format '{{.Names}} => {{.Ports}}'db-server2 => 0.0.0.0:32769->1521/tcp, 0.0.0.0:32768->8080/tcp
NonOfficialXEImage:https://hub.docker.com/r/sath89/oracle-xe-11g/
Linking Containers
When creating a container, you can link it to one or more existing and active containers (called source containers):
--link <source-container-name>:<alias>
Create a link enables two important behaviours• <alias> reference the IP address of the source
container in network communications (automatically updates /etc/hosts)
• The env variables created by Docker of the source container are pushed into the new container
MyComputer(Mac/Windows)
Docker Engine(inVM)
Images
Containers
DockerRegistry
db app
Demo 10: "Container Linking" (I)$ docker run -d -p 48080:8080 -p 49161:1521 --name db-server //
sath89/oracle-xe-11g
$ docker run -ti --link db-server:db --name app // gschmutz/sqlinstant-sqlplus
$ docker exec –ti app bash[root@9a5c9bdbf008 /]# cat /etc/hosts172.17.0.9 9a5c9bdbf008127.0.0.1 localhost172.17.0.4 db 5dd1d49633f5 db-server172.17.0.9 app172.17.0.4 db-server172.17.0.4 db-server.bridge
Managing Data in Containers
There are two primary ways to manage data in Docker
1. Data Volumes - specially-designated directory within one or more containers that bypasses the Union File System
-v <host-directory>:<container-directory>[:ro] - to create a volume or bind a volume to a specific directory of the host
2. Data Volume containers – allows for sharing data between containers
--volumes-from <container> - to create exactly the same volumes as the given container
Demo 11: "Data Volumes" (I)
$ docker run -d -p 48080:8080 -p 49161:1521 // -v /my/oracle/data:/u01/app/oracle --name db-server // sath89/oracle-xe-11g
Docker & Oracle SOA Suite
Oracle and Docker
Oracle Linux 6 and 7 Imageshttps://hub.docker.com/_/oraclelinux/
Oracle MySQL image
WebLogic certified on Dockerhttps://github.com/oracle/docker
Docker on Oracle Cloud soon
Docker for SOA Suite not (yet) available from Oracle
Docker & SOA Suite
soa-suite-base
soasuite-bam-domain
soasuite-domain
serivcebus-domain
oracle-xe-11g
db-server soa-server
oracle-linux
oracle-sx
sx-serversoa-server servicebus-server
Creditsto:BrunoBorges(WebLogicDocker),JorgeEsteban(SOASuiteDocker image)
soa-suite-bp1bam
soa-suite-bp4
Demo 12: "Use Oracle Stream Explorer" (I)
$ docker build -t gschmutz/docker-oracle-sx:12.1.3 .Step 0 : FROM oraclelinux:7.0Pulling repository docker.io/library/oraclelinux8d76f35d6be7: Pulling dependent layers8c3e49cb06dc: Download complete...Step 35 : CMD /u01/oracle/oep12c/user_projects/sx_domain/defaultserver/startwlevs.sh---> Using cache ---> f4f4407a2c31$ docker run -d -p 9002:9002 gschmutz/docker-oracle-sx:12.1.379a2a79c1134a22b072be9d42ad38c3a504d98e95fe5e9165c77c305e54be6cd
OpenBrowser:http://192.168.99.100:9002/sx/
Demo 13: "Use SOA Suite" (I)
$ docker build -t gschmutz/soa-suite-base:12.1.3 .
$ docker build -t gschmutz/soa-suite-bp1bam:12.1.3 .
$ docker build -t gschmutz/soasuite-bam-domain:12.1.3 .
$ docker run -p 7001:7001 --name=soahost // gschmutz/soasuite-bam-domain:12.1.3 startWebLogic.sh
$ docker run -d -p 48080:8080 // -p 49161:1521 //--name db-server sath89/oracle-xe-11g
Idea: "Use SOA Suite with docker-compose" (II)
db-server:image: sath89/oracle-xe-11gports:
- "48080:8080"- "49161:1521"
soa:image: gschmutz/storm-nimbusports:
- "47001:7001"links:
- db-repo:db-server
$ docker-compose up -d
To do …..
• Oracle SOA Suite 12.2.1 does no longer work with Oracle DB XE 11g
• Parameterize the creation of the domain so that different combination can be created easily
• Use docker-compose for starting multiple containers
• How to deploy SOA projects into a container / where to keep state
• Using GUI tools out of Docker container
• Make it available on GitHub
• Testing
Docker Product Family
Docker Machine
Machine makes it easy to create Docker hosts on your computer, on cloud providers and inside your own data center
It creates servers, installs Docker on them and then configures the Dockerclient to talk to them
Driverexitsfor:• SoftLayer• AWS• DigitalOcean• Azure• GoogleComputeEngine• Rackspace• OpenStack• VirtualBox• VMWareFusion/vSphere
Docker Swarm
Docker Swarm is native clustering for Docker
It turns a pool of Docker hosts into a single, virtual host
Has support for etcd, consul, and zookeeper host disovery systems
Integrated planned with Bluemix, Mesos, Kubernetes, AWS, Azure
Docker Compose
Compose is a tool for defining and running complex applications with Docker
define a multi-container application in a singlefile, then spin your application up in a singlecommand which does everything that needs to be done to get it runing
Docker Registry
a stateless, highly scalable server side application that stores and lets you distribute Docker images
open-source, under the permissive Apache license
use it to:
• tightly control where your images are being stored• fully own your images distribution pipeline• integrate image storage and distribution tightly into your in-house development
workflow
Kitematic
Kitematic is the fastest and easiest way to start using Docker on your laptop.
A completely automated process installs and configures the Dockerenvironment on your machine in just minutes.
Build and run containers through a simple, yet powerful graphical user interface (GUI).
Docker Toolbox
The Docker Toolbox is an installer to quickly and easily install and setup a Docker environment on your computer
Available for both Windows and Mac
the Toolbox installs
• Docker Client• Docker Machine• Docker Compose (Mac only)• Docker Kitematic• VirtualBox
Summary
Summary
Docker makes running isolated environments very easy
Much more lightweight than using Virtual Machine
Lot's of prebuild Docker images available on Docker Hub
Running SOA Suite inside a container is possible, although only use it for demo/PoC/development environments
Getting more and more traction by Oracle
http://bit.ly/1MtShoR
Guido SchmutzTechnology Manager