Skip to content
Snippets Groups Projects
Commit 03a3cb0a authored by DHOMBRES Stephanie's avatar DHOMBRES Stephanie
Browse files

Merge branch 'doc-update' into 'master'

Edit load_docker_images.sh

See merge request !6
parents 5666dd1f 8ef617c8
Branches master
No related tags found
1 merge request!6Edit load_docker_images.sh
......@@ -38,9 +38,9 @@ start_docker() {
echo "Starting Neo4j container..."
echo "--------------------------------------------------------------------------"
# Run Neo4j in detached mode (-d)
docker run -d --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data --name neo4j-container --rm --env NEO4J_AUTH=neo4j/secret_secret gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-docker-images:neo4j
docker run -d --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data --name neo4j --rm --env NEO4J_AUTH=neo4j/secret_secret gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-docker-images:neo4j
# Wait until the Neo4j container is running
wait_for_container "neo4j-container"
wait_for_container "neo4j"
echo "Neo4j container started at http://localhost:7474/browser/."
# Mosquitto service
......@@ -77,7 +77,6 @@ start_docker() {
wait_for_container "nanospace-front-end-container"
echo "Nanospace Front-end container started at http://localhost."
}
#========================================================================================================
......@@ -104,9 +103,11 @@ stop_docker() {
echo "Stopping Docker services..."
echo "--------------------------------------------------------------------------"
docker ps
# Stop the services only if they exist
stop_if_image_exists "neo4j"
stop_if_image_exists "eclipse-mosquitto"
stop_if_image_exists "gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-docker-images:neo4j"
stop_if_image_exists "gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-docker-images:eclipse-mosquitto"
stop_if_image_exists "gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-front-end"
stop_if_image_exists "gitlab-registry.isae-supaero.fr/nanostar/nanospace/nanospace-back-end"
......@@ -119,12 +120,14 @@ stop_docker() {
# Function to stop a container if the image exists
stop_if_image_exists() {
local container_name=$1
if [ "$(docker ps -q -f name=^/${container_name}$)" ]; then
echo "'${container_name}' is running. Stopping..."
docker stop "${container_name}"
container_id=$(docker ps -q -f ancestor=${container_name})
if [ -n "$container_id" ]; then
echo "${container_name} is running. Stopping..."
docker stop "${container_id}"
else
echo "'${container_name}' not running."
echo "${container_name} is not running."
fi
}
......@@ -190,4 +193,3 @@ case "$1" in
exit 1
;;
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment