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数据可视化-seaborn
详细介绍可以看seaborn官方API和example galler. 1 set_style( ) set( ) set_style( )是用来设置主题的,Seaborn有五个预设好的主题: d ...
- Block 循环引用(上)
iOS的内存管理机制 Objective-C在iOS中不支持GC(垃圾回收)机制,而是采用的引用计数的方式管理内存. 引用计数:在引用计数中,每一个对象负责维护对象所有引用的计数值.当一个新的引用指向 ...
- QString 与 string转换
[1]QString 转换为string QString qString("好好学习天天向上"); std::string stdString = qString.toStdStr ...
- ajax评论
评论有好几种格式:有评论树.评论楼等的格式 发表评论注意事项: 1. 展示评论 1. 评论楼(Django模板语言渲染) 1. 从后端查询出所有的评论 2. 如果有父评论就展示父评论 2. 评论树 通 ...
- base_review
简述Python的字符串驻留机制. - 字符串驻留是一种仅保存一份相同且不可变字符串的方法. - 原理 - 系统维护interned字典,记录已被驻留的字符串对象. - 当字符串对象a需要驻留时,先在 ...
- python 将字节写入文本文件
想在文本模式打开的文件中写入原始的字节数据 将字节数据直接写入文件的缓冲区即可 >>> import sys >>> sys.stdout.write(b'Hell ...
- java中的神奇"this"
java中的神奇"this",神奇的原因事它能不用new就可以直接创造一个对象出来,后来研究发现,其实java的“this”使用时,也是"new"了一个当前的对 ...
- Linux基础命令---添加组groupadd、删除组groupdel
groupadd 指定群组名称来建立新的群组账号,需要时可以从系统中取得新的群组值. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUSE.Fedora. ...
- java 数组和集合
1.概念说明 区别:数组固定长度的,集合,数组的长度是可以变化的. List,继承Collection,可重复.有序的对象 Set,继承Collection,不可重复.无序的对象 Map,键值对,提供 ...
- [转载]Oracle ltrim() 函数用法
前面有说到过LPAD和RPAD这两个函数用法的文章,今天发现与之相反意义的另外两个函数,那就是LTRIM() RTRIM(). 这次就挑LTRIM() 这一函数来讲讲: 具体的语法格式如下: LTRI ...