Oracle DB and Docker Get Your Dockerized Oracle Sandbox Running in the Cloud or On- Premises Martin Knazovicky Dbvisit Software
Martin Knazovicky Chief Services Officer – Dbvisit Software 20 + years IT experience San Francisco Bay Area 10 years Auckland, New Zealand 10 years Oracle, MS SQL, IBM Certified DBA Logical and Physical Replication Dbvisit Software since 2013 Oversee Dbvisit Services @knazo martin@dbvisit.com
Who is DBVISIT Software New Zealand-based, US office, Asia sales office, EU office (Prague) Low cost solutions; flexible licensing Full lifecycle DR application for Oracle Standard Edition ”Oracle-aware” replication vs “block level copy” Cloud Ready (AWS, Azure, Oracle etc.) Keeps standby (DR) database ready to go 24/7
Agenda: Intro to containers and Docker Oracle DB running in the Oracle Cloud’s Container Services Oracle Database running on your local server/laptop Demo Oracle DB – in Docker
Alternatives to docker Open Container Initiative, Kubernetes, CoreOS - rkt, Apache Mesos and Mesosphere, Canonical - LXD
Docker is the company driving the container movement
docker Solomon Hykes started Docker in France as an internal project within dotCloud An evolution of dotCloud's proprietary technology Docker was released as open source in March 2013
docker Lightweight virtualization = Speed + Space Easy updating Test against the same image as production. Automate and speed up your build process. Distribute and deploy scalable services.
docker Increase setup, configuration complexity Containers share the same kernel Elevated OS privileges may be needed. Containers not made for GUI systems
docker Enterprise Edition Community Edition
docker Docker Store Docker Documentation Docker Hands on Guides Docker Training Docker Certification
Docker behind the scenes
VM Docker container vs VM
Docker service The Docker software as a service has three components: The Docker daemon – “dockerd” Objects Docker Container Docker Image Docker Services Registries – repository for Docker images
Docker orchestration Tools Docker Swarm Docker Stack Docker Compose
Docker image Permanently stored image of the environment that Docker uses to create a container
Docker container By default all files created inside a container are stored on a writable container layer
Image vs container
Docker storage Volumes are stored in a part of the host filesystem which is managed by Docker. Non-Docker processes should not modify this part of the filesystem. Volumes are the best way to persist data in Docker. Bind mounts may be stored anywhere on the host system. They may even be important system files or directories. Non-Docker processes on the Docker host or a Docker container can modify them at any time. tmpfs mounts are stored in the host system’s memory only, and are never written to the host system’s filesystem.
docker stats
DOCKER COMMANDS docker build docker port docker commit docker ps docker cp docker create docker exec docker export docker import docker history docker network docker stop docker stats docker system docker port docker ps docker pull docker push docker rename docker rm docker rmi docker run docker service docker stack docker start https://docs.docker.com/engine/reference/commandline/docker/#description
Docker container resources Understand the risks of running out of memory It is important not to allow a running container to consume too much of the host machine’s memory. Configure the default CFS scheduler By default, each container’s access to the host machine’s CPU cycles is unlimited. You can set various constraints to limit a given container’s access to the host machine’s CPU cycles.
YAML FILE dbv8: image: your_repository/name:tag volumes: - ~/standby_releases:/install shm_size: 512M mem_limit: 1024M container_name: dbv8 hostname: dbv8 entrypoint: /home/oracle/bin/dbvs-entry.sh command: [ -i, "${INSTALL_FILE}", -g, -s] ports: "4433:4433" - "2228:22" links: - dbv1 - dbv2 - dbv3 - dbv4 - dbv5 - dbv6 - dbv7
Moving onto oracle container service
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services Setup new service - oracle database is located at https://store.docker.com/images/oracle-database-enterprise-edition
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services
Oracle Container services sqlplus sys/Oradoc_db1@ORCLCDB as sysdba
Oracle Container services
Oracle Container services to connect to database using your docker (for example if you don’t have an installation of oracle client on your laptop) you can use oracle’s docker instant client docker run -ti --rm store/oracle/database-instantclient:12.2.0.1 sqlplus "sys/Oradoc_db1@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=129.154.66.107)(Port=1521))(CONNECT_DATA=(SID=ORCLCDB))) as sysdba"
Oracle Container services to log onto the host: ssh -i oowdemo_rsa opc@xxx xxx xxx xxx
Oracle Container services root@xxx-occs-wkr-1 ~]# docker exec -it 0.OracleDB12.2.OracleDB12.2-20180906-135245 bash -c "source /home/oracle/.bashrc; sqlplus /nolog" SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 6 02:46:19 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> connect sys /as sysdba Enter password: Connected.
Local Docker demo
Thank you @knazo