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 ...
随机推荐
- [openjudge-动态规划]买书
题目描述 描述 小明手里有n元钱全部用来买书,书的价格为10元,20元,50元,100元.问小明有多少种买书方案?(每种书可购买多本) 输入 一个整数 n,代表总共钱数.(0 <= n < ...
- NGINX的几个应用场景
NGINX的几个应用场景 两个参考地址: NGINX的百度百科:https://baike.baidu.com/item/nginx/3817705?fr=aladdin NGINX的中文网站:htt ...
- 20165215 预备作业3 Linux安装及学习
Linux安装 根据老师的链接,我VirtualBox下载的是5.2.6的版本,下载Ubuntu时使用老师的链接总是出现404 Not found的页面,于是我采用其它方式下载了16.04.3的版本 ...
- 初探AngularJs框架(一)
一.需要准备的环境 Nodejs:https://nodejs.org/en/download/ Python:https://www.python.org/downloads/release/pyt ...
- react+redux+react-router+node.js 开发实时聊天App 学习记录
一.课程导学 1.React 主要解决的是UI层的问题,应用的状态需要借助Redux等状态管理. 2.前端React + antd-mobile UI组件库 + Redux 状态管理库 + Rea ...
- rabbitMq 教程
https://github.com/401Studio/WeekLearn/issues/2 目录 RabbitMQ 概念 exchange交换机机制 什么是交换机 binding? Direct ...
- JustOj 1415: 字符串解压
题目描述 豆豆非常调皮,总喜欢把一样的东西摆在一起,然后用神奇的猫爪功把他们揉成一团. 比如一堆A,就会被揉成个数+A. 这就是豆豆的字符串压缩算法了. 比如给豆豆一个字符串:ABBCCCDDDDEE ...
- [转载]Oracle中的NVL函数
Oracle中函数以前介绍的字符串处理,日期函数,数学函数,以及转换函数等等,还有一类函数是通用函数.主要有:NVL,NVL2,NULLIF,COALESCE,这几个函数用在各个类型上都可以. 下面简 ...
- Python+OpenCV图像处理(三)—— Numpy数组操作图片
一.改变图片每个像素点每个通道的灰度值 (一) 代码如下: #遍历访问图片每个像素点,并修改相应的RGB import cv2 as cv def access_pixels(image): prin ...
- right spindle supply short to gnd
hardware guy found that the R1004 lead to this error, but this error should not be checked, because ...