Using CLI-Docker as non-root user

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
marius
Posts: 6
Joined: Wed May 27, 2020 8:17 am

Using CLI-Docker as non-root user

Post by marius »

Hello,

I'm trying to use the docker container by amrit3701 on a host machine for which I don't have root permissions.
Therefor I'm trying to run the container with my UID and GID so I can use the CAD files outside the container.

Running the container with

Code: Select all

docker run -it amrit3701/freecad-cli
everthing behaves as it should and I can import the FreeCAD module in python3.8.

But when I specify my UID and GID with

Code: Select all

docker run -it -u 1051:100 amrit3701/freecad-cli
and launch python3.8, I get the following error message from the FreeCAD import defined in startup.py:

Code: Select all

I have no name!@c0dfdbd22ac4:/$ python3.8
Python 3.8.5 (default, Jul 20 2020, 19:48:14)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Initialization of FreeCAD failed:
While initializing FreeCAD the following exception occurred: 'Getting HOME path from system failed!'


Please contact the application's support team for more information.

Traceback (most recent call last):
  File "/.startup.py", line 1, in <module>
    import FreeCAD
ImportError: Failed to load FreeCAD module!
>>> import FreeCAD
Initialization of FreeCAD failed:
While initializing FreeCAD the following exception occurred: 'Getting HOME path from system failed!'


Please contact the application's support team for more information.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: Failed to load FreeCAD module!
I already tried adding a user for my UID in the dockerfile and rebuilding the container but this didn't change anything.

How could I resolve this issue?
manuel-buchner
Posts: 5
Joined: Wed Jun 02, 2021 8:52 am

Re: Using CLI-Docker as non-root user

Post by manuel-buchner »

Same problem here.

It is expected, that the user who executes FreeCAD has an entry in /etc/passwd (https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L2777).
But a "random" user used in the docker command has no such entry.

Don't know how to solve this issue yet.

Edit:
I'm all for not only getting the Home Path from the /etc/passwd entry, but also checking the $HOME env, if it is available, and only Fail, if both are unavailable.

Edit2:
Problem root similar to: https://stackoverflow.com/questions/485 ... d-database
0xCoto
Posts: 26
Joined: Wed Aug 10, 2022 3:56 pm

Re: Using CLI-Docker as non-root user

Post by 0xCoto »

@manuel-buchner @marius Any luck with this?
Post Reply