Using Pexpect When Building Docker Images Fails with IOCTL Error

I am trying to create a Base Image with the following Dockerfile information:

FROM scratch

ADD centos-7-docker.tar.xz /

LABEL org.label-schema.schema-version = “1.0”
org.label-schema.name=“CentOS Base Image”
org.label-schema.vendor=“CentOS”
org.label-schema.license=“GPLv2”
org.label-schema.build-date=“20180402”

ADD net-snmp-5.7.3.tar.gz /
ADD LoadSimulator /LoadSimulator

RUN yum -y --nogpgcheck install net-snmp
RUN yum -y --nogpgcheck install net-snmp-devel
RUN yum -y --nogpgcheck install gcc
RUN yum -y --nogpgcheck install file
RUN yum -y --nogpgcheck install python
RUN yum -y --nogpgcheck install epel-release
RUN yum -y --nogpgcheck install python-pip

RUN pip install -U pip
RUN pip install -U setuptools
RUN pip install pexpect

RUN cp /LoadSimulator/mibs/* /usr/share/snmp/mibs
RUN python /LoadSimulator/scripts/SetupLoadSimulator.py /LoadSimulator/mibs/

CMD [“/bin/bash”]

My script “LoadSimulator.py” uses pexpect. However, when I run the docker build command for this image I get the following error:

Traceback (most recent call last):
File “/LoadSimulator/scripts/SetupLoadSimulator.py”, line 459, in
main()
File “/LoadSimulator/scripts/SetupLoadSimulator.py”, line 452, in main
convertMibsToC()
File “/LoadSimulator/scripts/SetupLoadSimulator.py”, line 152, in convertMibsToC
child.interact()
File “/usr/lib/python2.7/site-packages/pexpect/pty_spawn.py”, line 761, in interact
mode = tty.tcgetattr(self.STDIN_FILENO)
termios.error: (25, ‘Inappropriate ioctl for device’)

From what I could find (and I could be wrong here), the docker build environment does not provide tty which may be why I am getting an IOCTL error for pexpect. Is there a way I can enable the use of pexpect during image build operations?

Thanks,
Dan