Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
docs(docker): 修改FAQ目录结构,解决因镜像源版本不匹配导致的git/g++安装失败问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Sep 26, 2019
1 parent 235a4c2 commit 73912de
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 50 deletions.
13 changes: 13 additions & 0 deletions docs/source/docker/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@



FAQ
=========================================

.. toctree::
:maxdepth: 2

faq/service启动docker失效
faq/docker build运行apt-get update失败
faq/安装git出错
faq/安装g++出错
Original file line number Diff line number Diff line change
@@ -1,52 +1,5 @@

# FAQ

## service启动docker失效

```
$ service docker start
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since 四 2019-09-19 16:16:09 CST; 6s ago
Docs: https://docs.docker.com
Process: 7950 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 7950 (code=exited, status=1/FAILURE)
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: Failed to start Docker Application Container Engine.
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: docker.service: Unit entered failed state.
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: docker.service: Failed with result 'exit-code'.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Service hold-off time over, scheduling restart.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: Stopped Docker Application Container Engine.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Start request repeated too quickly.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: Failed to start Docker Application Container Engine.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Unit entered failed state.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Failed with result 'start-limit-hit'.
```

我的问题是`/etc/docker/daemon.json`配置出错

```
$ cat /etc/docker/daemon.json
{
"mtu": 1450,
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"],
"dns": ["192.168.0.1", "8.8.8.8"]
}
```

去掉`dns`键值对后重新启动成功

```
$ sudo service docker start
$ ps aux | grep docker
root 8263 2.0 0.5 805596 82912 ? Ssl 16:19 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
zj 8468 0.0 0.0 15964 1016 pts/2 R+ 16:19 0:00 grep --color=auto docker
```

## docker build运行apt-get update失败
# docker build运行apt-get update失败

进入`ubuntu:18.04`容器,运行`apt-get update`失败

Expand Down
45 changes: 45 additions & 0 deletions docs/source/docker/faq/service启动docker失效.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# service启动docker失效

```
$ service docker start
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since 四 2019-09-19 16:16:09 CST; 6s ago
Docs: https://docs.docker.com
Process: 7950 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 7950 (code=exited, status=1/FAILURE)
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: Failed to start Docker Application Container Engine.
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: docker.service: Unit entered failed state.
9月 19 16:16:07 zj-ThinkPad-T470p systemd[1]: docker.service: Failed with result 'exit-code'.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Service hold-off time over, scheduling restart.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: Stopped Docker Application Container Engine.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Start request repeated too quickly.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: Failed to start Docker Application Container Engine.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Unit entered failed state.
9月 19 16:16:09 zj-ThinkPad-T470p systemd[1]: docker.service: Failed with result 'start-limit-hit'.
```

我的问题是`/etc/docker/daemon.json`配置出错

```
$ cat /etc/docker/daemon.json
{
"mtu": 1450,
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"],
"dns": ["192.168.0.1", "8.8.8.8"]
}
```

去掉`dns`键值对后重新启动成功

```
$ sudo service docker start
$ ps aux | grep docker
root 8263 2.0 0.5 805596 82912 ? Ssl 16:19 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
zj 8468 0.0 0.0 15964 1016 pts/2 R+ 16:19 0:00 grep --color=auto docker
```
37 changes: 37 additions & 0 deletions docs/source/docker/faq/安装g++出错.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# 安装g++出错

参考:

[Ubuntu18.04LTS安装g++错误以及解决方法](http://blog.sina.com.cn/s/blog_64bb0c990102yv3a.html)

[安装g++出现的问题解决了一部分,还有一些。求大神指教](https://forum.ubuntu.org.cn/viewtopic.php?t=465488)

使用`Docker`镜像`Ubuntu:18.04`,安装`g++`时出现错误

```
The following packages have unmet dependencies:
g++ : Depends: g++-5 (>= 5.3.1-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```

网上查询时发现可能是系统镜像源设置出错,我使用了`Ubuntu 16.04`的阿里镜像。在[Mirrors](https://opsx.alibaba.com/mirror)中找到`Ubuntu 18.04`的镜像源配置

```
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
```

重新配置后,成功安装`g++`
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

# git安装
# 安装git出错

最新发现:是因为`Ubuntu`镜像源出错,我在`18.04`上误用了`16.04``ali mirror`

## 问题

Expand Down
2 changes: 1 addition & 1 deletion docs/source/docker/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docker使用指南
advanced
gui

FAQ
faq

参考
******
Expand Down

0 comments on commit 73912de

Please sign in to comment.