diff --git a/services/webapp/code/rosetta/core_app/utils.py b/services/webapp/code/rosetta/core_app/utils.py
index 8f5e42d775171975a5d0d67e18476e67099c5066..4598a9a6411084b77268914f2cc2e15c156be926 100644
--- a/services/webapp/code/rosetta/core_app/utils.py
+++ b/services/webapp/code/rosetta/core_app/utils.py
@@ -789,7 +789,13 @@ def get_or_create_container_from_repository(user, repository_url, repository_tag
     # Set image registry, name and tag. Use "strip()" as sometimes the newline chars might jump in.
     registry = get_platform_registry()
     image_name = repository_name.lower().strip()
-    image_tag = repo2docker_image_name[-7:] # The last part of the image name generated by repo2docker is the git short hash
+    if repo2docker_image_name.endswith(':latest'):
+        # Not clear why sometimes this happens. maybe if an existent image gets reused?
+        image_name_for_tag = repo2docker_image_name.replace(':latest','')
+    else:
+        image_name_for_tag = repo2docker_image_name
+    
+    image_tag = image_name_for_tag[-7:] # The last part of the image name generated by repo2docker is the git short hash
 
     # Re-tag image taking into account that if we are using the proxy as registry we use localhost or it won't work
     if registry == 'proxy:5000':