我在另一个文件夹上复制本地环境时遇到了这个问题。
ERROR: for php Cannot create container for service php: Conflict. The container name "/php" is already in use by container "". You have to remove (or rename) that container to be able to reuse that name.
我找到了两种解决方法:
Docker rm PHP
(这将删除我以前的容器)