Docker setup#

You can use Docker to run test IOCs that are convenient for testing without having to locally build and install EPICS IOCs. Please use the following Docker links to install and configure Docker:

To communicate with the Docker you have set up some environmental variables:

#!/bin/bash

export DOCKER0_IP="172.17.0.1"
export EPICS_CA_ADDR_LIST=$( echo $DOCKER0_IP | sed -e 's/^\([0-9]\+\)\.\([0-9]\+\)\..*$/\1.\2.255.255/' )
export EPICS_CA_AUTO_ADDR_LIST="no"
export EPICS_CA_MAX_ARRAY_BYTES=10000000

and to run docker with the correct images (assuming the preceding code block is saved in epics_exports.sh):

#!/bin/bash

SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $SCRIPTS_DIR/epics_exports.sh

# Override the deprecation warning of V1 images
# Remove when images are updated
sudo mkdir -p /etc/systemd/system/docker.service.d
file="/etc/systemd/system/docker.service.d/extra_env.conf"
sudo cp $SCRIPTS_DIR/docker.conf $file
sudo systemctl daemon-reload
sudo systemctl restart docker

AD_DOCKERIMAGE="prjemian/synapps-6.1-ad-3.7:latest"

docker pull ${AD_DOCKERIMAGE}

mkdir -p /tmp/ophyd_AD_test/

# Create YYYY/MM/DD subdirectories.
# This is required because the images use a version of AD which
# does not create missing directories.
python $SCRIPTS_DIR/create_directories.py /tmp/ophyd_AD_test/data1

docker run --name=area-detector --rm -dit -v /tmp/ophyd_AD_test:/tmp/ophyd_AD_test/ -e AD_PREFIX="ADSIM:" ${AD_DOCKERIMAGE} /bin/bash
sleep 1  # Probably not needed?
docker exec area-detector iocSimDetector/simDetector.sh start

Running this multiple times will lead to multiple instances of the images running.

For EPICS to know where to search for the IOCs you will need to do

source epics_exports.sh

to setup the EPICS environmental variables. To check that it is setup correctly

$ env | grep -i epics
EPICS_CA_ADDR_LIST=172.17.255.255
EPICS_CA_AUTO_ADDR_LIST=no
EPICS_CA_MAX_ARRAY_BYTES=10000000

To check if it is working, try

$ caget XF:31IDA-OP{Tbl-Ax:X1}Mtr

Note

You may need to install pyepics, which installs epics-base and the corresponding caget executable:

conda install -c lightsource2-tag pyepics