---
subtitle: First Deployment
header-img: img/header_img/server.jpg
date: 2018-03-07 09:50:12
description: Spectrum Protect Server in a Docker Container - First run
related:
- { page: "index", title: "Containerising SP" }
- { page: "normalrun", title: "Normal Run of Container" }
- { page: "upgrade", title: "Upgrading SP" }
- { page: "recover", title: "Recovering the SP Database" }
---
# First deployment of a Spectrum Protect Server (in a container)

> **NOTES**:
> * The following instructions are for a Spectrum Protect 8.1.8 instance. I used the same procedure described [here](/server) to build the Docker Image. The only difference is that I performed a new install using the installation media from the IBM public website. (Thus it was just an install, not an 8.1.0 install and followed by a 8.1.8 upgrade).
> * Make sure you follow the guidelines for space required as presented in the [Knowledge Center](https://www.ibm.com/support/knowledgecenter/SSEQVQ_8.1.8/srv.install/t_srv_plan_capacity-linux.html).
 Our Docker Image will have the SP database in `/database`, the instance user in `/tsm` and storage pools in `/data`. Ultimately these will be volumes provisioned from the host and using host storage, or your preferred Docker persistent volume storage technology. 
> * The storage used in the example below is from the host file systems, passed to the container with Docker's `-v` option.
> * This implementation is using DISK or CLOUD storage pool storage. While accessing tape should be possible, I haven't explored what is required for that to work.

## Configuration
Our configuration will use these defaults

```bash Helpful Variables
SP_DB=/srv/sp/database
SP_USER=/srv/sp/user
SP_DATA=/srv/sp/data
SP_IMAGE=ibm/spectrumprotect:8.1.8
```

* **SP_DB** is where the TSM Database will be stored on the Docker Host, and will be passed to the container with `-v ${SP_DB}:/database`
* **SP_USER** is where the TSM Instance user's home directory is on the Docker Host, and will be passed to the container with `-v ${SP_USER}:/tsm`
* **SP_DATA** is where the TSM Disk based storage pools are stored on the Docker Host, and will be passed to the container with `-v ${SP_DATA}:/data`
 If data is stored in a cloud pool, then this would be where the acceleration pool is holding data before it gets sent to the cloud.
* **SP_IMAGE** is the name of your docker image (if you followed the instructions on this site it is `ibm/spectrumprotect:8.1.8`

## First Run Init #1

The first init run will be to create the database layout, and to copy the initialise database (as performed when containerising SP) onto our persistent storage.

`docker run --detach=false --hostname=tsm --interactive=false -v ${SP_USER}:/tsm.init -v ${SP_DB}:/database.init --privileged=true --rm=true --restart=no --tty=false --name=spectrumprotect ${SP_IMAGE} init1`

You wont see any output, but if you look in your ${SP_USER} path, you should see the familiar TSM instance owner files (like sqllib). The ${SP_DB} directory should have sub directories created for the DB2 database, active and archive logs.

```bash Example
[root@d-1-1 test-sp-server]# ls -aln ${SP_DB}
total 0
drwxr-xr-x 7 201 201 4096 Mar  8 14:30 .
drwxr-xr-x 5   0   0 4096 Mar  8 14:25 ..
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 activelog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 archfaillog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 archlog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 mirrorlog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 tsmdb
```

<small>**NOTE**: The UID/GID should be the same as you defined in your Dockerfile</small>

## First Run Init #2 

The second init run will now run the post-install setup for a new environment (`dsmserv formatdb` and then create the ADMIN user - using the macro file added during the build).

`docker run --detach=false --hostname=tsm --interactive=false -v ${SP_USER}:/tsm -v ${SP_DB}:/database --privileged=true --rm=true --restart=no --tty=false --name=spectrumprotect ${SP_IMAGE} init2`

```tsm Expected Output
ANR7800I DSMSERV generated at 00:18:30 on Feb  5 2019.

IBM Spectrum Protect for Linux/x86_64
Version 8, Release 1, Level 7.000

Licensed Materials - Property of IBM
...
ANR0152I Database manager successfully started.
ANR2976I Offline DB backup for database TSMDB1 started.
ANR2974I Offline DB backup for database TSMDB1 completed successfully.
...
ANR0916I IBM Spectrum Protect distributed by International Business Machines is
now ready for use.
ANR2068I Administrator ADMIN registered.
ANR2076I System privilege granted to administrator ADMIN.
ANR1912I Stopping the activity log because of a server shutdown.
ANR0369I Stopping the database manager because of a server shutdown.
```

<small>**NOTE**: With 8.1.8 I noticed a lot of `DBI1306N` messages floating up the screen. That doesn't appear to be an actual problem.</small>

The "init" steps will only need to be run the once for any "new" instance of SP. Thereafter, you'll start SP using the Normal steps documented [here](normalrun.html).
