docker使用笔记,自用以供参考

================================
配置不使用https链接pull镜像(ubuntu:/etc/default/docker)
#--------------------------------------------vsersion 1----------------------------------------
# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4  --insecure-registry 10.0.0.0/16" #整个网段都可以不使用https

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
#----------------------------------vsersion 2----------------------------------------------------
# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
#配置自己默认地址
DOCKER_OPTS="$DOCKER_OPTS  --registry-mirror=http://b6056ba3.m.daocloud.io --dns 8.8.8.8 --dns 8.8.4.4 --insecure-registry 10.0.0.0/16"

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
=======================================
docker-registry api
​#查看所有仓库
curl -X GET  http://10.0.99.2:5000/v1/search?q=cen //带上条件 cen 
#列出某一仓库的的所有内容
#删除某个标签
#删除某个仓库
#---------------------------------------------------------------------------------------------
#docker-registry API
IP="http://10.0.99.2:5000"

if [ $1 == 'search'  ];then
curl -X GET  $IP/v1/search #搜索所有仓库
fi
if [ $1 == 'tag-list'  ];then
curl -X GET  $IP/v1/repositories/$2/tags #列出某一个仓库的所有标签和image-id
fi
if [ $1 == 'delete'  ];then
curl -X DELETE  $IP/v1/repositories/$2/ #删除某一个仓库
fi
if [ $1 == 'tag-del'  ];then
curl -X GET  $IP/v1/repositories/$2/tags/$3 #删除某一个标签,但是该镜像还在硬盘上 
fi
if [ $1 == 'tag-image-id'  ];then
curl -X GET  $IP/v1/repositories/$2/tags/$3 #取得某一镜像的image-id
fi

===========================================
#使用docker-registry
#启动docker-registry
docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v  /root/app/docker-images-db:/tmp/registry -p 5000:5000 registry

docker run -d --name registry -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /home/jamlee/app/docker-images-db:/tmp/registry -p 5000:5000 registry
#启动cadvisor
docker run --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro   --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8014:8080 --detach=true --name=cadvisor1 google/cadvisor:latest


===============================================================
#使用前端webui管理仓库
docker run \
  -d \
  -e ENV_DOCKER_REGISTRY_HOST=10.0.99.2 \
  -e ENV_DOCKER_REGISTRY_PORT=5000 \
  -p 8080:80 \
  konradkleine/docker-registry-frontend

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值