我同时有两个用于run
php
服务的 cronjob。
只有一个run
命令正确执行
Cannot create container for service php: Conflict. The container name "/folder_php_run_1" is already in use by container {hashhere}. You have to remove (or rename) that container to be able to reuse that name.
Command exited with non-zero status 1
这可能意味着容器是在我们检查可用性和我们实际发出create
命令之间创建的。 一个解决方案是在稍微不同的时间运行这两个作业(5 秒的间隔可能就足够了)
我通过在不同的 tmux 选项卡中docker-compose up baz bar
编程方式运行docker-compose up foo bar
& docker-compose up baz bar
也遇到了这个问题。 似乎如果创建失败,它应该重新运行检查并尝试(等待和)附加。
非常简单的复制案例:
➤ cat docker-compose.yml
version: "2.2"
services:
test:
image: alpine
➤ docker-compose run --rm test true
Creating network "test_default" with the default driver
➤ docker-compose run --rm test docker-compose run --rm test true &; docker-compose run --rm test true
ERROR: Cannot create container for service test: Conflict. The container name "/test_test_run_1" is already in use by container "76db8705667961966468d66d0667417862ad6edb3fb4c09b95a8ebab4ec36bf8". You have to remove (or rename) that container to be able to reuse that name.
Job 4, 'docker-compose run --rm test do…' has ended
就我而言,问题是 CI 根据其内部计划触发并行作业。 这是非常可悲的有破解该计划正因为如此。