docker使用问题

在deepin linux操作系统中安装docker-engine后启动失败。

Version: 1.12.3
API version: 1.24
Go version: go1.6.3

错误1:

使用docker ps命令报错:Cannot connect to the Docker daemon. Is the docker daemon running on this host?

使用sudo dockerd报错

WARN[0000] devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem will be ignored.
INFO[0000] [graphdriver] using prior storage driver "devicemapper"
FATA[0001] Error starting daemon: timeout

ps查看进程dockerd已启动

重复使用systemctl stop/start docker 问题依然

systemctl stop docker 后,使用sudo dockerd启动无异常报错,怀疑是docker命令找不到sock,sock文件/var/run/docker.sock 权限是srw-rw----

当前用户没有权限访问,默认情况下,docker会监听 unix:///var/run/docker.sock,只允许本地的root用户连接

解决办法:

1. 将当前用户添加到docker启动组内,执行 usermod -aG docker $USER  ,但root启动无效

2. root启动,有sudo权限那就 使用 sudo docker ps即可


3. 修改docker启动配置,使用TCP监听 修改/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd -H fd://  修改为 /usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
重启docker
导入变量export DOCKER_HOST=tcp://localhost:2375

 

错误2:

docker run -d

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:53: mounting \\\\\\\"cgroup\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/devicemapper/mnt/dee9d3d23be58840c31b001018f5243c62686a23a28afc009e6029747ef0a955/rootfs\\\\\\\" at \\\\\\\"/sys/fs/cgroup\\\\\\\" caused \\\\\\\"no subsystem for mount\\\\\\\"\\\"\"\n".

解决:

opencontainers/runc#1175 mentions such solution:

Change GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub so that it looks like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet systemd.legacy_systemd_cgroup_controller=yes"

quiet is from default Debian grub install.

Then update grub and reboot:

sudo update-grub
sudo reboot

 

posted @ 2018-04-10 16:12  ivistn  阅读(1206)  评论(0编辑  收藏  举报