N4si / DevSecOps-Project

DevSecOps Project to setup Netflix clone on AWS using CICD, Security, Monitoring and GitOps
343 stars 1.65k forks source link

Fix Docker naming conflict issue in pipeline by stopping and removing existing containers #8

Closed UjjwalBudha closed 9 months ago

UjjwalBudha commented 9 months ago

When running the pipeline for the second time, a Docker error occurs due to a naming conflict with the container "netflix". The error message indicates that the container name "/netflix" is already in use by another container ("d69b14da489e315b0978df51a5ec0b767b91502d513183ff7ee9ed0c67c2be40"). This conflict prevents the pipeline from proceeding until the existing container is removed or renamed.

Error Message: docker: Error response from daemon: Conflict. The container name "/netflix" is already in use by container "d69b14da489e315b0978df51a5ec0b767b91502d513183ff7ee9ed0c67c2be40". You have to remove (or rename) that container to be able to reuse that name.

Solution:

To resolve this issue, the pipeline needs to include a step to stop and remove any existing containers with the name "netflix" before attempting to create a new one. This ensures that the container name is available for reuse without conflicts.