Package: conman-tool
CONtainerMANager : conmanDescriptionConman is a tool to manage containers. It is designed to be used with docker, docker-compose et VScode devcontainer tool.RequirementsUnix (Linux, macOS) based operating system (WSL workaround for Windows)A container engine ans its composer tool:Docker 24.0+andDocker-compose 2.20+Podman 4.0+andPodman-compose 1.0.6+Python 3.8+ and <3.11Python modules :pip 21.0.1+(Need setuptools integration)pyyaml 5.4.1+InstallationInstall conman using pip:pipinstallconman-toolYou can also install conman from source, tcd he current stable realease is1.2.0:pipinstallgit+https://github.com/elmokulc/conman.git@1.2.0UsageWhen starting a new projectGo to you project directory:mkdirmy_projectcdmy_projectCreate a conman configuration file by running:conmaninitThis will create a directory named.conmanwithin the configuration fileconman-config.yml.$➜~/my_project$conmaninit
$➜~/my_project$tree-a
.
└──.conman└──conman-config.yml1directory,1fileEdit theconman-config.ymlconfiguration file to fit your needs.As example:# Images Settings
images:
    root:
        generate: true
        name: BigFoot
        tag: latest
        from_image:
            name: ubuntu
            tag: '20.04'
        conda_environment:
            directory: /opt/conda
            env_name: myenv
            environment_file: ./environment.yml
        extra_instructions: 
            - "RUN echo 'export $PYTHONPATH=/python_modules:$PYTHONPATH' >> ~/.bashrc"
    user:
        extra_instructions:
            - "RUN sudo mkdir -p /python_modules"
            - "RUN sudo chown -R $USER:$USER /python_modules"
            - "RUN echo 'export $PYTHONPATH=/python_modules:$PYTHONPATH' >> ~/.bashrc"     

# Container Settings
container:
    engine: docker # docker or podman
    compose:
        service_name: main
        volumes:
        - ..:/workspace
        - path_module1/module1:/python_modules/module1
        - path_module2/module2:/python_modules/module2
    devcontainer:
        customizations:
            vscode:
                settings: {}
                extensions:
                - ms-python.python
                - ms-python.vscode-pylance
                - ms-toolsai.jupyter
    graphical:
        protocol: x11
    gpu:
        manufacturer: nvidia
        count: 1By running:conmanbuildConman will generate adocker-compose.ymlfile and aDockerfile.user, enventually: a.devcontainerdirectory within adevcontainer.jsonfile, aDockerfile.rootand a condaenvironment.ymlfile, all of this according to your configuration file:.conman-config.yml.Here is an example of the output from the previous configuration file:$➜~/my_project$conmanbuildBuilding...Directory .devcontainer createdCreating devcontainer.json file...Executing xhost +local: ...Appending volumes for display configuration...-> Add volume: /tmp/.X11-unix:/tmp/.X11-unix:rw-> Add volume: /home/vscode/.Xauthority:/home/vscode/.Xauthority:rw-> Display forwading activated-> Add volume: ..:/workspace-> Add volume: path_module1/module1:/python_modules/module1-> Add volume: path_module2/module2:/python_modules/module2-> GPU activated--- Build user Dockerfile ---Adding user extra instructions to Dockerfile...Generated Dockerfile.user at:    ~/my_project/.devcontainer/Dockerfile.user--- Build root Dockerfile ---Creating conda env file at:     ~/my_project/.conman/environment.ymlAdding root extra instructions to Dockerfile...Generated Dockerfile.root at:    ~/my_project/.conman/Dockerfile.rootProject Building done successfullyThe project directory will now look like this:$➜~/my_project$tree-a.├── .conman│   ├── conda│   │   └── environment.yml│   ├── conman-config.yml│   └── scripts│       ├── initializeCommand.sh│       ├── onCreateCommand.sh│       ├── postCreateCommand.sh│       ├── postStartCommand.sh│       └── updateContentCommand.sh├── .devcontainer│   ├── build_root_img.sh│   ├── devcontainer.json│   ├── docker-compose.yml│   ├── Dockerfile.root│   └── Dockerfile.user└── .env4 directories, 13 filesWhen working on an existing projectIn case you want to work on an existing project, you can use theconman updatecommand by running:conmanupdateThis command will regenerate user dependant files such asDockerfile.user,docker-compose.ymlordevcontainer.json:$➜~/my_project$conmanupdateUpdating conman build...Creating devcontainer.json file...[...]Appending volumes for display configuration...-> Add volume: /tmp/.X11-unix:/tmp/.X11-unix:rw-> Add volume: /home/vscode/.Xauthority:/home/vscode/.Xauthority:rw-> Display forwading activated-> Add volume: ../:/workspace--- Build user Dockerfile ---Adding conda environment to Dockerfile...No extra instructions in user imageGenerated Dockerfile.user at:    /workspaces/conman/myproject/.devcontainer/Dockerfile.userHelpAll available commands can be listed by running:conman--helpif you need some details about a specific command, you can run:conman<command>--helpRoot image generationIn case you need to generate a root image, conman will generate a build script for you namebuild_root_img.shin the same folder thatDockerfile.root.
Unfortunalety, you will need to set execution permissions and run this script manually.To set proper permissions and run the script:chmod+xbuild_root_img.sh&&./build_root_img.shTroubleshotingAccording to your system configuration and yours permissions, the location of the entry point of conman may change.
You may need to update your$PATHvariable.The command:pipshowconmanwill give you the following output within the location of the conman package:Name: conmanVersion: [****]Summary: [****]Home-page: [****]Author: [****]Author-email: [****]License: [****]Location: /home/<username>/.local/lib/python3.8/site-packagesEditable project location: [****]Requires: [****]In this example, the location of the entrypoint to be add will be/home/<username>/.local/bin.You can then add the following line to your.bashrcor.zshrcfile:exportPATH=$PATH://home/$USER/.local/binor by running:echo'export PATH=$PATH:/home/'$USER'/.local/bin'>>~/.bashrcThis will add the conman executable to your$PATHvariable.ContributingIf you want to contribute to this project, please read theCONTRIBUTING.mdfile.