Error starting userland proxy: listen tcp4 0.0.0.0:50028: bind: address already in use

If it is really just about conflicts related to compose project down and up, you can make your script wait until the project resources are actually removed:

docker compose --project-name ${PROJECT_NAME} --file compose.yml down
resource_types="container network"
for type in ${resource_types}; do
  until [ -z "$(docker $type ls --filter label=com.docker.compose.project=${PROJECT_NAME})" ]; do
    sleep 1
  done
done

If you want the volumes to be deleted as well, add the -v argument after down and add volume to the resource_types

1 Like