题外话先说docker安装,不要百度查到的安装几乎没有一气呵成的。各种问题各种答案。。。
docker虽然很新,但是官网的文档一点都不少认为比任何地方都全。
当然中国的墙总是这么牛逼,所以的把它趴了在看人。
docker run -d -p 80:4000 docs/docker.github.io #以docker的方式看官方文档。
百度上多数都说yum和apt直接安装docker的都行,也有说什么维护不维护的。个人用的是官网的的安装脚本
curl -fsSL https://get.docker.com/ | sh #官网太慢所以要常用一些加速器
使用阿里云安装脚本:curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
使用docloud安装docker脚本:curl -sSL https://get.daocloud.io/docker | sh
以上把墙给扒了看到docker的人了。
然后我们执行run -i -t hello-world或者pull的时候发现很慢。
还是的扒墙,配置加速器所谓的代理,此处为ubuntu16和centos7的配置方法:
$ sudo systemctl enable docker #启动服务
sudo vi /etc/systemd/system/multi-user.target.wants/docker.service #编辑这个文件加入代理的url
在文件中找到ExecStart=这一行,并且在其行尾添加上所需的配置。假设我们获得的加速器地址为https://jxus37ac.mirror.aliyuncs.com,那么可以这样配置:
ExecStart=/usr/bin/dockerd --registry-mirror=https://jxus37ac.mirror.aliyuncs.com
保存退出后,重新加载配置并启动服务:
sudo systemctl daemon-reload
sudo systemctl restart docker
确认一下配置是否已经生效:
sudo ps -ef | grep dockerd
如果配置成功,生效后就会在这里看到自己所配置的加速器。
chkconfig docker on #放到开机自动启动里方便,或者自己启动sudo service docker start
以上docker准备完事。
开始搭建环境:
从 docker hub或者docloud 下载docker镜像 docker-swift-onlyone 在本地运行:
sudo docker run -i -t morrisjobke/docker-swift-onlyone /bin/bash
ps ax
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing upload swift /etc/swift
swift -A http://127.0.0.1:49162/auth/v1.0 -U test:tester -K testing list test swift.txt
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing download swift /etc/swift
以上几条命令分别是swift启动后的查看上传下载命令。
启动脚本在路径:/usr/local/bin startmian.sh
swift路径:/etc/swift
log路径:/var/log
以上完成环境配置,很多知识可能会遗漏很多大概应该提供一个思路和部分的解决办法了。补充代理的url地址在docloud上有提示,登陆docloud就可以看到这个选项。