Docker Rest API配置及調用

來源:互聯網
上載者:User

預設情況下,Docker只允許通過unix socket通訊操作Docker daemon,但有時我們想通過HTTP調用其Rest API,需單獨配置啟動參數


為了使配置永久生效,在Ubuntu環境下修改其設定檔/etc/default/docker,加入DOCKER_OPTS="-H=unix:///var/run/docker.sock -H=0.0.0.0:6732",重啟Docker服務,可通過瀏覽器訪問設定主機:連接埠號碼(6372)/ Docker API操作Docker,後續會補充基於API如何做一個簡單的管理工具,先來一張雛形圖

# 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"DOCKER_OPTS="-H=unix:///var/run/docker.sock -H=0.0.0.0:6732"# 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"


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.