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 ...
随机推荐
- python中的作用域以及内置函数globals()-全局变量、locals()-局部变量
在python中,函数会创建一个自己的作用域,也称为为命名空间.这意味着在函数内部访问某个变量时,函数会优先在自己的命名空间中寻找. 通过内置函数globals()返回的是python解释器能知道的变 ...
- CentOS7 重启网卡Failed to start LSB: Bring up/down networking.解决方法
环境:MAC PD虚拟机安装centos7 修改完网卡配置,重启网络服务报错 使用提示命令查看:systemctl status network.service 发现报错为Failed to star ...
- linux grep 正则表达式
grep正则表达式元字符集: ^ 锚定行的开始 如:'^grep'匹配所有以grep开头的行. $ 锚定行的结束 如:'grep$'匹配所有以grep结尾的行. . 匹配一个非换行符的字符 如:'gr ...
- 全球最大的3D数据集公开了!标记好的10800张全景图
Middlebury数据集 http://vision.middlebury.edu/stereo/data/ KITTI数据集简介与使用 https://blog.csdn.net/solomon1 ...
- asyncio 中给running 的loop 动态添加 Future Task
https://my.oschina.net/backbye/blog/1919486 asyncio 提供了两个给运行中的事件循环(loop) 添加 事件的方法 call_soon_threadsa ...
- Java泛型中的标记符
E - Element (在集合中使用,因为集合中存放的是元素) T - Type(Java 类) K - Key(键) V - Value(值) N - Number(数值类型) ? - 表示不确 ...
- Java axis2.jar包详解及缺少jar包错误分析
Java axis2.jar包详解及缺少jar包错误分析 一.最小开发jar集 axis2 开发最小jar包集: activation-1.1.jar axiom-api-1.2.13.jar ax ...
- kafka学习指南(总结版)
版本介绍 从使用上来看,以0.9为分界线,0.9开始不再区分高级/低级消费者API. 从兼容性上来看,以0.8.x为分界线,0.8.x不兼容以前的版本. 总体拓扑架构 从上可知: 1.生产者不需要访问 ...
- SSL/TLS代理(termination proxy)
A TLS termination proxy (or SSL termination proxy) is a proxy server that is used by an institution ...
- 基础_cifar10_序贯
今天的基础研究主要是在cifar10数据集上解决一下几个问题: 1.从头开始,从最简单的序贯开始,尝试model的构造: 2.要将模型打印出来.最好是能够打印出图片,否则也要summary; 3.尝试 ...