使用docker一年多, 最深的感受就是方便。这种方便是颠覆性的, 举例来说, 自从用上docker, 我就再也没有在任何系统上安装过mysql并且我可以在半天甚至2小时内就搭建一个最新版的gitlab。
不过笔者现在仅仅停留在使用docker的层面, 如果要更好地,在生产环境中使用docker,还需要学习更多docker底层的内容。
    Docker
    
在centos安装最新版Docker CE版本
       说明 上一篇docker的文章是以前在centos安装docker的方法, 现在使用这种方法只能安装docker ce 17.05版本。最新的安装方法参见官方文档,目前版本为17.12.0
Step $ sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 $ sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo $ sudo yum install docker-ce $ sudo systemctl start docker  
    
  
    Docker
    
Install docker on CentOS7
       Install docker on CentOS7 Update  经过验证,用这种方法只能安装 docker 17.05.0-ce 版本,查看官方文档后,发现他的安装说明也更新了,参照新版安装说明。 小版本更新只需要执行 yum install docker-engine 就可以了。如:从17.03更新到17.05。经测试,从17.03升级到17.05后只需要重启container就可以了,并不会对原有的镜像及容器造成影响。  Required  os: x64 kernel: 3.10+
$ uname -r
  Step $ yum makecache $ yum update $ tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF $ yum install docker-engine $ systemctl enable docker.service $ systemctl start docker  换docker源 使用配置文件/etc/docker/daemon.json,需要docker版本1.10以上
{ "registry-mirrors": ["<your accelerate address>"] }  常用命令 # 使用root打开docker bash docker exec -u 0 -it container_name bash # 从container复制文件到host docker cp <containerId>:/file/path/within/container /host/path/target # 从host复制文件到container docker cp /host/path/target <containerId>:/file/path/within/container # remove Exited container docker ps -a | grep Exited | awk '{print $1}' | xargs docker rm # remove images that without name or tag docker images | grep none | awk '{print $3}' | xargs docker rmi