[REQUEST] / [HELP] pip

Hi. I am trying to use the ubuntu base image to install a pip package and run it as the abc user. I cant get it to work though. In a regular linux install the same commands work as expect (sudo for the python install obviously).

FROM lsiobase/ubuntu:bionic

RUN apt update && \
	apt install python3-pip -y && \
	python3 -m pip install <package>

CMD tail -f /dev/null

This particular pip package makes use of a config file in /home/user/.config/package name/. My first guess is that this could be the route of all the issues. I just dont know how to fix it.

Once created and logged in as the abc user through my portainer interface, trying to run a command gives

PermissionError: [Errno 13] Permission denied: '/root/.config/package name

Can anyone help me with this? I’ve done a lot of googling over the last couple of days and tried a lot of things that I dont really understand and always end up with the same error.

Thanks,
Chris

Tried chowning the package to abc?

I’m not sure what you mean.

“Deemix” is the package I am trying to get working.

Well the process in the container is running as abc as you mentioned in your first post.

It’s complaining it doesn’t have permissions to /root/.config/package_name

So chown /root/.config/package_name to be owned by abc in the container init stage.

Ah OK thanks.
Well thats helped some…

Firstly, it didnt exist. So I changed my Dockerfile to…

FROM lsiobase/ubuntu:bionic

RUN apt update && \
	apt install python3-pip -y && \
	python3 -m pip install deemix
	
WORKDIR /root/.config/deemix

RUN curl -s -o config.json https://notabug.org/RemixDev/deemix/raw/master/deemix/app/default.json && \
	chown -R abc:abc /root/.config/deemix 

CMD tail -f /dev/null

Now I can run the package as root!

But when I try as abc…

bash: /root/.bashrc: Permission denied
abc@5da8caedf115:~/.config/deemix$ deemix --help
Traceback (most recent call last):
  File "/usr/local/bin/deemix", line 7, in <module>
    from deemix.__main__ import main
  File "/usr/local/lib/python3.6/dist-packages/deemix/__main__.py", line 4, in <module>
    import deemix.app.cli as app
  File "/usr/local/lib/python3.6/dist-packages/deemix/app/cli.py", line 11, in <module>
    sp = SpotifyHelper()
  File "/usr/local/lib/python3.6/dist-packages/deemix/app/spotify.py", line 37, in __init__
    self.initCredentials()
  File "/usr/local/lib/python3.6/dist-packages/deemix/app/spotify.py", line 41, in initCredentials
    mkdir(self.configFolder)
PermissionError: [Errno 13] Permission denied: '/root/.config/deemix/'
abc@5da8caedf115:~/.config/deemix$

EDIT: I just changed it to this and now its working…

FROM lsiobase/ubuntu:bionic

RUN apt update && \
	apt install python3-pip nano cron -y && \
	python3 -m pip install deemix
	
WORKDIR /root/.config/deemix

RUN curl -s -o config.json https://notabug.org/RemixDev/deemix/raw/master/deemix/app/default.json && \
	chown -R abc:abc /root/

CMD tail -f /dev/null

This seems tacky though. Is there not a proper way to do this?