-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-stop-rm.sh
More file actions
23 lines (21 loc) · 1009 Bytes
/
docker-stop-rm.sh
File metadata and controls
23 lines (21 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
gql_container_name="graphql-server-example"
mongodb_container_name="mongodb"
# Stop and remove the GraphQL server container
if [ "$(docker container inspect -f '{{.State.Status}}' $gql_container_name)" == "running" ]; then
echo "Stopping the $gql_container_name container."
docker container stop $gql_container_name
fi
if [ "$(docker container inspect -f '{{.State.Status}}' $gql_container_name)" != "running" ]; then
echo "Removing the $gql_container_name container."
docker container rm $gql_container_name
fi
# Stop and remove the MongoDB container
if [ "$(docker container inspect -f '{{.State.Status}}' $mongodb_container_name)" == "running" ]; then
echo "Stopping the $mongodb_container_name container."
docker container stop $mongodb_container_name
fi
if [ "$(docker container inspect -f '{{.State.Status}}' $mongodb_container_name)" != "running" ]; then
echo "Removing the $mongodb_container_name container."
docker container rm $mongodb_container_name
fi