Skip to content

Commit

Permalink
fix: container conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yourzinc committed Jan 16, 2024
1 parent bfdbb76 commit 41f34b2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/start_docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash
# start_docker.sh

cd /home/ec2-user/my-nginx-app

docker build -t my-nginx-image .

if docker ps -a | grep -q 'my-nginx-container'; then
echo "Container 'my-nginx-container' already exists. Stopping and removing it."
docker stop my-nginx-container
docker rm my-nginx-container
fi

docker run -d --name my-nginx-container -p 80:80 my-nginx-image

0 comments on commit 41f34b2

Please sign in to comment.