Docker remote API

该教程基于Ubuntu或Debian环境,如果不是,请略过本文

Docker API

在Docker生态系统中一共有三种API

  • Registry API:提供了与来存储Docker镜像的Docker Registry集成的功能
  • Docker Hub API:提供了与Docker Hub集成的功能
  • Docker Remote API:提供与Docker守护进程进行集成的功能

其中, Docker Remote API是最常用的

启动Remote API

Remote API是由Docker守护进程提供的。因此我们在启动Docker守护进程时

,需要给Docker守护进程传递一个-H标志即可做到

  • Ubuntu或Debian系统: /etc/default/docker
  • 对于Red Hat、 Redora及相关发布版本 /etc/sysconfig/docker

在该配置文件中添加:

OPTIONS='-H=tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock'

重启Docker守护进程:

systemctl stop docker
systemctl start docker

现在我们可以从一台远程主机来访问Docker守护进程:

docker -H docker.example.com:2375 info

测试Docker Remote API

curl http://docker.example.com:2375/info

返回JSON结果

通过API来管理Docker镜像

curl http://docker.example.com:2375/images/json | python -mjson.tool

通过API来管理Docker容器

curl -s http://docker.example.com:2375/containers/json | python -mjson.tool

References:

Docker API详解

Docker remote API的更多相关文章

  1. Docker入门教程(八)Docker Remote API

    Docker入门教程(八)Docker Remote API [编者的话]DockerOne组织翻译了Flux7的Docker入门教程,本文是系列入门教程的第八篇,重点介绍了Docker Remote ...

  2. 【转+自己研究】新姿势之Docker Remote API未授权访问漏洞分析和利用

    0x00 概述 最近提交了一些关于 docker remote api 未授权访问导致代码泄露.获取服务器root权限的漏洞,造成的影响都比较严重,比如 新姿势之获取果壳全站代码和多台机器root权限 ...

  3. Docker remote API简单配置使用

    1.启动docker remote API的方式如下: docker -d -H uninx:///var/run/docker.sock -H tcp://0.0.0.0:5678 2.但是为了伴随 ...

  4. 关于docker remote api未授权访问漏洞的学习与研究

    漏洞介绍: 该未授权访问漏洞是因为docker remote api可以执行docker命令,从官方文档可以看出,该接口是目的是取代docker 命令界面,通过url操作docker. docker ...

  5. [Shell]Docker remote api未授权访问漏洞(Port=2375)

    0x01 简介 该未授权访问漏洞是因为docker remote api可以执行docker命令,从官方文档可以看出,该接口是目的是取代docker 命令界面,通过url操作docker. Docke ...

  6. docker remote api enable in ubuntu

    现在使用docker作为开发环境,操作系统是ubuntu16.10,pycharm中使用remote interpreter,需要用到remote api,结果发现自己的原答案是针对ubuntu 14 ...

  7. Docker Remote API v1.24

    1. Brief introduction The Remote API has replaced rcli. The daemon listens on unix:///var/run/docker ...

  8. docker remote api 的安全隐患

    开启docker的api,首先要知道docker的守护进程daemon,在下认为daemon作为Client和service连接的一个桥梁,负责代替将client的请求传递给service端. 默认情 ...

  9. Docker Remote API使用准备

    1 修改配置文件 CentOS: /etc/sysconfig/docker Ubuntu: /etc/init/docker.conf 1.添加: DOCKER_OPTS='-H tcp://0.0 ...

随机推荐

  1. ASP.NET Core快速入门(第3章:依赖注入)--学习笔记

    课程链接:http://video.jessetalk.cn/course/explore 良心课程,大家一起来学习哈! 任务16:介绍 1.依赖注入概念详解 从UML和软件建模来理解 从单元测试来理 ...

  2. 用openresty(Lua)写一个获取YouTube直播状态的接口

    文章原发布于:https://www.chenxublog.com/2019/08/29/openresty-get-youtube-live-api.html 之前在QQ机器人上面加了个虚拟主播开播 ...

  3. WPF中绘图(含调用GDI+)

    private void DrawStuff() { // //if (buffer == null) //{ // buffer = new RenderTargetBitmap((int)Back ...

  4. Python【day 11】闭包

    闭包 1.闭包的概念: 嵌套函数中,父级函数的变量,在子集函数中用到了(访问.修改.返回),那么这个变量就被保护起来了 只有自己可以修改,父级函数()()就是闭包函数 2.闭包的特点: 1.常驻内存 ...

  5. Freemarker简单封装

    Freemarker是曾经很流行的一个模板库,它是一种通用的模板库,不仅仅可以用来渲染html. 模板可以分为两类: 只能生成特殊类型文件的模板,如jinja.django.Thymeleaf.jad ...

  6. LeetCode——Duplicate Emails(使用group by以及having解决分组统计结果)

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  7. 去除数组空格 php

    public function trimArray($params){ if (!is_array($params)) return trim($params); return array_map([ ...

  8. tornado中的options常用姿势

    tornado是facebook开源的非阻塞web容器,类似java的netty,tornado.options是负责解析tornado容器的全局参数的,同时也能够解析命令行传递的参数和从配置文件中解 ...

  9. RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version

    /usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7 ...

  10. 如何用python编写一个计时器的程序

    python计时器的程序的代码和注释 import time as t #引入time模块 class MyTimer():     def __init__(self): #构造函数         ...