command results in:

Creating network "hlf_byfn" with the default driver
Creating peer1.org1.example.com ... 
Creating peer0.org2.example.com ... 
Creating peer1.org2.example.com ... 
Creating orderer.example.com ... 
Creating peer0.org1.example.com ... 
Creating peer0.org2.example.com
Creating peer1.org1.example.com
Creating peer1.org2.example.com
Creating orderer.example.com
Creating orderer.example.com ... error
ERROR: for orderer.example.com  Cannot create container for service orderer.example.com: Conflict. The container name "/orderer.example.com" is already in use by container "d6621116cf0d1ab108277893178ba29aCreating peer0.org1.example.com ... error
ERROR: for peer0.org1.example.com  Cannot create container for service peer0.org1.example.com: Conflict. The container name "/peer0.org1.example.com" is already in use by container "185c6449d163fa5593001b3Creating peer0.org2.example.com ... done
ERROR: for peer0.org1.example.com  Cannot create container for service peer0.org1.example.com: Conflict. The container name "/peer0.org1.example.com" is already in use by container "185c6449d163fa5593001b3bf9e052eee9ea365f89564a31fd84aac3c828bfbd". You have to remove (or rename) that container to be able to reuse that name.
ERROR: for orderer.example.com  Cannot create container for service orderer.example.com: Conflict. The container name "/orderer.example.com" is already in use by container "d6621116cf0d1ab108277893178ba29a05d4e50b36143d33fb6ec1dfc472eeb8". You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.

So orderer.example.com and peer0.org1.example.com could not be created. Output of docker ps :

CONTAINER ID        IMAGE                     COMMAND             CREATED              STATUS              PORTS                                              NAMES
543b2bf5df5c        hyperledger/fabric-peer   "peer node start"   About a minute ago   Up About a minute   0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1.org1.example.com
1c652a838c3b        hyperledger/fabric-peer   "peer node start"   About a minute ago   Up About a minute   0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer1.org2.example.com
65bdfcf71517        hyperledger/fabric-peer   "peer node start"   About a minute ago   Up About a minute   0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer0.org2.example.com

docker-compose.yaml:

# SPDX-License-Identifier: Apache-2.0 version: '2' networks: byfn: services: orderer.example.com: extends: file: base/docker-compose-base.yaml service: orderer.example.com container_name: orderer.example.com networks: - byfn peer0.org1.example.com: container_name: peer0.org1.example.com extends: file: base/docker-compose-base.yaml service: peer0.org1.example.com networks: - byfn peer1.org1.example.com: container_name: peer1.org1.example.com extends: file: base/docker-compose-base.yaml service: peer1.org1.example.com networks: - byfn peer0.org2.example.com: container_name: peer0.org2.example.com extends: file: base/docker-compose-base.yaml service: peer0.org2.example.com networks: - byfn peer1.org2.example.com: container_name: peer1.org2.example.com extends: file: base/docker-compose-base.yaml service: peer1.org2.example.com networks: - byfn container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_TLS_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer volumes: - /var/run/:/host/var/run/ - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artefacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artefacts depends_on: - orderer.example.com - peer0.org1.example.com - peer1.org1.example.com - peer0.org2.example.com - peer1.org2.example.com networks: - byfn

How can I determine, what went wrong, why the container name is in use already?

Based on the errors you provided:

ERROR: for orderer.example.com Cannot create container for service orderer.example.com: Conflict. The container name "/orderer.example.com" is already in use by container "d6621116cf0d1ab108277893178ba29aCreating peer0.org1.example.com ... error

ERROR: for peer0.org1.example.com Cannot create container for service peer0.org1.example.com: Conflict. The container name "/peer0.org1.example.com" is already in use by container "185c6449d163fa5593001b3Creating peer0.org2.example.com ... done

ERROR: for peer0.org1.example.com Cannot create container for service peer0.org1.example.com: Conflict. The container name "/peer0.org1.example.com" is already in use by container "185c6449d163fa5593001b3bf9e052eee9ea365f89564a31fd84aac3c828bfbd". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for orderer.example.com Cannot create container for service orderer.example.com: Conflict. The container name "/orderer.example.com" is already in use by container "d6621116cf0d1ab108277893178ba29a05d4e50b36143d33fb6ec1dfc472eeb8". You have to remove (or rename) that container to be able to reuse that name.

ERROR: Encountered errors while bringing up the project

I'd assume that you have stopped containers which was not removed/cleaned up from your previous executions/trials and therefore starting new containers with same names concludes to the errors above. Could you please try to run

docker ps -a

to check whenever you have containers with names: peer0.org1.example.compeer0.org1.example.com and etc...?

At any case you can try to run

docker ps -qa | xargs docker stop