Docker Engine SDKs and API 的开发2
Examples using the Docker Engine SDKs and Docker API
After you install Docker, you can install the Go and Python SDKs and also try out the Docker Engine API.
Each of these examples show how to perform a given Docker operation using the Go and Python SDKs and the HTTP API using curl.
Run a container
This first example shows how to run a container using the Docker API. On the command line, you would use the docker run command, but this is just as easy to do from your own apps too.
This is the equivalent of typing docker run alpine echo hello world at the command prompt:
Run a container in the background
You can also run containers in the background, the equivalent of typing docker run -d bfirsh/reticulate-splines:
List and manage containers
You can use the API to list containers that are running, just like using docker ps:
Stop all running containers
Now that you know what containers exist, you can perform operations on them. This example stops all running containers.
Note: Don’t run this on a production server.
Also, if you are using swarm services, the containers stop, but Docker creates new ones to keep the service running in its configured state.
Print the logs of a specific container
You can also perform actions on individual containers. This example prints the logs of a container given its ID. You need to modify the code before running it to change the hard-coded ID of the container to print the logs for.
List all images
List the images on your Engine, similar to docker image ls:
Pull an image
Pull an image, like docker pull:
Pull an image with authentication
Pull an image, like docker pull, with authentication:
Note: Credentials are sent in the clear.
Docker’s official registries use HTTPS.
Private registries should also be configured to use HTTPS.
Commit a container
Commit a container to create an image from its contents:
Docker Engine SDKs and API 的开发2的更多相关文章
- Docker Engine SDKs and API 的开发1
Develop with Docker Engine SDKs and API Docker provides an API for interacting with the Docker daemo ...
- API接口开发 配置、实现、测试
Yii2 基于RESTful架构的 advanced版API接口开发 配置.实现.测试 环境配置: 开启服务器伪静态 本处以apache为例,查看apache的conf目录下httpd.conf,找到 ...
- Docker Machine 和 Docker Engine 的区别
Docker Engine 当人们提到 Docker,一般而言,大家说的是 Docker Engine,如下图: 它是一个 client-server application. Docker Eng ...
- Install Docker Engine on CentOS 在CentOS 7 上安装Docker
Install Docker Engine on CentOS OS Requirements 系统要求 To install Docker Engine,you need a maintained ...
- 在Ubuntu上安装Docker Engine
在Ubuntu上安装Docker Engine 这篇文章是介绍如何在在Ubuntu上安装Docker Engine,就是Google翻译官方文档的版本,英语好的直接官方原文.原文 要在Ubuntu上开 ...
- 启动docker报错Failed to listen on Docker Socket for the API.
1.启动时报错查看日志发现 # journalctl -xe Failed to listen on Docker Socket for the API. 查找socket这个配置文件,修改如下 # ...
- Google Map API V3开发(1)
Google Map API V3开发(1) Google Map API V3开发(2) Google Map API V3开发(3) Google Map API V3开发(4) Google M ...
- Google Map API V3开发(2)
Google Map API V3开发(1) Google Map API V3开发(2) Google Map API V3开发(3) Google Map API V3开发(4) Google M ...
- Google Map API V3开发(3)
Google Map API V3开发(1) Google Map API V3开发(2) Google Map API V3开发(3) Google Map API V3开发(4) Google M ...
随机推荐
- timestamp与timedelta,管理信息系统概念与基础
1.将字符串‘2017年10月9日星期一9时10分0秒 UTC+8:00’转换为timestamp. 2.100天前是几号? 今年还有多少天? #timestamp与timedelta from ...
- XML系列之--创建电文格式的XML(一)
关于XML,学校那会,老师在口中仅仅提及,自己也未曾深入接触过,仅是些将最基本XML文件内容显示在web定义的表格中之类的简单操作,如今项目中的收发电文涉及到复杂XML的操作.趁此契机好好回顾下XML ...
- mybatis源码解析1--前言
在开始分析mybatis源码之前,需要定一个目标,也就是我们不是为了读源码而去读,一定是带着问题去读,在读的时候去寻找到答案,然后再读码的同时整理总结,学习一些高级的编码方式和技巧. 首先我们知道my ...
- linux监控性能和网络的命令
vmstat查看机器实时的综合情况:load,内存,swap,cpu使用率等方面 procs: r:运行队列中进程数量 b:等待IO的进程数量 memory(内存): swpd:使用虚拟内存大小 fr ...
- 三角形垂点坐标js算法(三点定圆求圆心)
已知平面三点坐标A(x1, y1).B(x2, y2).C(x3, y3),三点定圆也就是三角形的中垂线交点, //平面三点定位算法 function locate(x1, y1, x2, y2, x ...
- python-数据分析与展示(Numpy、matplotlib、pandas)---1
笔记内容整理自mooc上北京理工大学嵩天老师python系列课程数据分析与展示,本人小白一枚,如有不对,多加指正 1.ndarray对象的属性 .ndim..shape..size(元素个数,不是占用 ...
- kali linux下 hachcat安装
网上关于hachcat的简单使用方法介绍很多,然而却很少有在kali linux上的安装教程,找了好长时间,终于安装成功了,特此将中间借鉴的内容记录如下: #首先安装p7z,用于解压下载的p7z包 # ...
- MyEclipse10.7安装Aptana后重启:An internal error has occurred. No more handles [Could not detect registered XULRunner to use]
问题描述: 当安装Aptana插件后重启MyEclipse10.7,发生错误: An internal error has occurred. No more handles [Could not d ...
- 双屏互动h5
情侣H5:https://www.25xt.com/allcode/10837.html 双屏互动:https://www.digitaling.com/articles/18180.html
- 最简单的uwsgi+nginx配置多个django站点
1. nginx.conf http{ server { listen 80; server_name www.web1.com ....... location / { uwsgi_p ...