Docker 常见问题


    1. PS:0.0.0.0/0 表示信任所有非https地址的镜像仓库,对于内网测试,这样配置很方便。对于线上生产环境,
    2. 为了安全请不要这样配置
    1. touch /etc/docker/daemon.json
    2. {
    3. "storage-driver": "overlay"
    4. }
    5. EOF
    6. systemctl daemon-reload && systemctl restart docker

    编辑 文件,并设置:GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

    接着

    SUSE

    1. grub2-mkconfig -o /boot/grub2/grub.cfg
    1. Update grub

    Ubuntu

    启动容器的时候添加:

    1. -e http_proxy= -e https_proxy=

    1. --volume=/:/rootfs:ro \
    2. --volume=/var/run:/var/run:rw \
    3. --volume=/sys:/sys:ro \
    4. --volume=/var/lib/docker/:/var/lib/docker:ro \
    5. --publish=8080:8080 \
    6. --detach=true \
    7. --name=cadvisor \
    8. google/cadvisor:latest

    When you bind-mount /var/lib/docker/, this effectively mounts all resources of all other running containers as filesystems within the container which mounts . When you attempt to remove any of these containers, the removal attempt may fail with an error like the following:

    The problem occurs if the container which bind-mounts /var/lib/docker/ uses statfsor on filesystem handles within /var/lib/docker/ and does not close them.

    Typically, we would advise against bind-mounting /var/lib/docker in this way. However, cAdvisor requires this bind-mount for core functionality.