我有一个在只读根分区上运行Ubuntu 16.04.6 LTS的Raspberry Pi 3。现在,我尝试启动docker守护程序。但是重新启动后会显示:
ubuntu@z11:~$ docker info
Client:
Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
当尝试重新启动docker守护程序时,我得到:
ubuntu@z11:~$ sudo systemctl daemon-reload
ubuntu@z11:~$ sudo systemctl restart docker
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 Thu 2016-02-11 17:28:26 CET; 14s ago
Docs: https://docs.docker.com
Process: 1620 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 1620 (code=exited, status=1/FAILURE)
Feb 11 17:28:24 z11 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Feb 11 17:28:24 z11 systemd[1]: Failed to start Docker Application Container Engine.
Feb 11 17:28:24 z11 systemd[1]: docker.service: Unit entered failed state.
Feb 11 17:28:24 z11 systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 11 17:28:26 z11 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Feb 11 17:28:26 z11 systemd[1]: Stopped Docker Application Container Engine.
Feb 11 17:28:26 z11 systemd[1]: docker.service: Start request repeated too quickly.
Feb 11 17:28:26 z11 systemd[1]: Failed to start Docker Application Container Engine.
Feb 11 17:28:26 z11 systemd[1]: docker.service: Unit entered failed state.
Feb 11 17:28:26 z11 systemd[1]: docker.service: Failed with result 'start-limit-hit'.
这是我的/ etc / fstab,具有一个只读的根分区和可读写的/ var / lib / docker:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat ro 0 0
/dev/mmcblk0p2 / ext4 noatime,ro 0 0
/dev/mmcblk0p3 none swap sw 0 0
/dev/mmcblk0p4 /var/lib/docker ext4 noatime,rw 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=50m 0 0
tmpfs /var/log/apache2 tmpfs defaults,noatime,size=10m 0 0
tmpfs /var/lib/sudo tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=30m 0 0
将根分区从ro
更改为rw
时,重新启动系统后docker运行良好。
如何让docker在保持根分区只读的情况下运行? Docker是否需要写入其他文件或目录?
答案 0 :(得分:1)
我想知道您的import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { DataTablesResponse } from '../datatables/datatables-response';
import { Person } from './person';
@Component({
selector: 'app-angular-way-server-side',
templateUrl: 'angular-way-server-side.component.html',
styleUrls: ['angular-way-server-side.component.css'],
})
export class AngularWayServerSideComponent implements OnInit {
dtOptions: DataTables.Settings = {};
persons: Person[];
constructor(private http: HttpClient) { }
ngOnInit(): void {
var that = this;
this.dtOptions = {
pagingType: 'full_numbers',
serverSide: true,
processing: true,
ajax: (dataTablesParameters: any, callback) => {
that.http
.post<DataTablesResponse>('/api/Persons', dataTablesParameters, {})
.subscribe(resp => {
that.persons = resp.data;
callback({
recordsTotal: resp.recordsTotal,
recordsFiltered: resp.recordsFiltered,
data: [],
});
});
},
columns: [
{ data: "id" },
{ data: "firstName" },
{ data: "lastName" },
],
};
}
}
结果如何?
我的情况与您的情况有些不同。 就我而言,在根覆盖的文件系统上运行docker daemon时遇到相同的问题。 希望我的解决方案也能对您或其他任何人有所帮助。
根据指导方针, http://docs.docker.jp/engine/userguide/storagedriver/selectadriver.html, docker不能在覆盖支持文件系统上运行。 但幸运的是,它可以在覆盖文件系统上方的tmpfs上运行。
这是我的环境:
- Ubuntu Server 19.10
- Raspberry PI 4B
- 使用overlayroot使根覆盖在只读文件系统上
我的解决方法是:
mount
在启动后(编辑的sudo mount -t tmpfs tmpfs /var/lib/docker
可能不适用于overlayroot)- 使用
/etc/fstab
重新启动docker
如果Step2失败,请等待几秒钟,然后重试(Step1似乎无法立即工作)。
我还发现,如果重复执行步骤1两次以上,则可以立即执行步骤2。抱歉,我无法解释原因。
答案 1 :(得分:0)
显然,/ run(又名/ var / run)将用于打开套接字文件。 Docker是一个系统守护程序,“ docker”命令只是将输入发送到套接字文件。基本上,您已经将/ var的某些子目录挂载为rw,但未将/ var / run挂载。
如果您希望将/ var / lib / docker安装在持久性存储上,那么重新配置docker.service可能也是一个更好的主意-可能要检查/ etc / sysconfig / docker并使其
DOCKER_OPTS="-g /data/docker"
答案 2 :(得分:0)
我需要添加这个
tmpfs /var/lib/docker tmpfs nosuid,nodev 0 0
tmpfs /var/lib/containerd tmpfs nosuid,nodev 0 0
到/ etc / fstab