Installation¶
Contents
Note
Most of the installation steps require high permissions so you will probably need to run them with sudo.
Install the container toolkit¶
To use the Genv container toolkit, Genv needs be installed first as root using pip with the following command:
sudo pip install genv
Note
This is because the container runtime, which is implemented in Python and imports Genv (i.e. import genv) runs as root.
The container toolkit is part of the Genv project repository.
You will need to clone the project repository. Your home repository is a great place to keep it:
git clone https://github.com/run-ai/genv.git $HOME/genv
Then, you can then see the container toolkit components with the following command:
ls -la $HOME/genv/genv-docker
Register the container runtime¶
Then, you will need to register the Genv container runtime in the Docker daemon configuration file /etc/docker/daemon.json.
Edit the file manually¶
You can edit the Docker daemon configuration file /etc/docker/daemon.json manually and add the Genv container runtime under runtimes.
You should create the file if it does not exist.
Here is an example of the file:
{
"runtimes": {
"genv": {
"path": "/home/raz/genv/genv-docker/genv-container-runtime.py"
}
}
}
Note
You should use full absolute paths and avoid using environment variables like $HOME because the path will be evaluated in a root context.
Then, restart the Docker daemon for the changes to take effect:
systemctl restart docker
Pass as argument to dockerd¶
You can use the dockerd argument --add-runtime instead.
Here is an example:
dockerd --add-runtime genv=$HOME/genv/genv-docker/genv-container-runtime.py
Install the docker wrapper¶
The best way to run Genv containers is with the docker wrapper genv-docker.
It is recommended to install it in a system-wide location such as /usr/local/bin.
You can do this with the following command:
cp -f $HOME/genv/genv-docker/genv-docker.sh /usr/local/bin/genv-docker
Now, you will be able to execute genv-docker commands from any directory.
If you don’t want to install genv-docker in a system-wide location or don’t have sufficient permissions, you can install it at $HOME/.local/bin, or run it using its full path.
Verify installation¶
You can verify the installation with the following command:
genv-docker run --rm ubuntu env | grep GENV_
You should then see that the environment variable GENV_ENVIRONMENT_ID is set.