我是Docker的新手,我试图在Docker上运行Selenium Grid测试。为此,我创建了一个docker撰写文件,并在下面的命令中执行
docker-compose -f docker-compose.yaml up一切正常,但几个小时后,我重新启动主机并再次执行上述命令。这一次我犯了错误。
ERROR: for selenium-hub Cannot create container for service selenium-hub: Conflict. The container name "/selenium-hub" is already in use by container "some-hash". You have to remove (or rename) that container to be able to reuse that name.我尝试了docker-compose -f docker-compose.yaml run selenium-hub,但是这个命令没有启动selenium节点。所以我的问题是-
在再次运行
每次我重新启动docker时,我都可以运行这个文件来一起启动所有容器??。
下面是我用的“码头工”
version: "3"
services:
selenium-hub:
image: selenium/hub:3.141.59-20200525
container_name: selenium-hub
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
firefox:
image: selenium/node-firefox:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
opera:
image: selenium/node-opera:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444发布于 2020-06-19 12:46:28
有可能的方法
docker system prune将清理缓存,删除挂起的中间容器,并删除未活跃运行的容器名称。必须使用此命令,carefullydocker container prune将只删除死区/停止容器,并释放由停靠器-组合向上或坞-组合运行的创建的一次性容器。
发布于 2020-06-19 13:48:56
只需使用docker-compose up命令启动已经创建的容器。
https://stackoverflow.com/questions/62470244
复制相似问题