================================ 配置不使用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 curl -X GET http://10.0.99.2:5000/v1/search?q=cen //帶上條件 cen
#列出某一倉庫的的所有內容 curl -X GET http://10.0.99.2:5000/v1/repositories/library/centos/tags #刪除某個標籤 curl -X DELETE http://10.0.99.2:5000/v1/repositories/library/centos7/tags/latest #刪除某個倉庫 curl -X DELETE http://10.0.99.2:5000/v1/repositories/library/centos7/ #---------------------------------------------------------------------------------------------#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