Include param/wizard to remove container

This commit is contained in:
Gustavo Trott 2022-09-09 16:27:22 -03:00
parent 394c40f79d
commit 1c46b2585b
2 changed files with 44 additions and 2 deletions

View File

@ -57,7 +57,7 @@ Parameters:
- --image: Force an image different than default `--image=imdt/bigbluebutton:2.6.x-develop`
## Using the container
## SSH session within the container
### SSH session within the container
```
ssh bbb26
```
@ -68,6 +68,14 @@ That's all, open https://bbb26.test in your browser and enjoy.
PS: if you see certificate error in your browser, you need to add the CA certificate in it's trusted certificates. Instructions for Chrome and Firefox can be found [here](https://github.com/bigbluebutton/docker-dev/issues/1)
## Removing an existing container
```
./create_bbb.sh {container_name} --remove
```
or rather you can remove a BBB docker image using `docker image rm imdt/bigbluebutton:2.6.x-develop --force`
---
## BBB-Conf
Link to the API-Mate: `bbb-conf --salt`

View File

@ -5,6 +5,8 @@ IP=172.17.0.2
IMAGE=imdt/bigbluebutton:2.6.x-develop
GITHUB_USER=
CERT_DIR=
REMOVE_CONTAINER=0
CONTAINER_IMAGE=
for var in "$@"
do
@ -12,11 +14,13 @@ do
NAME="$var"
elif [[ $var == --image* ]] ; then
IMAGE=${var#*=}
CONTAINER_IMAGE=$IMAGE
elif [[ $var == "--remove" ]] ; then
REMOVE_CONTAINER=1
fi
done
echo "Container name: $NAME"
echo "Using image $IMAGE"
if [ ! $NAME ] ; then
echo "Missing name: ./create_bbb.sh [--update] [--fork=github_user] [--domain=domain_name] [--ip=ip_address] [--image=docker_image] [--cert=certificate_dir] {name}"
@ -30,6 +34,7 @@ for container_id in $(docker ps -f name=$NAME -q) ; do
done
for container_id in $(docker ps -f name=$NAME -q -a); do
CONTAINER_IMAGE="$(docker inspect --format '{{ .Config.Image }}' $NAME)"
echo "Removing container $NAME"
docker rm $container_id;
done
@ -39,6 +44,35 @@ if [ "$(docker volume ls | grep \docker_in_docker${NAME}$)" ]; then
sudo docker volume rm docker_in_docker$NAME;
fi
if [ $REMOVE_CONTAINER == 1 ]; then
if [ $CONTAINER_IMAGE ]; then
echo
echo "----"
read -p "Do you want to remove the image $CONTAINER_IMAGE (y/n)? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker image rm $CONTAINER_IMAGE --force
echo "Image $CONTAINER_IMAGE removed!"
fi
fi
if [ -d $HOME/$NAME ] ; then
echo
echo "----"
read -p "Do you want to remove all files from $HOME/$NAME (y/n)? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf $HOME/$NAME
fi
fi
echo "Container $NAME removed!"
exit 0
fi
echo "Using image $IMAGE"
for var in "$@"
do
if [ $var == "--update" ] ; then