This repository was archived by the owner on Oct 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
This repository was archived by the owner on Oct 15, 2021. It is now read-only.
Make MWM container agnostic #3
Copy link
Copy link
Open
Description
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 $map”
done
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 $map”
done
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
Labels
No labels