标签:console 基本操作 tar str blog use ons start 技术
$ sudo yum remove docker \ # 移除旧版本
docker-common docker-selinux docker-engine
$ curl -sSL https://get.daocloud.io/docker | sh # 超时
$ sudo yum -y install docker-io
$ sudo chkconfig docker on
$ sudo docker version
Client:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-61.git85d7426.el7.centos.x86_64
Go version: go1.8.3
Git commit: 85d7426/1.12.6
Built: Tue Oct 24 15:40:21 2017
OS/Arch: linux/amd64
Server:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-61.git85d7426.el7.centos.x86_64
Go version: go1.8.3
Git commit: 85d7426/1.12.6
Built: Tue Oct 24 15:40:21 2017
OS/Arch: linux/amd64
https://cr.console.aliyun.com/?spm=5176.1972343.0.2.739d6968UdvRn2#/accelerator
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF‘
{
"registry-mirrors": ["https://xxx"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker pull hello-world # 下载
docker images # 查看
docker rmi image-id #删除
docker run --name container-name -d image-name # 运行镜像为容器
docker ps # 容器列表
docker start/stop container-name/container-id
docker logs container-name/container-id # 查看容器日志
docker rm container-id
docker pull redis # 获取redis镜像
docker run -d -p 6378:6379 --name port-redis redis # daemon方式运行,并且映射容器的6379端口到本机的6378端口
$ sudo docker login --username=fengshenjie@foxmail.com registry.cn-hangzhou.aliyuncs.com
# 默认为版本号为latest
$ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/lawlietfans/my-oracle-xe-11g:[镜像版本号]
$ sudo docker push registry.cn-hangzhou.aliyuncs.com/lawlietfans/my-oracle-xe-11g:[镜像版本号]
$ sudo docker tag f794779ccdb9 registry.cn-hangzhou.aliyuncs.com/lawlietfans/my-oracle-xe-11g:v20171130
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
wnameless/oracle-xe-11g latest f794779ccdb9 7 weeks ago 2.23GB
registry.cn-hangzhou.aliyuncs.com/lawlietfans/my-oracle-xe-11g v20171130 f794779ccdb9 7 weeks ago 2.23GB
$ sudo docker push registry.cn-hangzhou.aliyuncs.com/lawlietfans/my-oracle-xe-11g:v20171130
done
另一个例子:
标签:console 基本操作 tar str blog use ons start 技术
原文地址:http://www.cnblogs.com/lawlietfans/p/7955975.html