ansible-runner-service
ansible-runner-service copied to clipboard
Docker build fail
Hello, I am trying to run the Docker container on Ubuntu 20.04 with Docker version 19.03.12, build 48a66213fe It seems the image can't build because of easy_install error, this is the output:
---> Running in 995ce457e1c7
Searching for pip
Best match: pip 9.0.3
Adding pip 9.0.3 to easy-install.pth file
Installing pip script to /usr/lib/python3.6/site-packages
error: [Errno 21] Is a directory: '/usr/lib/python3.6/site-packages/pip'
The command '/bin/sh -c easy_install-3.6 -d /usr/lib/python3.6/site-packages pip && ln -s /usr/lib/python3.6/site-packages/pip3 /usr/local/bin/pip3' returned a non-zero code: 1
I manged to make it work with the following Dockerfile, I have not tested the service with playbooks yet, but the /api endpoint seems to work. If you think it is good enough please use it or I can make pull request:
FROM centos:7
#RUN easy_install-3.6 -d /usr/lib/python3.6/site-packages pip && \
# ln -s /usr/lib/python3.6/site-packages/pip3 /usr/local/bin/pip3
# python2 CentOS packages
# python2-flask-restful python-flask python-crypto pyOpenSSL
# python2-psutil python-pip
# python-daemon (pulled in by pip3 install of ansible-runner)
# python-wheel
# PyYAML
# Install Ansible Runner
RUN yum -y install epel-release && \
yum -y install bash wget unzip ansible \
pexpect python-daemon bubblewrap gcc \
bzip2 openssh openssh-clients python2-psutil\
python36 python36-devel python36-setuptools && \
localedef -c -i en_US -f UTF-8 en_US.UTF-8
RUN /usr/bin/pip3 install cryptography docutils psutil PyYAML \
pyOpenSSL flask flask-restful && \
/usr/bin/pip3 install --no-cache-dir ansible-runner==1.3.2 && \
rm -rf /var/cache/yum
RUN mkdir -p /etc/ansible-runner-service && \
mkdir -p /root/.ssh && \
mkdir -p /usr/share/ansible-runner-service/{artifacts,env,project,inventory}
COPY ./ansible-runner-service.tar.gz /root/.
WORKDIR /root
RUN tar xvzf ansible-runner-service.tar.gz && \
cd ansible-runner-service && \
python3.6 setup.py install --record installed_files \
--single-version-externally-managed
ENTRYPOINT ["/usr/local/bin/ansible_runner_service"]
You are removing lot of dependencies from the base os(which is centos7 not ubuntu) in the container. I don't think this will work properly. I think that probably you have any kind of problem with your docker environment like in: https://github.com/drivendataorg/concept-to-clinic/issues/287
Ubuntu is the host, not the base image. I stumbled on that thread when I was google-ing, but that is not the problem.
The changes I made is removing easy_install
as it fails because there is already /usr/lib/python3.6/site-packages/pip
directory with the base Centos 7 image. Probably installed as dependency with some of the packages. Packages like python36
and python36-dev
does not exsit at all in this image repos, which is visible in yum stdout:
Installed:
ansible.noarch 0:2.9.10-1.el7 bubblewrap.x86_64 0:0.3.0-1.el7
bzip2.x86_64 0:1.0.6-13.el7 gcc.x86_64 0:4.8.5-39.el7
openssh.x86_64 0:7.4p1-21.el7 openssh-clients.x86_64 0:7.4p1-21.el7
pexpect.noarch 0:2.3-11.el7 python-daemon.noarch 0:1.6-4.el7
python2-psutil.x86_64 0:5.6.7-1.el7 python3.x86_64 0:3.6.8-13.el7
python3-devel.x86_64 0:3.6.8-13.el7 python3-setuptools.noarch 0:39.2.0-10.el7
unzip.x86_64 0:6.0-21.el7 wget.x86_64 0:1.14-18.el7_6.1
The binary python36
seems to be replaced with python3.6
in the image that the Dockerfile builds and the path to pip3 is different, probably the base Centos image got updated.
It got python3 installed most likely by a chance as dependency with some of the packages.
Does the image build successfully for you? Because I tried a few times on different distributions, just to be sure and it fails the same way.
The image built successfully for me locally on ubuntu 20.04 using podman instead of docker.
I also forked and rebuilt in a github actions pipeline on a ubi8 (rhel 8 container) rebase Dockerfile.ubi8.
GH Actions pipelines run on ubuntu by default as well (20.04 in this case).
Image is available for testing @ quay.io/containercraft/ansible-runner-service