Docker坑系列

1. container无法删除

表现为一个运行中的容器,stop和kill没效果,查看/var/log/messages日志如下:

Mar 14 18:24:23 localhost dockerd: time="2017-03-14T18:24:23.005216354+08:00" level=warning msg="container kill failed because of 'container not found' or 'no such process': Cannot kill container 2d3fd2ca48a42a2e4c56cf08abfe120cdc9a07c50a02b025c5e651ad0f8adb3e: rpc error: code = 2 desc = containerd: container not found"
Mar 14 18:24:33 localhost dockerd: time="2017-03-14T18:24:33.005531933+08:00" level=info msg="Container 2d3fd2ca48a4 failed to exit within 10 seconds of kill - trying direct SIGKILL"

systemctl restart docker重启解决。

2. docker run报错

执行sudo docker run -dit --restart=unless-stopped -p 8080:8080 rancher/server时报错:

docker: Error response from daemon: mkdir /var/lib/docker/overlay/22ec70f56f655c703dbfa7731e7596f7adab16688e5f7e0f5f80631e1b6282c1-init/merged/dev/shm: invalid argument.
See 'docker run --help'.

看到这篇帖子, 应该是跟storage drivers有关,再参考官方文档, CentOS 推荐devicemapper

Docker坑系列_第1张图片
image.png

vi /etc/docker/daemon.json 添加如下内容:

{
  "storage-driver": "devicemapper"
}

重启docker即可。

3. sbt-native-packager push镜像报错

[0m[�[0minfo�[0m] �[0mStep 1/12 : FROM malfurionpd/docker-oracle-jdk�[0m
�[0m[�[0minfo�[0m] �[0m ---> 33548a8b86f1�[0m
�[0m[�[0minfo�[0m] �[0mStep 2/12 : MAINTAINER bmkp-dev�[0m
�[0m[�[0minfo�[0m] �[0m ---> Running in 3d2d26c181b2�[0m
�[0m[�[0minfo�[0m] �[0m ---> d4e855f088da�[0m
�[0m[�[0minfo�[0m] �[0mRemoving intermediate container 3d2d26c181b2�[0m
�[0m[�[0minfo�[0m] �[0mStep 3/12 : WORKDIR /opt/docker�[0m
�[0m[�[0minfo�[0m] �[0m ---> 90d6e06c2545�[0m
�[0m[�[0minfo�[0m] �[0mRemoving intermediate container cde622bef5e1�[0m
�[0m[�[0minfo�[0m] �[0mStep 4/12 : ADD opt /opt�[0m
�[0m[�[0minfo�[0m] �[0m ---> c215fa9a48fa�[0m
�[0m[�[0minfo�[0m] �[0mRemoving intermediate container 2ac0b4328d83�[0m
�[0m[�[0minfo�[0m] �[0mStep 5/12 : RUN chown -R daemon:daemon .�[0m
�[0m[�[0minfo�[0m] �[0m ---> Running in 0d52ec5c59d6�[0m
�[0m[�[0minfo�[0m] �[0mRemoving intermediate container 0d52ec5c59d6�[0m
�[0m[�[31merror�[0m] �[0mgrpc: the connection is unavailable�[0m
java.lang.RuntimeException: Nonzero exit value: 1
    at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:302)
    at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$19.apply(DockerPlugin.scala:118)
    at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$19.apply(DockerPlugin.scala:116)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
�[0m[�[31merror�[0m] �[0m(docker:�[31mpublishLocal�[0m) Nonzero exit value: 1�[0m
�[0m[�[31merror�[0m] �[0mTotal time: 8 s, completed Jun 15, 2017 10:50:15 AM�[0m

重启大法好!systemctl restart docker.service 搞定!

你可能感兴趣的:(Docker坑系列)