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”“CentOS Base Image”

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/ /LoadSimulator/mibs/

CMD [“/bin/bash”]

My script “” 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/”, line 459, in
File “/LoadSimulator/scripts/”, line 452, in main
File “/LoadSimulator/scripts/”, line 152, in convertMibsToC
File “/usr/lib/python2.7/site-packages/pexpect/”, 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?