在使用docker啟動(dòng)命令時(shí),有時(shí)會(huì)發(fā)現(xiàn)啟動(dòng)失敗,下面介紹一些可能的原因。
1. 端口被占用
ERROR: for container_name Cannot start service container_name: driver failed programming external connectivity on endpoint container_name (port): Error starting userland proxy: listen tcp 0.0.0.0:port: bind: address already in use
如果在啟動(dòng)容器時(shí)指定了端口,容器啟動(dòng)時(shí)會(huì)檢查該端口是否被其它進(jìn)程占用,如果是,則會(huì)啟動(dòng)失敗。
2. 磁盤空間不足
no space left on device
在 docker 啟動(dòng)容器時(shí),如果磁盤空間不足,會(huì)導(dǎo)致容器啟動(dòng)失敗。
3. 容器的名字重復(fù)
docker: Error response from daemon: Conflict. The container name "/container_name" is already in use by container "container_id". You have to remove (or rename) that container to be able to reuse that name..
如果您嘗試啟動(dòng)一個(gè)與現(xiàn)有容器名稱相同的容器,則啟動(dòng)容器將失敗。
4. 系統(tǒng)資源不足
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request: unknown.\\"\n\"": unknown.
如果 Docker 容器需要大量的 CPU、內(nèi)存或空間資源,但它們被占用或不足,Docker 容器將無法啟動(dòng)。
5. Docker服務(wù)未啟動(dòng)
Couldn't connect to Docker daemon at http+docker://localhost - is it running?
如果您在啟動(dòng)容器之前尚未啟動(dòng) Docker 守護(hù)程序,則無法啟動(dòng) Docker 容器。