docker运行报错:Error response from daemon:Container {containerId} is not running

问题产生:

        已启动docker服务systemctl start docker.service,由于本地8080端口之前已经在使用忘记关闭了,在执行docker run -dit --privileged -p21:21 -p80:80 -p8080:8080 -p30000-30010:30000-30010 --name how2jtmall how2j/tmall:latest /usr/sbin/init试图启动容器后提示:Errror response from daemon:driver failed programming external connectivity on endpoint how2jtmall {containerId} : Error starting userland proxy: listen tcp 0.0.0.8080: bind: address already in use.

端口被占用,于是关闭TOMACAT再执行以上,又会报这个错:

        Error response from daemon: Conflict. The container name "/how2jtmall" is already in use by contanier {containerId}. You have to remove (or rename) that container to be able to reuse that name..

容器名称已被占用,如果此时执行:docker exec -it how2jtmall /bin/bash试图进入容器,又报错:

        Error response from daemon: Container {containerId}  is not running

容器还没运行,解决办法:

        运行容器就可以了:docker start how2jtmall,这是最简单的。

       也可以通过查看容器的ID启动它,执行docker ps -a,查看列表:

docker运行报错:Error response from daemon:Container {containerId} is not running_第1张图片

可以看到,列表有一个容器的ID已创建,现在执行:

        docker start 372d356ce094

docker运行报错:Error response from daemon:Container {containerId} is not running_第2张图片

再次查看状态,就不是Created状态而是Up状态了,查看8080端口,也能看到处于监听状态,问题解决。

参考:容器管理

 

 

你可能感兴趣的:(docker)