---
title: Operations Center
header-img: img/header_img/oc.jpg
date: 2018-03-07 09:50:12
description: Operations Centre in a Docker Container
related:
- { page: "index", title: "Containerising SP" }
---
> **NOTES**
> * Operations Centre is a good fit for a container - especially in a cluster (EG: Swarm), it requires no persistent storage (other than the initial config).
> * Make sure your host has sufficient memory to perform the build - OC requires at least 4GB of RAM to pass the installation logic.
> * The accompanying files for this build are available in my [gitlab](http://dev.leenooks.net/deon/spdocker/tree/oc)
> * And lastly, most importantly, running SP in a container is **not officially supported by IBM** - so you cannot make a help-desk call about having problems.
 Technically it should work without problems, but if you are experiencing a problem, be prepared to recreate your environment on a physical host and validate that your problem still exists (and thus not a result of Docker or the implementation on Docker).

The process for Containerising OC is very similar to [Containerising Spectrum Protect](index.html).

## Create your Dockerfile
As at the time of writing these instructions, Red Hat Linux is not available in the Docker hub - but CentOS is a good clone. We'll use it

### Image preparation
```Dockerfile
FROM centos:7
```

Operations Centre doesn't really need any dependencies - you can check the [Knowledge Center](https://www.ibm.com/support/knowledgecenter/SSEQVQ_8.1.7/srv.install/c_oc_inst_reqs_os.html) for any updates. However, to pass the installation logic, we do need to have a redhat-release RPM installed. For CentOS it doesn't exist (CentOS calls it centos-release), so I created one.

```Dockerfile
RUN yum -y install http://yum.leenooks.net/CentOS/7/base/redhat-release-7-6.el7.centos.12.2.x86_64.rpm \
 libaio \
 ksh \
 compat-libstdc++-33 \
 numactl && \
 yum clean all && rm -rf /var/tmp/*
```

<small>**NOTE**: During the installation of SP, it tests to make sure it is running on RedHat Linux by testing the existence of an RPM package `redhat-release`. The redhat-release installed on line 1 is a fake RPM package - it installs no files, but just emulates the existence of that required RPM package.</small>

### Operations Centre Installation

Now copy in our silent install configuration files. These files are based on the silent install XML files that come on the installation media. Some details on these files are also in the [Knowledge Center](https://www.ibm.com/support/knowledgecenter/SSEQVQ_8.1.7/srv.install/t_srv_inst_silently-linux.html)

```Dockerfile
COPY install.xml install-fp.xml /tmp/
```
<small>**NOTE**: We only include the silent install configuration files here - not the installation media, otherwise the size of the resulting Docker image is too big. Current versions of `docker build` do provide the ability to "flatten" the resulting container, but those instructions are outside the scope of this tutorial.</small>

Next, is performing a silent installation of SP.

```Dockerfile
RUN SOURCE_URL=http://YOUR_SITE_URL_HERE && \
 mkdir -p /tmp/build && cd /tmp/build && \
 curl -SL ${SOURCE_URL}/8.1.7.000-IBM-SPSRV-Linuxx86_64.bin > tsm && chmod +x tsm && ./tsm && rm -f tsm && \
 ./install.sh -s -input /tmp/install-oc.xml -acceptLicense && \
 rm -rf /tmp/build /tmp/install*xml
```

**NOTE**: Some information on what is occurring here.
* To avoid the resulting Docker Image being too large, we download the installation media from a web server (Line 3) and then delete it after it has been expanded.
* Line 4 is the silent installation method for installing SP components.
* Line 5 deletes any installation files to reduce the size of the resulting Docker Image.

And our final Docker Image settings for when our container starts.

```Dockerfile
COPY init /sbin/

# Our final docker parameters
EXPOSE 11443
ENTRYPOINT [ "/sbin/init" ]
CMD [ "start" ]
```

A complete Dockerfile is available [here](http://dev.leenooks.net/deon/spdocker/blob/oc/Dockerfile) if you need one as a starting point. Once you have your images loaded on a web server, and the supporting build files run `docker build -t ibm/spectrumprotect-oc:8.1.x .`

If your final build is success, you should see a Docker Image that is about 1GB.

```plain
REPOSITORY              TAG     IMAGE ID      CREATED        SIZE
ibm/spectrumprotect-oc  8.1.7   cf10a5a9a401  1 minutes ago  1.03GB
```

Now that your container is built, starting OC is simple

`docker run --detach=true --interactive=false --link=spectrumprotect -v <HOST_PATH>/serverConnection.properties:/opt/tivoli/tsm/ui/Liberty/usr/servers/guiServer/serverConnection.properties --memory=1g -p 11443:11443 --privileged=false --rm=false --restart=no --tty=false --name=spectrumprotectoc ibm/spectrumprotect-oc:8.1.7`

***NOTES***:
* The OC container needs to connect to your SP server(s). If your SP server is running in a container, you can use the `--link=` to link to the container name of your server (not necessarily required). If you are running your container in a cluster (EG: Docker Swarm), then you'll need to use the appropriate configuration for your cluster to do container-to-container networking.
* The `-v <HOST_PATH>/serverConnection.properties:../serverConnection.properties` will saving you having to do a "setup" of OC if the container is ever stopped and destroy (this will happen in cluster environments). Make sure the file reference in the `-v` option is available on your cluster persistent storage.
