Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6683684
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: LINUX

2016-01-24 21:45:05

# rpm -ivh ftp://ftp.muug.mb.ca/mirror/centos/7.2.1511/os/x86_64/Packages/PyYAML-3.10-11.el7.x86_64.rpm
# yum -y install docker docker-registry   OR    # yum -y install docker-engine docker-registry
# rpm -qa | grep docker
docker-engine-selinux-1.9.1-1.el7.centos.noarch
docker-registry-0.9.1-7.el7.x86_64
docker-engine-1.9.1-1.el7.centos.x86_64

# rm /etc/docker/key.json

# systemctl daemon-reload
# systemctl start docker.service
# systemctl enable docker.service
# systemctl disable docker.service

# docker version

# docker search centos

# docker pull centos
# docker run -i -t centos /bin/bash

--------------------------------
problem:
[root@localhost ~]# 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.
[root@localhost ~]# docker daemon
WARN[0000] Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section.
FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains other graphdrivers: overlay; Please cleanup or explicitly choose storage driver (-s )

resolve:
# rm /var/lib/docker/overlay/ -rf

--------------------------------
----------------------------------------------
uninstall docker:
----------------------------------------------
systemctl stop docker
systemctl disable docker
systemctl daemon-reload
yum -y remove docker*
rm -rf /etc/docker /var/lib/docker /var/run/docker
----------------------------------------------
core—pip  ——  refer to /opt/tools/network_simulators/core/core/daemon/core/service.py
----------------------------------------------
curl "" -o "get-pip.py"
python get-pip.py
pip --help
pip -V

++++++++++++++++++++++++++++++++++++++++++++

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
docker.io/centos    latest              60e65a8e4030        4 weeks ago         196.6 MB

# docker tag c8a648134623 docker.io/centos:core

# ls /var/lib/docker/
containers  devicemapper  graph  linkgraph.db  network  repositories-devicemapper  tmp  trust  volumes

# cat /var/lib/docker/repositories-devicemapper
{"Repositories":{"docker.io/centos":{"latest":"60e65a8e4030022260a4f84166814b2683e1cdfc9725a9c262e90ba9c5ae2332"},"hello-world":{"latest":"0a6ba66e537a53a5ea94f7c6a99c534c6adb12e3ed09326d4bf3b38f7c3ba4e7"}},"ConfirmDefPush":true}

++++++++++++++++++++++++++++++++++++++++++++
Where are docker images stored on the host machine?
++++++++++++++++++++++++++++++++++++++++++++
# docker info
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata

---------------------------------------------------------------
http://stackoverflow.com/questions/19234831/where-are-docker-images-stored-on-the-host-machine
---------------------------------------------------------------

The contents of the /var/lib/docker directory vary depending on the .

By default this will be aufs but can fall back to btrfs, devicemapper or vfs. In most places this will be aufs but the RedHats went with devicemapper.

You can manually set the storage driver with the -s or --storage-driver= option to the Docker daemon.

  • /var/lib/docker/{driver-name} will contain the driver specific storage for contents of the images.
  • /var/lib/docker/graph/ now only contains metadata about the image, in the json and layersize files.

In the case of aufs:

  • /var/lib/docker/aufs/diff/ has the file contents of the images.
  • /var/lib/docker/repositories-aufs is a JSON file containing local image information. This can be viewed with the command docker images.

In the case of devicemapper:

  • /var/lib/docker/devicemapper/devicemapper/data stores the images
  • /var/lib/docker/devicemapper/devicemapper/metadata the metadata
  • Note these files are thin provisioned "sparse" files so aren't as big as they seem.
++++++++++++++++++++++++++++++


--------------------------------
problem:
[root@localhost ~]# 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.
[root@localhost ~]# docker daemon
WARN[0000] Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section.
FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains other graphdrivers: overlay; Please cleanup or explicitly choose storage driver (-s )

resolve:
# rm /var/lib/docker/overlay/ -rf

--------------------------------
Docker not starting “ could not delete the default bridge network: network bridge has active endpoints”"

Run
sudo mv /var/lib/docker/network/files/ /tmp/dn-bak

to reset your networks. Then restart docker (sudo systemctl restart docker or sudo service docker restart depending on your OS). If everything works again you can delete the dn-bak directory.

--------------------------------

[root@localhost ~]# gedit /etc/sysconfig/docker
DOCKER_OPTS="--dns 8.8.8.8 --dns 75.75.75.76"
DOCKER_OPTS="--iptables=true --dns=10.20.100.1 --dns=8.8.8.8"

--------------------------------

On arch linux I needed
ip link set down docker0 instead of ifconfig docker0 down and
systemctl restart docker instead of service docker start.
To delete all images, I did
docker rmi $(docker images -q)

++++++++++++++++
docker tag c8a648134623 docker.io/centos:core

/etc/sysconfig/docker-storage这个配置文件
DOCKER_STORAGE_OPTIONS="--storage-opt dm.no_warn_on_loop_devices=true"
or
DOCKER_STORAGE_OPTIONS="-s overlay"

------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------
Description of problem:

`docker version`:

`docker info`:

`uname -a`:

Environment details (AWS, VirtualBox, physical, etc.):

How reproducible:

Steps to Reproduce:
1.
2.
3.

Actual Results:

Expected Results:

Additional info:
------------------------------------------------------------------------------------------------------



阅读(2093) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~