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 ...
随机推荐
- 关于poi导出excel方式HSSFWorkbook(xls).XSSFWorkbook(xlsx).SXSSFWorkbook.csv的总结
1.HSSFWorkbook(xls) import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermo ...
- NSThread(II)
非线程安全 //初始化火车票数量.卖票窗口(非线程安全).并开始卖票 - (void)initTicketStatusNotSave { // 1. 设置剩余火车票为 50 self.ticketSu ...
- 孤立森林(Isolation Forest)
前言随着机器学习近年来的流行,尤其是深度学习的火热.机器学习算法在很多领域的应用越来越普遍.最近,我在一家广告公司做广告点击反作弊算法研究工作.想到了异常检测算法,并且上网调研发现有一个算法非常火爆, ...
- plsql注册-转
注册码:Product Code:4t46t6vydkvsxekkvf3fjnpzy5wbuhphqzserial Number:601769 password:xs374ca https://blo ...
- 【JavaScript 6连载】三、构造函数
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 系统批量运维管理器Fabric详解
系统批量运维管理器Fabric详解 Fabrici 是基于python现实的SSH命令行工具,简化了SSH的应用程序部署及系统管理任务,它提供了系统基础的操作组件,可以实现本地或远程shell命令,包 ...
- Hybrid App中原生页面 VS H5页面(分享)
本文部分转自 http://www.jianshu.com/p/00ff5664e000 现有3类主流APP,分别为:Web App.Hybrid App(混合模式移动应用,Hybrid有“混合的” ...
- STM32L476应用开发之六:电池SOC检测(转)
源: STM32L476应用开发之六:电池SOC检测
- P5241 序列(滚动数组+前缀和优化dp)
P5241 序列 挺神仙的一题 看看除了dp好像没什么其他办法了 想着怎么构个具体的图出来,然鹅不太现实. 于是我们想办法用几个参数来表示dp数组 加了几条边肯定要的吧,于是加个参数$i$表示已加了$ ...
- Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration di
alexander@alexander-virtual-machine:~$ sudo apt-get install -y httpdE: Could not get lock /var/lib/d ...