---
title: Clients
header-img: img/header_img/client.jpg
date: 2019-06-28 09:50:12
description: Spectrum Protect Clients in a Docker Container
related:
- { page: "/server/index", title: "Containerising SP" }
---
# The Admin/CLI client

The admin client is an alternative way to connect to a Spectrum Protect Server, and is available with the Unix file client (also known as the BA client, where BA = Backup/Archive)

Using docker for the BA/Admin client is a simple way of deploying the client and keeping it up to date. When you `docker run`, if the client doesn't exist on the system you are running it from, it will automatically be pulled from (your defined) registry.

If you update the image in the registry, all you need to do is `docker pull` the new version (or just remove the current version with `docker rmi [IMAGE NAME]`) and the next run of `docker run` will pull the update image from the registry.

The steps below will help you create your own docker images of the BA client.

## Create your Dockerfile
Since IBM provides a Debian package for the BA Client, we'll use it. But you could use the RedHat one as well.

### Image preparation

```Dockerfile
FROM debian:stretch-slim
```

Next we need some additional dependencies to build the image

```Dockerfile
RUN apt-get update \
        && apt-get install -yyq curl procps \
        && rm -rf /var/lib/apt/lists/* /tmp/*
```

### BA Client Installation
As with building the server, it is better to download the package from the IBM website and have it available on a local webserver.

```Dockerfile
RUN SOURCE_URL=http://YOUR_SITE_URL_HERE && \
        mkdir -p /tmp/build && cd /tmp/build && \
        curl -SL ${SOURCE_URL}/8.1.8.0-TIV-TSMBAC-LinuxX86_DEB.tar |tar xf - && \
        apt-get install ./gsk*.deb ./tivsm-api64.amd64.deb ./tivsm-ba.amd64.deb && \
        rm -rf /tmp/build /var/lib/apt/lists/*
```

Next obtain the SSL certificate from the server package. The file is called `cert256.arm`.

<small>
> **NOTE**:
> If you use your own SSL certificates, then you will need to get your SP servers CA certifcate.
> If you call it something other than `cert256.arm`, then you'll need to modify the `RUN` command below.
</small>

Also pre-create your `dsm.sys` and `dsm.opt` files for your environment.

```Dockerfile
ADD cert256.arm dsm.sys dsm.opt /opt/tivoli/tsm/client/ba/bin/
RUN /opt/tivoli/tsm/client/ba/bin/dsmcert -add -server spectrumprotect -file /opt/tivoli/tsm/client/ba/bin/cert256.arm
```

### Final Docker Image Parameters

Lastly, the baclient uses `/etc/adsm/` to store some information (like the auto login credentials if you are using `PASSWORDACCESS GENERATE`). Ideally you should use `-v [host path]:/etc/adsm` when you run the image.

```Dockerfile
VOLUME [ "/etc/adsm" ]
```

### Set your container timezone (optional)

If you want your running container to be in your timezone, then add this to your Dockerfile

```Dockerfile
# Set out local time
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

```

<small>**NOTE**: This will set your timezone to Melbourne, Australia - naturally, choose the appropriate Country/City for your timezone.</small>

## Build your Image 

A complete Dockerfile is available [here](https://dev.leenooks.net/deon/spdocker/blob/client/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/spcient:8.1.x .`

If your final build is successful, you should see a Docker Image that is about 840MB.

```plain
REPOSITORY           TAG     IMAGE ID      CREATED        SIZE
ibm/spclient         8.1.8   8f5f34c8a38d  2 minutes ago  842MB
```

If you would like to access a pre-built image, you are welcome to from here: `registry.leenooks.net/deon/spdocker/client:8.1.8`

# Trying out the container image

Using the image is simple

`docker run -it --rm --name=ba --hostname=${HOSTNAME:-$(hostname)} -v [host path]:/etc/adsm $IMAGE [dsmc|dsmadmc] ...`

> **NOTES**:
> * There is no reason to keep the container after it has been created - but removing the `--rm` will leave it around. It might make it a bit quicker to start next time by leaving it.
> * `--name=` is optional, but it gives your container a useful name
> * `--hostname=` gives your running a container a friendlier hostname - this is recommended if you are running the client (dsmc).
> * `-v` maps the /etc/adsm path (inside the container) to something on the host outside the container. This is recommended, especially if you want auto login. 
