docker使用筆記,自用以供參考

來源:互聯網
上載者:User
================================ 配置不使用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


=============================================================== #使用前端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
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.