欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Docker 陷阱

最编程 2024-04-11 20:20:44
...

Docker Desktop for Windows 

一. 打开 docker 的 Settings 选项时一直显示 Loading

解决方案: 

  1. 关闭 docker 并停止进程;

  2. 导航到 C:\Users\Username\AppData\Roaming\Docker 目录并删除(或者重命名) settings.json 文件;

  3. 重启 docker,然后在 Settings->General 中取消 Automatically check for updates 选项的勾选.

 

. 执行 docker 的操作命令时出现 docker:  Error response from daemon: Get https://registry-1.docker.io/v2/... 的错误

原因: docker 的默认的镜像源是官方镜像,拉取速度过慢导致的。建议使用阿里云镜像,个人感觉速度是最快的。这需要先开通阿里云帐户,然后在 https://cr.console.aliyun.com/undefined/instances/mirrors 中查看你的专属加速器地址。

解决方案:对系统右下角托盘 docker 的鲸鱼图标点击右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Engine 后修改配置,如下图,然后点击 Apply & Restart 按钮.

 

 

Vagrant + Virtualbox

注意:不是所有 Virtualbox 的版本都能配合 Vagrant 使用 Centos7,6.1.x 版本是不支持的。

一. Could not retrieve mirrorlist http://mirrorlist.centos.org/xxx error

[root@localhost ~]# sudo yum install -y yum-utils \
>   device-mapper-persistent-data \
>   lvm2
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

 

原因分析:网卡出现问题,导致了无法连接网络

解决方案:

1. 查看本机网卡,命令:nmcli d

2. 查看网卡配置,命令:cd /etc/sysconfig/network-scripts

 

3. 按上图修改配置文件后保存退出(注意 value 是没有双引号的,我遇到的错误就是 value 值加了双引号导致的

4. 重启一下网络服务,命令:systemctl restart network