The containers are getting recreated to preserve any data volumes that might be used.
If you’re doing CI, you don’t need this.
Hence just removing everything might solve the problem
docker-compose rm -f
docker-compose up --build -d
# Run some tests
docker-compose stop -t 1