tophee
(Christoph)
2020 年1 月 16 日 20:23
1
我在尝试通过 Web 界面更新 Docker 管理器时,Docker 安装出现了问题。我知道我的 Docker 安装已损坏,因为我按照sam 的建议 操作后得到了以下结果:
$ docker run -it --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f
Status: Downloaded newer image for hello-world:latest
docker: Error response from daemon: no status provided on response: unknown.
ERRO[0003] error waiting for container: context canceled
随后我发现了这个 GitHub 问题,似乎与我遇到的情况相符:
opened 08:30AM - 10 Oct 19 UTC
closed 10:01PM - 21 Oct 19 UTC
* [x] This is a bug report
* [ ] This is a feature request
* [ ] I searched ex… isting issues before opening this one
### Expected behavior
### Actual behavior
```
docker: Error response from daemon: no status provided on response: unknown.
ERRO[0000] error waiting for container: context canceled
```
### Steps to reproduce the behavior
```
sudo docker run --rm hello-world
```
**Output of `docker version`:**
```
Client: Docker Engine - Community
Version: 19.03.3
API version: 1.40
Go version: go1.12.10
Git commit: a872fc2
Built: Tue Oct 8 00:59:54 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.3
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: a872fc2
Built: Tue Oct 8 00:58:28 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.5
GitCommit: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
**Output of `docker info`:**
```
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
Server Version: 19.03.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-1046-gcp
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.853GiB
Name: dev-core
ID: ZVTZ:2OZX:VHFQ:OFY7:R7NR:RN32:SO2L:QHAX:5H5R:27FJ:5L2B:C5Z7
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
```
**Additional environment details (AWS, VirtualBox, physical, etc.)**
AWS
|Distributor ID:|Ubuntu|
|---|---|
|Description:|Ubuntu 16.04.6 LTS|
|Release:|16.04|
|Codename:|xenial|
由于我使用的是 Ubuntu 16.04,看起来这个解决方案 是可行的:
添加一个 deb 仓库:
sudo add-apt-repository 'deb http://security.ubuntu.com/ubuntu xenial-security main universe'
安装 runc(注意其中的 ~ 符号,GitHub 在 @vietthang207 的原始帖子中弄错了它们):
sudo apt-get install runc=1.0.0~rc7+git20190403.029124da-0ubuntu1~16.04.4
安装 runc 会导致 docker-ce 被卸载,因此需要重新安装它:
sudo apt-get install docker-ce
有人能确认这样做是否安全,或者会有什么后果吗?我有点担心这会卸载 Docker。我猜想这意味着我的网站在安装过程中会停机(奇怪的是,尽管 Docker 已损坏,但目前网站仍然正常运行)。但我的 Discourse 安装是否安全?我的容器会消失吗?
编辑:这是我目前敢尝试的操作:
$ sudo apt-get install runc=1.0.0~rc7+git20190403.029124da-0ubuntu1~16.04.4
[sudo] password for christoph:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
aufs-tools cgroupfs-mount docker-ce-cli libltdl7
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
containerd.io docker-ce
The following NEW packages will be installed:
runc
0 upgraded, 1 newly installed, 2 to remove and 21 not upgraded.
1 not fully installed or removed.
Need to get 1,890 kB of archives.
After this operation, 192 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
$
pfaffman
(Jay Pfaffman)
2020 年1 月 16 日 23:11
2
你重启过吗?我如果在升级后没有重启,Docker 就会出问题。
是的,听起来挺吓人的。我知道我在 16.04 上运行着一些站点,而且我并没有对 runc 做过任何操作。
如果你担心停机时间,并且使用的是 Digital Ocean,你可以考虑以下步骤:
创建一个运行 18.04 的新 Droplet,并进行干净安装。
获取一个浮动 IP,将其指向旧服务器,同时将 DNS 也指向该 IP。
将旧论坛设置为只读模式。
进行备份。
将备份恢复到新服务器。
将浮动 IP 重新指向新服务器。
这样就不会有停机时间,只会因为备份和恢复而短暂进入只读模式。你可以在正式执行只读操作之前练习几次。你也可以使用 rsync 同步上传文件,而不是将其包含在备份中,这样你只需要备份和恢复数据库。
不过,你可能还需要将现有的 Let’s Encrypt 证书迁移过来,否则我认为你需要重新生成这些证书。
tophee
(Christoph)
2020 年1 月 16 日 23:17
3
pfaffman:
你重启过吗?
我本来在考虑重启,但后来决定不做了。因为我觉得我的 Docker 安装似乎已经损坏,但论坛还能正常运行,如果重启服务器,可能会导致论坛也无法使用。这种可能性有多大?我应该尝试重启吗?
感谢你关于最小化停机时间的解释。不过,我并没有使用 DigitalOcean(DO)。而且只要停机时间不会持续数小时或数天,完全不是问题。
pfaffman
(Jay Pfaffman)
2020 年1 月 16 日 23:24
4
tophee:
我应该尝试重启吗?
如果你升级了 Docker,它仍然已安装,并且这个问题是在升级后出现的,那么我敢肯定重启能解决你的问题。注意: 免费的建议只值你付出的代价。
在重启之前请做好备份。最坏的情况下,有了备份和你的 app.yml,你可以在不到一小时内启动一台新服务器并重新开始(除非你有数十 GB 的数据,也许需要更久)。
我的方案很可能适用于多种托管服务。
如果你特别担心,可以在某个地方 启动一台新服务器,并将备份拉取过去,这样万一出现严重问题,你还有备用方案。
tophee
(Christoph)
2020 年1 月 16 日 23:52
5
pfaffman:
免费的建议
我非常感激。
pfaffman:
它值你付出的代价
实际上,我认为它的价值远超于此。但我理解你的意思。
准确来说:
我尝试 通过 Discourse 网页界面升级 Docker 管理器,但失败了(我在这里 发布了错误信息)
然后我尝试运行 . /launcher rebuild app,但也失败了,并引导我访问 Troubleshoot docker installation issues
随后我意识到我可能需要使用不同的命令,因为我有独立的数据容器和 web_only 容器,于是我尝试了 ./launcher bootstrap web_only,但得到了相同的错误。
我按照 Troubleshoot docker installation issues 的说明进行了操作。其余内容在原帖(OP)中。
我想我会在本周末有空时尝试重启,以便有时间修复可能出现的后续问题。因为:不,虽然我几年前曾设置过三个 Discourse 实例,但“启动新服务器并重新开始”可能会让我忙上一整天。仅将我的域名指向新的 IP 地址本身就可能是一场潜在的噩梦。或者也许不是,但若要确认这其实没什么大不了的,也需要花费一些时间……
pfaffman
(Jay Pfaffman)
2020 年1 月 17 日 00:07
6
好吧,既然我已经花费了数百个小时(比我前任提供的“手工安装”所花的时间多得多),如果你知道如何配置 DNS,我的安装方案 是完全自动化的,耗时不到一小时(大部分时间是 DNS 传播所需的时间)。