I need to run python-jira inside a Docker Container based on Ubuntu 14.04/16.04.
The default python is 2.7, but the Docker container also has python 3.
I need to access python-jira from a python3 application.
I added python-pip to my file system, but there is no ubuntu python-jira package.
I tried doing "RUN pip install jira" inside the Dockerfile, but that fails since I am not superuser. I then tried RUN [ "sudo", "-A", "pip", "install", "jira" ] after installing an ask-pass app which generates the password, but the build fails.
If I create a container without python-jira, I can do:
Docker> sudo pip install jira
Right now, I have an ENTRYPOINT script, and I do the "sudo -A pip install jira" in that, which allows me to "import jira", but doing it this way, adds 15-20 seconds to the startup time of the container, which is undesirable.
Also, this installs python-jira for python-2.7, not python-3.
Is there any way to install python-jira for python3 without
changing standard python with "update-alternatives" ?
How do I get python3-jira installed in my Dockerfile which defaults python to python2?
If you have both Python 2 and 3 installed then you should also have pip and pip3 binaries available. pip3 install python-jira should install the python-jira package into your Python 3 environment.
To answer your other questions we'll need to see your entire Dockerfile. Can you include the contents of the Dockerfile you're using? The base image in use will inform the solution you need to use here.
Here is what I tried:
The pip install python-jira fails, so right now I am rsyncing all the files
to the docker image in the "start-ale" script which is a kludge.
MAINTAINER N N <email@example.com>
ENV DEBIAN_FRONTEND noninteractive
RUN ["apt-get", "update"]
RUN ["apt-get", "upgrade", "-y", "--fix-missing"]
RUN apt-get update && apt-get -y install locales build-essential python python3 git diffstat texinfo gawk chrpath wget cpio nano vim mc iptables lzop devscripts ca-certificates gnome-terminal libcanberra-gtk3-module nfs-common python-pip python3-pip
RUN echo "root:root" | chpasswd
RUN pip install jira
RUN pip3 install jira
RUN ["locale-gen", "en_US.UTF-8"]
RUN ["dpkg-reconfigure", "locales"]
ADD start-ale /usr/local/bin/
I tried pip install here, but that adds 15-20 seconds to the startup time,
so I went with the copy instead.
if [ "$3" == "" ] ; then
echo "A build directory must be specified!"
# yocto needs /dev/shm writable and it's not for some reason
chmod a+w /dev/shm
useradd -m -u $1 -g $2 -s /bin/bash builder
[ -c "$(tty)" ] && chmod a+rw $(tty)
# Zap the password for builder
[ -e /etc/shadow ] && sed -i 's%^builder:\*:%builder::%' /etc/shadow
[ -e /etc/passwd ] && sed -i 's%^builder:x:%builder::%' /etc/passwd
# Copy all files found under ale-builder-files to the docker image
cp -rp /mnt/ale-builder/ale-builder-files/home /
chown -R builder: /home
chown -R builder: /opt
cp -rp /mnt/ale-builder/ale-builder-files/usr /
cp -rp /mnt/ale-builder/ale-builder-files/etc /
# if ! [ -d /usr/local/lib/python2.7/dist-packages/jira ] ; then
# echo "Installing python-jira"
# sudo -A pip install --quiet jira
# Special step to make sure the ssh keys have the correct attributes
chmod 700 /home/builder/.ssh
chmod 600 /home/builder/.ssh/id_rsa
chmod 644 /home/builder/.ssh/id_rsa.pub
chmod 644 /home/builder/.ssh/known_hosts
chmod 600 /home/builder/.ssh/id_dss.openssh.px2it
chmod 600 /home/builder/.ssh/id_dss.openssh.px2drv
# Set correct build dir
sed -i 's/##BUILD_DIR##/'$3'/' /home/builder/.bashrc
sed -i 's%##HTTP_PROXY##%'$4'%' /home/builder/.bashrc
if [ -n "$SSTATE_NFS" ]; then
mount $NFS_OPTS $SSTATE_NFS /mnt/sstate-cache
if [ -n "$DL_NFS" ]; then
mount $NFS_OPTS $DL_NFS /mnt/downloads
# Start builder
if [ "$5" != "" ] ; then
su - builder -c "$5"
su - builder
I seem to run into an SSH problem
Step 8/13 : RUN pip install jira pbr
---> Running in b7c332519c5e
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 546, in unpack_http_url
resp = session.get(target_url, stream=True)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 467, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 385, in send
SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c pip install jira pbr' returned a non-zero code: 2
The following commands in Dockerfile appears to work:
RUN pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org jira
RUN pip3 install --trusted-host pypi.org --trusted-host files.pythonhosted.org jira
This only works with Ubuntu 16.04, not with Ubuntu 14.04
since pip in Ubuntu-14.04 does not support the "--trusted-host" switch
It would be good if a debian package was created, so apt-get install could be used.
The Jira Software Cloud Team has been busy working on a simple, secure, and reliable way to integrate your build and deployment information from Jenkins with Jira Software Cloud. This means you don’t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events