diff --git a/docs/sources/articles.md b/docs/sources/articles.md index da5a2d2..48654b0 100644 --- a/docs/sources/articles.md +++ b/docs/sources/articles.md @@ -1,8 +1,7 @@ -# Articles -## Contents: +# Articles -- [Docker Security](security/) -- [Create a Base Image](baseimages/) -- [Runtime Metrics](runmetrics/) +- [Docker Security](security/) +- [Create a Base Image](baseimages/) +- [Runtime Metrics](runmetrics/) diff --git a/docs/sources/articles/runmetrics.md b/docs/sources/articles/runmetrics.md index 1a832d1..2372282 100644 --- a/docs/sources/articles/runmetrics.md +++ b/docs/sources/articles/runmetrics.md @@ -56,7 +56,7 @@ ID or long ID of the container. If a container shows up as ae836c95b4c3 in `docker ps`, its long ID might be something like `ae836c95b4c3c9e9179e0e91015512da89fdec91612f63cebae57df9a5444c79`{.docutils .literal}. You can look it up with `docker inspect` -or `docker ps -notrunc`. +or `docker ps --no-trunc`. Putting everything together to look at the memory metrics for a Docker container, take a look at diff --git a/docs/sources/articles/security.md b/docs/sources/articles/security.md index 23d595f..13917f0 100644 --- a/docs/sources/articles/security.md +++ b/docs/sources/articles/security.md @@ -5,7 +5,7 @@ page_keywords: Docker, Docker documentation, security # Docker Security > *Adapted from* [Containers & Docker: How Secure are -> They?](blogsecurity) +> They?](http://blog.docker.io/2013/08/containers-docker-how-secure-are-they/) There are three major areas to consider when reviewing Docker security: @@ -255,4 +255,4 @@ with Docker, since everything is provided by the kernel anyway. For more context and especially for comparisons with VMs and other container systems, please also see the [original blog -post](blogsecurity). +post](http://blog.docker.io/2013/08/containers-docker-how-secure-are-they/). diff --git a/docs/sources/contributing.md b/docs/sources/contributing.md index b311d13..0a31cb2 100644 --- a/docs/sources/contributing.md +++ b/docs/sources/contributing.md @@ -1,7 +1,6 @@ -# Contributing -## Contents: +# Contributing -- [Contributing to Docker](contributing/) -- [Setting Up a Dev Environment](devenvironment/) +- [Contributing to Docker](contributing/) +- [Setting Up a Dev Environment](devenvironment/) diff --git a/docs/sources/contributing/devenvironment.md b/docs/sources/contributing/devenvironment.md index 3b77acf..76df680 100644 --- a/docs/sources/contributing/devenvironment.md +++ b/docs/sources/contributing/devenvironment.md @@ -10,7 +10,7 @@ used for all tests, builds and releases. The standard development environment defines all build dependencies: system libraries and binaries, go environment, go dependencies, etc. -## Install Docker +## Step 1: Install Docker Docker’s build environment itself is a Docker container, so the first step is to install Docker on your system. @@ -20,7 +20,7 @@ system](https://docs.docker.io/en/latest/installation/). Make sure you have a working, up-to-date docker installation, then continue to the next step. -## Install tools used for this tutorial +## Step 2: Install tools used for this tutorial Install `git`; honest, it’s very good. You can use other ways to get the Docker source, but they’re not anywhere near as @@ -30,7 +30,7 @@ Install `make`. This tutorial uses our base Makefile to kick off the docker containers in a repeatable and consistent way. Again, you can do it in other ways but you need to do more work. -## Check out the Source +## Step 3: Check out the Source git clone http://git@github.com/dotcloud/docker cd docker @@ -38,7 +38,7 @@ Again, you can do it in other ways but you need to do more work. To checkout a different revision just use `git checkout`{.docutils .literal} with the name of branch or revision number. -## Build the Environment +## Step 4: Build the Environment This following command will build a development environment using the Dockerfile in the current directory. Essentially, it will install all @@ -50,7 +50,7 @@ This command will take some time to complete when you first execute it. If the build is successful, congratulations! You have produced a clean build of docker, neatly encapsulated in a standard build environment. -## Build the Docker Binary +## Step 5: Build the Docker Binary To create the Docker binary, run this command: @@ -73,7 +73,7 @@ Note Its safer to run the tests below before swapping your hosts docker binary. -## Run the Tests +## Step 5: Run the Tests To execute the test cases, run this command: @@ -114,7 +114,7 @@ eg. > TESTFLAGS=’-run \^TestBuild\$’ make test -## Use Docker +## Step 6: Use Docker You can run an interactive session in the newly built container: @@ -122,7 +122,7 @@ You can run an interactive session in the newly built container: # type 'exit' or Ctrl-D to exit -## Build And View The Documentation +## Extra Step: Build and view the Documentation If you want to read the documentation from a local website, or are making changes to it, you can build the documentation and then serve it diff --git a/docs/sources/examples.md b/docs/sources/examples.md index 98b3d25..81ad1de 100644 --- a/docs/sources/examples.md +++ b/docs/sources/examples.md @@ -1,25 +1,23 @@ # Examples -## Introduction: - Here are some examples of how to use Docker to create running processes, starting from a very simple *Hello World* and progressing to more substantial services like those which you might find in production. -## Contents: - -- [Check your Docker install](hello_world/) -- [Hello World](hello_world/#hello-world) -- [Hello World Daemon](hello_world/#hello-world-daemon) -- [Node.js Web App](nodejs_web_app/) -- [Redis Service](running_redis_service/) -- [SSH Daemon Service](running_ssh_service/) -- [CouchDB Service](couchdb_data_volumes/) -- [PostgreSQL Service](postgresql_service/) -- [Building an Image with MongoDB](mongodb/) -- [Riak Service](running_riak_service/) -- [Using Supervisor with Docker](using_supervisord/) -- [Process Management with CFEngine](cfengine_process_management/) -- [Python Web App](python_web_app/) +- [Check your Docker install](hello_world/) +- [Hello World](hello_world/#hello-world) +- [Hello World Daemon](hello_world/#hello-world-daemon) +- [Node.js Web App](nodejs_web_app/) +- [Redis Service](running_redis_service/) +- [SSH Daemon Service](running_ssh_service/) +- [CouchDB Service](couchdb_data_volumes/) +- [PostgreSQL Service](postgresql_service/) +- [Building an Image with MongoDB](mongodb/) +- [Riak Service](running_riak_service/) +- [Using Supervisor with Docker](using_supervisord/) +- [Process Management with CFEngine](cfengine_process_management/) +- [Python Web App](python_web_app/) +- [Apt-Cacher-ng Service](apt-cacher-ng/) +- [Running Docker with https](https/) diff --git a/docs/sources/examples/couchdb_data_volumes.md b/docs/sources/examples/couchdb_data_volumes.md index c4d478e..9665bb0 100644 --- a/docs/sources/examples/couchdb_data_volumes.md +++ b/docs/sources/examples/couchdb_data_volumes.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo Here’s an example of using data volumes to share the same data between two CouchDB containers. This could be used for hot upgrades, testing diff --git a/docs/sources/examples/hello_world.md b/docs/sources/examples/hello_world.md index 8f2ae58..a9b0d7d 100644 --- a/docs/sources/examples/hello_world.md +++ b/docs/sources/examples/hello_world.md @@ -2,7 +2,7 @@ page_title: Hello world example page_description: A simple hello world example with Docker page_keywords: docker, example, hello world -# Check your Docker installation +# Check your Docker install This guide assumes you have a working installation of Docker. To check your Docker install, run the following command: @@ -18,7 +18,7 @@ privileges to access docker on your machine. Please refer to [*Installation*](../../installation/#installation-list) for installation instructions. -## Hello World +# Hello World Note @@ -27,6 +27,8 @@ Note install*](#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo This is the most basic example available for using Docker. @@ -59,7 +61,9 @@ standard out. See the example in action -## Hello World Daemon +* * * * * + +# Hello World Daemon Note @@ -68,6 +72,8 @@ Note install*](#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo And now for the most boring daemon ever written! @@ -77,7 +83,7 @@ continue to do this until we stop it. **Steps:** - CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done") + container_id=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done") We are going to run a simple hello world daemon in a new container made from the `ubuntu` image. @@ -89,31 +95,31 @@ from the `ubuntu` image. - **“while true; do echo hello world; sleep 1; done”** is the mini script we want to run, that will just print hello world once a second until we stop it. -- **\$CONTAINER\_ID** the output of the run command will return a +- **\$container\_id** the output of the run command will return a container id, we can use in future commands to see what is going on with this process. - sudo docker logs $CONTAINER_ID + sudo docker logs $container_id Check the logs make sure it is working correctly. - **“docker logs**” This will return the logs for a container -- **\$CONTAINER\_ID** The Id of the container we want the logs for. +- **\$container\_id** The Id of the container we want the logs for. - sudo docker attach -sig-proxy=false $CONTAINER_ID + sudo docker attach --sig-proxy=false $container_id Attach to the container to see the results in real-time. - **“docker attach**” This will allow us to attach to a background process to see what is going on. -- **“-sig-proxy=false”** Do not forward signals to the container; +- **“–sig-proxy=false”** Do not forward signals to the container; allows us to exit the attachment using Control-C without stopping the container. -- **\$CONTAINER\_ID** The Id of the container we want to attach too. +- **\$container\_id** The Id of the container we want to attach too. Exit from the container attachment by pressing Control-C. @@ -125,12 +131,12 @@ Check the process list to make sure it is running. - sudo docker stop $CONTAINER_ID + sudo docker stop $container_id Stop the container, since we don’t need it anymore. - **“docker stop”** This stops a container -- **\$CONTAINER\_ID** The Id of the container we want to stop. +- **\$container\_id** The Id of the container we want to stop. diff --git a/docs/sources/examples/mongodb.md b/docs/sources/examples/mongodb.md index 6612bf3..3708c18 100644 --- a/docs/sources/examples/mongodb.md +++ b/docs/sources/examples/mongodb.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo The goal of this example is to show how you can build your own Docker images with MongoDB pre-installed. We will do that by constructing a @@ -43,7 +45,7 @@ we’ll divert `/sbin/initctl` to # Hack for initctl not being available in Ubuntu RUN dpkg-divert --local --rename --add /sbin/initctl - RUN ln -s /bin/true /sbin/initctl + RUN ln -sf /bin/true /sbin/initctl Afterwards we’ll be able to update our apt repositories and install MongoDB @@ -75,10 +77,10 @@ Now you should be able to run `mongod` as a daemon and be able to connect on the local port! # Regular style - MONGO_ID=$(sudo docker run -d /mongodb) + MONGO_ID=$(sudo docker run -P -d /mongodb) # Lean and mean - MONGO_ID=$(sudo docker run -d /mongodb --noprealloc --smallfiles) + MONGO_ID=$(sudo docker run -P -d /mongodb --noprealloc --smallfiles) # Check the logs out sudo docker logs $MONGO_ID diff --git a/docs/sources/examples/nodejs_web_app.md b/docs/sources/examples/nodejs_web_app.md index 8d692d8..59e6c77 100644 --- a/docs/sources/examples/nodejs_web_app.md +++ b/docs/sources/examples/nodejs_web_app.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo The goal of this example is to show you how you can build your own Docker images from a parent image using a `Dockerfile`{.docutils @@ -82,7 +84,7 @@ CentOS, we’ll use the instructions from the [Node.js wiki](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#rhelcentosscientific-linux-6): # Enable EPEL for Node.js - RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm + RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # Install Node.js and npm RUN yum install -y npm diff --git a/docs/sources/examples/postgresql_service.md b/docs/sources/examples/postgresql_service.md index 211dcb2..b87d121 100644 --- a/docs/sources/examples/postgresql_service.md +++ b/docs/sources/examples/postgresql_service.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo ## Installing PostgreSQL on Docker @@ -34,7 +36,7 @@ suitably secure. # Add the PostgreSQL PGP key to verify their Debian packages. # It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc - RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 # Add PostgreSQL's repository. It contains the most recent stable release # of PostgreSQL, ``9.3``. @@ -85,7 +87,7 @@ Build an image from the Dockerfile assign it a name. And run the PostgreSQL server container (in the foreground): - $ sudo docker run -rm -P -name pg_test eg_postgresql + $ sudo docker run --rm -P --name pg_test eg_postgresql There are 2 ways to connect to the PostgreSQL server. We can use [*Link Containers*](../../use/working_with_links_names/#working-with-links-names), @@ -93,17 +95,17 @@ or we can access it from our host (or the network). Note -The `-rm` removes the container and its image when +The `--rm` removes the container and its image when the container exists successfully. ### Using container linking Containers can be linked to another container’s ports directly using -`-link remote_name:local_alias` in the client’s +`--link remote_name:local_alias` in the client’s `docker run`. This will set a number of environment variables that can then be used to connect: - $ sudo docker run -rm -t -i -link pg_test:pg eg_postgresql bash + $ sudo docker run --rm -t -i --link pg_test:pg eg_postgresql bash postgres@7ef98b1b7243:/$ psql -h $PG_PORT_5432_TCP_ADDR -p $PG_PORT_5432_TCP_PORT -d docker -U docker --password @@ -145,7 +147,7 @@ prompt, you can create a table and populate it. You can use the defined volumes to inspect the PostgreSQL log files and to backup your configuration and data: - docker run -rm --volumes-from pg_test -t -i busybox sh + docker run --rm --volumes-from pg_test -t -i busybox sh / # ls bin etc lib linuxrc mnt proc run sys usr diff --git a/docs/sources/examples/python_web_app.md b/docs/sources/examples/python_web_app.md index b5854a4..8c0d783 100644 --- a/docs/sources/examples/python_web_app.md +++ b/docs/sources/examples/python_web_app.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo While using Dockerfiles is the preferred way to create maintainable and repeatable images, its useful to know how you can try things out and @@ -52,7 +54,7 @@ the `$URL` variable. The container is given a name While this example is simple, you could run any number of interactive commands, try things out, and then exit when you’re done. - $ sudo docker run -i -t -name pybuilder_run shykes/pybuilder bash + $ sudo docker run -i -t --name pybuilder_run shykes/pybuilder bash $$ URL=http://github.com/shykes/helloflask/archive/master.tar.gz $$ /usr/local/bin/buildapp $URL diff --git a/docs/sources/examples/running_redis_service.md b/docs/sources/examples/running_redis_service.md index 81114e6..c0511a9 100644 --- a/docs/sources/examples/running_redis_service.md +++ b/docs/sources/examples/running_redis_service.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo Very simple, no frills, Redis service attached to a web application using a link. @@ -20,11 +22,11 @@ using a link. Firstly, we create a `Dockerfile` for our new Redis image. - FROM ubuntu:12.10 - RUN apt-get update - RUN apt-get -y install redis-server + FROM debian:jessie + RUN apt-get update && apt-get install -y redis-server EXPOSE 6379 ENTRYPOINT ["/usr/bin/redis-server"] + CMD ["--bind", "0.0.0.0"] Next we build an image from our `Dockerfile`. Replace `` with your own user name. @@ -48,7 +50,7 @@ database. ## Create your web application container Next we can create a container for our application. We’re going to use -the `-link` flag to create a link to the +the `--link` flag to create a link to the `redis` container we’ve just created with an alias of `db`. This will create a secure tunnel to the `redis` container and expose the Redis instance diff --git a/docs/sources/examples/running_riak_service.md b/docs/sources/examples/running_riak_service.md index e7171d8..c1b95e7 100644 --- a/docs/sources/examples/running_riak_service.md +++ b/docs/sources/examples/running_riak_service.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo The goal of this example is to show you how to build a Docker image with Riak pre-installed. @@ -85,7 +87,7 @@ Almost there. Next, we add a hack to get us by the lack of # Hack for initctl # See: https://github.com/dotcloud/docker/issues/1024 RUN dpkg-divert --local --rename --add /sbin/initctl - RUN ln -s /bin/true /sbin/initctl + RUN ln -sf /bin/true /sbin/initctl Then, we expose the Riak Protocol Buffers and HTTP interfaces, along with SSH: diff --git a/docs/sources/examples/running_ssh_service.md b/docs/sources/examples/running_ssh_service.md index 112b9fa..2a0acfa 100644 --- a/docs/sources/examples/running_ssh_service.md +++ b/docs/sources/examples/running_ssh_service.md @@ -4,12 +4,15 @@ page_keywords: docker, example, package installation, networking # SSH Daemon Service -> **Note:** -> - This example assumes you have Docker running in daemon mode. For -> more information please see [*Check your Docker -> install*](../hello_world/#running-examples). -> - **If you don’t like sudo** then see [*Giving non-root -> access*](../../installation/binaries/#dockergroup) +Note + +- This example assumes you have Docker running in daemon mode. For + more information please see [*Check your Docker + install*](../hello_world/#running-examples). +- **If you don’t like sudo** then see [*Giving non-root + access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo The following Dockerfile sets up an sshd service in a container that you can use to connect to and inspect other container’s volumes, or to get @@ -35,12 +38,12 @@ quick access to a test container. Build the image using: - $ sudo docker build -rm -t eg_sshd . + $ sudo docker build -t eg_sshd . Then run it. You can then use `docker port` to find out what host port the container’s port 22 is mapped to: - $ sudo docker run -d -P -name test_sshd eg_sshd + $ sudo docker run -d -P --name test_sshd eg_sshd $ sudo docker port test_sshd 22 0.0.0.0:49154 diff --git a/docs/sources/examples/using_supervisord.md b/docs/sources/examples/using_supervisord.md index d64b300..8d6e796 100644 --- a/docs/sources/examples/using_supervisord.md +++ b/docs/sources/examples/using_supervisord.md @@ -11,6 +11,8 @@ Note install*](../hello_world/#running-examples). - **If you don’t like sudo** then see [*Giving non-root access*](../../installation/binaries/#dockergroup) +- **If you’re using OS X or docker via TCP** then you shouldn’t use + sudo Traditionally a Docker container runs a single process when it is launched, for example an Apache daemon or a SSH server daemon. Often diff --git a/docs/sources/faq.md b/docs/sources/faq.md index 06da238..4977f73 100644 --- a/docs/sources/faq.md +++ b/docs/sources/faq.md @@ -1,122 +1,128 @@ +page_title: FAQ +page_description: Most frequently asked questions. +page_keywords: faq, questions, documentation, docker + # FAQ ## Most frequently asked questions. ### How much does Docker cost? -Docker is 100% free, it is open source, so you can use it without -paying. +> Docker is 100% free, it is open source, so you can use it without +> paying. ### What open source license are you using? -We are using the Apache License Version 2.0. -You can see it [here](https://github.com/dotcloud/docker/blob/master/LICENSE). +> We are using the Apache License Version 2.0, see it here: +> [https://github.com/dotcloud/docker/blob/master/LICENSE](https://github.com/dotcloud/docker/blob/master/LICENSE) ### Does Docker run on Mac OS X or Windows? -Not at this time, Docker currently only runs on Linux, but you can use -VirtualBox to run Docker in a virtual machine on your box, and get the -best of both worlds. Check out the [*Mac OSX*](../installation/mac/#macosx) and -[*Windows*](../installation/windows/#windows) installation guides. The -small Linux distribution *boot2docker* can be run inside virtual -machines on these two operating systems. +> Not at this time, Docker currently only runs on Linux, but you can use +> VirtualBox to run Docker in a virtual machine on your box, and get the +> best of both worlds. Check out the [*Mac OS +> X*](../installation/mac/#macosx) and [*Microsoft +> Windows*](../installation/windows/#windows) installation guides. The +> small Linux distribution boot2docker can be run inside virtual +> machines on these two operating systems. ### How do containers compare to virtual machines? -They are complementary. VMs are best used to allocate chunks of -hardware resources. Containers operate at the process level, which -makes them very lightweight and perfect as a unit of software -delivery. +> They are complementary. VMs are best used to allocate chunks of +> hardware resources. Containers operate at the process level, which +> makes them very lightweight and perfect as a unit of software +> delivery. ### What does Docker add to just plain LXC? -Docker is not a replacement for LXC. “LXC” refers to capabilities of -the Linux kernel (specifically namespaces and control groups) which -allow sandboxing processes from one another, and controlling their -resource allocations. On top of this low-level foundation of kernel -features, Docker offers a high-level tool with several powerful -functionalities: - - - **Portable deployment across machines:** - Docker defines a format for bundling an application and all - its dependencies into a single object which can be transferred - to any Docker-enabled machine, and executed there with the - guarantee that the execution environment exposed to the - application will be the same. LXC implements process - sandboxing, which is an important pre-requisite for portable - deployment, but that alone is not enough for portable - deployment. If you sent me a copy of your application - installed in a custom LXC configuration, it would almost - certainly not run on my machine the way it does on yours, - because it is tied to your machine’s specific configuration: - networking, storage, logging, distro, etc. Docker defines an - abstraction for these machine-specific settings, so that the - exact same Docker container can run - unchanged - on many - different machines, with many different configurations. - - - **Application-centric:** - Docker is optimized for the deployment of applications, as - opposed to machines. This is reflected in its API, user - interface, design philosophy and documentation. By contrast, - the `lxc` helper scripts focus on - containers as lightweight machines - basically servers that - boot faster and need less RAM. We think there’s more to - containers than just that. - - - **Automatic build:** - Docker includes [*a tool for developers to automatically - assemble a container from their source - code*](../reference/builder/#dockerbuilder), with full control - over application dependencies, build tools, packaging etc. - They are free to use - `make, maven, chef, puppet, salt,` Debian - packages, RPMs, source tarballs, or any combination of the - above, regardless of the configuration of the machines. - - - **Versioning:** - Docker includes git-like capabilities for tracking successive - versions of a container, inspecting the diff between versions, - committing new versions, rolling back etc. The history also - includes how a container was assembled and by whom, so you get - full traceability from the production server all the way back - to the upstream developer. Docker also implements incremental - uploads and downloads, similar to `git pull`{.docutils - .literal}, so new versions of a container can be transferred - by only sending diffs. - - - **Component re-use:** - Any container can be used as a [*“base - image”*](../terms/image/#base-image-def) to create more - specialized components. This can be done manually or as part - of an automated build. For example you can prepare the ideal - Python environment, and use it as a base for 10 different - applications. Your ideal Postgresql setup can be re-used for - all your future projects. And so on. - - - **Sharing:** - Docker has access to a [public registry](http://index.docker.io) - where thousands of people have uploaded useful containers: anything - from Redis, CouchDB, Postgres to IRC bouncers to Rails app servers to - Hadoop to base images for various Linux distros. The - [*registry*](../reference/api/registry_index_spec/#registryindexspec) - also includes an official “standard library” of useful - containers maintained by the Docker team. The registry itself - is open-source, so anyone can deploy their own registry to - store and transfer private containers, for internal server - deployments for example. - - - **Tool ecosystem:** - Docker defines an API for automating and customizing the - creation and deployment of containers. There are a huge number - of tools integrating with Docker to extend its capabilities. - PaaS-like deployment (Dokku, Deis, Flynn), multi-node - orchestration (Maestro, Salt, Mesos, Openstack Nova), - management dashboards (docker-ui, Openstack Horizon, - Shipyard), configuration management (Chef, Puppet), continuous - integration (Jenkins, Strider, Travis), etc. Docker is rapidly - establishing itself as the standard for container-based - tooling. - +> Docker is not a replacement for LXC. “LXC” refers to capabilities of +> the Linux kernel (specifically namespaces and control groups) which +> allow sandboxing processes from one another, and controlling their +> resource allocations. On top of this low-level foundation of kernel +> features, Docker offers a high-level tool with several powerful +> functionalities: +> +> - *Portable deployment across machines.* +> : Docker defines a format for bundling an application and all +> its dependencies into a single object which can be transferred +> to any Docker-enabled machine, and executed there with the +> guarantee that the execution environment exposed to the +> application will be the same. LXC implements process +> sandboxing, which is an important pre-requisite for portable +> deployment, but that alone is not enough for portable +> deployment. If you sent me a copy of your application +> installed in a custom LXC configuration, it would almost +> certainly not run on my machine the way it does on yours, +> because it is tied to your machine’s specific configuration: +> networking, storage, logging, distro, etc. Docker defines an +> abstraction for these machine-specific settings, so that the +> exact same Docker container can run - unchanged - on many +> different machines, with many different configurations. +> +> - *Application-centric.* +> : Docker is optimized for the deployment of applications, as +> opposed to machines. This is reflected in its API, user +> interface, design philosophy and documentation. By contrast, +> the `lxc` helper scripts focus on +> containers as lightweight machines - basically servers that +> boot faster and need less RAM. We think there’s more to +> containers than just that. +> +> - *Automatic build.* +> : Docker includes [*a tool for developers to automatically +> assemble a container from their source +> code*](../reference/builder/#dockerbuilder), with full control +> over application dependencies, build tools, packaging etc. +> They are free to use +> `make, maven, chef, puppet, salt,` Debian +> packages, RPMs, source tarballs, or any combination of the +> above, regardless of the configuration of the machines. +> +> - *Versioning.* +> : Docker includes git-like capabilities for tracking successive +> versions of a container, inspecting the diff between versions, +> committing new versions, rolling back etc. The history also +> includes how a container was assembled and by whom, so you get +> full traceability from the production server all the way back +> to the upstream developer. Docker also implements incremental +> uploads and downloads, similar to `git pull`{.docutils +> .literal}, so new versions of a container can be transferred +> by only sending diffs. +> +> - *Component re-use.* +> : Any container can be used as a [*“base +> image”*](../terms/image/#base-image-def) to create more +> specialized components. This can be done manually or as part +> of an automated build. For example you can prepare the ideal +> Python environment, and use it as a base for 10 different +> applications. Your ideal Postgresql setup can be re-used for +> all your future projects. And so on. +> +> - *Sharing.* +> : Docker has access to a [public +> registry](http://index.docker.io) where thousands of people +> have uploaded useful containers: anything from Redis, CouchDB, +> Postgres to IRC bouncers to Rails app servers to Hadoop to +> base images for various Linux distros. The +> [*registry*](../reference/api/registry_index_spec/#registryindexspec) +> also includes an official “standard library” of useful +> containers maintained by the Docker team. The registry itself +> is open-source, so anyone can deploy their own registry to +> store and transfer private containers, for internal server +> deployments for example. +> +> - *Tool ecosystem.* +> : Docker defines an API for automating and customizing the +> creation and deployment of containers. There are a huge number +> of tools integrating with Docker to extend its capabilities. +> PaaS-like deployment (Dokku, Deis, Flynn), multi-node +> orchestration (Maestro, Salt, Mesos, Openstack Nova), +> management dashboards (docker-ui, Openstack Horizon, +> Shipyard), configuration management (Chef, Puppet), continuous +> integration (Jenkins, Strider, Travis), etc. Docker is rapidly +> establishing itself as the standard for container-based +> tooling. +> ### What is different between a Docker container and a VM? There’s a great StackOverflow answer [showing the @@ -159,22 +165,22 @@ here](http://docs.docker.io/en/latest/examples/using_supervisord/). ### What platforms does Docker run on? -**Linux:** +Linux: -- Ubuntu 12.04, 13.04 et al -- Fedora 19/20+ -- RHEL 6.5+ -- Centos 6+ -- Gentoo -- ArchLinux -- openSUSE 12.3+ -- CRUX 3.0+ +- Ubuntu 12.04, 13.04 et al +- Fedora 19/20+ +- RHEL 6.5+ +- Centos 6+ +- Gentoo +- ArchLinux +- openSUSE 12.3+ +- CRUX 3.0+ -**Cloud:** +Cloud: -- Amazon EC2 -- Google Compute Engine -- Rackspace +- Amazon EC2 +- Google Compute Engine +- Rackspace ### How do I report a security issue with Docker? @@ -196,14 +202,17 @@ sources. ### Where can I find more answers? -You can find more answers on: - -- [Docker user mailinglist](https://groups.google.com/d/forum/docker-user) -- [Docker developer mailinglist](https://groups.google.com/d/forum/docker-dev) -- [IRC, docker on freenode](irc://chat.freenode.net#docker) -- [GitHub](http://www.github.com/dotcloud/docker) -- [Ask questions on Stackoverflow](http://stackoverflow.com/search?q=docker) -- [Join the conversation on Twitter](http://twitter.com/docker) +> You can find more answers on: +> +> - [Docker user +> mailinglist](https://groups.google.com/d/forum/docker-user) +> - [Docker developer +> mailinglist](https://groups.google.com/d/forum/docker-dev) +> - [IRC, docker on freenode](irc://chat.freenode.net#docker) +> - [GitHub](http://www.github.com/dotcloud/docker) +> - [Ask questions on +> Stackoverflow](http://stackoverflow.com/search?q=docker) +> - [Join the conversation on Twitter](http://twitter.com/docker) Looking for something else to read? Checkout the [*Hello World*](../examples/hello_world/#hello-world) example. diff --git a/docs/sources/genindex.md b/docs/sources/genindex.md index 8b013d6..e9bcd34 100644 --- a/docs/sources/genindex.md +++ b/docs/sources/genindex.md @@ -1 +1,2 @@ + # Index diff --git a/docs/sources/http-routingtable.md b/docs/sources/http-routingtable.md index 2a06fdb..4ca4116 100644 --- a/docs/sources/http-routingtable.md +++ b/docs/sources/http-routingtable.md @@ -1,3 +1,4 @@ + # HTTP Routing Table [**/api**](#cap-/api) | [**/auth**](#cap-/auth) | diff --git a/docs/sources/index.md b/docs/sources/index.md index c5a5b6f..dd9e272 100644 --- a/docs/sources/index.md +++ b/docs/sources/index.md @@ -1,3 +1 @@ -# Docker Documentation - -## Introduction \ No newline at end of file +# Docker documentation diff --git a/docs/sources/installation.md b/docs/sources/installation.md index 0ee7b2f..4fdd102 100644 --- a/docs/sources/installation.md +++ b/docs/sources/installation.md @@ -1,25 +1,26 @@ -# Installation -## Introduction +# Installation There are a number of ways to install Docker, depending on where you want to run the daemon. The [*Ubuntu*](ubuntulinux/#ubuntu-linux) installation is the officially-tested version. The community adds more techniques for installing Docker all the time. -## Contents: +Contents: + +- [Ubuntu](ubuntulinux/) +- [Red Hat Enterprise Linux](rhel/) +- [Fedora](fedora/) +- [Arch Linux](archlinux/) +- [CRUX Linux](cruxlinux/) +- [Gentoo](gentoolinux/) +- [openSUSE](openSUSE/) +- [FrugalWare](frugalware/) +- [Mac OS X](mac/) +- [Microsoft Windows](windows/) +- [Amazon EC2](amazon/) +- [Rackspace Cloud](rackspace/) +- [Google Cloud Platform](google/) +- [IBM SoftLayer](softlayer/) +- [Binaries](binaries/) -- [Ubuntu](ubuntulinux/) -- [Red Hat Enterprise Linux](rhel/) -- [Fedora](fedora/) -- [Arch Linux](archlinux/) -- [CRUX Linux](cruxlinux/) -- [Gentoo](gentoolinux/) -- [openSUSE](openSUSE/) -- [FrugalWare](frugalware/) -- [Mac OS X](mac/) -- [Windows](windows/) -- [Amazon EC2](amazon/) -- [Rackspace Cloud](rackspace/) -- [Google Cloud Platform](google/) -- [Binaries](binaries/) \ No newline at end of file diff --git a/docs/sources/installation/binaries.md b/docs/sources/installation/binaries.md index 5d761de..0aa22ca 100644 --- a/docs/sources/installation/binaries.md +++ b/docs/sources/installation/binaries.md @@ -23,14 +23,15 @@ packages for many distributions, and more keep showing up all the time! To run properly, docker needs the following software to be installed at runtime: -- iproute2 version 3.5 or later (build after 2012-05-21), and - specifically the “ip” utility - iptables version 1.4 or later -- The LXC utility scripts - ([http://lxc.sourceforge.net](http://lxc.sourceforge.net)) version - 0.8 or later - Git version 1.7 or later - XZ Utils 4.9 or later +- a [properly + mounted](https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount) + cgroupfs hierarchy (having a single, all-encompassing “cgroup” mount + point [is](https://github.com/dotcloud/docker/issues/2683) + [not](https://github.com/dotcloud/docker/issues/3485) + [sufficient](https://github.com/dotcloud/docker/issues/4568)) ## Check kernel dependencies @@ -38,7 +39,7 @@ Docker in daemon mode has specific kernel requirements. For details, check your distribution in [*Installation*](../#installation-list). Note that Docker also has a client mode, which can run on virtually any -linux kernel (it even builds on OSX!). +Linux kernel (it even builds on OSX!). ## Get the docker binary: @@ -69,7 +70,9 @@ all the client commands. Warning -The *docker* group is root-equivalent. +The *docker* group (or the group specified with `-G`{.docutils +.literal}) is root-equivalent; see [*Docker Daemon Attack +Surface*](../../articles/security/#dockersecurity-daemon) details. ## Upgrades diff --git a/docs/sources/installation/fedora.md b/docs/sources/installation/fedora.md index 545e523..32f4fd2 100644 --- a/docs/sources/installation/fedora.md +++ b/docs/sources/installation/fedora.md @@ -31,13 +31,14 @@ installed already, it will conflict with `docker-io`{.docutils .literal}. There’s a [bug report](https://bugzilla.redhat.com/show_bug.cgi?id=1043676) filed for it. To proceed with `docker-io` installation on -Fedora 19, please remove `docker` first. +Fedora 19 or Fedora 20, please remove `docker` +first. sudo yum -y remove docker -For Fedora 20 and later, the `wmdocker` package will -provide the same functionality as `docker` and will -also not conflict with `docker-io`. +For Fedora 21 and later, the `wmdocker` package will +provide the same functionality as the old `docker` +and will also not conflict with `docker-io`. sudo yum -y install wmdocker sudo yum -y remove docker diff --git a/docs/sources/installation/ubuntulinux.md b/docs/sources/installation/ubuntulinux.md index 8c83e87..b6e9889 100644 --- a/docs/sources/installation/ubuntulinux.md +++ b/docs/sources/installation/ubuntulinux.md @@ -56,13 +56,13 @@ These instructions have changed for 0.6. If you are upgrading from an earlier version, you will need to follow them again. Docker is available as a Debian package, which makes installation easy. -**See the :ref:\`installmirrors\` section below if you are not in the -United States.** Other sources of the Debian packages may be faster for -you to install. +**See the** [*Docker and local DNS server warnings*](#installmirrors) +**section below if you are not in the United States.** Other sources of +the Debian packages may be faster for you to install. First add the Docker repository key to your local keychain. - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 Add the Docker repository to your apt sources list, update and install the `lxc-docker` package. @@ -121,7 +121,7 @@ upgrading from an earlier version, you will need to follow them again. First add the Docker repository key to your local keychain. - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 Add the Docker repository to your apt sources list, update and install the `lxc-docker` package. @@ -156,11 +156,15 @@ socket read/writable by the *docker* group when the daemon starts. The `docker` daemon must always run as the root user, but if you run the `docker` client as a user in the *docker* group then you don’t need to add `sudo` to -all the client commands. +all the client commands. As of 0.9.0, you can specify that a group other +than `docker` should own the Unix socket with the +`-G` option. Warning -The *docker* group is root-equivalent. +The *docker* group (or the group specified with `-G`{.docutils +.literal}) is root-equivalent; see [*Docker Daemon Attack +Surface*](../../articles/security/#dockersecurity-daemon) details. **Example:** @@ -259,9 +263,9 @@ Docker daemon for the containers: sudo nano /etc/default/docker --- # Add: - DOCKER_OPTS="-dns 8.8.8.8" + DOCKER_OPTS="--dns 8.8.8.8" # 8.8.8.8 could be replaced with a local DNS server, such as 192.168.1.1 - # multiple DNS servers can be specified: -dns 8.8.8.8 -dns 192.168.1.1 + # multiple DNS servers can be specified: --dns 8.8.8.8 --dns 192.168.1.1 The Docker daemon has to be restarted: diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index ec3e706..ad367d9 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -2,7 +2,7 @@ page_title: Installation on Windows page_description: Please note this project is currently under heavy development. It should not be used in production. page_keywords: Docker, Docker documentation, Windows, requirements, virtualbox, boot2docker -# Windows +# Microsoft Windows Docker can run on Windows using a virtualization platform like VirtualBox. A Linux distribution is run inside a virtual machine and @@ -17,7 +17,7 @@ production yet, but we’re getting closer with each release. Please see our blog post, [“Getting to Docker 1.0”](http://blog.docker.io/2013/08/getting-to-docker-1-0/) -1. Install virtualbox from +1. Install VirtualBox from [https://www.virtualbox.org](https://www.virtualbox.org) - or follow this [tutorial](http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7). diff --git a/docs/sources/reference.md b/docs/sources/reference.md index 3cd720c..1c4022e 100644 --- a/docs/sources/reference.md +++ b/docs/sources/reference.md @@ -1,9 +1,10 @@ + # Reference Manual -## Contents: +Contents: -- [Commands](commandline/) -- [Dockerfile Reference](builder/) -- [Docker Run Reference](run/) -- [APIs](api/) +- [Commands](commandline/) +- [Dockerfile Reference](builder/) +- [Docker Run Reference](run/) +- [APIs](api/) diff --git a/docs/sources/reference/api.md b/docs/sources/reference/api.md index ae55e6a..ce571bc 100644 --- a/docs/sources/reference/api.md +++ b/docs/sources/reference/api.md @@ -1,3 +1,4 @@ + # APIs Your programs and scripts can access Docker’s functionality via these @@ -8,34 +9,28 @@ interfaces: - [1.1 Index](registry_index_spec/#index) - [1.2 Registry](registry_index_spec/#registry) - [1.3 Docker](registry_index_spec/#docker) - - [2. Workflow](registry_index_spec/#workflow) - [2.1 Pull](registry_index_spec/#pull) - [2.2 Push](registry_index_spec/#push) - [2.3 Delete](registry_index_spec/#delete) - - [3. How to use the Registry in standalone mode](registry_index_spec/#how-to-use-the-registry-in-standalone-mode) - [3.1 Without an Index](registry_index_spec/#without-an-index) - [3.2 With an Index](registry_index_spec/#with-an-index) - - [4. The API](registry_index_spec/#the-api) - [4.1 Images](registry_index_spec/#images) - [4.2 Users](registry_index_spec/#users) - [4.3 Tags (Registry)](registry_index_spec/#tags-registry) - [4.4 Images (Index)](registry_index_spec/#images-index) - [4.5 Repositories](registry_index_spec/#repositories) - - [5. Chaining Registries](registry_index_spec/#chaining-registries) - [6. Authentication & Authorization](registry_index_spec/#authentication-authorization) - [6.1 On the Index](registry_index_spec/#on-the-index) - [6.2 On the Registry](registry_index_spec/#on-the-registry) - - [7 Document Version](registry_index_spec/#document-version) - - [Docker Registry API](registry_api/) - [1. Brief introduction](registry_api/#brief-introduction) - [2. Endpoints](registry_api/#endpoints) @@ -43,16 +38,13 @@ interfaces: - [2.2 Tags](registry_api/#tags) - [2.3 Repositories](registry_api/#repositories) - [2.4 Status](registry_api/#status) - - [3 Authorization](registry_api/#authorization) - - [Docker Index API](index_api/) - [1. Brief introduction](index_api/#brief-introduction) - [2. Endpoints](index_api/#endpoints) - [2.1 Repository](index_api/#repository) - [2.2 Users](index_api/#users) - [2.3 Search](index_api/#search) - - [Docker Remote API](docker_remote_api/) - [1. Brief introduction](docker_remote_api/#brief-introduction) - [2. Versions](docker_remote_api/#versions) @@ -67,7 +59,6 @@ interfaces: - [v1.2](docker_remote_api/#v1-2) - [v1.1](docker_remote_api/#v1-1) - [v1.0](docker_remote_api/#v1-0) - - [Docker Remote API Client Libraries](remote_api_client_libraries/) - [docker.io OAuth API](docker_io_oauth_api/) - [1. Brief introduction](docker_io_oauth_api/#brief-introduction) @@ -79,10 +70,8 @@ interfaces: - [3.2 Get an Access Token](docker_io_oauth_api/#get-an-access-token) - [3.3 Refresh a Token](docker_io_oauth_api/#refresh-a-token) - - [4. Use an Access Token with the API](docker_io_oauth_api/#use-an-access-token-with-the-api) - - [docker.io Accounts API](docker_io_accounts_api/) - [1. Endpoints](docker_io_accounts_api/#endpoints) - [1.1 Get a single @@ -96,4 +85,5 @@ interfaces: - [1.5 Update an email address for a user](docker_io_accounts_api/#update-an-email-address-for-a-user) - [1.6 Delete email address for a - user](docker_io_accounts_api/#delete-email-address-for-a-user) \ No newline at end of file + user](docker_io_accounts_api/#delete-email-address-for-a-user) + diff --git a/docs/sources/reference/api/docker_io_accounts_api.md b/docs/sources/reference/api/docker_io_accounts_api.md index 6ad5361..dc78076 100644 --- a/docs/sources/reference/api/docker_io_accounts_api.md +++ b/docs/sources/reference/api/docker_io_accounts_api.md @@ -2,35 +2,50 @@ page_title: docker.io Accounts API page_description: API Documentation for docker.io accounts. page_keywords: API, Docker, accounts, REST, documentation -# Docker IO Accounts API +# [docker.io Accounts API](#id1) -## Endpoints +Table of Contents -### Get A Single User +- [docker.io Accounts API](#docker-io-accounts-api) + - [1. Endpoints](#endpoints) + - [1.1 Get a single user](#get-a-single-user) + - [1.2 Update a single user](#update-a-single-user) + - [1.3 List email addresses for a + user](#list-email-addresses-for-a-user) + - [1.4 Add email address for a + user](#add-email-address-for-a-user) + - [1.5 Update an email address for a + user](#update-an-email-address-for-a-user) + - [1.6 Delete email address for a + user](#delete-email-address-for-a-user) + +## [1. Endpoints](#id2) + +### [1.1 Get a single user](#id3) `GET `{.descname}`/api/v1.1/users/:username/`{.descname} : Get profile info for the specified user. Parameters: - - **username** – username of the user whose profile info is being + - **username** – username of the user whose profile info is being requested. Request Headers:   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token. Status Codes: - - **200** – success, user data returned. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **200** – success, user data returned. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have `profile_read` scope. - - **404** – the specified username does not exist. + - **404** – the specified username does not exist. **Example request**: @@ -59,45 +74,45 @@ page_keywords: API, Docker, accounts, REST, documentation "is_active": true } -### Update A Single User +### [1.2 Update a single user](#id4) `PATCH `{.descname}`/api/v1.1/users/:username/`{.descname} : Update profile info for the specified user. Parameters: - - **username** – username of the user whose profile info is being + - **username** – username of the user whose profile info is being updated. Json Parameters:   - - **full\_name** (*string*) – (optional) the new name of the user. - - **location** (*string*) – (optional) the new location. - - **company** (*string*) – (optional) the new company of the user. - - **profile\_url** (*string*) – (optional) the new profile url. - - **gravatar\_email** (*string*) – (optional) the new Gravatar + - **full\_name** (*string*) – (optional) the new name of the user. + - **location** (*string*) – (optional) the new location. + - **company** (*string*) – (optional) the new company of the user. + - **profile\_url** (*string*) – (optional) the new profile url. + - **gravatar\_email** (*string*) – (optional) the new Gravatar email address. Request Headers:   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token. - - **Content-Type** – MIME Type of post data. JSON, url-encoded + - **Content-Type** – MIME Type of post data. JSON, url-encoded form data, etc. Status Codes: - - **200** – success, user data updated. - - **400** – post data validation error. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **200** – success, user data updated. + - **400** – post data validation error. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being updated, OAuth access tokens must have `profile_write` scope. - - **404** – the specified username does not exist. + - **404** – the specified username does not exist. **Example request**: @@ -132,31 +147,31 @@ page_keywords: API, Docker, accounts, REST, documentation "is_active": true } -### List Email Addresses For A User +### [1.3 List email addresses for a user](#id5) `GET `{.descname}`/api/v1.1/users/:username/emails/`{.descname} : List email info for the specified user. Parameters: - - **username** – username of the user whose profile info is being + - **username** – username of the user whose profile info is being updated. Request Headers:   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token Status Codes: - - **200** – success, user data updated. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **200** – success, user data updated. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have `email_read` scope. - - **404** – the specified username does not exist. + - **404** – the specified username does not exist. **Example request**: @@ -170,7 +185,7 @@ page_keywords: API, Docker, accounts, REST, documentation HTTP/1.1 200 OK Content-Type: application/json - + [ { "email": "jane.doe@example.com", "verified": true, @@ -178,7 +193,7 @@ page_keywords: API, Docker, accounts, REST, documentation } ] -### Add Email Address For A User +### [1.4 Add email address for a user](#id6) `POST `{.descname}`/api/v1.1/users/:username/emails/`{.descname} : Add a new email address to the specified user’s account. The email @@ -189,26 +204,26 @@ page_keywords: API, Docker, accounts, REST, documentation   - - **email** (*string*) – email address to be added. + - **email** (*string*) – email address to be added. Request Headers:   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token. - - **Content-Type** – MIME Type of post data. JSON, url-encoded + - **Content-Type** – MIME Type of post data. JSON, url-encoded form data, etc. Status Codes: - - **201** – success, new email added. - - **400** – data validation error. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **201** – success, new email added. + - **400** – data validation error. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have `email_write` scope. - - **404** – the specified username does not exist. + - **404** – the specified username does not exist. **Example request**: @@ -233,7 +248,7 @@ page_keywords: API, Docker, accounts, REST, documentation "primary": false } -### Update An Email Address For A User +### [1.5 Update an email address for a user](#id7) `PATCH `{.descname}`/api/v1.1/users/:username/emails/`{.descname} : Update an email address for the specified user to either verify an @@ -244,17 +259,17 @@ page_keywords: API, Docker, accounts, REST, documentation Parameters: - - **username** – username of the user whose email info is being + - **username** – username of the user whose email info is being updated. Json Parameters:   - - **email** (*string*) – the email address to be updated. - - **verified** (*boolean*) – (optional) whether the email address + - **email** (*string*) – the email address to be updated. + - **verified** (*boolean*) – (optional) whether the email address is verified, must be `true` or absent. - - **primary** (*boolean*) – (optional) whether to set the email + - **primary** (*boolean*) – (optional) whether to set the email address as the primary email, must be `true` or absent. @@ -262,20 +277,20 @@ page_keywords: API, Docker, accounts, REST, documentation   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token. - - **Content-Type** – MIME Type of post data. JSON, url-encoded + - **Content-Type** – MIME Type of post data. JSON, url-encoded form data, etc. Status Codes: - - **200** – success, user’s email updated. - - **400** – data validation error. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **200** – success, user’s email updated. + - **400** – data validation error. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being updated, OAuth access tokens must have `email_write` scope. - - **404** – the specified username or email address does not + - **404** – the specified username or email address does not exist. **Example request**: @@ -303,7 +318,7 @@ page_keywords: API, Docker, accounts, REST, documentation "primary": false } -### Delete Email Address For A User +### [1.6 Delete email address for a user](#id8) `DELETE `{.descname}`/api/v1.1/users/:username/emails/`{.descname} : Delete an email address from the specified user’s account. You @@ -313,26 +328,26 @@ page_keywords: API, Docker, accounts, REST, documentation   - - **email** (*string*) – email address to be deleted. + - **email** (*string*) – email address to be deleted. Request Headers:   - - **Authorization** – required authentication credentials of + - **Authorization** – required authentication credentials of either type HTTP Basic or OAuth Bearer Token. - - **Content-Type** – MIME Type of post data. JSON, url-encoded + - **Content-Type** – MIME Type of post data. JSON, url-encoded form data, etc. Status Codes: - - **204** – success, email address removed. - - **400** – validation error. - - **401** – authentication error. - - **403** – permission error, authenticated user must be the user + - **204** – success, email address removed. + - **400** – validation error. + - **401** – authentication error. + - **403** – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have `email_write` scope. - - **404** – the specified username or email address does not + - **404** – the specified username or email address does not exist. **Example request**: @@ -350,4 +365,6 @@ page_keywords: API, Docker, accounts, REST, documentation **Example response**: HTTP/1.1 204 NO CONTENT - Content-Length: 0 \ No newline at end of file + Content-Length: 0 + + diff --git a/docs/sources/reference/api/docker_io_oauth_api.md b/docs/sources/reference/api/docker_io_oauth_api.md index 85f3a22..c39ab56 100644 --- a/docs/sources/reference/api/docker_io_oauth_api.md +++ b/docs/sources/reference/api/docker_io_oauth_api.md @@ -2,9 +2,21 @@ page_title: docker.io OAuth API page_description: API Documentation for docker.io's OAuth flow. page_keywords: API, Docker, oauth, REST, documentation -# Docker IO OAuth API +# [docker.io OAuth API](#id1) -## Introduction +Table of Contents + +- [docker.io OAuth API](#docker-io-oauth-api) + - [1. Brief introduction](#brief-introduction) + - [2. Register Your Application](#register-your-application) + - [3. Endpoints](#endpoints) + - [3.1 Get an Authorization Code](#get-an-authorization-code) + - [3.2 Get an Access Token](#get-an-access-token) + - [3.3 Refresh a Token](#refresh-a-token) + - [4. Use an Access Token with the + API](#use-an-access-token-with-the-api) + +## [1. Brief introduction](#id2) Some docker.io API requests will require an access token to authenticate. To get an access token for a user, that user must first @@ -12,13 +24,13 @@ grant your application access to their docker.io account. In order for them to grant your application access you must first register your application. -Before continuing, we encourage you to familiarize yourself with The -OAuth 2.0 Authorization Framework](http://tools.ietf.org/c6749). +Before continuing, we encourage you to familiarize yourself with [The +OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749). *Also note that all OAuth interactions must take place over https connections* -## Registering Your Application +## [2. Register Your Application](#id3) You will need to register your application with docker.io before users will be able to grant your application access to their account @@ -27,10 +39,10 @@ request registration of your application send an email to [support-accounts@docker.com](mailto:support-accounts%40docker.com) with the following information: -- The name of your application -- A description of your application and the service it will provide to +- The name of your application +- A description of your application and the service it will provide to docker.io users. -- A callback URI that we will use for redirecting authorization +- A callback URI that we will use for redirecting authorization requests to your application. These are used in the step of getting an Authorization Code. The domain name of the callback URI will be visible to the user when they are requested to authorize your @@ -41,9 +53,9 @@ docker.io team with your `client_id` and `client_secret` which your application will use in the steps of getting an Authorization Code and getting an Access Token. -## Endpoints +## [3. Endpoints](#id4) -### Get an Authorization Code +### [3.1 Get an Authorization Code](#id5) Once You have registered you are ready to start integrating docker.io accounts into your application! The process is usually started by a user @@ -61,24 +73,24 @@ following a link in your application to an OAuth Authorization endpoint.   - - **client\_id** – The `client_id` given to + - **client\_id** – The `client_id` given to your application at registration. - - **response\_type** – MUST be set to `code`. + - **response\_type** – MUST be set to `code`. This specifies that you would like an Authorization Code returned. - - **redirect\_uri** – The URI to redirect back to after the user + - **redirect\_uri** – The URI to redirect back to after the user has authorized your application. If omitted, the first of your registered `response_uris` is used. If included, it must be one of the URIs which were submitted when registering your application. - - **scope** – The extent of access permissions you are requesting. + - **scope** – The extent of access permissions you are requesting. Currently, the scope options are `profile_read`{.docutils .literal}, `profile_write`, `email_read`, and `email_write`{.docutils .literal}. Scopes must be separated by a space. If omitted, the default scopes `profile_read email_read` are used. - - **state** – (Recommended) Used by your application to maintain + - **state** – (Recommended) Used by your application to maintain state between the authorization request and callback to protect against CSRF attacks. @@ -115,7 +127,7 @@ following a link in your application to an OAuth Authorization endpoint. : An error message in the event of the user denying the authorization or some other kind of error with the request. -### Get an Access Token +### [3.2 Get an Access Token](#id6) Once the user has authorized your application, a request will be made to your application’s specified `redirect_uri` which @@ -131,7 +143,7 @@ to get an Access Token.   - - **Authorization** – HTTP basic authentication using your + - **Authorization** – HTTP basic authentication using your application’s `client_id` and `client_secret` @@ -139,11 +151,11 @@ to get an Access Token.   - - **grant\_type** – MUST be set to `authorization_code`{.docutils + - **grant\_type** – MUST be set to `authorization_code`{.docutils .literal} - - **code** – The authorization code received from the user’s + - **code** – The authorization code received from the user’s redirect request. - - **redirect\_uri** – The same `redirect_uri` + - **redirect\_uri** – The same `redirect_uri` used in the authentication request. **Example Request** @@ -180,7 +192,7 @@ to get an Access Token. In the case of an error, there will be a non-200 HTTP Status and and data detailing the error. -### Refresh a Token +### [3.3 Refresh a Token](#id7) Once the Access Token expires you can use your `refresh_token`{.docutils .literal} to have docker.io issue your application a new Access Token, @@ -195,7 +207,7 @@ if the user has not revoked access from your application.   - - **Authorization** – HTTP basic authentication using your + - **Authorization** – HTTP basic authentication using your application’s `client_id` and `client_secret` @@ -203,11 +215,11 @@ if the user has not revoked access from your application.   - - **grant\_type** – MUST be set to `refresh_token`{.docutils + - **grant\_type** – MUST be set to `refresh_token`{.docutils .literal} - - **refresh\_token** – The `refresh_token` + - **refresh\_token** – The `refresh_token` which was issued to your application. - - **scope** – (optional) The scope of the access token to be + - **scope** – (optional) The scope of the access token to be returned. Must not include any scope not originally granted by the user and if omitted is treated as equal to the scope originally granted. @@ -245,7 +257,7 @@ if the user has not revoked access from your application. In the case of an error, there will be a non-200 HTTP Status and and data detailing the error. -## Use an Access Token with the API +## [4. Use an Access Token with the API](#id8) Many of the docker.io API requests will require a Authorization request header field. Simply ensure you add this header with “Bearer diff --git a/docs/sources/reference/api/docker_remote_api.md b/docs/sources/reference/api/docker_remote_api.md index 35dd858..8a2e456 100644 --- a/docs/sources/reference/api/docker_remote_api.md +++ b/docs/sources/reference/api/docker_remote_api.md @@ -4,21 +4,21 @@ page_keywords: API, Docker, rcli, REST, documentation # Docker Remote API -## Introduction - -- The Remote API is replacing rcli -- By default the Docker daemon listens on unix:///var/run/docker.sock - and the client must have root access to interact with the daemon -- If a group named *docker* exists on your system, docker will apply - ownership of the socket to the group -- The API tends to be REST, but for some complex commands, like attach - or pull, the HTTP connection is hijacked to transport stdout stdin - and stderr -- Since API version 1.2, the auth configuration is now handled client - side, so the client has to send the authConfig as POST in - `/images/(name)/push`. - -## Docker Remote API Versions +## 1. Brief introduction + +- The Remote API is replacing rcli +- By default the Docker daemon listens on unix:///var/run/docker.sock + and the client must have root access to interact with the daemon +- If a group named *docker* exists on your system, docker will apply + ownership of the socket to the group +- The API tends to be REST, but for some complex commands, like attach + or pull, the HTTP connection is hijacked to transport stdout stdin + and stderr +- Since API version 1.2, the auth configuration is now handled client + side, so the client has to send the authConfig as POST in + /images/(name)/push + +## 2. Versions The current version of the API is 1.10 @@ -28,25 +28,31 @@ Calling /images/\/insert is the same as calling You can still call an old version of the api using /v1.0/images/\/insert -## Docker Remote API v1.10 +### v1.10 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.10*](../docker_remote_api_v1.10/) -### What’s new +#### What’s new `DELETE `{.descname}`/images/`{.descname}(*name*) : **New!** You can now use the force parameter to force delete of an - image, even if it’s tagged in multiple repositories. + image, even if it’s tagged in multiple repositories. **New!** You + can now use the noprune parameter to prevent the deletion of parent + images -## Docker Remote API v1.9 + `DELETE `{.descname}`/containers/`{.descname}(*id*) +: **New!** You can now use the force paramter to force delete a + container, even if it is currently running -### Full Documentation +### v1.9 + +#### Full Documentation [*Docker Remote API v1.9*](../docker_remote_api_v1.9/) -### What’s New +#### What’s new `POST `{.descname}`/build`{.descname} : **New!** This endpoint now takes a serialized ConfigFile which it @@ -54,13 +60,13 @@ You can still call an old version of the api using base image. Clients which previously implemented the version accepting an AuthConfig object must be updated. -## Docker Remote API v1.8 +### v1.8 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.8*](../docker_remote_api_v1.8/) -### What’s New +#### What’s new `POST `{.descname}`/build`{.descname} : **New!** This endpoint now returns build status as json stream. In @@ -82,13 +88,13 @@ You can still call an old version of the api using possible to get the current value and the total of the progress without having to parse the string. -## Docker Remote API v1.7 +### v1.7 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.7*](../docker_remote_api_v1.7/) -### What’s New +#### What’s new `GET `{.descname}`/images/json`{.descname} : The format of the json returned from this uri changed. Instead of an @@ -175,17 +181,17 @@ You can still call an old version of the api using ] `GET `{.descname}`/images/viz`{.descname} -: This URI no longer exists. The `images -viz` +: This URI no longer exists. The `images --viz` output is now generated in the client, using the `/images/json` data. -## Docker Remote API v1.6 +### v1.6 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.6*](../docker_remote_api_v1.6/) -### What’s New +#### What’s new `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : **New!** You can now split stderr from stdout. This is done by @@ -195,13 +201,13 @@ You can still call an old version of the api using The WebSocket attach is unchanged. Note that attach calls on the previous API version didn’t change. Stdout and stderr are merged. -## Docker Remote API v1.5 +### v1.5 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.5*](../docker_remote_api_v1.5/) -### What’s New +#### What’s new `POST `{.descname}`/images/create`{.descname} : **New!** You can now pass registry credentials (via an AuthConfig @@ -216,13 +222,13 @@ You can still call an old version of the api using dicts each containing PublicPort, PrivatePort and Type describing a port mapping. -## Docker Remote API v1.4 +### v1.4 -### Full Documentation +#### Full Documentation [*Docker Remote API v1.4*](../docker_remote_api_v1.4/) -### What’s New +#### What’s new `POST `{.descname}`/images/create`{.descname} : **New!** When pulling a repo, all images are now downloaded in @@ -235,16 +241,16 @@ You can still call an old version of the api using `GET `{.descname}`/events:`{.descname} : **New!** Image’s name added in the events -## Docker Remote API v1.3 +### v1.3 docker v0.5.0 [51f6c4a](https://github.com/dotcloud/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909) -### Full Documentation +#### Full Documentation [*Docker Remote API v1.3*](../docker_remote_api_v1.3/) -### What’s New +#### What’s new `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List the processes running inside a container. @@ -254,10 +260,10 @@ docker v0.5.0 Builder (/build): -- Simplify the upload of the build context -- Simply stream a tarball instead of multipart upload with 4 - intermediary buffers -- Simpler, less memory usage, less disk usage and faster +- Simplify the upload of the build context +- Simply stream a tarball instead of multipart upload with 4 + intermediary buffers +- Simpler, less memory usage, less disk usage and faster Warning @@ -266,23 +272,23 @@ break on /build. List containers (/containers/json): -- You can use size=1 to get the size of the containers +- You can use size=1 to get the size of the containers Start containers (/containers/\/start): -- You can now pass host-specific configuration (e.g. bind mounts) in - the POST body for start calls +- You can now pass host-specific configuration (e.g. bind mounts) in + the POST body for start calls -## Docker Remote API v1.2 +### v1.2 docker v0.4.2 [2e7649b](https://github.com/dotcloud/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168) -### Full Documentation +#### Full Documentation [*Docker Remote API v1.2*](../docker_remote_api_v1.2/) -### What’s New +#### What’s new The auth configuration is now handled by the client. @@ -302,16 +308,16 @@ The client should send it’s authConfig as POST on each call of : Now returns a JSON structure with the list of images deleted/untagged. -## Docker Remote API v1.1 +### v1.1 docker v0.4.0 [a8ae398](https://github.com/dotcloud/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f) -### Full Documentation +#### Full Documentation [*Docker Remote API v1.1*](../docker_remote_api_v1.1/) -### What’s New +#### What’s new `POST `{.descname}`/images/create`{.descname} : @@ -330,15 +336,15 @@ docker v0.4.0 > {"error":"Invalid..."} > ... -## Docker Remote API v1.0 +### v1.0 docker v0.3.4 [8d73740](https://github.com/dotcloud/docker/commit/8d73740343778651c09160cde9661f5f387b36f4) -### Full Documentation +#### Full Documentation [*Docker Remote API v1.0*](../docker_remote_api_v1.0/) -### What’s New +#### What’s new Initial version diff --git a/docs/sources/reference/api/docker_remote_api_v1.0.md b/docs/sources/reference/api/docker_remote_api_v1.0.md index 6bb0fcb..30b1718 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.0.md +++ b/docs/sources/reference/api/docker_remote_api_v1.0.md @@ -2,21 +2,70 @@ page_title: Remote API v1.0 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.0 - -## Introduction - -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +# [Docker Remote API v1.0](#id1) + +Table of Contents + +- [Docker Remote API v1.0](#docker-remote-api-v1-0) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Get default username and + email](#get-default-username-and-email) + - [Check auth configuration and store + it](#check-auth-configuration-and-store-it) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + +## [1. Brief introduction](#id2) + +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -65,22 +114,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -126,16 +175,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -198,11 +247,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem:] +#### [Inspect changes on a container’s filesystem](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -233,11 +282,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -255,11 +304,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id10) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -274,11 +323,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -295,15 +344,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -320,15 +369,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -343,11 +392,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -367,25 +416,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -404,11 +453,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id16) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -425,19 +474,19 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id17) -### List images: +#### [List Images](#id18) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -498,16 +547,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id19) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -528,18 +577,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id20) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -557,10 +606,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id21) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -603,11 +652,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id22) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -636,11 +685,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id23) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -660,15 +709,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id24) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -685,17 +734,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **500** – server error -### Remove an image: +#### [Remove an image](#id25) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -710,11 +759,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such image - - **500** – server error + - **204** – no error + - **404** – no such image + - **500** – server error -### Search images: +#### [Search images](#id26) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -747,9 +796,9 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id27) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id28) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -770,15 +819,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name to be applied to the resulting image in + - **t** – repository name to be applied to the resulting image in case of success Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -#### [Get default username and email +#### [Get default username and email](#id29) `GET `{.descname}`/auth`{.descname} : Get the default username and email @@ -799,10 +848,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: and store it +#### [Check auth configuration and store it](#id30) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -824,11 +873,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id31) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -854,10 +903,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id32) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -879,10 +928,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id33) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -908,41 +957,41 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -## Going Further +## [3. Going further](#id34) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id35) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id36) In this first version of the API, some of the endpoints, like /attach, /pull or /push uses hijacking to transport stdin, stdout and stderr on diff --git a/docs/sources/reference/api/docker_remote_api_v1.1.md b/docs/sources/reference/api/docker_remote_api_v1.1.md index 476b942..2d510f4 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.1.md +++ b/docs/sources/reference/api/docker_remote_api_v1.1.md @@ -2,21 +2,70 @@ page_title: Remote API v1.1 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.1 - -## Introduction - -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +# [Docker Remote API v1.1](#id1) + +Table of Contents + +- [Docker Remote API v1.1](#docker-remote-api-v1-1) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Get default username and + email](#get-default-username-and-email) + - [Check auth configuration and store + it](#check-auth-configuration-and-store-it) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + +## [1. Brief introduction](#id2) + +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -65,22 +114,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -126,16 +175,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -198,11 +247,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem:] +#### [Inspect changes on a container’s filesystem](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -233,11 +282,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -255,11 +304,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id10) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -274,11 +323,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -295,15 +344,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -320,15 +369,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -343,11 +392,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -367,25 +416,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -404,11 +453,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id16) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -425,19 +474,19 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id17) -### List images: +#### [List Images](#id18) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -498,16 +547,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id19) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -531,18 +580,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id20) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -564,10 +613,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id21) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -610,11 +659,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id22) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -643,11 +692,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id23) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -670,15 +719,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id24) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -695,18 +744,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id25) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -721,11 +770,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such image - - **500** – server error + - **204** – no error + - **404** – no such image + - **500** – server error -### Search images: +#### [Search images](#id26) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -758,9 +807,9 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id27) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id28) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -781,15 +830,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – tag to be applied to the resulting image in case of + - **t** – tag to be applied to the resulting image in case of success Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -#### [Get default username and email +#### [Get default username and email](#id29) `GET `{.descname}`/auth`{.descname} : Get the default username and email @@ -810,10 +859,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: and store it +#### [Check auth configuration and store it](#id30) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -835,11 +884,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id31) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -865,10 +914,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id32) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -890,10 +939,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id33) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -919,41 +968,41 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -## Going Further +## [3. Going further](#id34) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id35) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id36) In this version of the API, /attach uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. diff --git a/docs/sources/reference/api/docker_remote_api_v1.10.md b/docs/sources/reference/api/docker_remote_api_v1.10.md index b6aa5bc..2a99f72 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.10.md +++ b/docs/sources/reference/api/docker_remote_api_v1.10.md @@ -2,24 +2,80 @@ page_title: Remote API v1.10 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.10 - -## Introduction - -- The Remote API has replaced rcli -- The daemon listens on `unix:///var/run/docker.sock`{.docutils +# [Docker Remote API v1.10](#id1) + +Table of Contents + +- [Docker Remote API v1.10](#docker-remote-api-v1-10) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [Get a tarball containing all images and tags in a + repository](#get-a-tarball-containing-all-images-and-tags-in-a-repository) + - [Load a tarball with a set of images and tags into + docker](#load-a-tarball-with-a-set-of-images-and-tags-into-docker) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API has replaced rcli +- The daemon listens on `unix:///var/run/docker.sock`{.docutils .literal}, but you can [*Bind Docker to another host/port or a Unix socket*](../../../use/basics/#bind-docker). -- The API tends to be REST, but for some complex commands, like +- The API tends to be REST, but for some complex commands, like `attach` or `pull`{.docutils .literal}, the HTTP connection is hijacked to transport `stdout, stdin`{.docutils .literal} and `stderr` -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -80,24 +136,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -130,6 +186,7 @@ page_keywords: API, Docker, rcli, REST, documentation }, "VolumesFrom":"", "WorkingDir":"", + "DisableNetwork": false, "ExposedPorts":{ "22/tcp": {} } @@ -149,23 +206,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Query Parameters:   - - **name** – Assign the specified name to the container. Must + - **name** – Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`. Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -246,11 +303,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -288,15 +345,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -327,11 +384,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -349,11 +406,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -380,15 +437,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -405,15 +462,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -430,15 +487,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -453,11 +510,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -477,23 +534,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error **Stream details**: @@ -518,9 +575,9 @@ page_keywords: API, Docker, rcli, REST, documentation `STREAM_TYPE` can be: - - 0: stdin (will be writen on stdout) - - 1: stdout - - 2: stderr + - 0: stdin (will be writen on stdout) + - 1: stdout + - 2: stderr `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian. @@ -539,7 +596,7 @@ page_keywords: API, Docker, rcli, REST, documentation 4. Read the extracted size and output it on the correct output 5. Goto 1) -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -558,11 +615,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -579,17 +636,19 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false + - **force** – 1/True/true or 0/False/false, Removes the container + even if it was running. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -612,13 +671,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List images: +#### [List Images](#id20) `GET `{.descname}`/images/json`{.descname} : **Example request**: @@ -655,7 +714,7 @@ page_keywords: API, Docker, rcli, REST, documentation } ] -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -683,24 +742,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Request Headers:   - - **X-Registry-Auth** – base64-encoded AuthConfig object + - **X-Registry-Auth** – base64-encoded AuthConfig object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -722,10 +781,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -770,11 +829,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -803,11 +862,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -830,22 +889,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Request Headers:   - - **X-Registry-Auth** – include a base64-encoded AuthConfig + - **X-Registry-Auth** – include a base64-encoded AuthConfig object. Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -862,18 +921,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -897,16 +956,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **force** – 1/True/true or 0/False/false, default false + - **force** – 1/True/true or 0/False/false, default false + - **noprune** – 1/True/true or 0/False/false, default false Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index. @@ -954,16 +1014,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **term** – term to search + - **term** – term to search Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -995,25 +1055,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image Request Headers:   - - **Content-type** – should be set to + - **Content-type** – should be set to `"application/tar"`. - - **X-Registry-Config** – base64-encoded ConfigFile object + - **X-Registry-Config** – base64-encoded ConfigFile object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -1036,11 +1096,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -1067,10 +1127,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1092,10 +1152,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1115,22 +1175,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) - - **run** – config automatically applied when the image is run. + - **run** – config automatically applied when the image is run. (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1154,14 +1214,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Get a tarball containing all images and tags in a repository: +#### [Get a tarball containing all images and tags in a repository](#id36) `GET `{.descname}`/images/`{.descname}(*name*)`/get`{.descname} : Get a tarball containing all images and metadata for the repository @@ -1180,10 +1240,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Load a tarball with a set of images and tags into docker: +#### [Load a tarball with a set of images and tags into docker](#id37) `POST `{.descname}`/images/load`{.descname} : Load a set of images and tags into the docker repository. @@ -1200,38 +1260,38 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id38) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id39) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id40) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id41) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.2.md b/docs/sources/reference/api/docker_remote_api_v1.2.md index 5a70c94..b11bce6 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.2.md +++ b/docs/sources/reference/api/docker_remote_api_v1.2.md @@ -2,21 +2,68 @@ page_title: Remote API v1.2 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.2 - -## Introduction - -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +# [Docker Remote API v1.2](#id1) + +Table of Contents + +- [Docker Remote API v1.2](#docker-remote-api-v1-2) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -77,22 +124,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -138,16 +185,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -210,11 +257,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem:] +#### [Inspect changes on a container’s filesystem](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -245,11 +292,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -267,11 +314,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id10) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -286,11 +333,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -307,15 +354,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -332,15 +379,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -355,11 +402,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -379,25 +426,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -416,11 +463,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id16) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -437,19 +484,19 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id17) -### List images: +#### [List Images](#id18) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -514,16 +561,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id19) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -547,18 +594,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id20) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -580,10 +627,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id21) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -627,11 +674,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id22) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -661,11 +708,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id23) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -689,15 +736,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id24) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -714,18 +761,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id25) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -747,12 +794,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **204** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id26) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -785,9 +832,9 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id27) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id28) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile @@ -808,19 +855,19 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name to be applied to the resulting image in + - **t** – repository name to be applied to the resulting image in case of success - - **remote** – resource to fetch, as URI + - **remote** – resource to fetch, as URI Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error {{ STREAM }} is the raw text output of the build command. It uses the HTTP Hijack method in order to stream. -### Check auth configuration: +#### [Check auth configuration](#id29) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -847,13 +894,13 @@ HTTP Hijack method in order to stream. Status Codes: - - **200** – no error - - **204** – no error - - **401** – unauthorized - - **403** – forbidden - - **500** – server error + - **200** – no error + - **204** – no error + - **401** – unauthorized + - **403** – forbidden + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id30) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -879,10 +926,10 @@ HTTP Hijack method in order to stream. Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id31) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -904,10 +951,10 @@ HTTP Hijack method in order to stream. Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id32) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -933,49 +980,49 @@ HTTP Hijack method in order to stream.   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -## Going Further +## [3. Going further](#id33) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id34) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id35) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id36) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. > docker -d -H=”[tcp://192.168.1.9:4243](tcp://192.168.1.9:4243)” -> -api-enable-cors +> –api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.3.md b/docs/sources/reference/api/docker_remote_api_v1.3.md index 7e0e6bd..4203699 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.3.md +++ b/docs/sources/reference/api/docker_remote_api_v1.3.md @@ -2,74 +2,71 @@ page_title: Remote API v1.3 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.3 +# [Docker Remote API v1.3](#id1) Table of Contents -- [Docker Remote API v1.3](#docker-remote-api-v1-3) - - [1. Brief introduction](#brief-introduction) - - [2. Endpoints](#endpoints) - - [2.1 Containers](#containers) - - [List containers](#list-containers) - - [Create a container](#create-a-container) - - [Inspect a container](#inspect-a-container) - - [List processes running inside a +- [Docker Remote API v1.3](#docker-remote-api-v1-3) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a container](#list-processes-running-inside-a-container) - - [Inspect changes on a container’s + - [Inspect changes on a container’s filesystem](#inspect-changes-on-a-container-s-filesystem) - - [Export a container](#export-a-container) - - [Start a container](#start-a-container) - - [Stop a container](#stop-a-container) - - [Restart a container](#restart-a-container) - - [Kill a container](#kill-a-container) - - [Attach to a container](#attach-to-a-container) - - [Wait a container](#wait-a-container) - - [Remove a container](#remove-a-container) - - - [2.2 Images](#images) - - [List Images](#list-images) - - [Create an image](#create-an-image) - - [Insert a file in an image](#insert-a-file-in-an-image) - - [Inspect an image](#inspect-an-image) - - [Get the history of an + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an image](#get-the-history-of-an-image) - - [Push an image on the + - [Push an image on the registry](#push-an-image-on-the-registry) - - [Tag an image into a + - [Tag an image into a repository](#tag-an-image-into-a-repository) - - [Remove an image](#remove-an-image) - - [Search images](#search-images) - - - [2.3 Misc](#misc) - - [Build an image from Dockerfile via + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via stdin](#build-an-image-from-dockerfile-via-stdin) - - [Check auth configuration](#check-auth-configuration) - - [Display system-wide + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide information](#display-system-wide-information) - - [Show the docker version + - [Show the docker version information](#show-the-docker-version-information) - - [Create a new image from a container’s + - [Create a new image from a container’s changes](#create-a-new-image-from-a-container-s-changes) - - [Monitor Docker’s events](#monitor-docker-s-events) - - - [3. Going further](#going-further) - - [3.1 Inside ‘docker run’](#inside-docker-run) - - [3.2 Hijacking](#hijacking) - - [3.3 CORS Requests](#cors-requests) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) -## Introduction +## [1. Brief introduction](#id2) -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -130,24 +127,24 @@ Table of Contents   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -193,16 +190,16 @@ Table of Contents   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -265,11 +262,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -300,11 +297,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -335,11 +332,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -357,11 +354,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -384,15 +381,15 @@ Table of Contents   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -409,15 +406,15 @@ Table of Contents   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -434,15 +431,15 @@ Table of Contents   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -457,11 +454,11 @@ Table of Contents Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -481,25 +478,25 @@ Table of Contents   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -518,11 +515,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -539,19 +536,19 @@ Table of Contents   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id18) -### List images: +#### [List Images](#id19) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -616,16 +613,16 @@ Table of Contents   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id20) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -649,18 +646,18 @@ Table of Contents   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id21) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -682,10 +679,10 @@ Table of Contents Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id22) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -729,11 +726,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -762,11 +759,11 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id24) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -790,15 +787,15 @@ Table of Contents   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -815,18 +812,18 @@ Table of Contents   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id26) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -848,12 +845,12 @@ Table of Contents Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id27) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -886,9 +883,9 @@ Table of Contents :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id28) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id29) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -917,16 +914,16 @@ Table of Contents   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output + - **q** – suppress verbose build output Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id30) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -948,11 +945,11 @@ Table of Contents Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id31) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -981,10 +978,10 @@ Table of Contents Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id32) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1006,10 +1003,10 @@ Table of Contents Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id33) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1035,20 +1032,20 @@ Table of Contents   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id34) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1072,42 +1069,42 @@ Table of Contents   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id35) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id36) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id37) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id38) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. -> docker -d -H=”192.168.1.9:4243” -api-enable-cors +> docker -d -H=”192.168.1.9:4243” –api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.4.md b/docs/sources/reference/api/docker_remote_api_v1.4.md index f665b1e..4eca2a6 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.4.md +++ b/docs/sources/reference/api/docker_remote_api_v1.4.md @@ -2,21 +2,73 @@ page_title: Remote API v1.4 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.4 - -## Introduction - -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +# [Docker Remote API v1.4](#id1) + +Table of Contents + +- [Docker Remote API v1.4](#docker-remote-api-v1-4) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -77,24 +129,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -143,16 +195,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -217,12 +269,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **409** – conflict between containers and images - - **500** – server error + - **200** – no error + - **404** – no such container + - **409** – conflict between containers and images + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -260,15 +312,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -299,11 +351,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -321,11 +373,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -349,15 +401,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -374,15 +426,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -399,15 +451,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -422,11 +474,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -446,25 +498,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -483,11 +535,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -504,17 +556,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -537,13 +589,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List images: +#### [List Images](#id20) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -608,16 +660,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -641,18 +693,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -674,10 +726,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -722,12 +774,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict between containers and images - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict between containers and images + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -756,11 +808,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -782,14 +834,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error :statuscode 404: no such image :statuscode + - **200** – no error :statuscode 404: no such image :statuscode 500: server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -806,18 +858,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -839,12 +891,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -877,9 +929,9 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -908,17 +960,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -941,11 +993,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -972,10 +1024,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -997,10 +1049,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1026,20 +1078,20 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1063,42 +1115,42 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id36) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id37) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id38) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id39) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.5.md b/docs/sources/reference/api/docker_remote_api_v1.5.md index d9c3542..ff11cd1 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.5.md +++ b/docs/sources/reference/api/docker_remote_api_v1.5.md @@ -2,21 +2,73 @@ page_title: Remote API v1.5 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.5 - -## Introduction - -- The Remote API is replacing rcli -- Default port in the docker daemon is 4243 -- The API tends to be REST, but for some complex commands, like attach +# [Docker Remote API v1.5](#id1) + +Table of Contents + +- [Docker Remote API v1.5](#docker-remote-api-v1-5) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API is replacing rcli +- Default port in the docker daemon is 4243 +- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -77,24 +129,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -142,16 +194,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -215,11 +267,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -257,15 +309,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -296,11 +348,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -318,11 +370,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -346,15 +398,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -371,15 +423,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -396,15 +448,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -419,11 +471,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -443,25 +495,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -480,11 +532,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -501,17 +553,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -534,13 +586,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List images: +#### [List Images](#id20) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -605,16 +657,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -642,18 +694,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -675,10 +727,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -723,11 +775,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -756,11 +808,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -786,15 +838,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -811,18 +863,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -844,12 +896,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -882,16 +934,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **term** – term to search + - **term** – term to search Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -920,18 +972,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image - - **rm** – remove intermediate containers after a successful build + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image + - **rm** – remove intermediate containers after a successful build Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -954,11 +1006,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -985,10 +1037,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1010,10 +1062,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1039,20 +1091,20 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1076,37 +1128,37 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id36) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id37) Here are the steps of ‘docker run’ : -- Create the container -- If the status code is 404, it means the image doesn’t exists: \* Try +- Create the container +- If the status code is 404, it means the image doesn’t exists: \* Try to pull it \* Then retry to create the container -- Start the container -- If you are not in detached mode: \* Attach to the container, using +- Start the container +- If you are not in detached mode: \* Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: \* Display the +- If in detached mode or only stdin is attached: \* Display the container’s id -### Hijacking +### [3.2 Hijacking](#id38) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id39) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.6.md b/docs/sources/reference/api/docker_remote_api_v1.6.md index 4455608..fd6a650 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.6.md +++ b/docs/sources/reference/api/docker_remote_api_v1.6.md @@ -2,24 +2,76 @@ page_title: Remote API v1.6 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.6 - -## Introduction - -- The Remote API has replaced rcli -- The daemon listens on `unix:///var/run/docker.sock`{.docutils +# [Docker Remote API v1.6](#id1) + +Table of Contents + +- [Docker Remote API v1.6](#docker-remote-api-v1-6) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API has replaced rcli +- The daemon listens on `unix:///var/run/docker.sock`{.docutils .literal}, but you can [*Bind Docker to another host/port or a Unix socket*](../../../use/basics/#bind-docker). -- The API tends to be REST, but for some complex commands, like +- The API tends to be REST, but for some complex commands, like `attach` or `pull`{.docutils .literal}, the HTTP connection is hijacked to transport `stdout, stdin`{.docutils .literal} and `stderr` -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -80,24 +132,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -144,20 +196,20 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Query Parameters:   - - **name** – container name to use + - **name** – container name to use Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error **More Complex Example request, in 2 steps.** **First, use create to expose a Private Port, which can be bound back to a Public Port at @@ -202,7 +254,7 @@ page_keywords: API, Docker, rcli, REST, documentation **Now you can ssh into your new container on port 11022.** -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -267,11 +319,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -309,15 +361,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -348,11 +400,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -370,11 +422,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -403,15 +455,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -428,15 +480,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -453,15 +505,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -478,17 +530,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **signal** – Signal to send to the container (integer). When not + - **signal** – Signal to send to the container (integer). When not set, SIGKILL is assumed and the call will waits for the container to exit. Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -508,23 +560,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error **Stream details**: @@ -549,9 +601,9 @@ page_keywords: API, Docker, rcli, REST, documentation `STREAM_TYPE` can be: - - 0: stdin (will be writen on stdout) - - 1: stdout - - 2: stderr + - 0: stdin (will be writen on stdout) + - 1: stdout + - 2: stderr `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian. @@ -570,7 +622,7 @@ page_keywords: API, Docker, rcli, REST, documentation 4. Read the extracted size and output it on the correct output 5. Goto 1) -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -589,11 +641,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -610,17 +662,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -643,13 +695,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List images: +#### [List Images](#id20) `GET `{.descname}`/images/`{.descname}(*format*) : List images `format` could be json or viz (json @@ -714,16 +766,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -751,18 +803,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -784,10 +836,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -832,11 +884,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -865,11 +917,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -893,14 +945,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Status Codes: - - **200** – no error :statuscode 404: no such image :statuscode + - **200** – no error :statuscode 404: no such image :statuscode 500: server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -917,18 +969,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -950,12 +1002,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index @@ -988,9 +1040,9 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -1019,17 +1071,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -1052,11 +1104,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -1083,10 +1135,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1108,10 +1160,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1137,20 +1189,20 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1174,42 +1226,42 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id36) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id37) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id38) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id39) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.7.md b/docs/sources/reference/api/docker_remote_api_v1.7.md index 1d1bd27..0c8c962 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.7.md +++ b/docs/sources/reference/api/docker_remote_api_v1.7.md @@ -2,24 +2,80 @@ page_title: Remote API v1.7 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.7 - -## Introduction - -- The Remote API has replaced rcli -- The daemon listens on `unix:///var/run/docker.sock`{.docutils +# [Docker Remote API v1.7](#id1) + +Table of Contents + +- [Docker Remote API v1.7](#docker-remote-api-v1-7) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [Get a tarball containing all images and tags in a + repository](#get-a-tarball-containing-all-images-and-tags-in-a-repository) + - [Load a tarball with a set of images and tags into + docker](#load-a-tarball-with-a-set-of-images-and-tags-into-docker) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API has replaced rcli +- The daemon listens on `unix:///var/run/docker.sock`{.docutils .literal}, but you can [*Bind Docker to another host/port or a Unix socket*](../../../use/basics/#bind-docker). -- The API tends to be REST, but for some complex commands, like +- The API tends to be REST, but for some complex commands, like `attach` or `pull`{.docutils .literal}, the HTTP connection is hijacked to transport `stdout, stdin`{.docutils .literal} and `stderr` -## Endpoints +## [2. Endpoints](#id3) -### Containers +### [2.1 Containers](#id4) -### List containers: +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -80,24 +136,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -149,16 +205,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **config** – the container’s configuration + - **config** – the container’s configuration Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -223,11 +279,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -265,15 +321,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -304,11 +360,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -326,11 +382,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -360,15 +416,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **hostConfig** – the container’s host configuration (optional) + - **hostConfig** – the container’s host configuration (optional) Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -385,15 +441,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -410,15 +466,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -433,11 +489,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -457,23 +513,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error **Stream details**: @@ -498,9 +554,9 @@ page_keywords: API, Docker, rcli, REST, documentation `STREAM_TYPE` can be: - - 0: stdin (will be writen on stdout) - - 1: stdout - - 2: stderr + - 0: stdin (will be writen on stdout) + - 1: stdout + - 2: stderr `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian. @@ -519,7 +575,7 @@ page_keywords: API, Docker, rcli, REST, documentation 4. Read the extracted size and output it on the correct output 5. Goto 1) -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -538,11 +594,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -559,17 +615,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -592,13 +648,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List images: +#### [List Images](#id20) `GET `{.descname}`/images/json`{.descname} : **Example request**: @@ -635,7 +691,7 @@ page_keywords: API, Docker, rcli, REST, documentation } ] -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -663,24 +719,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Request Headers:   - - **X-Registry-Auth** – base64-encoded AuthConfig object + - **X-Registry-Auth** – base64-encoded AuthConfig object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -702,10 +758,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -750,11 +806,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -783,11 +839,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -810,22 +866,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Request Headers:   - - **X-Registry-Auth** – include a base64-encoded AuthConfig + - **X-Registry-Auth** – include a base64-encoded AuthConfig object. Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -842,18 +898,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -875,12 +931,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index. @@ -928,16 +984,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **term** – term to search + - **term** – term to search Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -967,24 +1023,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image Request Headers:   - - **Content-type** – should be set to + - **Content-type** – should be set to `"application/tar"`. Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -1007,11 +1063,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -1038,10 +1094,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1063,10 +1119,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1086,22 +1142,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) - - **run** – config automatically applied when the image is run. + - **run** – config automatically applied when the image is run. (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1125,14 +1181,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Get a tarball containing all images and tags in a repository: +#### [Get a tarball containing all images and tags in a repository](#id36) `GET `{.descname}`/images/`{.descname}(*name*)`/get`{.descname} : Get a tarball containing all images and metadata for the repository @@ -1153,7 +1209,7 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -### Load a tarball with a set of images and tags into docker: +#### [Load a tarball with a set of images and tags into docker](#id37) `POST `{.descname}`/images/load`{.descname} : Load a set of images and tags into the docker repository. @@ -1173,35 +1229,35 @@ page_keywords: API, Docker, rcli, REST, documentation :statuscode 200: no error :statuscode 500: server error -## Going Further +## [3. Going further](#id38) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id39) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id40) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id41) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.8.md b/docs/sources/reference/api/docker_remote_api_v1.8.md index 49c8fb6..115cabc 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.8.md +++ b/docs/sources/reference/api/docker_remote_api_v1.8.md @@ -2,24 +2,80 @@ page_title: Remote API v1.8 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.8 - -## Introduction - -- The Remote API has replaced rcli -- The daemon listens on `unix:///var/run/docker.sock`{.docutils - .literal}, but you can [*Bind Docker to another host/port or a Unix - socket*](../../../use/basics/#bind-docker). -- The API tends to be REST, but for some complex commands, like - `attach` or `pull`{.docutils .literal}, the HTTP - connection is hijacked to transport `stdout, stdin`{.docutils - .literal} and `stderr` - -## Endpoints - -### Containers - -### List containers: +# [Docker Remote API v1.8](#id1) + +Table of Contents + +- [Docker Remote API v1.8](#docker-remote-api-v1-8) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from Dockerfile via + stdin](#build-an-image-from-dockerfile-via-stdin) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [Get a tarball containing all images and tags in a + repository](#get-a-tarball-containing-all-images-and-tags-in-a-repository) + - [Load a tarball with a set of images and tags into + docker](#load-a-tarball-with-a-set-of-images-and-tags-into-docker) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API has replaced rcli +- The daemon listens on `unix:///var/run/docker.sock`{.docutils + .literal}, but you can [*Bind Docker to another host/port or a Unix + socket*](../../../use/basics/#bind-docker). +- The API tends to be REST, but for some complex commands, like + `attach` or `pull`{.docutils .literal}, the HTTP + connection is hijacked to transport `stdout, stdin`{.docutils + .literal} and `stderr` + +## [2. Endpoints](#id3) + +### [2.1 Containers](#id4) + +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -80,24 +136,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -150,36 +206,36 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **Hostname** – Container host name - - **User** – Username or UID - - **Memory** – Memory Limit in bytes - - **CpuShares** – CPU shares (relative weight - - **AttachStdin** – 1/True/true or 0/False/false, attach to + - **Hostname** – Container host name + - **User** – Username or UID + - **Memory** – Memory Limit in bytes + - **CpuShares** – CPU shares (relative weight) + - **AttachStdin** – 1/True/true or 0/False/false, attach to standard input. Default false - - **AttachStdout** – 1/True/true or 0/False/false, attach to + - **AttachStdout** – 1/True/true or 0/False/false, attach to standard output. Default false - - **AttachStderr** – 1/True/true or 0/False/false, attach to + - **AttachStderr** – 1/True/true or 0/False/false, attach to standard error. Default false - - **Tty** – 1/True/true or 0/False/false, allocate a pseudo-tty. + - **Tty** – 1/True/true or 0/False/false, allocate a pseudo-tty. Default false - - **OpenStdin** – 1/True/true or 0/False/false, keep stdin open + - **OpenStdin** – 1/True/true or 0/False/false, keep stdin open even if not attached. Default false Query Parameters:   - - **name** – Assign the specified name to the container. Must + - **name** – Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`. Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -260,11 +316,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -302,15 +358,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -341,11 +397,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Export a container: +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -363,11 +419,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Start a container: +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -394,24 +450,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **Binds** – Create a bind mount to a directory or file with + - **Binds** – Create a bind mount to a directory or file with [host-path]:[container-path]:[rw|ro]. If a directory “container-path” is missing, then docker creates a new volume. - - **LxcConf** – Map of custom lxc options - - **PortBindings** – Expose ports from the container, optionally + - **LxcConf** – Map of custom lxc options + - **PortBindings** – Expose ports from the container, optionally publishing them via the HostPort flag - - **PublishAllPorts** – 1/True/true or 0/False/false, publish all + - **PublishAllPorts** – 1/True/true or 0/False/false, publish all exposed ports to the host interfaces. Default false - - **Privileged** – 1/True/true or 0/False/false, give extended + - **Privileged** – 1/True/true or 0/False/false, give extended privileges to this container. Default false Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Stop a container: +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -428,15 +484,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Restart a container: +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -453,15 +509,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Kill a container: +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -476,11 +532,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error + - **204** – no error + - **404** – no such container + - **500** – server error -### Attach to a container: +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -500,23 +556,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error **Stream details**: @@ -541,9 +597,9 @@ page_keywords: API, Docker, rcli, REST, documentation `STREAM_TYPE` can be: - - 0: stdin (will be writen on stdout - - 1: stdout - - 2: stderr + - 0: stdin (will be writen on stdout) + - 1: stdout + - 2: stderr `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian. @@ -560,9 +616,9 @@ page_keywords: API, Docker, rcli, REST, documentation 2. chose stdout or stderr depending on the first byte 3. Extract the frame size from the last 4 byets 4. Read the extracted size and output it on the correct output - 5. Goto 1 + 5. Goto 1) -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -581,13 +637,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) - `DELETE `{.descname}`/containers/`{.descname}(*id* + `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem **Example request**: @@ -602,17 +658,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -635,13 +691,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Images +### [2.2 Images](#id19) -### List Images: +#### [List Images](#id20) `GET `{.descname}`/images/json`{.descname} : **Example request**: @@ -678,7 +734,7 @@ page_keywords: API, Docker, rcli, REST, documentation } ] -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -706,24 +762,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Request Headers:   - - **X-Registry-Auth** – base64-encoded AuthConfig object + - **X-Registry-Auth** – base64-encoded AuthConfig object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Insert a file in an image: +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -745,10 +801,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -793,11 +849,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -826,11 +882,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Push an image on the registry: +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -853,22 +909,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Request Headers:   - - **X-Registry-Auth** – include a base64-encoded AuthConfig + - **X-Registry-Auth** – include a base64-encoded AuthConfig object. Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -885,20 +941,20 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) - `DELETE `{.descname}`/images/`{.descname}(*name* + `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem **Example request**: @@ -918,12 +974,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index. @@ -971,16 +1027,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **term** – term to search + - **term** – term to search Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile via stdin: +#### [Build an image from Dockerfile via stdin](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile via stdin @@ -1012,25 +1068,25 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image Request Headers:   - - **Content-type** – should be set to + - **Content-type** – should be set to `"application/tar"`. - - **X-Registry-Auth** – base64-encoded AuthConfig object + - **X-Registry-Auth** – base64-encoded AuthConfig object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -1053,11 +1109,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -1084,10 +1140,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1109,10 +1165,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1132,26 +1188,26 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith - \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>” - - **run** – config automatically applied when the image is run. - (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]} + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith + \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) + - **run** – config automatically applied when the image is run. + (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via - polling (using since + polling (using since) **Example request**: @@ -1171,14 +1227,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Get a tarball containing all images and tags in a repository: +#### [Get a tarball containing all images and tags in a repository](#id36) `GET `{.descname}`/images/`{.descname}(*name*)`/get`{.descname} : Get a tarball containing all images and metadata for the repository @@ -1197,10 +1253,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Load a tarball with a set of images and tags into docker: +#### [Load a tarball with a set of images and tags into docker](#id37) `POST `{.descname}`/images/load`{.descname} : Load a set of images and tags into the docker repository. @@ -1217,38 +1273,38 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id38) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id39) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id40) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id41) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.9.md b/docs/sources/reference/api/docker_remote_api_v1.9.md index 658835c..c25f837 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.9.md +++ b/docs/sources/reference/api/docker_remote_api_v1.9.md @@ -2,24 +2,80 @@ page_title: Remote API v1.9 page_description: API Documentation for Docker page_keywords: API, Docker, rcli, REST, documentation -# Docker Remote API v1.9 - -## Introduction - -- The Remote API has replaced rcli -- The daemon listens on `unix:///var/run/docker.sock`{.docutils - .literal}, but you can [*Bind Docker to another host/port or a Unix - socket*](../../../use/basics/#bind-docker). -- The API tends to be REST, but for some complex commands, like - `attach` or `pull`{.docutils .literal}, the HTTP - connection is hijacked to transport `stdout, stdin`{.docutils - .literal} and `stderr` - -## Endpoints - -## Containers - -### List containers: +# [Docker Remote API v1.9](#id1) + +Table of Contents + +- [Docker Remote API v1.9](#docker-remote-api-v1-9) + - [1. Brief introduction](#brief-introduction) + - [2. Endpoints](#endpoints) + - [2.1 Containers](#containers) + - [List containers](#list-containers) + - [Create a container](#create-a-container) + - [Inspect a container](#inspect-a-container) + - [List processes running inside a + container](#list-processes-running-inside-a-container) + - [Inspect changes on a container’s + filesystem](#inspect-changes-on-a-container-s-filesystem) + - [Export a container](#export-a-container) + - [Start a container](#start-a-container) + - [Stop a container](#stop-a-container) + - [Restart a container](#restart-a-container) + - [Kill a container](#kill-a-container) + - [Attach to a container](#attach-to-a-container) + - [Wait a container](#wait-a-container) + - [Remove a container](#remove-a-container) + - [Copy files or folders from a + container](#copy-files-or-folders-from-a-container) + - [2.2 Images](#images) + - [List Images](#list-images) + - [Create an image](#create-an-image) + - [Insert a file in an image](#insert-a-file-in-an-image) + - [Inspect an image](#inspect-an-image) + - [Get the history of an + image](#get-the-history-of-an-image) + - [Push an image on the + registry](#push-an-image-on-the-registry) + - [Tag an image into a + repository](#tag-an-image-into-a-repository) + - [Remove an image](#remove-an-image) + - [Search images](#search-images) + - [2.3 Misc](#misc) + - [Build an image from + Dockerfile](#build-an-image-from-dockerfile) + - [Check auth configuration](#check-auth-configuration) + - [Display system-wide + information](#display-system-wide-information) + - [Show the docker version + information](#show-the-docker-version-information) + - [Create a new image from a container’s + changes](#create-a-new-image-from-a-container-s-changes) + - [Monitor Docker’s events](#monitor-docker-s-events) + - [Get a tarball containing all images and tags in a + repository](#get-a-tarball-containing-all-images-and-tags-in-a-repository) + - [Load a tarball with a set of images and tags into + docker](#load-a-tarball-with-a-set-of-images-and-tags-into-docker) + - [3. Going further](#going-further) + - [3.1 Inside ‘docker run’](#inside-docker-run) + - [3.2 Hijacking](#hijacking) + - [3.3 CORS Requests](#cors-requests) + +## [1. Brief introduction](#id2) + +- The Remote API has replaced rcli +- The daemon listens on `unix:///var/run/docker.sock`{.docutils + .literal}, but you can [*Bind Docker to another host/port or a Unix + socket*](../../../use/basics/#bind-docker). +- The API tends to be REST, but for some complex commands, like + `attach` or `pull`{.docutils .literal}, the HTTP + connection is hijacked to transport `stdout, stdin`{.docutils + .literal} and `stderr` + +## [2. Endpoints](#id3) + +### [2.1 Containers](#id4) + +#### [List containers](#id5) `GET `{.descname}`/containers/json`{.descname} : List containers @@ -80,24 +136,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **all** – 1/True/true or 0/False/false, Show all containers. + - **all** – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default - - **limit** – Show `limit` last created + - **limit** – Show `limit` last created containers, include non-running ones. - - **since** – Show only containers created since Id, include + - **since** – Show only containers created since Id, include non-running ones. - - **before** – Show only containers created before Id, include + - **before** – Show only containers created before Id, include non-running ones. - - **size** – 1/True/true or 0/False/false, Show the containers + - **size** – 1/True/true or 0/False/false, Show the containers sizes Status Codes: - - **200** – no error - - **400** – bad parameter - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **500** – server error -### Create a container: +#### [Create a container](#id6) `POST `{.descname}`/containers/create`{.descname} : Create a container @@ -150,36 +206,36 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **Hostname** – Container host name - - **User** – Username or UID - - **Memory** – Memory Limit in bytes - - **CpuShares** – CPU shares (relative weight) - - **AttachStdin** – 1/True/true or 0/False/false, attach to + - **Hostname** – Container host name + - **User** – Username or UID + - **Memory** – Memory Limit in bytes + - **CpuShares** – CPU shares (relative weight) + - **AttachStdin** – 1/True/true or 0/False/false, attach to standard input. Default false - - **AttachStdout** – 1/True/true or 0/False/false, attach to + - **AttachStdout** – 1/True/true or 0/False/false, attach to standard output. Default false - - **AttachStderr** – 1/True/true or 0/False/false, attach to + - **AttachStderr** – 1/True/true or 0/False/false, attach to standard error. Default false - - **Tty** – 1/True/true or 0/False/false, allocate a pseudo-tty. + - **Tty** – 1/True/true or 0/False/false, allocate a pseudo-tty. Default false - - **OpenStdin** – 1/True/true or 0/False/false, keep stdin open + - **OpenStdin** – 1/True/true or 0/False/false, keep stdin open even if not attached. Default false Query Parameters:   - - **name** – Assign the specified name to the container. Must + - **name** – Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`. Status Codes: - - **201** – no error - - **404** – no such container - - **406** – impossible to attach (container not running) - - **500** – server error + - **201** – no error + - **404** – no such container + - **406** – impossible to attach (container not running) + - **500** – server error -### Inspect a container: +#### [Inspect a container](#id7) `GET `{.descname}`/containers/`{.descname}(*id*)`/json`{.descname} : Return low-level information on the container `id`{.docutils @@ -260,11 +316,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### List processes running inside a container: +#### [List processes running inside a container](#id8) `GET `{.descname}`/containers/`{.descname}(*id*)`/top`{.descname} : List processes running inside the container `id` @@ -302,15 +358,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **ps\_args** – ps arguments to use (eg. aux) + - **ps\_args** – ps arguments to use (eg. aux) Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Inspect changes on a container’s filesystem: +#### [Inspect changes on a container’s filesystem](#id9) `GET `{.descname}`/containers/`{.descname}(*id*)`/changes`{.descname} : Inspect changes on container `id` ‘s filesystem @@ -341,12 +397,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error - -### Export a container: + - **200** – no error + - **404** – no such container + - **500** – server error +#### [Export a container](#id10) `GET `{.descname}`/containers/`{.descname}(*id*)`/export`{.descname} : Export the contents of container `id` @@ -364,12 +419,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error - -### Start a container: + - **200** – no error + - **404** – no such container + - **500** – server error +#### [Start a container](#id11) `POST `{.descname}`/containers/`{.descname}(*id*)`/start`{.descname} : Start the container `id` @@ -396,25 +450,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **Binds** – Create a bind mount to a directory or file with + - **Binds** – Create a bind mount to a directory or file with [host-path]:[container-path]:[rw|ro]. If a directory “container-path” is missing, then docker creates a new volume. - - **LxcConf** – Map of custom lxc options - - **PortBindings** – Expose ports from the container, optionally + - **LxcConf** – Map of custom lxc options + - **PortBindings** – Expose ports from the container, optionally publishing them via the HostPort flag - - **PublishAllPorts** – 1/True/true or 0/False/false, publish all + - **PublishAllPorts** – 1/True/true or 0/False/false, publish all exposed ports to the host interfaces. Default false - - **Privileged** – 1/True/true or 0/False/false, give extended + - **Privileged** – 1/True/true or 0/False/false, give extended privileges to this container. Default false Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error - -### Stop a container: + - **204** – no error + - **404** – no such container + - **500** – server error +#### [Stop a container](#id12) `POST `{.descname}`/containers/`{.descname}(*id*)`/stop`{.descname} : Stop the container `id` @@ -431,16 +484,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error - -### Restart a container: + - **204** – no error + - **404** – no such container + - **500** – server error +#### [Restart a container](#id13) `POST `{.descname}`/containers/`{.descname}(*id*)`/restart`{.descname} : Restart the container `id` @@ -457,16 +509,15 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – number of seconds to wait before killing the container + - **t** – number of seconds to wait before killing the container Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error - -### Kill a container: + - **204** – no error + - **404** – no such container + - **500** – server error +#### [Kill a container](#id14) `POST `{.descname}`/containers/`{.descname}(*id*)`/kill`{.descname} : Kill the container `id` @@ -481,12 +532,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **204** – no error - - **404** – no such container - - **500** – server error - -### Attach to a container: + - **204** – no error + - **404** – no such container + - **500** – server error +#### [Attach to a container](#id15) `POST `{.descname}`/containers/`{.descname}(*id*)`/attach`{.descname} : Attach to the container `id` @@ -506,23 +556,23 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **logs** – 1/True/true or 0/False/false, return logs. Default + - **logs** – 1/True/true or 0/False/false, return logs. Default false - - **stream** – 1/True/true or 0/False/false, return stream. + - **stream** – 1/True/true or 0/False/false, return stream. Default false - - **stdin** – 1/True/true or 0/False/false, if stream=true, attach + - **stdin** – 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false - - **stdout** – 1/True/true or 0/False/false, if logs=true, return + - **stdout** – 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false - - **stderr** – 1/True/true or 0/False/false, if logs=true, return + - **stderr** – 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false Status Codes: - - **200** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **200** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error **Stream details**: @@ -547,9 +597,9 @@ page_keywords: API, Docker, rcli, REST, documentation `STREAM_TYPE` can be: - - 0: stdin (will be writen on stdout) - - 1: stdout - - 2: stderr + - 0: stdin (will be writen on stdout) + - 1: stdout + - 2: stderr `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian. @@ -568,7 +618,7 @@ page_keywords: API, Docker, rcli, REST, documentation 4. Read the extracted size and output it on the correct output 5. Goto 1) -### Wait a container: +#### [Wait a container](#id16) `POST `{.descname}`/containers/`{.descname}(*id*)`/wait`{.descname} : Block until container `id` stops, then returns @@ -587,11 +637,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -### Remove a container: +#### [Remove a container](#id17) `DELETE `{.descname}`/containers/`{.descname}(*id*) : Remove the container `id` from the filesystem @@ -608,17 +658,17 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **v** – 1/True/true or 0/False/false, Remove the volumes + - **v** – 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false Status Codes: - - **204** – no error - - **400** – bad parameter - - **404** – no such container - - **500** – server error + - **204** – no error + - **400** – bad parameter + - **404** – no such container + - **500** – server error -### Copy files or folders from a container: +#### [Copy files or folders from a container](#id18) `POST `{.descname}`/containers/`{.descname}(*id*)`/copy`{.descname} : Copy files or folders of container `id` @@ -641,13 +691,13 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such container - - **500** – server error + - **200** – no error + - **404** – no such container + - **500** – server error -## Images +### [2.2 Images](#id19) -### List Images: +#### [List Images](#id20) `GET `{.descname}`/images/json`{.descname} : **Example request**: @@ -684,7 +734,7 @@ page_keywords: API, Docker, rcli, REST, documentation } ] -### Create an image: +#### [Create an image](#id21) `POST `{.descname}`/images/create`{.descname} : Create an image, either by pull it from the registry or by importing @@ -712,25 +762,24 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **fromImage** – name of the image to pull - - **fromSrc** – source to import, - means stdin - - **repo** – repository - - **tag** – tag - - **registry** – the registry to pull from + - **fromImage** – name of the image to pull + - **fromSrc** – source to import, - means stdin + - **repo** – repository + - **tag** – tag + - **registry** – the registry to pull from Request Headers:   - - **X-Registry-Auth** – base64-encoded AuthConfig object + - **X-Registry-Auth** – base64-encoded AuthConfig object Status Codes: - - **200** – no error - - **500** – server error - -### Insert a file in an image: + - **200** – no error + - **500** – server error +#### [Insert a file in an image](#id22) `POST `{.descname}`/images/`{.descname}(*name*)`/insert`{.descname} : Insert a file from `url` in the image @@ -752,10 +801,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Inspect an image: +#### [Inspect an image](#id23) `GET `{.descname}`/images/`{.descname}(*name*)`/json`{.descname} : Return low-level information on the image `name` @@ -800,11 +849,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Get the history of an image: +#### [Get the history of an image](#id24) `GET `{.descname}`/images/`{.descname}(*name*)`/history`{.descname} : Return the history of the image `name` @@ -833,12 +882,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error - -### Push an image on the registry: + - **200** – no error + - **404** – no such image + - **500** – server error +#### [Push an image on the registry](#id25) `POST `{.descname}`/images/`{.descname}(*name*)`/push`{.descname} : Push the image `name` on the registry @@ -861,22 +909,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **registry** – the registry you wan to push, optional + - **registry** – the registry you wan to push, optional Request Headers:   - - **X-Registry-Auth** – include a base64-encoded AuthConfig + - **X-Registry-Auth** – include a base64-encoded AuthConfig object. Status Codes: - - **200** – no error - - **404** – no such image - - **500** – server error + - **200** – no error + - **404** – no such image + - **500** – server error -### Tag an image into a repository: +#### [Tag an image into a repository](#id26) `POST `{.descname}`/images/`{.descname}(*name*)`/tag`{.descname} : Tag the image `name` into a repository @@ -893,18 +941,18 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **repo** – The repository to tag in - - **force** – 1/True/true or 0/False/false, default false + - **repo** – The repository to tag in + - **force** – 1/True/true or 0/False/false, default false Status Codes: - - **201** – no error - - **400** – bad parameter - - **404** – no such image - - **409** – conflict - - **500** – server error + - **201** – no error + - **400** – bad parameter + - **404** – no such image + - **409** – conflict + - **500** – server error -### Remove an image: +#### [Remove an image](#id27) `DELETE `{.descname}`/images/`{.descname}(*name*) : Remove the image `name` from the filesystem @@ -926,12 +974,12 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **404** – no such image - - **409** – conflict - - **500** – server error + - **200** – no error + - **404** – no such image + - **409** – conflict + - **500** – server error -### Search images: +#### [Search images](#id28) `GET `{.descname}`/images/search`{.descname} : Search for an image in the docker index. @@ -979,16 +1027,16 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **term** – term to search + - **term** – term to search Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Misc +### [2.3 Misc](#id29) -### Build an image from Dockerfile: +#### [Build an image from Dockerfile](#id30) `POST `{.descname}`/build`{.descname} : Build an image from Dockerfile using a POST body. @@ -1020,26 +1068,26 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **t** – repository name (and optionally a tag) to be applied to + - **t** – repository name (and optionally a tag) to be applied to the resulting image in case of success - - **q** – suppress verbose build output - - **nocache** – do not use the cache when building the image - - **rm** – Remove intermediate containers after a successful build + - **q** – suppress verbose build output + - **nocache** – do not use the cache when building the image + - **rm** – Remove intermediate containers after a successful build Request Headers:   - - **Content-type** – should be set to + - **Content-type** – should be set to `"application/tar"`. - - **X-Registry-Config** – base64-encoded ConfigFile object + - **X-Registry-Config** – base64-encoded ConfigFile object Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Check auth configuration: +#### [Check auth configuration](#id31) `POST `{.descname}`/auth`{.descname} : Get the default username and email @@ -1062,11 +1110,11 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **204** – no error - - **500** – server error + - **200** – no error + - **204** – no error + - **500** – server error -### Display system-wide information: +#### [Display system-wide information](#id32) `GET `{.descname}`/info`{.descname} : Display system-wide information @@ -1093,10 +1141,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Show the docker version information: +#### [Show the docker version information](#id33) `GET `{.descname}`/version`{.descname} : Show the docker version information @@ -1118,10 +1166,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Create a new image from a container’s changes: +#### [Create a new image from a container’s changes](#id34) `POST `{.descname}`/commit`{.descname} : Create a new image from a container’s changes @@ -1141,22 +1189,22 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **container** – source container - - **repo** – repository - - **tag** – tag - - **m** – commit message - - **author** – author (eg. “John Hannibal Smith + - **container** – source container + - **repo** – repository + - **tag** – tag + - **m** – commit message + - **author** – author (eg. “John Hannibal Smith \<[hannibal@a-team.com](mailto:hannibal%40a-team.com)\>”) - - **run** – config automatically applied when the image is run. + - **run** – config automatically applied when the image is run. (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) Status Codes: - - **201** – no error - - **404** – no such container - - **500** – server error + - **201** – no error + - **404** – no such container + - **500** – server error -### Monitor Docker’s events: +#### [Monitor Docker’s events](#id35) `GET `{.descname}`/events`{.descname} : Get events from docker, either in real time via streaming, or via @@ -1180,14 +1228,14 @@ page_keywords: API, Docker, rcli, REST, documentation   - - **since** – timestamp used for polling + - **since** – timestamp used for polling Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Get a tarball containing all images and tags in a repository: +#### [Get a tarball containing all images and tags in a repository](#id36) `GET `{.descname}`/images/`{.descname}(*name*)`/get`{.descname} : Get a tarball containing all images and metadata for the repository @@ -1206,10 +1254,10 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -### Load a tarball with a set of images and tags into docker: +#### [Load a tarball with a set of images and tags into docker](#id37) `POST `{.descname}`/images/load`{.descname} : Load a set of images and tags into the docker repository. @@ -1226,38 +1274,38 @@ page_keywords: API, Docker, rcli, REST, documentation Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error -## Going Further +## [3. Going further](#id38) -### Inside ‘docker run’ +### [3.1 Inside ‘docker run’](#id39) Here are the steps of ‘docker run’ : -- Create the container +- Create the container -- If the status code is 404, it means the image doesn’t exists: - : - Try to pull it - - Then retry to create the container +- If the status code is 404, it means the image doesn’t exists: + : - Try to pull it + - Then retry to create the container -- Start the container +- Start the container -- If you are not in detached mode: - : - Attach to the container, using logs=1 (to have stdout and +- If you are not in detached mode: + : - Attach to the container, using logs=1 (to have stdout and stderr from the container’s start) and stream=1 -- If in detached mode or only stdin is attached: - : - Display the container’s id +- If in detached mode or only stdin is attached: + : - Display the container’s id -### Hijacking +### [3.2 Hijacking](#id40) In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. -### CORS Requests +### [3.3 CORS Requests](#id41) To enable cross origin requests to the remote api add the flag -“-api-enable-cors” when running docker in daemon mode. +“–api-enable-cors” when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" -api-enable-cors + docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/index_api.md b/docs/sources/reference/api/index_api.md index 83cf36b..e9bcc2b 100644 --- a/docs/sources/reference/api/index_api.md +++ b/docs/sources/reference/api/index_api.md @@ -4,17 +4,19 @@ page_keywords: API, Docker, index, REST, documentation # Docker Index API -## Introduction +## 1. Brief introduction -- This is the REST API for the Docker index -- Authorization is done with basic auth over SSL -- Not all commands require authentication, only those noted as such. +- This is the REST API for the Docker index +- Authorization is done with basic auth over SSL +- Not all commands require authentication, only those noted as such. -## Repository +## 2. Endpoints -### Repositories +### 2.1 Repository -### User Repo +#### Repositories + +##### User Repo `PUT `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repo\_name*)`/`{.descname} : Create a user repository with the given `namespace`{.docutils @@ -33,8 +35,8 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **namespace** – the namespace for the repo - - **repo\_name** – the name for the repo + - **namespace** – the namespace for the repo + - **repo\_name** – the name for the repo **Example Response**: @@ -49,10 +51,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – Created - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active + - **200** – Created + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active `DELETE `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repo\_name*)`/`{.descname} : Delete a user repository with the given `namespace`{.docutils @@ -71,8 +73,8 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **namespace** – the namespace for the repo - - **repo\_name** – the name for the repo + - **namespace** – the namespace for the repo + - **repo\_name** – the name for the repo **Example Response**: @@ -87,13 +89,13 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – Deleted - - **202** – Accepted - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active + - **200** – Deleted + - **202** – Accepted + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active -### Library Repo +##### Library Repo `PUT `{.descname}`/v1/repositories/`{.descname}(*repo\_name*)`/`{.descname} : Create a library repository with the given `repo_name`{.docutils @@ -116,7 +118,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **repo\_name** – the library name for the repo + - **repo\_name** – the library name for the repo **Example Response**: @@ -131,10 +133,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – Created - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active + - **200** – Created + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active `DELETE `{.descname}`/v1/repositories/`{.descname}(*repo\_name*)`/`{.descname} : Delete a library repository with the given `repo_name`{.docutils @@ -157,7 +159,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **repo\_name** – the library name for the repo + - **repo\_name** – the library name for the repo **Example Response**: @@ -172,15 +174,15 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – Deleted - - **202** – Accepted - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active + - **200** – Deleted + - **202** – Accepted + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active -### Repository Images +#### Repository Images -### User Repo Images +##### User Repo Images `PUT `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repo\_name*)`/images`{.descname} : Update the images for a user repo. @@ -198,8 +200,8 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **namespace** – the namespace for the repo - - **repo\_name** – the name for the repo + - **namespace** – the namespace for the repo + - **repo\_name** – the name for the repo **Example Response**: @@ -211,10 +213,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **204** – Created - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active or permission denied + - **204** – Created + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active or permission denied `GET `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repo\_name*)`/images`{.descname} : get the images for a user repo. @@ -227,8 +229,8 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **namespace** – the namespace for the repo - - **repo\_name** – the name for the repo + - **namespace** – the namespace for the repo + - **repo\_name** – the name for the repo **Example Response**: @@ -243,10 +245,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – OK - - **404** – Not found + - **200** – OK + - **404** – Not found -### Library Repo Images +##### Library Repo Images `PUT `{.descname}`/v1/repositories/`{.descname}(*repo\_name*)`/images`{.descname} : Update the images for a library repo. @@ -264,7 +266,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **repo\_name** – the library name for the repo + - **repo\_name** – the library name for the repo **Example Response**: @@ -276,10 +278,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **204** – Created - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active or permission denied + - **204** – Created + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active or permission denied `GET `{.descname}`/v1/repositories/`{.descname}(*repo\_name*)`/images`{.descname} : get the images for a library repo. @@ -292,7 +294,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **repo\_name** – the library name for the repo + - **repo\_name** – the library name for the repo **Example Response**: @@ -307,12 +309,12 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – OK - - **404** – Not found + - **200** – OK + - **404** – Not found -### Repository Authorization +#### Repository Authorization -### Library Repo +##### Library Repo `PUT `{.descname}`/v1/repositories/`{.descname}(*repo\_name*)`/auth`{.descname} : authorize a token for a library repo @@ -326,7 +328,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **repo\_name** – the library name for the repo + - **repo\_name** – the library name for the repo **Example Response**: @@ -338,11 +340,11 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – OK - - **403** – Permission denied - - **404** – Not found + - **200** – OK + - **403** – Permission denied + - **404** – Not found -### User Repo +##### User Repo `PUT `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repo\_name*)`/auth`{.descname} : authorize a token for a user repo @@ -356,8 +358,8 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **namespace** – the namespace for the repo - - **repo\_name** – the name for the repo + - **namespace** – the namespace for the repo + - **repo\_name** – the name for the repo **Example Response**: @@ -369,13 +371,13 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – OK - - **403** – Permission denied - - **404** – Not found + - **200** – OK + - **403** – Permission denied + - **404** – Not found -### Users +### 2.2 Users -### User Login +#### User Login `GET `{.descname}`/v1/users`{.descname} : If you want to check your login, you can try this endpoint @@ -397,11 +399,11 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **200** – no error - - **401** – Unauthorized - - **403** – Account is not Active + - **200** – no error + - **401** – Unauthorized + - **403** – Account is not Active -### User Register +#### User Register `POST `{.descname}`/v1/users`{.descname} : Registering a new account. @@ -421,10 +423,10 @@ page_keywords: API, Docker, index, REST, documentation   - - **email** – valid email address, that needs to be confirmed - - **username** – min 4 character, max 30 characters, must match + - **email** – valid email address, that needs to be confirmed + - **username** – min 4 character, max 30 characters, must match the regular expression [a-z0-9\_]. - - **password** – min 5 characters + - **password** – min 5 characters **Example Response**: @@ -436,10 +438,10 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **201** – User Created - - **400** – Errors (invalid json, missing or invalid fields, etc) + - **201** – User Created + - **400** – Errors (invalid json, missing or invalid fields, etc) -### Update User +#### Update User `PUT `{.descname}`/v1/users/`{.descname}(*username*)`/`{.descname} : Change a password or email address for given user. If you pass in an @@ -463,7 +465,7 @@ page_keywords: API, Docker, index, REST, documentation Parameters: - - **username** – username for the person you want to update + - **username** – username for the person you want to update **Example Response**: @@ -475,17 +477,17 @@ page_keywords: API, Docker, index, REST, documentation Status Codes: - - **204** – User Updated - - **400** – Errors (invalid json, missing or invalid fields, etc) - - **401** – Unauthorized - - **403** – Account is not Active - - **404** – User not found + - **204** – User Updated + - **400** – Errors (invalid json, missing or invalid fields, etc) + - **401** – Unauthorized + - **403** – Account is not Active + - **404** – User not found -## Search +### 2.3 Search If you need to search the index, this is the endpoint you would use. -### Search +#### Search `GET `{.descname}`/v1/search`{.descname} : Search the Index given a search term. It accepts @@ -515,11 +517,13 @@ If you need to search the index, this is the endpoint you would use. Query Parameters: - - **q** – what you want to search for +   + + - **q** – what you want to search for Status Codes: - - **200** – no error - - **500** – server error + - **200** – no error + - **500** – server error diff --git a/docs/sources/reference/api/registry_api.md b/docs/sources/reference/api/registry_api.md index e067586..f251169 100644 --- a/docs/sources/reference/api/registry_api.md +++ b/docs/sources/reference/api/registry_api.md @@ -4,34 +4,34 @@ page_keywords: API, Docker, index, registry, REST, documentation # Docker Registry API -## Introduction +## 1. Brief introduction -- This is the REST API for the Docker Registry -- It stores the images and the graph for a set of repositories -- It does not have user accounts data -- It has no notion of user accounts or authorization -- It delegates authentication and authorization to the Index Auth +- This is the REST API for the Docker Registry +- It stores the images and the graph for a set of repositories +- It does not have user accounts data +- It has no notion of user accounts or authorization +- It delegates authentication and authorization to the Index Auth service using tokens -- It supports different storage backends (S3, cloud files, local FS) -- It doesn’t have a local database -- It will be open-sourced at some point +- It supports different storage backends (S3, cloud files, local FS) +- It doesn’t have a local database +- It will be open-sourced at some point We expect that there will be multiple registries out there. To help to grasp the context, here are some examples of registries: -- **sponsor registry**: such a registry is provided by a third-party +- **sponsor registry**: such a registry is provided by a third-party hosting infrastructure as a convenience for their customers and the docker community as a whole. Its costs are supported by the third party, but the management and operation of the registry are supported by dotCloud. It features read/write access, and delegates authentication and authorization to the Index. -- **mirror registry**: such a registry is provided by a third-party +- **mirror registry**: such a registry is provided by a third-party hosting infrastructure but is targeted at their customers only. Some mechanism (unspecified to date) ensures that public images are pulled from a sponsor registry to the mirror registry, to make sure that the customers of the third-party provider can “docker pull” those images locally. -- **vendor registry**: such a registry is provided by a software +- **vendor registry**: such a registry is provided by a software vendor, who wants to distribute docker images. It would be operated and managed by the vendor. Only users authorized by the vendor would be able to get write access. Some images would be public (accessible @@ -41,7 +41,7 @@ grasp the context, here are some examples of registries: basho/riak1.3” and automatically push from the vendor registry (instead of a sponsor registry); i.e. get all the convenience of a sponsor registry, while retaining control on the asset distribution. -- **private registry**: such a registry is located behind a firewall, +- **private registry**: such a registry is located behind a firewall, or protected by an additional security layer (HTTP authorization, SSL client-side certificates, IP address authorization...). The registry is operated by a private entity, outside of dotCloud’s @@ -58,9 +58,9 @@ can be powered by a simple static HTTP server. Note The latter implies that while HTTP is the protocol of choice for a registry, multiple schemes are possible (and in some cases, trivial): -: - HTTP with GET (and PUT for read-write registries); - - local mount point; - - remote docker addressed through SSH. +: - HTTP with GET (and PUT for read-write registries); + - local mount point; + - remote docker addressed through SSH. The latter would only require two new commands in docker, e.g. `registryget` and `registryput`{.docutils .literal}, @@ -68,11 +68,11 @@ wrapping access to the local filesystem (and optionally doing consistency checks). Authentication and authorization are then delegated to SSH (e.g. with public keys). -## Endpoints +## 2. Endpoints -### Images +### 2.1 Images -### Layer +#### Layer `GET `{.descname}`/v1/images/`{.descname}(*image\_id*)`/layer`{.descname} : get image layer for a given `image_id` @@ -87,7 +87,7 @@ to SSH (e.g. with public keys). Parameters: - - **image\_id** – the id for the layer you want to get + - **image\_id** – the id for the layer you want to get **Example Response**: @@ -100,9 +100,9 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Image not found + - **200** – OK + - **401** – Requires authorization + - **404** – Image not found `PUT `{.descname}`/v1/images/`{.descname}(*image\_id*)`/layer`{.descname} : put image layer for a given `image_id` @@ -118,7 +118,7 @@ to SSH (e.g. with public keys). Parameters: - - **image\_id** – the id for the layer you want to get + - **image\_id** – the id for the layer you want to get **Example Response**: @@ -131,11 +131,11 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Image not found + - **200** – OK + - **401** – Requires authorization + - **404** – Image not found -### Image +#### Image `PUT `{.descname}`/v1/images/`{.descname}(*image\_id*)`/json`{.descname} : put image for a given `image_id` @@ -181,7 +181,7 @@ to SSH (e.g. with public keys). Parameters: - - **image\_id** – the id for the layer you want to get + - **image\_id** – the id for the layer you want to get **Example Response**: @@ -194,8 +194,8 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization + - **200** – OK + - **401** – Requires authorization `GET `{.descname}`/v1/images/`{.descname}(*image\_id*)`/json`{.descname} : get image for a given `image_id` @@ -210,7 +210,7 @@ to SSH (e.g. with public keys). Parameters: - - **image\_id** – the id for the layer you want to get + - **image\_id** – the id for the layer you want to get **Example Response**: @@ -254,11 +254,11 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Image not found + - **200** – OK + - **401** – Requires authorization + - **404** – Image not found -### Ancestry +#### Ancestry `GET `{.descname}`/v1/images/`{.descname}(*image\_id*)`/ancestry`{.descname} : get ancestry for an image given an `image_id` @@ -273,7 +273,7 @@ to SSH (e.g. with public keys). Parameters: - - **image\_id** – the id for the layer you want to get + - **image\_id** – the id for the layer you want to get **Example Response**: @@ -289,11 +289,11 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Image not found + - **200** – OK + - **401** – Requires authorization + - **404** – Image not found -### Tags +### 2.2 Tags `GET `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repository*)`/tags`{.descname} : get all of the tags for the given repo. @@ -309,8 +309,8 @@ to SSH (e.g. with public keys). Parameters: - - **namespace** – namespace for the repo - - **repository** – name for the repo + - **namespace** – namespace for the repo + - **repository** – name for the repo **Example Response**: @@ -326,9 +326,9 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Repository not found + - **200** – OK + - **401** – Requires authorization + - **404** – Repository not found `GET `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repository*)`/tags/`{.descname}(*tag*) : get a tag for the given repo. @@ -344,9 +344,9 @@ to SSH (e.g. with public keys). Parameters: - - **namespace** – namespace for the repo - - **repository** – name for the repo - - **tag** – name of tag you want to get + - **namespace** – namespace for the repo + - **repository** – name for the repo + - **tag** – name of tag you want to get **Example Response**: @@ -359,9 +359,9 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Tag not found + - **200** – OK + - **401** – Requires authorization + - **404** – Tag not found `DELETE `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repository*)`/tags/`{.descname}(*tag*) : delete the tag for the repo @@ -376,9 +376,9 @@ to SSH (e.g. with public keys). Parameters: - - **namespace** – namespace for the repo - - **repository** – name for the repo - - **tag** – name of tag you want to delete + - **namespace** – namespace for the repo + - **repository** – name for the repo + - **tag** – name of tag you want to delete **Example Response**: @@ -391,9 +391,9 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Tag not found + - **200** – OK + - **401** – Requires authorization + - **404** – Tag not found `PUT `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repository*)`/tags/`{.descname}(*tag*) : put a tag for the given repo. @@ -410,9 +410,9 @@ to SSH (e.g. with public keys). Parameters: - - **namespace** – namespace for the repo - - **repository** – name for the repo - - **tag** – name of tag you want to add + - **namespace** – namespace for the repo + - **repository** – name for the repo + - **tag** – name of tag you want to add **Example Response**: @@ -425,12 +425,12 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **400** – Invalid data - - **401** – Requires authorization - - **404** – Image not found + - **200** – OK + - **400** – Invalid data + - **401** – Requires authorization + - **404** – Image not found -### Repositories +### 2.3 Repositories `DELETE `{.descname}`/v1/repositories/`{.descname}(*namespace*)`/`{.descname}(*repository*)`/`{.descname} : delete a repository @@ -447,8 +447,8 @@ to SSH (e.g. with public keys). Parameters: - - **namespace** – namespace for the repo - - **repository** – name for the repo + - **namespace** – namespace for the repo + - **repository** – name for the repo **Example Response**: @@ -461,11 +461,11 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK - - **401** – Requires authorization - - **404** – Repository not found + - **200** – OK + - **401** – Requires authorization + - **404** – Repository not found -### Status +### 2.4 Status `GET `{.descname}`/v1/_ping`{.descname} : Check status of the registry. This endpoint is also used to @@ -491,9 +491,9 @@ to SSH (e.g. with public keys). Status Codes: - - **200** – OK + - **200** – OK -## Authorization +## 3 Authorization This is where we describe the authorization process, including the tokens and cookies. diff --git a/docs/sources/reference/api/registry_index_spec.md b/docs/sources/reference/api/registry_index_spec.md index dc0dd80..281fe07 100644 --- a/docs/sources/reference/api/registry_index_spec.md +++ b/docs/sources/reference/api/registry_index_spec.md @@ -4,55 +4,55 @@ page_keywords: docker, registry, api, index # Registry & Index Spec -## The 3 roles +## 1. The 3 roles -### Index +### 1.1 Index The Index is responsible for centralizing information about: -- User accounts -- Checksums of the images -- Public namespaces +- User accounts +- Checksums of the images +- Public namespaces The Index has different components: -- Web UI -- Meta-data store (comments, stars, list public repositories) -- Authentication service -- Tokenization +- Web UI +- Meta-data store (comments, stars, list public repositories) +- Authentication service +- Tokenization The index is authoritative for those information. We expect that there will be only one instance of the index, run and managed by Docker Inc. -### Registry +### 1.2 Registry -- It stores the images and the graph for a set of repositories -- It does not have user accounts data -- It has no notion of user accounts or authorization -- It delegates authentication and authorization to the Index Auth +- It stores the images and the graph for a set of repositories +- It does not have user accounts data +- It has no notion of user accounts or authorization +- It delegates authentication and authorization to the Index Auth service using tokens -- It supports different storage backends (S3, cloud files, local FS) -- It doesn’t have a local database -- [Source Code](https://github.com/dotcloud/docker-registry) +- It supports different storage backends (S3, cloud files, local FS) +- It doesn’t have a local database +- [Source Code](https://github.com/dotcloud/docker-registry) We expect that there will be multiple registries out there. To help to grasp the context, here are some examples of registries: -- **sponsor registry**: such a registry is provided by a third-party +- **sponsor registry**: such a registry is provided by a third-party hosting infrastructure as a convenience for their customers and the docker community as a whole. Its costs are supported by the third party, but the management and operation of the registry are supported by dotCloud. It features read/write access, and delegates authentication and authorization to the Index. -- **mirror registry**: such a registry is provided by a third-party +- **mirror registry**: such a registry is provided by a third-party hosting infrastructure but is targeted at their customers only. Some mechanism (unspecified to date) ensures that public images are pulled from a sponsor registry to the mirror registry, to make sure that the customers of the third-party provider can “docker pull” those images locally. -- **vendor registry**: such a registry is provided by a software +- **vendor registry**: such a registry is provided by a software vendor, who wants to distribute docker images. It would be operated and managed by the vendor. Only users authorized by the vendor would be able to get write access. Some images would be public (accessible @@ -62,20 +62,19 @@ grasp the context, here are some examples of registries: basho/riak1.3” and automatically push from the vendor registry (instead of a sponsor registry); i.e. get all the convenience of a sponsor registry, while retaining control on the asset distribution. -- **private registry**: such a registry is located behind a firewall, +- **private registry**: such a registry is located behind a firewall, or protected by an additional security layer (HTTP authorization, SSL client-side certificates, IP address authorization...). The registry is operated by a private entity, outside of dotCloud’s control. It can optionally delegate additional authorization to the Index, but it is not mandatory. -> **Note:** The latter implies that while HTTP is the protocol -> of choice for a registry, multiple schemes are possible (and -> in some cases, trivial): -> -> - HTTP with GET (and PUT for read-write registries); -> - local mount point; -> - remote docker addressed through SSH. +Note + +The latter implies that while HTTP is the protocol of choice for a registry, multiple schemes are possible (and in some cases, trivial): +: - HTTP with GET (and PUT for read-write registries); + - local mount point; + - remote docker addressed through SSH. The latter would only require two new commands in docker, e.g. `registryget` and `registryput`{.docutils .literal}, @@ -83,17 +82,17 @@ wrapping access to the local filesystem (and optionally doing consistency checks). Authentication and authorization are then delegated to SSH (e.g. with public keys). -### Docker +### 1.3 Docker On top of being a runtime for LXC, Docker is the Registry client. It supports: -- Push / Pull on the registry -- Client authentication on the Index +- Push / Pull on the registry +- Client authentication on the Index -## Workflow +## 2. Workflow -### Pull +### 2.1 Pull ![](../../../_images/docker_pull_chart.png) @@ -147,9 +146,9 @@ and for an active account. 2. (Index -\> Docker) HTTP 200 OK > **Headers**: - > : - Authorization: Token + > : - Authorization: Token > signature=123abc,repository=”foo/bar”,access=write - > - X-Docker-Endpoints: registry.docker.io [, + > - X-Docker-Endpoints: registry.docker.io [, > registry2.docker.io] > > **Body**: @@ -188,7 +187,7 @@ Note If someone makes a second request, then we will always give a new token, never reuse tokens. -### Push +### 2.2 Push ![](../../../_images/docker_push_chart.png) @@ -204,15 +203,17 @@ never reuse tokens. pushed by docker and store the repository (with its images) 6. docker contacts the index to give checksums for upload images -> **Note:** -> **It’s possible not to use the Index at all!** In this case, a deployed -> version of the Registry is deployed to store and serve images. Those -> images are not authenticated and the security is not guaranteed. +Note + +**It’s possible not to use the Index at all!** In this case, a deployed +version of the Registry is deployed to store and serve images. Those +images are not authenticated and the security is not guaranteed. + +Note -> **Note:** -> **Index can be replaced!** For a private Registry deployed, a custom -> Index can be used to serve and validate token according to different -> policies. +**Index can be replaced!** For a private Registry deployed, a custom +Index can be used to serve and validate token according to different +policies. Docker computes the checksums and submit them to the Index at the end of the push. When a repository name does not have checksums on the Index, @@ -227,7 +228,7 @@ the end). true **Action**:: - : - in index, we allocated a new repository, and set to + : - in index, we allocated a new repository, and set to initialized **Body**:: @@ -239,9 +240,9 @@ the end). 2. (Index -\> Docker) 200 Created : **Headers**: - : - WWW-Authenticate: Token + : - WWW-Authenticate: Token signature=123abc,repository=”foo/bar”,access=write - - X-Docker-Endpoints: registry.docker.io [, + - X-Docker-Endpoints: registry.docker.io [, registry2.docker.io] 3. (Docker -\> Registry) PUT /v1/images/98765432\_parent/json @@ -255,18 +256,18 @@ the end). signature=123abc,repository=”foo/bar”,access=write **Action**:: - : - Index: + : - Index: : will invalidate the token. - - Registry: + - Registry: : grants a session (if token is approved) and fetches the images id 5. (Docker -\> Registry) PUT /v1/images/98765432\_parent/json : **Headers**:: - : - Authorization: Token + : - Authorization: Token signature=123abc,repository=”foo/bar”,access=write - - Cookie: (Cookie provided by the Registry) + - Cookie: (Cookie provided by the Registry) 6. (Docker -\> Registry) PUT /v1/images/98765432/json : **Headers**: @@ -303,17 +304,19 @@ the end). **Return** HTTP 204 -> **Note:** If push fails and they need to start again, what happens in the index, -> there will already be a record for the namespace/name, but it will be -> initialized. Should we allow it, or mark as name already used? One edge -> case could be if someone pushes the same thing at the same time with two -> different shells. +Note + +If push fails and they need to start again, what happens in the index, +there will already be a record for the namespace/name, but it will be +initialized. Should we allow it, or mark as name already used? One edge +case could be if someone pushes the same thing at the same time with two +different shells. If it’s a retry on the Registry, Docker has a cookie (provided by the registry after token validation). So the Index won’t have to provide a new token. -### Delete +### 2.3 Delete If you need to delete something from the index or registry, we need a nice clean way to do that. Here is the workflow. @@ -333,9 +336,11 @@ nice clean way to do that. Here is the workflow. 6. docker contacts the index to let it know it was removed from the registry, the index removes all records from the database. -> **Note:** The Docker client should present an “Are you sure?” prompt to confirm -> the deletion before starting the process. Once it starts it can’t be -> undone. +Note + +The Docker client should present an “Are you sure?” prompt to confirm +the deletion before starting the process. Once it starts it can’t be +undone. #### API (deleting repository foo/bar): @@ -345,7 +350,7 @@ nice clean way to do that. Here is the workflow. true **Action**:: - : - in index, we make sure it is a valid repository, and set + : - in index, we make sure it is a valid repository, and set to deleted (logically) **Body**:: @@ -353,9 +358,9 @@ nice clean way to do that. Here is the workflow. 2. (Index -\> Docker) 202 Accepted : **Headers**: - : - WWW-Authenticate: Token + : - WWW-Authenticate: Token signature=123abc,repository=”foo/bar”,access=delete - - X-Docker-Endpoints: registry.docker.io [, + - X-Docker-Endpoints: registry.docker.io [, registry2.docker.io] \# list of endpoints where this repo lives. @@ -370,10 +375,10 @@ nice clean way to do that. Here is the workflow. signature=123abc,repository=”foo/bar”,access=delete **Action**:: - : - Index: + : - Index: : will invalidate the token. - - Registry: + - Registry: : deletes the repository (if token is approved) 5. (Registry -\> Docker) 200 OK @@ -391,20 +396,20 @@ nice clean way to do that. Here is the workflow. > > **Return** HTTP 200 -## How to use the Registry in standalone mode +## 3. How to use the Registry in standalone mode The Index has two main purposes (along with its fancy social features): -- Resolve short names (to avoid passing absolute URLs all the time) - : - username/projectname -\> +- Resolve short names (to avoid passing absolute URLs all the time) + : - username/projectname -\> https://registry.docker.io/users/\/repositories/\/ - - team/projectname -\> + - team/projectname -\> https://registry.docker.io/team/\/repositories/\/ -- Authenticate a user as a repos owner (for a central referenced +- Authenticate a user as a repos owner (for a central referenced repository) -### Without an Index +### 3.1 Without an Index Using the Registry without the Index can be useful to store the images on a private network without having to rely on an external entity @@ -425,12 +430,12 @@ As hinted previously, a standalone registry can also be implemented by any HTTP server handling GET/PUT requests (or even only GET requests if no write access is necessary). -### With an Index +### 3.2 With an Index The Index data needed by the Registry are simple: -- Serve the checksums -- Provide and authorize a Token +- Serve the checksums +- Provide and authorize a Token In the scenario of a Registry running on a private network with the need of centralizing and authorizing, it’s easy to use a custom Index. @@ -441,12 +446,12 @@ specific Index, it’ll be the private entity responsibility (basically the organization who uses Docker in a private environment) to maintain the Index and the Docker’s configuration among its consumers. -## The API +## 4. The API The first version of the api is available here: [https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull.md](https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull.md) -### Images +### 4.1 Images The format returned in the images is not defined here (for layer and JSON), basically because Registry stores exactly the same kind of @@ -464,9 +469,9 @@ file is empty. GET /v1/images//ancestry PUT /v1/images//ancestry -### Users +### 4.2 Users -### Create a user (Index) +#### 4.2.1 Create a user (Index) POST /v1/users @@ -474,9 +479,9 @@ POST /v1/users : {“email”: “[sam@dotcloud.com](mailto:sam%40dotcloud.com)”, “password”: “toto42”, “username”: “foobar”’} **Validation**: -: - **username**: min 4 character, max 30 characters, must match the +: - **username**: min 4 character, max 30 characters, must match the regular expression [a-z0-9\_]. - - **password**: min 5 characters + - **password**: min 5 characters **Valid**: return HTTP 200 @@ -489,7 +494,7 @@ Note A user account will be valid only if the email has been validated (a validation link is sent to the email address). -### Update a user (Index) +#### 4.2.2 Update a user (Index) PUT /v1/users/\ @@ -501,7 +506,7 @@ Note We can also update email address, if they do, they will need to reverify their new email address. -### Login (Index) +#### 4.2.3 Login (Index) Does nothing else but asking for a user authentication. Can be used to validate credentials. HTTP Basic Auth for now, maybe change in future. @@ -509,11 +514,11 @@ validate credentials. HTTP Basic Auth for now, maybe change in future. GET /v1/users **Return**: -: - Valid: HTTP 200 - - Invalid login: HTTP 401 - - Account inactive: HTTP 403 Account is not Active +: - Valid: HTTP 200 + - Invalid login: HTTP 401 + - Account inactive: HTTP 403 Account is not Active -### Tags (Registry) +### 4.3 Tags (Registry) The Registry does not know anything about users. Even though repositories are under usernames, it’s just a namespace for the @@ -522,11 +527,11 @@ per user later, without modifying the Registry’s API. The following naming restrictions apply: -- Namespaces must match the same regular expression as usernames (See +- Namespaces must match the same regular expression as usernames (See 4.2.1.) -- Repository names must match the regular expression [a-zA-Z0-9-\_.] +- Repository names must match the regular expression [a-zA-Z0-9-\_.] -### Get all tags: +#### 4.3.1 Get all tags GET /v1/repositories/\/\/tags @@ -536,25 +541,25 @@ GET /v1/repositories/\/\/tags “0.1.1”: “b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087” } -### Read the content of a tag (resolve the image id): +#### 4.3.2 Read the content of a tag (resolve the image id) GET /v1/repositories/\/\/tags/\ **Return**: : “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f” -### Delete a tag (registry): +#### 4.3.3 Delete a tag (registry) DELETE /v1/repositories/\/\/tags/\ -## Images (Index) +### 4.4 Images (Index) For the Index to “resolve” the repository name to a Registry location, it uses the X-Docker-Endpoints header. In other terms, this requests always add a `X-Docker-Endpoints` to indicate the location of the registry which hosts this repository. -### Get the images: +#### 4.4.1 Get the images GET /v1/repositories/\/\/images @@ -562,9 +567,9 @@ GET /v1/repositories/\/\/images : [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”, “checksum”: - “[md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087](md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087)”}] + “”}] -### Add/update the images: +#### 4.4.2 Add/update the images You always add images, you never remove them. @@ -579,15 +584,15 @@ PUT /v1/repositories/\/\/images **Return** 204 -### Repositories +### 4.5 Repositories -### Remove a Repository (Registry) +#### 4.5.1 Remove a Repository (Registry) DELETE /v1/repositories/\/\ Return 200 OK -### Remove a Repository (Index) +#### 4.5.2 Remove a Repository (Index) This starts the delete process. see 2.3 for more details. @@ -595,12 +600,12 @@ DELETE /v1/repositories/\/\ Return 202 OK -## Chaining Registries +## 5. Chaining Registries It’s possible to chain Registries server for several reasons: -- Load balancing -- Delegate the next request to another server +- Load balancing +- Delegate the next request to another server When a Registry is a reference for a repository, it should host the entire images chain in order to avoid breaking the chain during the @@ -618,9 +623,9 @@ On every request, a special header can be returned: On the next request, the client will always pick a server from this list. -## Authentication & Authorization +## 6. Authentication & Authorization -### On the Index +### 6.1 On the Index The Index supports both “Basic” and “Token” challenges. Usually when there is a `401 Unauthorized`, the Index replies @@ -634,16 +639,16 @@ You have 3 options: 1. Provide user credentials and ask for a token > **Header**: - > : - Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== - > - X-Docker-Token: true + > : - Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + > - X-Docker-Token: true > > In this case, along with the 200 response, you’ll get a new token > (if user auth is ok): If authorization isn’t correct you get a 401 > response. If account isn’t active you will get a 403 response. > > **Response**: - > : - 200 OK - > - X-Docker-Token: Token + > : - 200 OK + > - X-Docker-Token: Token > signature=123abc,repository=”foo/bar”,access=read > 2. Provide user credentials only @@ -681,9 +686,9 @@ Next request: GET /(...) Cookie: session="wD/J7LqL5ctqw8haL10vgfhrb2Q=?foo=UydiYXInCnAxCi4=×tamp=RjEzNjYzMTQ5NDcuNDc0NjQzCi4=" -## Document Version +## 7 Document Version -- 1.0 : May 6th 2013 : initial release -- 1.1 : June 1st 2013 : Added Delete Repository and way to handle new +- 1.0 : May 6th 2013 : initial release +- 1.1 : June 1st 2013 : Added Delete Repository and way to handle new source namespace. diff --git a/docs/sources/reference/api/remote_api_client_libraries.md b/docs/sources/reference/api/remote_api_client_libraries.md index 0392da3..4991924 100644 --- a/docs/sources/reference/api/remote_api_client_libraries.md +++ b/docs/sources/reference/api/remote_api_client_libraries.md @@ -4,115 +4,82 @@ page_keywords: API, Docker, index, registry, REST, documentation, clients, Pytho # Docker Remote API Client Libraries -## Introduction - These libraries have not been tested by the Docker Maintainers for compatibility. Please file issues with the library owners. If you find more library implementations, please list them in Docker doc bugs and we will add the libraries here. -Language/Framework - -Name - -Repository - -Status - -Python - -docker-py - -[https://github.com/dotcloud/docker-py](https://github.com/dotcloud/docker-py) - -Active - -Ruby - -docker-client - -[https://github.com/geku/docker-client](https://github.com/geku/docker-client) - -Outdated - -Ruby - -docker-api - -[https://github.com/swipely/docker-api](https://github.com/swipely/docker-api) - -Active - -JavaScript (NodeJS) - -dockerode - -[https://github.com/apocas/dockerode](https://github.com/apocas/dockerode) -Install via NPM: npm install dockerode - -Active - -JavaScript (NodeJS) - -docker.io - -[https://github.com/appersonlabs/docker.io](https://github.com/appersonlabs/docker.io) -Install via NPM: npm install docker.io - -Active - -JavaScript - -docker-js - -[https://github.com/dgoujard/docker-js](https://github.com/dgoujard/docker-js) - -Active - -JavaScript (Angular) **WebUI** - -docker-cp - -[https://github.com/13W/docker-cp](https://github.com/13W/docker-cp) - -Active - -JavaScript (Angular) **WebUI** - -dockerui - -[https://github.com/crosbymichael/dockerui](https://github.com/crosbymichael/dockerui) + ------------------------------------------------------------------------- + Language/Framewor Name Repository Status + k + ----------------- ------------ ---------------------------------- ------- + Python docker-py [https://github.com/dotcloud/docke Active + r-py](https://github.com/dotcloud/ + docker-py) -Active + Ruby docker-clien [https://github.com/geku/docker-cl Outdate + t ient](https://github.com/geku/dock d + er-client) -Java + Ruby docker-api [https://github.com/swipely/docker Active + -api](https://github.com/swipely/d + ocker-api) -docker-java + JavaScript dockerode [https://github.com/apocas/dockero Active + (NodeJS) de](https://github.com/apocas/dock + erode) + Install via NPM: npm install + dockerode -[https://github.com/kpelykh/docker-java](https://github.com/kpelykh/docker-java) + JavaScript docker.io [https://github.com/appersonlabs/d Active + (NodeJS) ocker.io](https://github.com/apper + sonlabs/docker.io) + Install via NPM: npm install + docker.io -Active + JavaScript docker-js [https://github.com/dgoujard/docke Outdate + r-js](https://github.com/dgoujard/ d + docker-js) -Erlang + JavaScript docker-cp [https://github.com/13W/docker-cp] Active + (Angular) (https://github.com/13W/docker-cp) + **WebUI** -erldocker + JavaScript dockerui [https://github.com/crosbymichael/ Active + (Angular) dockerui](https://github.com/crosb + **WebUI** ymichael/dockerui) -[https://github.com/proger/erldocker](https://github.com/proger/erldocker) + Java docker-java [https://github.com/kpelykh/docker Active + -java](https://github.com/kpelykh/ + docker-java) -Active + Erlang erldocker [https://github.com/proger/erldock Active + er](https://github.com/proger/erld + ocker) -Go + Go go-dockercli [https://github.com/fsouza/go-dock Active + ent erclient](https://github.com/fsouz + a/go-dockerclient) -go-dockerclient + Go dockerclient [https://github.com/samalba/docker Active + client](https://github.com/samalba + /dockerclient) -[https://github.com/fsouza/go-dockerclient](https://github.com/fsouza/go-dockerclient) + PHP Alvine [http://pear.alvine.io/](http://pe Active + ar.alvine.io/) + (alpha) -Active + PHP Docker-PHP [http://stage1.github.io/docker-ph Active + p/](http://stage1.github.io/docker + -php/) -PHP + Perl Net::Docker [https://metacpan.org/pod/Net::Doc Active + ker](https://metacpan.org/pod/Net: + :Docker) -Alvine + Perl Eixo::Docker [https://github.com/alambike/eixo- Active + docker](https://github.com/alambik + e/eixo-docker) + ------------------------------------------------------------------------- -[http://pear.alvine.io/](http://pear.alvine.io/) (alpha) -Active diff --git a/docs/sources/reference/commandline.md b/docs/sources/reference/commandline.md index 6f7a779..b2fb7e0 100644 --- a/docs/sources/reference/commandline.md +++ b/docs/sources/reference/commandline.md @@ -1,7 +1,7 @@ # Commands -## Contents: +Contents: - [Command Line Help](cli/) - [Options](cli/#options) diff --git a/docs/sources/reference/run.md b/docs/sources/reference/run.md index 9d825ce..3deac40 100644 --- a/docs/sources/reference/run.md +++ b/docs/sources/reference/run.md @@ -2,7 +2,7 @@ page_title: Docker Run Reference page_description: Configure containers at runtime page_keywords: docker, run, configure, runtime -# Docker Run Reference +# [Docker Run Reference](#id2) **Docker runs processes in isolated containers**. When an operator executes `docker run`, she starts a process with its @@ -25,7 +25,7 @@ Table of Contents - [Overriding `Dockerfile` Image Defaults](#overriding-dockerfile-image-defaults) -## General Form +## [General Form](#id3) As you’ve seen in the [*Examples*](../../examples/#example-list), the basic run command takes this form: @@ -52,7 +52,7 @@ control over runtime behavior to the operator, allowing them to override all defaults set by the developer during `docker build`{.docutils .literal} and nearly all the defaults set by the Docker runtime itself. -## Operator Exclusive Options +## [Operator Exclusive Options](#id4) Only the operator (the person executing `docker run`{.docutils .literal}) can set the following options. @@ -60,19 +60,17 @@ Only the operator (the person executing `docker run`{.docutils - [Detached vs Foreground](#detached-vs-foreground) - [Detached (-d)](#detached-d) - [Foreground](#foreground) - - [Container Identification](#container-identification) - - [Name (-name)](#name-name) + - [Name (–name)](#name-name) - [PID Equivalent](#pid-equivalent) - - [Network Settings](#network-settings) -- [Clean Up (-rm)](#clean-up-rm) +- [Clean Up (–rm)](#clean-up-rm) - [Runtime Constraints on CPU and Memory](#runtime-constraints-on-cpu-and-memory) - [Runtime Privilege and LXC Configuration](#runtime-privilege-and-lxc-configuration) -### Detached vs Foreground +### [Detached vs Foreground](#id6) When starting a Docker container, you must first decide if you want to run the container in the background in a “detached” mode or in the @@ -80,7 +78,7 @@ default foreground mode: -d=false: Detached mode: Run container in the background, print new container id -**Detached (-d)** +#### [Detached (-d)](#id7) In detached mode (`-d=true` or just `-d`{.docutils .literal}), all I/O should be done through network connections or shared @@ -88,10 +86,10 @@ volumes because the container is no longer listening to the commandline where you executed `docker run`. You can reattach to a detached container with `docker` [*attach*](../commandline/cli/#cli-attach). If you choose to run a -container in the detached mode, then you cannot use the `-rm`{.docutils +container in the detached mode, then you cannot use the `--rm`{.docutils .literal} option. -**Foreground** +#### [Foreground](#id8) In foreground mode (the default when `-d` is not specified), `docker run` can start the process in @@ -100,10 +98,10 @@ output, and standard error. It can even pretend to be a TTY (this is what most commandline executables expect) and pass along signals. All of that is configurable: - -a=[] : Attach to ``stdin``, ``stdout`` and/or ``stderr`` - -t=false : Allocate a pseudo-tty - -sig-proxy=true: Proxify all received signal to the process (even in non-tty mode) - -i=false : Keep STDIN open even if not attached + -a=[] : Attach to ``stdin``, ``stdout`` and/or ``stderr`` + -t=false : Allocate a pseudo-tty + --sig-proxy=true: Proxify all received signal to the process (even in non-tty mode) + -i=false : Keep STDIN open even if not attached If you do not specify `-a` then Docker will [attach everything @@ -119,9 +117,9 @@ as well as persistent standard input (`stdin`), so you’ll use `-i -t` together in most interactive cases. -### Container Identification +### [Container Identification](#id9) -**Name (-name)** +#### [Name (–name)](#id10) The operator can identify a container in three ways: @@ -131,27 +129,27 @@ The operator can identify a container in three ways: - Name (“evil\_ptolemy”) The UUID identifiers come from the Docker daemon, and if you do not -assign a name to the container with `-name` then the -daemon will also generate a random string name too. The name can become -a handy way to add meaning to a container since you can use this name -when defining +assign a name to the container with `--name` then +the daemon will also generate a random string name too. The name can +become a handy way to add meaning to a container since you can use this +name when defining [*links*](../../use/working_with_links_names/#working-with-links-names) (or any other place you need to identify a container). This works for both background and foreground Docker containers. -**PID Equivalent** +#### [PID Equivalent](#id11) And finally, to help with automation, you can have Docker write the container ID out to a file of your choosing. This is similar to how some programs might write out their process ID to a file (you’ve seen them as PID files): - -cidfile="": Write the container ID to the file + --cidfile="": Write the container ID to the file -### Network Settings +### [Network Settings](#id12) -n=true : Enable networking for this container - -dns=[] : Set custom dns servers for the container + --dns=[] : Set custom dns servers for the container By default, all containers have networking enabled and they can make any outgoing connections. The operator can completely disable networking @@ -160,9 +158,9 @@ outgoing networking. In cases like this, you would perform I/O through files or STDIN/STDOUT only. Your container will use the same DNS servers as the host by default, but -you can override this with `-dns`. +you can override this with `--dns`. -### Clean Up (-rm) +### [Clean Up (–rm)](#id13) By default a container’s file system persists even after the container exits. This makes debugging a lot easier (since you can inspect the @@ -170,11 +168,11 @@ final state) and you retain all your data by default. But if you are running short-term **foreground** processes, these container file systems can really pile up. If instead you’d like Docker to **automatically clean up the container and remove the file system when -the container exits**, you can add the `-rm` flag: +the container exits**, you can add the `--rm` flag: - -rm=false: Automatically remove the container when it exits (incompatible with -d) + --rm=false: Automatically remove the container when it exits (incompatible with -d) -### Runtime Constraints on CPU and Memory +### [Runtime Constraints on CPU and Memory](#id14) The operator can also adjust the performance parameters of the container: @@ -193,10 +191,10 @@ the same priority and get the same proportion of CPU cycles, but you can tell the kernel to give more shares of CPU time to one or more containers when you start them via Docker. -### Runtime Privilege and LXC Configuration +### [Runtime Privilege and LXC Configuration](#id15) - -privileged=false: Give extended privileges to this container - -lxc-conf=[]: Add custom lxc options -lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" + --privileged=false: Give extended privileges to this container + --lxc-conf=[]: (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" By default, Docker containers are “unprivileged” and cannot, for example, run a Docker daemon inside a Docker container. This is because @@ -206,23 +204,26 @@ by default a container is not allowed to access any devices, but a and documentation on [cgroups devices](https://www.kernel.org/doc/Documentation/cgroups/devices.txt)). -When the operator executes `docker run -privileged`, -Docker will enable to access to all devices on the host as well as set -some configuration in AppArmor to allow the container nearly all the -same access to the host as processes running outside containers on the -host. Additional information about running with `-privileged`{.docutils -.literal} is available on the [Docker +When the operator executes `docker run --privileged`{.docutils +.literal}, Docker will enable to access to all devices on the host as +well as set some configuration in AppArmor to allow the container nearly +all the same access to the host as processes running outside containers +on the host. Additional information about running with +`--privileged` is available on the [Docker Blog](http://blog.docker.io/2013/09/docker-can-now-run-within-docker/). -An operator can also specify LXC options using one or more -`-lxc-conf` parameters. These can be new parameters +If the Docker daemon was started using the `lxc` +exec-driver (`docker -d --exec-driver=lxc`) then the +operator can also specify LXC options using one or more +`--lxc-conf` parameters. These can be new parameters or override existing parameters from the [lxc-template.go](https://github.com/dotcloud/docker/blob/master/execdriver/lxc/lxc_template.go). Note that in the future, a given host’s Docker daemon may not use LXC, so this is an implementation-specific configuration meant for operators already familiar with using LXC directly. -## Overriding `Dockerfile` Image Defaults +## [Overriding `Dockerfile` Image Defaults](#id5) + When a developer builds an image from a [*Dockerfile*](../builder/#dockerbuilder) or when she commits it, the developer can set a number of default parameters that take effect when @@ -244,7 +245,7 @@ how the operator can override that setting. - [USER](#user) - [WORKDIR](#workdir) -### CMD (Default Command or Options) +### [CMD (Default Command or Options)](#id16) Recall the optional `COMMAND` in the Docker commandline: @@ -262,9 +263,9 @@ If the image also specifies an `ENTRYPOINT` then the `CMD` or `COMMAND`{.docutils .literal} get appended as arguments to the `ENTRYPOINT`. -### ENTRYPOINT (Default Command to Execute at Runtime +### [ENTRYPOINT (Default Command to Execute at Runtime](#id17) - -entrypoint="": Overwrite the default entrypoint set by the image + --entrypoint="": Overwrite the default entrypoint set by the image The ENTRYPOINT of an image is similar to a `COMMAND` because it specifies what executable to run when the container starts, @@ -280,14 +281,14 @@ the new `ENTRYPOINT`. Here is an example of how to run a shell in a container that has been set up to automatically run something else (like `/usr/bin/redis-server`): - docker run -i -t -entrypoint /bin/bash example/redis + docker run -i -t --entrypoint /bin/bash example/redis or two examples of how to pass more parameters to that ENTRYPOINT: - docker run -i -t -entrypoint /bin/bash example/redis -c ls -l - docker run -i -t -entrypoint /usr/bin/redis-cli example/redis --help + docker run -i -t --entrypoint /bin/bash example/redis -c ls -l + docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help -### EXPOSE (Incoming Ports) +### [EXPOSE (Incoming Ports)](#id18) The `Dockerfile` doesn’t give much control over networking, only providing the `EXPOSE` instruction @@ -295,17 +296,17 @@ to give a hint to the operator about what incoming ports might provide services. The following options work with or override the `Dockerfile`‘s exposed defaults: - -expose=[]: Expose a port from the container + --expose=[]: Expose a port from the container without publishing it to your host - -P=false : Publish all exposed ports to the host interfaces - -p=[] : Publish a container's port to the host (format: - ip:hostPort:containerPort | ip::containerPort | - hostPort:containerPort) - (use 'docker port' to see the actual mapping) - -link="" : Add link to another container (name:alias) + -P=false : Publish all exposed ports to the host interfaces + -p=[] : Publish a container's port to the host (format: + ip:hostPort:containerPort | ip::containerPort | + hostPort:containerPort) + (use 'docker port' to see the actual mapping) + --link="" : Add link to another container (name:alias) As mentioned previously, `EXPOSE` (and -`-expose`) make a port available **in** a container +`--expose`) make a port available **in** a container for incoming connections. The port number on the inside of the container (where the service listens) does not need to be the same number as the port exposed on the outside of the container (where clients connect), so @@ -315,11 +316,11 @@ inside the container you might have an HTTP service listening on port 80 might be 42800. To help a new client container reach the server container’s internal -port operator `-expose`‘d by the operator or +port operator `--expose`‘d by the operator or `EXPOSE`‘d by the developer, the operator has three choices: start the server container with `-P` or `-p,` or start the client container with -`-link`. +`--link`. If the operator uses `-P` or `-p`{.docutils .literal} then Docker will make the exposed port accessible on the host @@ -327,20 +328,20 @@ and the ports will be available to any client that can reach the host. To find the map between the host ports and the exposed ports, use `docker port`) -If the operator uses `-link` when starting the new +If the operator uses `--link` when starting the new client container, then the client container can access the exposed port via a private networking interface. Docker will set some environment variables in the client container to help indicate which interface and port to use. -### ENV (Environment Variables) +### [ENV (Environment Variables)](#id19) The operator can **set any environment variable** in the container by using one or more `-e` flags, even overriding those already defined by the developer with a Dockefile `ENV`{.docutils .literal}: - $ docker run -e "deep=purple" -rm ubuntu /bin/bash -c export + $ docker run -e "deep=purple" --rm ubuntu /bin/bash -c export declare -x HOME="/" declare -x HOSTNAME="85bc26a0e200" declare -x OLDPWD @@ -353,13 +354,13 @@ already defined by the developer with a Dockefile `ENV`{.docutils Similarly the operator can set the **hostname** with `-h`{.docutils .literal}. -`-link name:alias` also sets environment variables, +`--link name:alias` also sets environment variables, using the *alias* string to define environment variables within the container that give the IP and PORT information for connecting to the service container. Let’s imagine we have a container running Redis: # Start the service container, named redis-name - $ docker run -d -name redis-name dockerfiles/redis + $ docker run -d --name redis-name dockerfiles/redis 4241164edf6f5aca5b0e9e4c9eccd899b0b8080c64c0cd26efe02166c73208f3 # The redis-name container exposed port 6379 @@ -372,10 +373,10 @@ service container. Let’s imagine we have a container running Redis: 2014/01/25 00:55:38 Error: No public port '6379' published for 4241164edf6f Yet we can get information about the Redis container’s exposed ports -with `-link`. Choose an alias that will form a valid -environment variable! +with `--link`. Choose an alias that will form a +valid environment variable! - $ docker run -rm -link redis-name:redis_alias -entrypoint /bin/bash dockerfiles/redis -c export + $ docker run --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c export declare -x HOME="/" declare -x HOSTNAME="acda7f7b1cdc" declare -x OLDPWD @@ -393,14 +394,14 @@ environment variable! And we can use that information to connect from another container as a client: - $ docker run -i -t -rm -link redis-name:redis_alias -entrypoint /bin/bash dockerfiles/redis -c '/redis-stable/src/redis-cli -h $REDIS_ALIAS_PORT_6379_TCP_ADDR -p $REDIS_ALIAS_PORT_6379_TCP_PORT' + $ docker run -i -t --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c '/redis-stable/src/redis-cli -h $REDIS_ALIAS_PORT_6379_TCP_ADDR -p $REDIS_ALIAS_PORT_6379_TCP_PORT' 172.17.0.32:6379> -### VOLUME (Shared Filesystems) +### [VOLUME (Shared Filesystems)](#id20) -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro]. If "container-dir" is missing, then docker creates a new volume. - -volumes-from="": Mount all volumes from the given container(s) + --volumes-from="": Mount all volumes from the given container(s) The volumes commands are complex enough to have their own documentation in section [*Share Directories via @@ -409,7 +410,7 @@ define one or more `VOLUME`s associated with an image, but only the operator can give access from one container to another (or from a container to a volume mounted on the host). -### USER +### [USER](#id21) The default user within a container is `root` (id = 0), but if the developer created additional users, those are accessible @@ -419,7 +420,7 @@ override it -u="": Username or UID -### WORKDIR +### [WORKDIR](#id22) The default working directory for running binaries within a container is the root directory (`/`), but the developer can set diff --git a/docs/sources/search.md b/docs/sources/search.md index 0e2e13f..0296d50 100644 --- a/docs/sources/search.md +++ b/docs/sources/search.md @@ -1,8 +1,7 @@ -# Search -*Please activate JavaScript to enable the search functionality.* +# Search {#search-documentation} -## How To Search +Please activate JavaScript to enable the search functionality. From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will diff --git a/docs/sources/terms.md b/docs/sources/terms.md index 59579d9..5152876 100644 --- a/docs/sources/terms.md +++ b/docs/sources/terms.md @@ -1,13 +1,14 @@ + # Glossary -*Definitions of terms used in Docker documentation.* +Definitions of terms used in Docker documentation. -## Contents: +Contents: -- [File System](filesystem/) -- [Layers](layer/) -- [Image](image/) -- [Container](container/) -- [Registry](registry/) -- [Repository](repository/) +- [File System](filesystem/) +- [Layers](layer/) +- [Image](image/) +- [Container](container/) +- [Registry](registry/) +- [Repository](repository/) diff --git a/docs/sources/terms/container.md b/docs/sources/terms/container.md index bc493d4..6fbf952 100644 --- a/docs/sources/terms/container.md +++ b/docs/sources/terms/container.md @@ -4,8 +4,6 @@ page_keywords: containers, lxc, concepts, explanation, image, container # Container -## Introduction - ![](../../_images/docker-filesystems-busyboxrw.png) Once you start a process in Docker from an diff --git a/docs/sources/terms/filesystem.md b/docs/sources/terms/filesystem.md index 2038d00..8fbd977 100644 --- a/docs/sources/terms/filesystem.md +++ b/docs/sources/terms/filesystem.md @@ -4,8 +4,6 @@ page_keywords: containers, files, linux # File System -## Introduction - ![](../../_images/docker-filesystems-generic.png) In order for a Linux system to run, it typically needs two [file diff --git a/docs/sources/terms/image.md b/docs/sources/terms/image.md index 721d4c9..98914dd 100644 --- a/docs/sources/terms/image.md +++ b/docs/sources/terms/image.md @@ -4,8 +4,6 @@ page_keywords: containers, lxc, concepts, explanation, image, container # Image -## Introduction - ![](../../_images/docker-filesystems-debian.png) In Docker terminology, a read-only [*Layer*](../layer/#layer-def) is diff --git a/docs/sources/terms/layer.md b/docs/sources/terms/layer.md index 7665467..6949d5c 100644 --- a/docs/sources/terms/layer.md +++ b/docs/sources/terms/layer.md @@ -4,8 +4,6 @@ page_keywords: containers, lxc, concepts, explanation, image, container # Layers -## Introduction - In a traditional Linux boot, the kernel first mounts the root [*File System*](../filesystem/#filesystem-def) as read-only, checks its integrity, and then switches the whole rootfs volume to read-write mode. diff --git a/docs/sources/terms/registry.md b/docs/sources/terms/registry.md index 0d5af2c..53c0a24 100644 --- a/docs/sources/terms/registry.md +++ b/docs/sources/terms/registry.md @@ -4,8 +4,6 @@ page_keywords: containers, lxc, concepts, explanation, image, repository, contai # Registry -## Introduction - A Registry is a hosted service containing [*repositories*](../repository/#repository-def) of [*images*](../image/#image-def) which responds to the Registry API. @@ -14,7 +12,5 @@ The default registry can be accessed using a browser at [http://images.docker.io](http://images.docker.io) or using the `sudo docker search` command. -## Further Reading - For more information see [*Working with Repositories*](../../use/workingwithrepository/#working-with-the-repository) diff --git a/docs/sources/terms/repository.md b/docs/sources/terms/repository.md index e3332e4..8868440 100644 --- a/docs/sources/terms/repository.md +++ b/docs/sources/terms/repository.md @@ -4,8 +4,6 @@ page_keywords: containers, lxc, concepts, explanation, image, repository, contai # Repository -## Introduction - A repository is a set of images either on your local Docker server, or shared, by pushing it to a [*Registry*](../registry/#registry-def) server. diff --git a/docs/sources/toctree.md b/docs/sources/toctree.md index 259a231..b268e90 100644 --- a/docs/sources/toctree.md +++ b/docs/sources/toctree.md @@ -1,14 +1,18 @@ +page_title: Documentation +page_description: -- todo: change me +page_keywords: todo, docker, documentation, installation, usage, examples, contributing, faq, command line, concepts + # Documentation -## This documentation has the following resources: - -- [Introduction](../) -- [Installation](../installation/) -- [Use](../use/) -- [Examples](../examples/) -- [Reference Manual](../reference/) -- [Contributing](../contributing/) -- [Glossary](../terms/) -- [Articles](../articles/) -- [FAQ](../faq/) +This documentation has the following resources: + +- [Introduction](../) +- [Installation](../installation/) +- [Use](../use/) +- [Examples](../examples/) +- [Reference Manual](../reference/) +- [Contributing](../contributing/) +- [Glossary](../terms/) +- [Articles](../articles/) +- [FAQ](../faq/) diff --git a/docs/sources/use.md b/docs/sources/use.md index ce4a510..00077a5 100644 --- a/docs/sources/use.md +++ b/docs/sources/use.md @@ -1,13 +1,16 @@ + # Use -## Contents: - -- [First steps with Docker](basics/) -- [Share Images via Repositories](workingwithrepository/) -- [Redirect Ports](port_redirection/) -- [Configure Networking](networking/) -- [Automatically Start Containers](host_integration/) -- [Share Directories via Volumes](working_with_volumes/) -- [Link Containers](working_with_links_names/) -- [Link via an Ambassador Container](ambassador_pattern_linking/) -- [Using Puppet](puppet/) \ No newline at end of file +Contents: + +- [First steps with Docker](basics/) +- [Share Images via Repositories](workingwithrepository/) +- [Redirect Ports](port_redirection/) +- [Configure Networking](networking/) +- [Automatically Start Containers](host_integration/) +- [Share Directories via Volumes](working_with_volumes/) +- [Link Containers](working_with_links_names/) +- [Link via an Ambassador Container](ambassador_pattern_linking/) +- [Using Chef](chef/) +- [Using Puppet](puppet/) + diff --git a/docs/sources/use/ambassador_pattern_linking.md b/docs/sources/use/ambassador_pattern_linking.md index b5df7f8..f7704a5 100644 --- a/docs/sources/use/ambassador_pattern_linking.md +++ b/docs/sources/use/ambassador_pattern_linking.md @@ -4,8 +4,6 @@ page_keywords: Examples, Usage, links, docker, documentation, examples, names, n # Link via an Ambassador Container -## Introduction - Rather than hardcoding network links between a service consumer and provider, Docker encourages service portability. @@ -38,24 +36,24 @@ link wiring is controlled entirely from the `docker run`{.docutils Start actual redis server on one Docker host - big-server $ docker run -d -name redis crosbymichael/redis + big-server $ docker run -d --name redis crosbymichael/redis Then add an ambassador linked to the redis server, mapping a port to the outside world - big-server $ docker run -d -link redis:redis -name redis_ambassador -p 6379:6379 svendowideit/ambassador + big-server $ docker run -d --link redis:redis --name redis_ambassador -p 6379:6379 svendowideit/ambassador On the other host, you can set up another ambassador setting environment variables for each remote port we want to proxy to the `big-server` - client-server $ docker run -d -name redis_ambassador -expose 6379 -e REDIS_PORT_6379_TCP=tcp://192.168.1.52:6379 svendowideit/ambassador + client-server $ docker run -d --name redis_ambassador --expose 6379 -e REDIS_PORT_6379_TCP=tcp://192.168.1.52:6379 svendowideit/ambassador Then on the `client-server` host, you can use a redis client container to talk to the remote redis server, just by linking to the local redis ambassador. - client-server $ docker run -i -t -rm -link redis_ambassador:redis relateiq/redis-cli + client-server $ docker run -i -t --rm --link redis_ambassador:redis relateiq/redis-cli redis 172.17.0.160:6379> ping PONG @@ -68,19 +66,19 @@ The following example shows what the `svendowideit/ambassador`{.docutils On the docker host (192.168.1.52) that redis will run on: # start actual redis server - $ docker run -d -name redis crosbymichael/redis + $ docker run -d --name redis crosbymichael/redis # get a redis-cli container for connection testing $ docker pull relateiq/redis-cli # test the redis server by talking to it directly - $ docker run -t -i -rm -link redis:redis relateiq/redis-cli + $ docker run -t -i --rm --link redis:redis relateiq/redis-cli redis 172.17.0.136:6379> ping PONG ^D # add redis ambassador - $ docker run -t -i -link redis:redis -name redis_ambassador -p 6379:6379 busybox sh + $ docker run -t -i --link redis:redis --name redis_ambassador -p 6379:6379 busybox sh in the redis\_ambassador container, you can see the linked redis containers’s env @@ -104,7 +102,7 @@ to the world (via the -p 6379:6379 port mapping) $ docker rm redis_ambassador $ sudo ./contrib/mkimage-unittest.sh - $ docker run -t -i -link redis:redis -name redis_ambassador -p 6379:6379 docker-ut sh + $ docker run -t -i --link redis:redis --name redis_ambassador -p 6379:6379 docker-ut sh $ socat TCP4-LISTEN:6379,fork,reuseaddr TCP4:172.17.0.136:6379 @@ -113,14 +111,14 @@ then ping the redis server via the ambassador Now goto a different server $ sudo ./contrib/mkimage-unittest.sh - $ docker run -t -i -expose 6379 -name redis_ambassador docker-ut sh + $ docker run -t -i --expose 6379 --name redis_ambassador docker-ut sh $ socat TCP4-LISTEN:6379,fork,reuseaddr TCP4:192.168.1.52:6379 and get the redis-cli image so we can talk over the ambassador bridge $ docker pull relateiq/redis-cli - $ docker run -i -t -rm -link redis_ambassador:redis relateiq/redis-cli + $ docker run -i -t --rm --link redis_ambassador:redis relateiq/redis-cli redis 172.17.0.160:6379> ping PONG @@ -133,7 +131,7 @@ out the (possibly multiple) link environment variables to set up the port forwarding. On the remote host, you need to set the variable using the `-e` command line option. -`-expose 1234 -e REDIS_PORT_1234_TCP=tcp://192.168.1.52:6379`{.docutils +`--expose 1234 -e REDIS_PORT_1234_TCP=tcp://192.168.1.52:6379`{.docutils .literal} will forward the local `1234` port to the remote IP and port - in this case `192.168.1.52:6379`{.docutils .literal}. @@ -146,12 +144,12 @@ remote IP and port - in this case `192.168.1.52:6379`{.docutils # docker build -t SvenDowideit/ambassador . # docker tag SvenDowideit/ambassador ambassador # then to run it (on the host that has the real backend on it) - # docker run -t -i -link redis:redis -name redis_ambassador -p 6379:6379 ambassador + # docker run -t -i --link redis:redis --name redis_ambassador -p 6379:6379 ambassador # on the remote host, you can set up another ambassador - # docker run -t -i -name redis_ambassador -expose 6379 sh + # docker run -t -i --name redis_ambassador --expose 6379 sh FROM docker-ut MAINTAINER SvenDowideit@home.org.au - CMD env | grep _TCP= | sed 's/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&/' | sh && top \ No newline at end of file + CMD env | grep _TCP= | sed 's/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&/' | sh && top diff --git a/docs/sources/use/basics.md b/docs/sources/use/basics.md index 1b10335..0abc8e7 100644 --- a/docs/sources/use/basics.md +++ b/docs/sources/use/basics.md @@ -37,7 +37,10 @@ hash `539c0211cd76: Download complete` which is the short form of the image ID. These short image IDs are the first 12 characters of the full image ID - which can be found using `docker inspect` or -`docker images -notrunc=true` +`docker images --no-trunc=true` + +**If you’re using OS X** then you shouldn’t use `sudo`{.docutils +.literal} ## Running an interactive shell diff --git a/docs/sources/use/host_integration.md b/docs/sources/use/host_integration.md index 50eae8b..a7dba9b 100644 --- a/docs/sources/use/host_integration.md +++ b/docs/sources/use/host_integration.md @@ -5,7 +5,8 @@ page_keywords: systemd, upstart, supervisor, docker, documentation, host integra # Automatically Start Containers You can use your Docker containers with process managers like -`upstart`, `systemd`{.docutils .literal} and `supervisor`. +`upstart`, `systemd`{.docutils .literal} and +`supervisor`. ## Introduction @@ -15,21 +16,22 @@ docker will not automatically restart your containers when the host is restarted. When you have finished setting up your image and are happy with your -running container, you may want to use a process manager to manage it. +running container, you can then attach a process manager to manage it. When your run `docker start -a` docker will -automatically attach to the process and forward all signals so that the -process manager can detect when a container stops and correctly restart -it. +automatically attach to the running container, or start it if needed and +forward all signals so that the process manager can detect when a +container stops and correctly restart it. Here are a few sample scripts for systemd and upstart to integrate with docker. ## Sample Upstart Script -In this example we’ve already created a container to run Redis with an -id of 0a7e070b698b. To create an upstart script for our container, we -create a file named `/etc/init/redis.conf` and place -the following into it: +In this example we’ve already created a container to run Redis with +`--name redis_server`. To create an upstart script +for our container, we create a file named +`/etc/init/redis.conf` and place the following into +it: description "Redis container" author "Me" @@ -42,7 +44,7 @@ the following into it: while [ ! -e $FILE ] ; do inotifywait -t 2 -e create $(dirname $FILE) done - /usr/bin/docker start -a 0a7e070b698b + /usr/bin/docker start -a redis_server end script Next, we have to configure docker so that it’s run with the option @@ -59,8 +61,8 @@ Next, we have to configure docker so that it’s run with the option [Service] Restart=always - ExecStart=/usr/bin/docker start -a 0a7e070b698b - ExecStop=/usr/bin/docker stop -t 2 0a7e070b698b + ExecStart=/usr/bin/docker start -a redis_server + ExecStop=/usr/bin/docker stop -t 2 redis_server [Install] WantedBy=local.target diff --git a/docs/sources/use/networking.md b/docs/sources/use/networking.md index e4cc5c5..56a9885 100644 --- a/docs/sources/use/networking.md +++ b/docs/sources/use/networking.md @@ -4,16 +4,15 @@ page_keywords: network, networking, bridge, docker, documentation # Configure Networking -## Introduction - Docker uses Linux bridge capabilities to provide network connectivity to containers. The `docker0` bridge interface is managed by Docker for this purpose. When the Docker daemon starts it : -- creates the `docker0` bridge if not present -- searches for an IP address range which doesn’t overlap with an existing route -- picks an IP in the selected range -- assigns this IP to the `docker0` bridge +- creates the `docker0` bridge if not present +- searches for an IP address range which doesn’t overlap with an + existing route +- picks an IP in the selected range +- assigns this IP to the `docker0` bridge @@ -113,9 +112,9 @@ The value of the Docker daemon’s `icc` parameter determines whether containers can communicate with each other over the bridge network. -- The default, `-icc=true` allows containers to +- The default, `--icc=true` allows containers to communicate with each other. -- `-icc=false` means containers are isolated from +- `--icc=false` means containers are isolated from each other. Docker uses `iptables` under the hood to either @@ -137,6 +136,6 @@ ip link command) and the namespaces infrastructure. ## I want more -Jérôme Petazzoni has create `pipework` to connect +Jérôme Petazzoni has created `pipework` to connect together containers in arbitrarily complex scenarios : [https://github.com/jpetazzo/pipework](https://github.com/jpetazzo/pipework) diff --git a/docs/sources/use/port_redirection.md b/docs/sources/use/port_redirection.md index 6970d0d..1c1b676 100644 --- a/docs/sources/use/port_redirection.md +++ b/docs/sources/use/port_redirection.md @@ -4,8 +4,6 @@ page_keywords: Usage, basic port, docker, documentation, examples # Redirect Ports -## Introduction - Interacting with a service is commonly done through a connection to a port. When this service runs inside a container, one can connect to the port after finding the IP address of the container as follows: @@ -74,7 +72,7 @@ port on the host machine bound to a given container port. It is useful when using dynamically allocated ports: # Bind to a dynamically allocated port - docker run -p 127.0.0.1::8080 -name dyn-bound + docker run -p 127.0.0.1::8080 --name dyn-bound # Lookup the actual port docker port dyn-bound 8080 @@ -105,18 +103,18 @@ started. Here is a full example. On `server`, the port of interest is exposed. The exposure is done either through the -`-expose` parameter to the `docker run`{.docutils +`--expose` parameter to the `docker run`{.docutils .literal} command, or the `EXPOSE` build command in a Dockerfile: # Expose port 80 - docker run -expose 80 -name server + docker run --expose 80 --name server The `client` then links to the `server`{.docutils .literal}: # Link - docker run -name client -link server:linked-server + docker run --name client --link server:linked-server `client` locally refers to `server`{.docutils .literal} as `linked-server`. The following @@ -137,4 +135,4 @@ port 80 of `server` and that `server`{.docutils .literal} is accessible at the IP address 172.17.0.8 Note: Using the `-p` parameter also exposes the -port.. +port. diff --git a/docs/sources/use/puppet.md b/docs/sources/use/puppet.md index 55f16dd..b00346c 100644 --- a/docs/sources/use/puppet.md +++ b/docs/sources/use/puppet.md @@ -4,10 +4,12 @@ page_keywords: puppet, installation, usage, docker, documentation # Using Puppet -> *Note:* Please note this is a community contributed installation path. The only -> ‘official’ installation is using the -> [*Ubuntu*](../../installation/ubuntulinux/#ubuntu-linux) installation -> path. This version may sometimes be out of date. +Note + +Please note this is a community contributed installation path. The only +‘official’ installation is using the +[*Ubuntu*](../../installation/ubuntulinux/#ubuntu-linux) installation +path. This version may sometimes be out of date. ## Requirements diff --git a/docs/sources/use/working_with_links_names.md b/docs/sources/use/working_with_links_names.md index 3a12284..b41be0d 100644 --- a/docs/sources/use/working_with_links_names.md +++ b/docs/sources/use/working_with_links_names.md @@ -4,8 +4,6 @@ page_keywords: Examples, Usage, links, linking, docker, documentation, examples, # Link Containers -## Introduction - From version 0.6.5 you are now able to `name` a container and `link` it to another container by referring to its name. This will create a parent -\> child relationship @@ -15,12 +13,13 @@ where the parent container can see selected information about its child. New in version v0.6.5. -You can now name your container by using the `-name` -flag. If no name is provided, Docker will automatically generate a name. -You can see this name using the `docker ps` command. +You can now name your container by using the `--name`{.docutils +.literal} flag. If no name is provided, Docker will automatically +generate a name. You can see this name using the `docker ps`{.docutils +.literal} command. - # format is "sudo docker run -name " - $ sudo docker run -name test ubuntu /bin/bash + # format is "sudo docker run --name " + $ sudo docker run --name test ubuntu /bin/bash # the flag "-a" Show all containers. Only running containers are shown by default. $ sudo docker ps -a @@ -32,9 +31,9 @@ You can see this name using the `docker ps` command. New in version v0.6.5. Links allow containers to discover and securely communicate with each -other by using the flag `-link name:alias`. +other by using the flag `--link name:alias`. Inter-container communication can be disabled with the daemon flag -`-icc=false`. With this flag set to +`--icc=false`. With this flag set to `false`, Container A cannot access Container B unless explicitly allowed via a link. This is a huge win for securing your containers. When two containers are linked together Docker creates @@ -52,9 +51,9 @@ communication is set to false. For example, there is an image called `crosbymichael/redis`{.docutils .literal} that exposes the port 6379 and starts the Redis server. Let’s name the container as `redis` based on that image -and run it as daemon. +and run it as a daemon. - $ sudo docker run -d -name redis crosbymichael/redis + $ sudo docker run -d --name redis crosbymichael/redis We can issue all the commands that you would expect using the name `redis`; start, stop, attach, using the name for our @@ -67,9 +66,9 @@ our Redis server we did not use the `-p` flag to publish the Redis port to the host system. Redis exposed port 6379 and this is all we need to establish a link. - $ sudo docker run -t -i -link redis:db -name webapp ubuntu bash + $ sudo docker run -t -i --link redis:db --name webapp ubuntu bash -When you specified `-link redis:db` you are telling +When you specified `--link redis:db` you are telling Docker to link the container named `redis` into this new container with the alias `db`. Environment variables are prefixed with the alias so that the parent container can @@ -101,8 +100,18 @@ Accessing the network information along with the environment of the child container allows us to easily connect to the Redis service on the specific IP and port in the environment. +Note + +These Environment variables are only set for the first process in the +container. Similarly, some daemons (such as `sshd`) +will scrub them when spawning shells for connection. + +You can work around this by storing the initial `env`{.docutils +.literal} in a file, or looking at `/proc/1/environ`{.docutils +.literal}. + Running `docker ps` shows the 2 containers, and the -`webapp/db` alias name for the redis container. +`webapp/db` alias name for the Redis container. $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES diff --git a/docs/sources/use/working_with_volumes.md b/docs/sources/use/working_with_volumes.md index 6cf57ee..542c715 100644 --- a/docs/sources/use/working_with_volumes.md +++ b/docs/sources/use/working_with_volumes.md @@ -4,27 +4,24 @@ page_keywords: Examples, Usage, volume, docker, documentation, examples # Share Directories via Volumes -## Introduction - A *data volume* is a specially-designated directory within one or more containers that bypasses the [*Union File System*](../../terms/layer/#ufs-def) to provide several useful features for persistent or shared data: -- **Data volumes can be shared and reused between containers:** - This is the feature that makes data volumes so powerful. You can - use it for anything from hot database upgrades to custom backup or - replication tools. See the example below. -- **Changes to a data volume are made directly:** - Without the overhead of a copy-on-write mechanism. This is good for - very large files. -- **Changes to a data volume will not be included at the next commit:** - Because they are not recorded as regular filesystem changes in the - top layer of the [*Union File System*](../../terms/layer/#ufs-def) -- **Volumes persist until no containers use them:** - As they are a reference counted resource. The container does not need to be - running to share its volumes, but running it can help protect it - against accidental removal via `docker rm`. +- **Data volumes can be shared and reused between containers.** This + is the feature that makes data volumes so powerful. You can use it + for anything from hot database upgrades to custom backup or + replication tools. See the example below. +- **Changes to a data volume are made directly**, without the overhead + of a copy-on-write mechanism. This is good for very large files. +- **Changes to a data volume will not be included at the next commit** + because they are not recorded as regular filesystem changes in the + top layer of the [*Union File System*](../../terms/layer/#ufs-def) +- **Volumes persist until no containers use them** as they are a + reference counted resource. The container does not need to be + running to share its volumes, but running it can help protect it + against accidental removal via `docker rm`. Each container can have zero or more data volumes. @@ -43,7 +40,7 @@ container with two new volumes: This command will create the new container with two new volumes that exits instantly (`true` is pretty much the smallest, simplest program that you can run). Once created you can mount its -volumes in any other container using the `-volumes-from`{.docutils +volumes in any other container using the `--volumes-from`{.docutils .literal} option; irrespective of whether the container is running or not. @@ -51,7 +48,7 @@ Or, you can use the VOLUME instruction in a Dockerfile to add one or more new volumes to any container created from that image: # BUILD-USING: docker build -t data . - # RUN-USING: docker run -name DATA data + # RUN-USING: docker run --name DATA data FROM busybox VOLUME ["/var/volume1", "/var/volume2"] CMD ["/bin/true"] @@ -66,20 +63,20 @@ it. Create a named container with volumes to share (`/var/volume1`{.docutils .literal} and `/var/volume2`): - $ docker run -v /var/volume1 -v /var/volume2 -name DATA busybox true + $ docker run -v /var/volume1 -v /var/volume2 --name DATA busybox true Then mount those data volumes into your application containers: - $ docker run -t -i -rm -volumes-from DATA -name client1 ubuntu bash + $ docker run -t -i --rm --volumes-from DATA --name client1 ubuntu bash -You can use multiple `-volumes-from` parameters to +You can use multiple `--volumes-from` parameters to bring together multiple data volumes from multiple containers. Interestingly, you can mount the volumes that came from the `DATA` container in yet another container via the `client1` middleman container: - $ docker run -t -i -rm -volumes-from client1 -name client2 ubuntu bash + $ docker run -t -i --rm --volumes-from client1 --name client2 ubuntu bash This allows you to abstract the actual data source from users of that data, similar to @@ -136,9 +133,9 @@ because they are external to images. Instead you can use `--volumes-from` to start a new container that can access the data-container’s volume. For example: - $ sudo docker run -rm --volumes-from DATA -v $(pwd):/backup busybox tar cvf /backup/backup.tar /data + $ sudo docker run --rm --volumes-from DATA -v $(pwd):/backup busybox tar cvf /backup/backup.tar /data -- `-rm` - remove the container when it exits +- `--rm` - remove the container when it exits - `--volumes-from DATA` - attach to the volumes shared by the `DATA` container - `-v $(pwd):/backup` - bind mount the current @@ -153,13 +150,13 @@ Then to restore to the same container, or another that you’ve made elsewhere: # create a new data container - $ sudo docker run -v /data -name DATA2 busybox true + $ sudo docker run -v /data --name DATA2 busybox true # untar the backup files into the new container's data volume - $ sudo docker run -rm --volumes-from DATA2 -v $(pwd):/backup busybox tar xvf /backup/backup.tar + $ sudo docker run --rm --volumes-from DATA2 -v $(pwd):/backup busybox tar xvf /backup/backup.tar data/ data/sven.txt # compare to the original container - $ sudo docker run -rm --volumes-from DATA -v `pwd`:/backup busybox ls /data + $ sudo docker run --rm --volumes-from DATA -v `pwd`:/backup busybox ls /data sven.txt You can use the basic techniques above to automate backup, migration and diff --git a/docs/sources/use/workingwithrepository.md b/docs/sources/use/workingwithrepository.md index bd0e274..1cfec63 100644 --- a/docs/sources/use/workingwithrepository.md +++ b/docs/sources/use/workingwithrepository.md @@ -4,8 +4,6 @@ page_keywords: repo, repositories, usage, pull image, push image, image, documen # Share Images via Repositories -## Introduction - A *repository* is a shareable collection of tagged [*images*](../../terms/image/#image-def) that together create the file systems for containers. The repository’s name is a label that indicates @@ -27,14 +25,12 @@ repositories. You can host your own Registry too! Docker acts as a client for these services via `docker search, pull, login`{.docutils .literal} and `push`. -## Repositories - -### Local Repositories +## Local Repositories Docker images which have been created and labeled on your local Docker server need to be pushed to a Public or Private registry to be shared. -### Public Repositories +## Public Repositories There are two types of public repositories: *top-level* repositories which are controlled by the Docker team, and *user* repositories created @@ -67,7 +63,7 @@ user name or description: Search the docker index for images - -notrunc=false: Don't truncate output + --no-trunc=false: Don't truncate output $ sudo docker search centos Found 25 results matching your query ("centos") NAME DESCRIPTION @@ -204,7 +200,7 @@ See also [Docker Blog: How to use your own registry](http://blog.docker.io/2013/07/how-to-use-your-own-registry/) -## Authentication File +## Authentication file The authentication is stored in a json file, `.dockercfg`{.docutils .literal} located in your home directory. It supports multiple registry