Flox provides three main ways of sharing environments with others:Documentation Index
Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Sharing environments with files: Flox environments are shared via the
.floxfolder and often checked into version control. - Sharing environments on FloxHub: Flox environments are shared via FloxHub and available to all
floxcommands with-r username/environment. Commands operate on your local copy; useflox pushto sync changes to FloxHub. - Containers: Flox environments are used to create container images.
Sharing environments with files
New environments created withflox init will create a .flox folder in the directory where flox init was run. This folder contains everything required to run this environment on their system and can be sent to another user any way files are shared. It is most common to commit the .flox to a version controlled code repository such as git. If shared this way, the user needs only git clone the project and flox activate in the directory containing the .flox.
NoteIf you are sharing an environment with a user on a different CPU architecture or OS from the person who created the environment, you may run into some issues where system-specific packages are not available on their OS. This can be fixed with a minor edit to the manifest, described in the manifest concept. If you get stumped, reach out to us on our forum for assistance.
example-projectis a stand-in for a git source code managed project.
.flox directory and commit the changes.
flox activate, which will automatically download the same versions of those packages to their machine:
Sharing environments on FloxHub
Instead of sharing environments with files, you can share them on FloxHub with a free account, which eliminates the need to clone a repository when using the environment. Once an environment has been pushed to FloxHub, it can be used in number of different workflows:- You can
flox pull --copyan environment to use it as a template for a new project. - You can use it directly in other environments by adding it to another environment’s
[include]section. - You can use it to share software across multiple machines, most commonly with a default environment, by adding it to your terminal’s RC files.
- Finally, you can use it to materialize an ad-hoc set of tools, which we’ll show here.
flox init to create it locally:
Using a local copy of a FloxHub environment
Suppose you’ve dropped into a shell on another host or in a container, and you need to use a tool not on that host. To activate your FloxHub environment, run:Pulling a FloxHub environment into a directory (and pushing updates)
If you intend to commit the environment to version control, you may want toflox pull it instead.
flox pull adds a .flox folder to the directory you are in that is linked to the FloxHub environment. When using a FloxHub environment in multiple projects it allows centralized management of the dependencies used across these projects. Run flox pull to sync the latest changes from FloxHub:
flox push them to FloxHub if you have permissions:
NoteRight now, only environment owners can push edits to their environments.
Sharing with containers
Flox can render that environment as an OCI container runtime suitable for use with containerd, Docker, Kubernetes, Nomad, and more. Let’s create a container image from theexample-environment we have been working with.
To render your environment to a container, run flox containerize. This command
will automatically load the image into Docker:
- See
flox containerizefor more output options.
Why so many layers?By default Flox splits every dependency into a different layers, which allows
better dependency sharing and faster iteration.