Skip to content
This repository was archived by the owner on Oct 15, 2021. It is now read-only.
This repository was archived by the owner on Oct 15, 2021. It is now read-only.

Make MWM container agnostic #3

@hexmode

Description

@hexmode

You have been working on docker containers so, in as much as any of this works, it works on Docker already. Looking at the changes you madeit seems fairly straight-forward.

The “why” is to allow widespread adaption and adoption of this tool. I am not suggesting that you should be responsible for maintaining compatibility between every container available, but by initially targeting podman and docker, you have done a little bit of the work.

The “how” is by adding container-specific commands to a shell file that would be sourced to pull in the necessary commands. For example, docker-container.sh would have

function containerExec() {
    container=shift
    command=$@

    sudo docker exec $container$command”
}

function containerStart() {
    container=shift
    env=shift
    image=shift
    command=shift
    volMap=''

    for map in $@; do
        volMap=”$volMap --volume $mapdone
    sudo docker run --env-file $env $volMap —verbose $command
}

function packStart() {
    env=shift

    sudo docker-compose --env-file $env up -d
}

function packStop() {
    env=shift

    sudo docker-compose --env-file $env stop -d
}

A similar podman-container.sh file would look like this:

function containerExec() {
    container=shift
    command=$@

    podman exec $container$command”
}

function containerStart() {
    container=shift
    env=shift
    image=shift
    command=shift
    volMap=''

    for map in $@; do
        volMap=”$volMap --volume $mapdone
    podman run --env-file $env $volMap —verbose $command
}

function packStart() {
    env=shift
    name=shift

    . $env
    podman pod start $name
}

function packStop() {
    env=shift
    name=shift

    . $env
    podman pod stop $name
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions