How to stop container and delete images in github actions script before docker builds?

I have this script in my github actions
- name: Build docker image
run: |-
docker build -t "api:latest" .
- name: Deploy docker image
run: |-
docker run --name api -d -p 5000:5000
- name: Build docker image
run: |-
docker build -t "api:latest" .
- name: Deploy docker image
run: |-
docker run --name api -d -p 5000:5000
But if i don't manually stop container and delete images it's not actually stopping them or clearing old stuff. how can I work around this?
1 Reply
Nikita
Nikita11mo ago
is this question acutall?
Want results from more Discord servers?
Add your server