Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker 小问题集中营 #98

Open
mattshma opened this issue Sep 25, 2017 · 5 comments
Open

docker 小问题集中营 #98

mattshma opened this issue Sep 25, 2017 · 5 comments
Labels

Comments

@mattshma
Copy link
Owner

mattshma commented Sep 25, 2017

  • etcdmain: member 4a77989596e4f4e2 has already been bootstrapped

使用 etcd --name xxx --initial-advertise-peer-urls ... --initial-cluster-state new 重启 etcd 报错:etcdmain: member 4a77989596e4f4e2 has already been bootstrapped

--initial-cluster-state new 改为--initial-cluster-state existing即可。

@mattshma
Copy link
Owner Author

mattshma commented Sep 25, 2017

  • docker: layers from manifest don't match image configuration
    报错原因应该是本地镜像与远程镜像冲突。执行各种删除缓存的命令和docker system prune -a后仍报该问题,无奈删除整个/var/lib/docker 目录,重启后该问题消失。

@mattshma mattshma reopened this Sep 25, 2017
@mattshma mattshma changed the title etcdmain: member 4a77989596e4f4e2 has already been bootstrapped docker 小问题集中营 Sep 25, 2017
@mattshma
Copy link
Owner Author

mattshma commented Sep 28, 2017

  • Docker build 设置网络代理:
    sudo docker build --build-arg HTTP_PROXY=http://IP:PORT - < Dockerfile。或
    sudo docker build --build-arg HTTPS_PROXY=http://IP:PORT - < Dockerfile

注意 HTTP_PROXY 与 HTTPS_PROXY 须为大写。

@mattshma
Copy link
Owner Author

mattshma commented Nov 6, 2017

Dockerfile 中 CMD 命令为:CMD ["sh", "-c", "start-notebook.sh --NotebookApp.password=$PASSWD", "--allow-root"],运行时报错--allow-root: 1: --allow-root: start-notebook.sh: Permission denied,查看start-notebook.sh 文件属性,没有 x 属性,添加 x 属性后重新 build,再次执行即可。

即确保 COPY 的可执行文件有 x 属性。

@mattshma
Copy link
Owner Author

mattshma commented Dec 15, 2017

  • No space left on device
    Docker build 时报错:No space left on device。通过 df -hdf -i 查看磁盘空间,容量是充足的。想到 Docker 对 image 有限制,执行命令如下:
$ sudo docker info |grep -i "device size"
 Base Device Size: 10.74GB

通过 sudo docker image 查看正在制作的镜像已达 9G,所以猜测问题应该是在这了。查看文档中关于 dm.basesize的描述,在 Docker 启动时添加参数:--storage-opt dm.basesize=15G,然后重启 docker 即可。

查看 basesize:

$ sudo docker info |grep -i "device size"
 Base Device Size: 16.11GB

再次 build ,成功。不过这样的话,使用该image的机器都得调整 basesize,还是比较麻烦的。所以尽量减小 image 尺寸。

@mattshma
Copy link
Owner Author

mattshma commented Feb 27, 2018

执行 docker logs CONTAINER_ID 时,报错如下:"logs" command is supported only for "json-file" and "journald" logging drivers (got: syslog),查看官网关于 log driver 的内容,知 json-file是默认日志服务,由于希望通过 k8s 查看 log,而 json-file 会产生大量日志,于是编辑 /etc/docker/daemon.json,修改日志服务:

{
  "log-driver": "journald"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant