What is container?
An image is a lightweight, stand-alone, executable package that includes everything you need to run specific software. It can include code, libraries, environment variables and config files.
A container is running instance of an image. It exists in memory and runs in isolated (from host) environment. Container can access host files and port if it allowed.
Containers run applications natively on kernel. They have better performance than virtual machines because VMs access resources through a hypervisor. Containers can get native access, each one running in a discrete process, taking no more memory than any other executable.
See comparison between VMs and containers below
So containers don’t run OS every time. That’s why they don’t need a lot of resources and a lot of time to start. Now containers are very popular because they are very useful for DevOps and Cloud.
Installing Docker for Oracle Linux 7
1. Enable following repositories in yum: ol7_latest, ul7_uekr4 and ol7_addons
2. Install docker engine
yum install docker-engine
3. One completed you start the docker service
systemctl start docker
systemctl enable docker
systemctl status docker
4. Login to Oracle Container Registry, trusted source of Oracle software. It will give you predefined list of Docker containers
[root@scdocker ~]# docker login container-registry.oracle.com
Username: alexander.ryndin@oracle.com
Password:
Login Succeeded
5. Pull some docker containers
docker pull container-registry.oracle.com/os/oraclelinux
docker pull container-registry.oracle.com/java/serverjre
6. Now you can run container. Let’s start general OS container
docker container run -i -t -h oracletest container-registry.oracle.com/os/oraclelinux
Run Oracle Database using Docker
You can find Oracle docker images on Oracle’s own docker — Oracle Container Registry and on public Docker Store. We will use Oracle’s registry.
1. Pull Oracle Database image
docker pull container-registry.oracle.com/database/enterprise:12.2.0.1
2.
Run GoldenGate using Docker
You can find full list of ready-to-use Oracle’s images in Oracle Container Registry. It is easy to download and use them but some Oracle tools don’t have their own images in registry. Sometimes you need to create your own images, customize them and use them inside your company. You can use the following github server (https://github.com/oracle/docker-images) to download and create your own images. For example this repository contains GoldenGate image artifacts.
GoldenGate image is based on oracle/instantclient image. So we need to build oracle/instantclient first.
1. Create directory docker_instantclient and download Dockerfile for oracle/instantclient to this directory.
2. Download the following Oracle instant client rpms from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpmoracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpmoracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
3. If you receive «Permission denied» error then disable SELinux
setenforce 0
4. Put these files to docker_instantclient and run building of image
docker build -t oracle/instantclient:12.2.0.1 .
5. If you are behind proxy then add the following statement to Dockerfile
docker build —build-arg http_proxy=http://proxy.your-company.com:80 -t oracle/instantclient:12.2.0.1 . —no-cache
6. Check that image is available
[root@scdocker docker_instantclient]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/instantclient 12.2.0.1 1169f3a168be 25 seconds ago 407MB
Now we can build GoldenGate image:
1. Download dockerBuild.sh and Dockerfile from repository. It will be used to automate process of docker image building.
2. Download GoldenGate 12.3 media from http://edelivery.oracle.com (both Microservice and Classic)
3. Check that you have Docker version17.05.0+
[root@scdocker ~]# docker version
Client:
Version: 17.06.2-ol
4. Put both downloaded file into the same directory and run
./dockerBuild.sh V974396-01.zip —no-cache —build-arg http_proxy=http://proxy.your-company.com:80
5. Now you should have image available
[root@scdocker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/goldengate-microservices 12.3.0.1.2 a55adc92e19f 27 minutes ago 1.04GB
6. So let’s run it
docker run 5195512dc5d1
7. You should see starting GoldenGate instance. First page will contain password for GoldenGate Administrator
[root@scdocker oggdocker]# docker run a55adc92e19f —ip 10.162.175.222 -h myhost
———————————————————————————-
— Password for administrative user ‘oggadmin’ is ‘Hoo7mf9Tz4KP’
———————————————————————————-
Operation is successfully completed.
Operation is successfully completed.
Operation is successfully completed.
Operation is successfully completed.
2018-01-16T17:14:20.988Z | INFO | ——————————————————-
2018-01-16T17:14:20.992Z | INFO | Copyright (c) 2014, 2017, Oracle and/or its affiliates.
2018-01-16T17:14:20.992Z | INFO | All rights reserved.
Password:
2018-01-16T17:14:20.992Z | INFO |
2018-01-16T17:14:21.013Z | INFO | Create deployment started on 01-16-2018 17:14:20
2018-01-16T17:14:21.014Z | INFO | JRE: 1.8.0_151
2018-01-16T17:14:21.014Z | INFO | ——————————————————-
2018-01-16T17:14:21.025Z | INFO | Using hostname: 2d07f0f97803
2018-01-16T17:14:21.025Z | INFO | Using default port for adminsrvr: 0
2018-01-16T17:14:21.026Z | INFO | Using default port for distsrvr: 0
2018-01-16T17:14:21.026Z | INFO | Using default port for rcvrsrvr: 0
2018-01-16T17:14:21.026Z | INFO | GGSCHEMA not provided. GLOBALS file won’t be created.
2018-01-16T17:14:21.028Z | INFO | Creating deployment ‘ServiceManager’
Know issues
1. There was error while starting GoldenGate image.
———————————————————————————-
/runOracleGoldenGate.sh: line 135: hostname: command not found
/runOracleGoldenGate.sh: line 105: hostname: command not found
Operation is successfully completed.
Operation is successfully completed.
I’ve resolved it by adding installation of hostname package to initial Dockerfile
Before:
yum -y —enablerepo ol${MAJOR_VERSION}_software_collections install openssl rh-nginx18 java-1.8.0-openjdk-headless && \
After
yum -y —enablerepo ol${MAJOR_VERSION}_software_collections install openssl rh-nginx18 java-1.8.0-openjdk-headless hostname && \