当前位置:   article > 正文

使用Docker遇到的各种问题_docker镜像部署之后 invli host header

docker镜像部署之后 invli host header

目录

Docker镜像下载慢

如何在Docker容器中使用docker命令

Docker刚安装后执行docker ps -a报错(centos)

Dockerfile中用pip install命令一直retry,容器中pip确是可以下载的


Docker镜像下载慢

需要更改一下默认的下载地址

cd /etc/docker


配置镜像位置

  1. vim daemon.json
  2. {
  3.     "registry-mirrors":["https://almtd3fa.mirror.aliyuncs.com"]      
  4. }


重启docker

systemctl daemon-reload && systemctl restart docker

如何在Docker容器中使用docker命令

在启动docker容器的时候挂载以下两个目录

  1. -v /usr/bin/docker:/usr/bin/docker
  2. -v /var/run/docker.sock:/var/run/docker.sock

Docker刚安装后执行docker ps -a报错(centos)

通过yum install -y docker安装docker后,执行docker ps -a检查一下是否docker已运行。

  1. [root@localhost]# docker ps -a
  2. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

这个情况是没有运行docker导致的。。。所以启动一下docker就可以。

  1. [root@localhost]# docker ps -a
  2. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  3. [root@localhost]# systemctl start docker
  4. [root@localhost]# docker ps -a
  5. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  6. [root@localhost]# systemctl enable docker
  7. Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

Dockerfile中用pip install命令一直retry,容器中pip确是可以下载的

  1. root@lenovo-PC:/home/lenovo/project/docker/jupyter# docker-compose build
  2. Building jupyterlab
  3. Step 1/2 : FROM jupyter/base-notebook
  4. ---> a954c1f0a0b5
  5. Step 2/2 : RUN pip install jupyter-lsp && jupyter labextension install @krassowski/jupyterlab-lsp && pip install python-language-server[all]
  6. ---> Running in c39ac0a04176
  7. WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcf3a995eb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/jupyter-lsp/
  8. WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcf3a9b9100>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/jupyter-lsp/
  9. WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fcf3a9b92b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/jupyter-lsp/

可能是docker的dns问题,在daemon.json中增加dns后重启下docker

  1. vim /etc/docker/daemon.json
  2. {
  3.     "registry-mirrors":["https://almtd3fa.mirror.aliyuncs.com"],
  4. "dns": ["114.114.114.114", "8.8.8.8"]  
  5. }
  6. service docker restart

执行docker exec后 报错http: invalid Host header

在某OS的docker 18的版本上发生这样的错,手动更新docker至24.0.5版本后解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/170859
推荐阅读
相关标签
  

闽ICP备14008679号