Questions with toolbox containers

Hello!

I’m on Silverblue and I’m having problems understanding how the system works with container.

My goal is to use poetry insine my toolbox container. But when I install poetry, the installation make it available system-wide, which I don’t want. I understand that poetry is linked with the python path, but the command which python3 shows the same output inside or outside the container (/usr/bin/python3).

So how should I proceed to make my poetry installation only in my container, linked to the python package inside of it ?

And if you have any more informations/guides about how containers work in details, I’m taking them!

I would like to tweak a bit more to make them “less linked” to my home system (like not sharing the same .bashrc and stuff)

Thank you

I suggest you’ll get better answers to this question in a Python or Poetry forum. I’ve used Python with the provided virtual environment and obtained the separation I think you’re describing, but I don’t know about Poetry or exactly what you mean by a ‘toolbox container.’

Best of luck!

Greg.

You can’t really tell if you’re inside or outside of the container just by looking at the path, Python will be in /usr/bin/python3 in both places. The python command is a bad example here because it is present on both the host and in the container so let’s get more specific:

Try this, go inside your toolbox and do sudo dnf install poetry, and then do a which poetry and it’ll tell you /usr/bin/poetry. This is installed inside the container. Now exit the container and do which poetry again and it’ll say it can’t find it. It would only be on the host system if you explicitly installed it on the host using the rpm-ostree command.

Follow up: If you used the upstream poetry instructions it will put poetry in ~/.local/bin/poetry. Since toolbox transparently mounts your home directory if you run this command that’s where it will put it and then you’d be able to run poetry from either the toolbox or the host.

This may or may not be what you want and might be why it’s confusing.

you’d be able to run poetry from either the toolbox or the host.

Yes that is exactly what I wanted to prevent to happen. I only want the poetry install inside my container. The sudo dnf install poetryactually resolves this, since I can’t use poetry in my base system anymore.

I’m still a bit lost with containers in silverblue, especially understanding what files are shared or not.

Thank you!

By default it’ll share eveything in your home directory.

Here’s the corresponding issue for toolbox: Adjust home path · Issue #348 · containers/toolbox · GitHub

Distrobox has a --home option that lets you define a custom directory: distrobox/distrobox-create.md at main · 89luca89/distrobox · GitHub

Or if you prefer to just use podman by hand you can make it so it doesn’t mount your home directory.

1 Like