在使用docker啟動命令時,有時會發現啟動失敗,下面介紹一些可能的原因。
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
如果在啟動容器時指定了端口,容器啟動時會檢查該端口是否被其它進程占用,如果是,則會啟動失敗。
2. 磁盤空間不足
no space left on device
在 docker 啟動容器時,如果磁盤空間不足,會導致容器啟動失敗。
3. 容器的名字重復
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..
如果您嘗試啟動一個與現有容器名稱相同的容器,則啟動容器將失敗。
4. 系統資源不足
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、內存或空間資源,但它們被占用或不足,Docker 容器將無法啟動。
5. Docker服務未啟動
Couldn't connect to Docker daemon at http+docker://localhost - is it running?
如果您在啟動容器之前尚未啟動 Docker 守護程序,則無法啟動 Docker 容器。