How to open bash from docker-compose?

I tried using docker-compose exec -d web sh, however I got this error:

e[31mERRORe[0m: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a hig
her value (current value: 60).

If I try using docker exec -it 054 bash, it works perfectly. Shouldn’t the first work too?