Docker Rest(Remote) API
来源:互联网 发布:软件测试原则包括 编辑:程序博客网 时间:2024/06/13 13:48
本人是基于工作的需求,对docker稍微做了一些了解,如果不正确的地方,还请大家多多吐槽!!!
What happens when you run a container?
Either by using the docker
binary or via the API, the Docker client tells the Docker daemon to run a container.
$ docker run -i -t ubuntu /bin/bash
So what happens under the hood when we run this command?
In order, Docker Engine does the following:
- Pulls the
ubuntu
image: Docker Engine checks for the presence of theubuntu
image. If the image already exists, then Docker Engine uses it for the new container. If it doesn’t exist locally on the host, then Docker Engine pulls it from Docker Hub. - Creates a new container: Once Docker Engine has the image, it uses it to create a container.
- Allocates a filesystem and mounts a read-write layer: The container is created in the file system and a read-write layer is added to the image.
- Allocates a network / bridge interface: Creates a network interface that allows the Docker container to talk to the local host.
- Sets up an IP address: Finds and attaches an available IP address from a pool.
- Executes a process that you specify: Runs your application, and;
- Captures and provides application output: Connects and logs standard input, outputs and errors for you to see how your application is running.
You now have a running container! Now you can manage your container, interact with your application and then, when finished, stop and remove your container.
docker--run for windows
Because the Docker daemon uses Linux-specific kernel features, you can’t run Docker natively in Windows. Instead, you must use docker-machine
to create and attach to a Docker VM on your machine. This VM hosts Docker for you on your Windows system.
Run a Hello world
Let’s run a hello world container.
$ docker run ubuntu /bin/echo 'Hello world'Hello world
Run an interactive container
Let’s specify a new command to run in the container.
$ docker run -t -i ubuntu /bin/bashroot@af8bae53bdd3:/#
In this example:
docker run
runs a container.ubuntu
is the image you would like to run.-t
flag assigns a pseudo-tty or terminal inside the new container.-i
flag allows you to make an interactive connection by grabbing the standard in (STDIN
) of the container./bin/bash
launches a Bash shell inside our container.
Listing images on the host
Let’s start with listing the images you have locally on our host. You can do this using the docker images
command like so:
$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEubuntu 14.04 1d073211c498 3 days ago 187.9 MBbusybox latest 2c5ac3f849df 5 days ago 1.113 MBtraining/webapp latest 54bb4e8718e8 5 months ago
So when you run a container you refer to a tagged image like so:
$ docker run -t -i ubuntu:14.04 /bin/bash
If you want to new ImagesGetting a new image
So how do you get new images? Well Docker will automatically download any image you use that isn’t already present on the Docker host. But this can potentially add some time to the launch of a container. If you want to pre-load an image you can download it using the docker pull
command. Suppose you’d like to download thecentos or ubuntu
image.
$ docker pull centos (ubuntu)Pulling repository centosb7de3133ff98: Pulling dependent layers5cc9e91966f7: Pulling fs layer511136ea3c5a: Download completeef52fb1fe610: Download complete. . .Status: Downloaded newer image for centos
You can see that each layer of the image has been pulled down and now you can run a container from this image and you won’t have to wait to download the image.
$ docker run -t -i centos /bin/bashbash-4.1#
Pulling our image
You’ve identified a suitable image, training/sinatra
, and now you can download it using the docker pull
command.
$ docker pull training/sinatra
Updating and committing an image
To update an image you first need to create a container from the image you’d like to update.
$ docker run -t -i training/sinatra /bin/bashroot@0b2616b0e5a8:/
这次就分享到这里,未完待续......
- Docker Rest(Remote) API
- 8 Docker Remote API
- Docker Remote API
- docker remote api 调用
- Docker Remote API
- Docker Remote API 初步尝试
- Docker Remote api(一)
- Docker remote api 创建container
- Docker入门教程(八)Docker Remote API
- Docker Rest API使用入门
- Docker Remote Api未授权访问漏洞
- Docker Rest API配置及调用
- java 模拟terminal通过docker remote api连接docker容器
- [开源夏令营][四] Docker remote API 之 镜像篇
- [开源夏令营][五] Docker remote API 之 容器篇
- Docker Remote API未授权访问漏洞分析和利用
- Docker 1.12新功能探索(8):Remote Api 1.24
- Centos 7.2下开放Docker Remote API端口
- 编程成长日记——打印菱形图案
- 内存泄漏之thread浅析
- 编程成长日记——有意思的编程题(一)
- 编程成长日记——有意思的编程题(二)
- 编程成长日记——杨辉三角
- Docker Rest(Remote) API
- C++之浅谈类与对象
- AndroidStudio 依赖 ButterKnife 出现的空指针异常
- 数据结构之用栈实现逆波兰表达式
- iOS 环信集成方法之集成环信SDK
- DOCKER 容器CPU 配额控制
- Linux系统(X64)安装Oracle11g完整安装图文教程另附基本操作
- android关机流程-framework部分
- 第97课:Spark Streaming在线动态计算特定时间窗口下热门商品排名