[Docker系列·8]Docker遠端介面
https://docs.docker.com/reference/api/docker_remote_api
tends to be REST
拓撲
Parallel Desktop網路配置
共享網路-預設介面卡
訪問拓撲
可以從虛擬機器、宿主機、同網路的其他主機訪問Docker提供的remote api
主要角色
角色 | IP | OS |
---|---|---|
宿主機 | 10.16.41.12 | Mac OS X Mavericks |
-虛擬機器 | 10.16.41.40 | Ubuntu 14.04.1; Linux 3.13.0-34 |
–Docker Daemon | 172.17.42.1 | Docker 1.2.0 |
其他主機 | 10.125.1.168 | RHEL5.7 |
別名
alias d="sudo /usr/local/bin/docker"
alias dd = "sudo /usr/local/bin/docker -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock -d &"
alias dc="sudo /usr/bin/docker -d -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock >> /dev/null 2>&1 &"
啟動服務
erichan@ubuntu14_04_1-pd:~/docker-tars$ sudo service docker stop
erichan@ubuntu14_04_1-pd:~/docker-tars$ dc
[1] 4116
erichan@ubuntu14_04_1-pd:~/docker-tars$ ps aux | grep docker
root 4116 0.0 0.2 71240 2184 pts/1 S 21:31 0:00 sudo /usr/bin/docker -d -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
root 4117 1.0 1.0 264368 10236 pts/1 Sl 21:31 0:00 /usr/bin/docker -d -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
erichan 4143 0.0 0.0 15940 952 pts/1 S+ 21:31 0:00 grep --color=auto docker
Docker Remote API
容器
List containers
curl -X GET http://10.16.41.40:4243/containers/json?all=1 --http1.1 | python -m json.tool
[
{
"Command": "/bin/sh -c /installer",
"Created": 1408780391,
"Id": "8ba64b90fdca0d46bfe837614b16bfb33b4b06d28b8cc38c464e3da719dfffe0",
"Image": "jpetazzo/nsenter:latest",
"Names": [
"/compassionate_feynman"
],
"Ports": [],
"Status": "Exited (0) 6 hours ago"
},
{
"Command": "/opt/sinopia/start.sh",
"Created": 1408780007,
"Id": "5b03fb519385209b08cc16c263f3819532b3defeb3b3bba952d2d654013bfec2",
"Image": "feuyeux/ubuntu-sinopia:latest",
"Names": [
"/sinopia"
],
"Ports": [
{
"PrivatePort": 22,
"Type": "tcp"
},
{
"IP": "0.0.0.0",
"PrivatePort": 4873,
"PublicPort": 4873,
"Type": "tcp"
},
{
"PrivatePort": 8080,
"Type": "tcp"
}
],
"Status": "Exited (-127) 5 hours ago"
}
]
Start/Stop a container
curl -X POST http://10.16.41.40:4243/containers/sinopia/start
curl -X POST http://10.16.41.40:4243/containers/sinopia/stop
curl -X POST http://10.16.41.40:4243/containers/sinopia/restart
curl -X POST http://10.16.41.40:4243/containers/sinopia/kill
curl -X POST http://10.16.41.40:4243/containers/sinopia/wait curl -X POST http://10.16.41.40:4243/containers/sinopia/pause
curl -X POST http://10.16.41.40:4243/containers/sinopia/unpause
Inspect a container
curl http://10.16.41.40:4243/containers/sinopia/json
Inspect changes on a container`s filesystem
curl http://10.16.41.40:4243/containers/sinopia/changes
Attach to a container 詳細
curl -X POST --http1.1 http://10.16.41.40:4243/containers/sinopia/attach?logs=1&stream=0&stdout=1
映象
List Images
GET /images/json
Create an image
POST /images/create
Inspect an image
GET /images/(name)/json
Get the history of an image
GET /images/(name)/history
Push an image on the registry
POST /images/(name)/push
Tag an image into a repository
POST /images/(name)/tag
Remove an image
DELETE /images/(name)
Search images
GET /images/search
其他
Build an image from Dockerfile via stdin
POST /build
Check auth configuration
POST /auth
Display system-wide information
GET /info
Show the docker version information
GET /version
Ping the docker server
GET /_ping
Create a new image from a container`s changes
POST /commit
Monitor Docker`s events
GET /events
Load a tarball with a set of images and tags into docker
POST /images/load
使用POSTMAN除錯
相關文章
- Docker Machine遠端部署docker主機環境DockerMac
- 操作遠端主機 docker 命令Docker
- Docker遠端連線設定Docker
- TLS加密遠端連線DockerTLS加密Docker
- idea 連線遠端 docker 並部署專案到 dockerIdeaDocker
- mysql8.x docker遠端訪問配置詳解硨磬MySqlDocker
- Windows遠端連線Docker服務WindowsDocker
- Docker 如何開啟遠端訪問Docker
- 使用Docker Context連線遠端節點DockerContext
- 使用遠端Docker進行整合測試Docker
- 【Docker】docker-compose檔案快速部署RustDesk遠端桌面平替TeamViewerDockerRustView
- [Docker 系列]docker 學習八,Docker 網路Docker
- Docker 系列 - 04 - 解疑 & Docker 指令Docker
- 【Docker 系列】docker 學習 三Docker
- [Docker 系列]docker 學習 三Docker
- Docker 容器基本操作[Docker 系列-2]Docker
- Docker 入門系列一:docker 命令Docker
- Docker:Docker搭建Jenkins並共用宿主機Docker部署服務(五)跨伺服器遠端部署後端微服務多模組DockerJenkins伺服器後端微服務
- Docker檢視遠端倉庫的標籤工具Docker
- docker hub 下載centos配置ssh遠端登陸DockerCentOS
- 如何打包Docker映象並推送到遠端倉庫Docker
- docker安裝mysql8.0.20並遠端連線DockerMySql
- 雲伺服器:如何遠端登入docker容器伺服器Docker
- Docker入門系列(二)--docker操作命令Docker
- 使用 Frp 和 Docker 通過遠端桌面和 SSH 來遠端控制 Windows(反向代理)FRPDockerWindows
- 【Docker 系列】docker 學習 二,Docker 的常用命令Docker
- [Docker 系列]docker 學習 二,Docker 的常用命令Docker
- Git 系列教程(8)- 遠端倉庫的使用Git
- docker 學習之一 裝MySQL 供遠端使用 LinuxDockerMySqlLinux
- IntelliJ IDEA引入了VsCode的Docker遠端除錯功能IntelliJIdeaVSCodeDocker除錯
- mysql8--dockerMySqlDocker
- Docker 入門及安裝[Docker 系列-1]Docker
- docker系列(二):映象Docker
- [Docker 系列]docker 學習十一,docker 總結和麵試題整理Docker
- K8S系列第三篇(Docker網路)K8SDocker
- 理解Docker(8):Docker 儲存之卷(Volume) (轉)Docker
- 由淺入深 docker 系列: (2) docker 構建Docker
- 由淺入深 docker 系列: (3) docker-composeDocker
- Docker 快速入門系列-Docker 在 MacOS 安裝DockerMac