Flux7 DevOps Blog

Docker Tutorial Series, Part 8: Docker Remote API

Jun 26, 2014 11:15:00 AM Flux7 Labs Docker, Docker Tutorials, Lowering Maintenance

Docker Remote API

In the last post, as part of our on-going Docker Tutorial Series, we discussed Docker Hub and Docker Registry API. In today’s post, let’s delve into Docker Remote API.

Docker Remote API

Docker Remote API is a REST API that replaces the remote command line interface -- rcli. For the purpose of this tutorial, we have used cURL which is a command line tool that handles url manipulations. It helps make requests, get and send data, and retrieve information.

List docker containers - Get the Docker container list using the following command:

GET /containers/json

list docker containers

 

Create a new container - A new container can be created using:

POST /containers/create

create docker container

Inspect Container- The command used to return low-level information about a container with the id is:

GET /containers/(id)/json

inspect docker container

Process List - To obtain the list of processes running inside a container, use:

GET /containers/(id)/top

list docker containers

Container Logs - Collect stdout and stderr logs from the container using:

GET /containers/(id)/logs

docker container logs

Export Container - Use the following command to export the contents of the container:

GET /containers/(id)/export

docker remote api

Start a container - Use Docker command:

POST /containers/(id)/start

docker commands

Stop a container - Use Docker command:

POST /containers/(id)/stop

docker commands

Restart a Container - Use Docker command:

POST /containers/(id)/restart

docker commands

Kill a container - Use Docker command:

POST /containers/(id)/kill

docker-kill-a-container

 

Now that we’ve taken you on the next leg of this Docker API journey, watch out for the continuation of this post to learn about Docker Remote API commands for Images. It’s all part of our on-going Docker Tutorial Series that you can find here every Thursday.

Get Started with AWS

Receive AWS tips, DevOps best practices, news analysis, commentary and more. Sign up for our IT Modernization blog here and set your topic and frequency preferences. Or, download our guide on getting started with AWS, establishing a secure AWS enterprise architecture with Flux7 Landing Zones. 

Get Started Guide

 

Other Tutorials in this series:


Part 1: An Introduction

Part 2: The 15 Commands

Part 3: Automation is the word using DockerFile

Part 4: Registry & Workflows

Part 5: Docker Security

Part 6: The Next 15 Commands

Part 7: Ultimate Guide for Docker APIs

Part 9: 10 Docker Remote API Commands for Images

Written by Flux7 Labs

Flux7 is the only Sherpa on the DevOps journey that assesses, designs, and teaches while implementing a holistic solution for its enterprise customers, thus giving its clients the skills needed to manage and expand on the technology moving forward. Not a reseller or an MSP, Flux7 recommendations are 100% focused on customer requirements and creating the most efficient infrastructure possible that automates operations, streamlines and enhances development, and supports specific business goals.

Subscribe Here!

Posts by Topic

see all

Recent Posts