+
+## 5. Add the new VDI image
+
+In the settings for the Boot2Docker image in VirtualBox, remove the VMDK image
+from the SATA contoller and add the VDI image.
+
+
+
+## 6. Verify the boot order
+
+In the **System** settings for the Boot2Docker VM, make sure that **CD/DVD** is
+at the top of the **Boot Order** list.
+
+
+
+## 7. Boot to the disk partitioning ISO
+
+Manually start the Boot2Docker VM in VirtualBox, and the disk partitioning ISO
+should start up. Using GParted, choose the **GParted Live (default settings)**
+option. Choose the default keyboard, language, and XWindows settings, and the
+GParted tool will start up and display the VDI volume you created. Right click
+on the VDI and choose **Resize/Move**.
+
+
+
+Drag the slider representing the volume to the maximum available size, click
+**Resize/Move**, and then **Apply**.
+
+
+
+Quit GParted and shut down the VM. Remove the GParted ISO from the IDE controller
+for the Boot2Docker VM in VirtualBox.
+
+## 8. Start the Boot2Docker VM
+
+Fire up the Boot2Docker VM manually in VirtualBox. The VM should log in
+automatically, but if it doesn't, the credentials are `docker/tcuser`. Using
+the `df -h` command, verify that your changes took effect.
+
+
+
+You’re done!
+
diff --git a/docs/sources/articles/baseimages.md b/docs/sources/articles/baseimages.md
index bc677eb8a3..3f53c8a84b 100644
--- a/docs/sources/articles/baseimages.md
+++ b/docs/sources/articles/baseimages.md
@@ -55,5 +55,14 @@ image to base your new minimal containers `FROM`:
COPY true-asm /true
CMD ["/true"]
-The Dockerfile above is from extremely minimal image - [tianon/true](
+The `Dockerfile` above is from an extremely minimal image - [tianon/true](
https://github.com/tianon/dockerfiles/tree/master/true).
+
+## More resources
+
+There are lots more resources available to help you write your 'Dockerfile`.
+
+* There's a [complete guide to all the instructions](/reference/builder/) available for use in a `Dockerfile` in the reference section.
+* To help you write a clear, readable, maintainable `Dockerfile`, we've also
+written a [`Dockerfile` Best Practices guide](/articles/dockerfile_best-practices).
+* If you're working on an Official Repo, be sure to check out the [Official Repo Guidelines](/docker-hub/official_repos/).
diff --git a/docs/sources/articles/basics.md b/docs/sources/articles/basics.md
index e931569652..8f3e1dc1aa 100644
--- a/docs/sources/articles/basics.md
+++ b/docs/sources/articles/basics.md
@@ -10,7 +10,7 @@ This guide assumes you have a working installation of Docker. To check
your Docker install, run the following command:
# Check that you have a working install
- $ docker info
+ $ sudo docker info
If you get `docker: command not found` or something like
`/var/lib/docker/repositories: permission denied` you may have an
@@ -126,20 +126,20 @@ TCP and a Unix socket
$ JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done")
# Stop the container
- $ docker stop $JOB
+ $ sudo docker stop $JOB
# Start the container
- $ docker start $JOB
+ $ sudo docker start $JOB
# Restart the container
- $ docker restart $JOB
+ $ sudo docker restart $JOB
# SIGKILL a container
- $ docker kill $JOB
+ $ sudo docker kill $JOB
# Remove a container
- $ docker stop $JOB # Container must be stopped to remove it
- $ docker rm $JOB
+ $ sudo docker stop $JOB # Container must be stopped to remove it
+ $ sudo docker rm $JOB
## Bind a service on a TCP port
diff --git a/docs/sources/articles/cfengine_process_management.md b/docs/sources/articles/cfengine_process_management.md
index a9441a6d35..e32b266397 100644
--- a/docs/sources/articles/cfengine_process_management.md
+++ b/docs/sources/articles/cfengine_process_management.md
@@ -94,7 +94,7 @@ your image with the docker build command, e.g.,
Start the container with `apache2` and `sshd` running and managed, forwarding
a port to our SSH instance:
- $ docker run -p 127.0.0.1:222:22 -d managed_image "/usr/sbin/sshd" "/etc/init.d/apache2 start"
+ $ sudo docker run -p 127.0.0.1:222:22 -d managed_image "/usr/sbin/sshd" "/etc/init.d/apache2 start"
We now clearly see one of the benefits of the cfe-docker integration: it
allows to start several processes as part of a normal `docker run` command.
diff --git a/docs/sources/articles/chef.md b/docs/sources/articles/chef.md
index 5568e99afa..6ca0eba73d 100644
--- a/docs/sources/articles/chef.md
+++ b/docs/sources/articles/chef.md
@@ -43,7 +43,7 @@ The next step is to pull a Docker image. For this, we have a resource:
This is equivalent to running:
- $ docker pull samalba/docker-registry
+ $ sudo docker pull samalba/docker-registry
There are attributes available to control how long the cookbook will
allow for downloading (5 minute default).
@@ -68,7 +68,7 @@ managed by Docker.
This is equivalent to running the following command, but under upstart:
- $ docker run --detach=true --publish='5000:5000' --env='SETTINGS_FLAVOR=local' --volume='/mnt/docker:/docker-storage' samalba/docker-registry
+ $ sudo docker run --detach=true --publish='5000:5000' --env='SETTINGS_FLAVOR=local' --volume='/mnt/docker:/docker-storage' samalba/docker-registry
The resources will accept a single string or an array of values for any
Docker flags that allow multiple values.
diff --git a/docs/sources/articles/dockerfile_best-practices.md b/docs/sources/articles/dockerfile_best-practices.md
new file mode 100644
index 0000000000..31f932d651
--- /dev/null
+++ b/docs/sources/articles/dockerfile_best-practices.md
@@ -0,0 +1,412 @@
+page_title: Best Practices for Writing Dockerfiles
+page_description: Hints, tips and guidelines for writing clean, reliable Dockerfiles
+page_keywords: Examples, Usage, base image, docker, documentation, dockerfile, best practices, hub, official repo
+
+# Best practices for writing Dockerfiles
+
+## Overview
+
+Docker can build images automatically by reading the instructions from a
+`Dockerfile`, a text file that contains all the commands, in order, needed to
+build a given image. `Dockerfile`s adhere to a specific format and use a
+specific set of instructions. You can learn the basics on the
+[Dockerfile Reference](https://docs.docker.com/reference/builder/) page. If
+you’re new to writing `Dockerfile`s, you should start there.
+
+This document covers the best practices and methods recommended by Docker,
+Inc. and the Docker community for creating easy-to-use, effective
+`Dockerfile`s. We strongly suggest you follow these recommendations (in fact,
+if you’re creating an Official Image, you *must* adhere to these practices).
+
+You can see many of these practices and recommendations in action in the [buildpack-deps `Dockerfile`](https://github.com/docker-library/buildpack-deps/blob/master/jessie/Dockerfile).
+
+> Note: for more detailed explanations of any of the Dockerfile commands
+>mentioned here, visit the [Dockerfile Reference](https://docs.docker.com/reference/builder/) page.
+
+## General guidelines and recommendations
+
+### Containers should be ephemeral
+
+The container produced by the image your `Dockerfile` defines should be as
+ephemeral as possible. By “ephemeral,” we mean that it can be stopped and
+destroyed and a new one built and put in place with an absolute minimum of
+set-up and configuration.
+
+### Use [a .dockerignore file](https://docs.docker.com/reference/builder/#the-dockerignore-file)
+
+For faster uploading and efficiency during `docker build`, you should use
+a `.dockerignore` file to exclude files or directories from the build
+context and final image. For example, unless`.git` is needed by your build
+process or scripts, you should add it to `.dockerignore`, which can save many
+megabytes worth of upload time.
+
+### Avoid installing unnecessary packages
+
+In order to reduce complexity, dependencies, file sizes, and build times, you
+should avoid installing extra or unnecessary packages just because they
+might be “nice to have.” For example, you don’t need to include a text editor
+in a database image.
+
+### Run only one process per container
+
+In almost all cases, you should only run a single process in a single
+container. Decoupling applications into multiple containers makes it much
+easier to scale horizontally and reuse containers. If that service depends on
+another service, make use of [container linking](https://docs.docker.com/userguide/dockerlinks/).
+
+### Minimize the number of layers
+
+You need to find the balance between readability (and thus long-term
+maintainability) of the `Dockerfile` and minimizing the number of layers it
+uses. Be strategic and cautious about the number of layers you use.
+
+### Sort multi-line arguments
+
+Whenever possible, ease later changes by sorting multi-line arguments
+alphanumerically. This will help you avoid duplication of packages and make the
+list much easier to update. This also makes PRs a lot easier to read and
+review. Adding a space before a backslash (`\`) helps as well.
+
+Here’s an example from the [`buildpack-deps` image](https://github.com/docker-library/buildpack-deps):
+
+ RUN apt-get update && apt-get install -y \
+ bzr \
+ cvs \
+ git \
+ mercurial \
+ subversion
+
+### Build cache
+
+During the process of building an image Docker will step through the
+instructions in your `Dockerfile` executing each in the order specified.
+As each instruction is examined Docker will look for an existing image in its
+cache that it can reuse, rather than creating a new (duplicate) image.
+If you do not want to use the cache at all you can use the ` --no-cache=true`
+option on the `docker build` command.
+
+However, if you do let Docker use its cache then it is very important to
+understand when it will, and will not, find a matching image. The basic rules
+that Docker will follow are outlined below:
+
+* Starting with a base image that is already in the cache, the next
+instruction is compared against all child images derived from that base
+image to see if one of them was built using the exact same instruction. If
+not, the cache is invalidated.
+
+* In most cases simply comparing the instruction in the `Dockerfile` with one
+of the child images is sufficient. However, certain instructions require
+a little more examination and explanation.
+
+* In the case of the `ADD` and `COPY` instructions, the contents of the file(s)
+being put into the image are examined. Specifically, a checksum is done
+of the file(s) and then that checksum is used during the cache lookup.
+If anything has changed in the file(s), including its metadata,
+then the cache is invalidated.
+
+* Aside from the `ADD` and `COPY` commands cache checking will not look at the
+files in the container to determine a cache match. For example, when processing
+a `RUN apt-get -y update` command the files updated in the container
+will not be examined to determine if a cache hit exists. In that case just
+the command string itself will be used to find a match.
+
+Once the cache is invalidated, all subsequent `Dockerfile` commands will
+generate new images and the cache will not be used.
+
+ bzr \
+ cvs \
+ git \
+ mercurial \
+ subversion
+
+## The Dockerfile instructions
+
+Below you'll find recommendations for the best way to write the
+various instructions available for use in a `Dockerfile`.
+
+### [`FROM`](https://docs.docker.com/reference/builder/#from)
+
+Whenever possible, use current Official Repositories as the basis for your
+image. We recommend the [Debian image](https://registry.hub.docker.com/_/debian/)
+since it’s very tightly controlled and kept extremely minimal (currently under
+100 mb), while still being a full distribution.
+
+### [`RUN`](https://docs.docker.com/reference/builder/#run)
+
+As always, to make your `Dockerfile` more readable, understandable, and
+maintainable, put long or complex `RUN` statements on multiple lines separated
+with backslashes.
+
+Probably the most common use-case for `RUN` is an application of `apt-get`.
+When using `apt-get`, here are a few things to keep in mind:
+
+* Don’t do `RUN apt-get update` on a single line. This will cause
+caching issues if the referenced archive gets updated, which will make your
+subsequent `apt-get install` fail without comment.
+
+* Avoid `RUN apt-get upgrade` or `dist-upgrade`, since many of the “essential”
+packages from the base images will fail to upgrade inside an unprivileged
+container. If a base package is out of date, you should contact its
+maintainers. If you know there’s a particular package, `foo`, that needs to be
+updated, use `apt-get install -y foo` and it will update automatically.
+
+* Do write instructions like:
+
+ RUN apt-get update && apt-get install -y package-bar package-foo package-baz
+
+Writing the instruction this way not only makes it easier to read
+and maintain, but also, by including `apt-get update`, ensures that the cache
+will naturally be busted and the latest versions will be installed with no
+further coding or manual intervention required.
+
+* Further natural cache-busting can be realized by version-pinning packages
+(e.g., `package-foo=1.3.*`). This will force retrieval of that version
+regardless of what’s in the cache.
+Writing your `apt-get` code this way will greatly ease maintenance and reduce
+failures due to unanticipated changes in required packages.
+
+#### Example
+
+Below is a well-formed `RUN` instruction that demonstrates the above
+recommendations. Note that the last package, `s3cmd`, specifies a version
+`1.1.0*`. If the image previously used an older version, specifying the new one
+will cause a cache bust of `apt-get update` and ensure the installation of
+the new version (which in this case had a new, required feature).
+
+ RUN apt-get update && apt-get install -y \
+ aufs-tools \
+ automake \
+ btrfs-tools \
+ build-essential \
+ curl \
+ dpkg-sig \
+ git \
+ iptables \
+ libapparmor-dev \
+ libcap-dev \
+ libsqlite3-dev \
+ lxc=1.0* \
+ mercurial \
+ parallel \
+ reprepro \
+ ruby1.9.1 \
+ ruby1.9.1-dev \
+ s3cmd=1.1.0*
+
+Writing the instruction this way also helps you avoid potential duplication of
+a given package because it is much easier to read than an instruction like:
+
+ RUN apt-get install -y package-foo && apt-get install -y package-bar
+
+### [`CMD`](https://docs.docker.com/reference/builder/#cmd)
+
+The `CMD` instruction should be used to run the software contained by your
+image, along with any arguments. `CMD` should almost always be used in the
+form of `CMD [“executable”, “param1”, “param2”…]`. Thus, if the image is for a
+service (Apache, Rails, etc.), you would run something like
+`CMD ["apache2","-DFOREGROUND"]`. Indeed, this form of the instruction is
+recommended for any service-based image.
+
+In most other cases, `CMD` should be given an interactive shell (bash, python,
+perl, etc), for example, `CMD ["perl", "-de0"]`, `CMD ["python"]`, or
+`CMD [“php”, “-a”]`. Using this form means that when you execute something like
+`docker run -it python`, you’ll get dropped into a usable shell, ready to go.
+`CMD` should rarely be used in the manner of `CMD [“param”, “param”]` in
+conjunction with [`ENTRYPOINT`](https://docs.docker.com/reference/builder/#entrypoint), unless
+you and your expected users are already quite familiar with how `ENTRYPOINT`
+works.
+
+### [`EXPOSE`](https://docs.docker.com/reference/builder/#expose)
+
+The `EXPOSE` instruction indicates the ports on which a container will listen
+for connections. Consequently, you should use the common, traditional port for
+your application. For example, an image containing the Apache web server would
+use `EXPOSE 80`, while an image containing MongoDB would use `EXPOSE 27017` and
+so on.
+
+For external access, your users can execute `docker run` with a flag indicating
+how to map the specified port to the port of their choice.
+For container linking, Docker provides environment variables for the path from
+the recipient container back to the source (ie, `MYSQL_PORT_3306_TCP`).
+
+### [`ENV`](https://docs.docker.com/reference/builder/#env)
+
+In order to make new software easier to run, you can use `ENV` to update the
+`PATH` environment variable for the software your container installs. For
+example, `ENV PATH /usr/local/nginx/bin:$PATH` will ensure that `CMD [“nginx”]`
+just works.
+
+The `ENV` instruction is also useful for providing required environment
+variables specific to services you wish to containerize, such as Postgres’s
+`PGDATA`.
+
+Lastly, `ENV` can also be used to set commonly used version numbers so that
+version bumps are easier to maintain, as seen in the following example:
+
+ ENV PG_MAJOR 9.3
+ ENV PG_VERSION 9.3.4
+ RUN curl -SL http://example.com/postgres-$PG_VERSION.tar.xz | tar -xJC /usr/src/postgress && …
+ ENV PATH /usr/local/postgres-$PG_MAJOR/bin:$PATH
+
+Similar to having constant variables in a program (as opposed to hard-coding
+values), this approach lets you change a single `ENV` instruction to
+auto-magically bump the version of the software in your container.
+
+### [`ADD`](https://docs.docker.com/reference/builder/#add) or [`COPY`](https://docs.docker.com/reference/builder/#copy)
+
+Although `ADD` and `COPY` are functionally similar, generally speaking, `COPY`
+is preferred. That’s because it’s more transparent than `ADD`. `COPY` only
+supports the basic copying of local files into the container, while `ADD` has
+some features (like local-only tar extraction and remote URL support) that are
+not immediately obvious. Consequently, the best use for `ADD` is local tar file
+auto-extraction into the image, as in `ADD rootfs.tar.xz /`.
+
+If you have multiple `Dockerfile` steps that use different files from your
+context, `COPY` them individually, rather than all at once. This will ensure that
+each step's build cache is only invalidated (forcing the step to be re-run) if the
+specifically required files change.
+
+For example:
+
+ COPY requirements.txt /tmp/
+ RUN pip install /tmp/requirements.txt
+ COPY . /tmp/
+
+Results in fewer cache invalidations for the `RUN` step, than if you put the
+`COPY . /tmp/` before it.
+
+Because image size matters, using `ADD` to fetch packages from remote URLs is
+strongly discouraged; you should use `curl` or `wget` instead. That way you can
+delete the files you no longer need after they've been extracted and you won't
+have to add another layer in your image. For example, you should avoid doing
+things like:
+
+ ADD http://example.com/big.tar.xz /usr/src/things/
+ RUN tar -xJf /usr/src/things/big.tar.xz -C /usr/src/things
+ RUN make -C /usr/src/things all
+
+And instead, do something like:
+
+ RUN mdkir -p /usr/src/things \
+ && curl -SL http://example.com/big.tar.gz \
+ | tar -xJC /usr/src/things \
+ && make -C /usr/src/things all
+
+For other items (files, directories) that do not require `ADD`’s tar
+auto-extraction capability, you should always use `COPY`.
+
+### [`ENTRYPOINT`](https://docs.docker.com/reference/builder/#entrypoint)
+
+The best use for `ENTRYPOINT` is as a helper script. Using `ENTRYPOINT` for
+other tasks can make your code harder to understand. For example,
+
+....docker run -it official-image bash
+
+is much easier to understand than
+
+....docker run -it --entrypoint bash official-image -i
+
+This is especially true for new Docker users, who might naturally assume the
+above command will work fine. In cases where an image uses `ENTRYPOINT` for
+anything other than just a wrapper script, the command will fail and the
+beginning user will then be forced to learn about `ENTRYPOINT` and
+`--entrypoint`.
+
+In order to avoid a situation where commands are run without clear visibility
+to the user, make sure your script ends with something like `exec "$@"`. After
+the entrypoint completes, the script will transparently bootstrap the command
+invoked by the user, making what has been run clear to the user (for example,
+`docker run -it mysql mysqld --some --flags` will transparently run
+`mysqld --some --flags` after `ENTRYPOINT` runs `initdb`).
+
+For example, let’s look at the `Dockerfile` for the
+[Postgres Official Image](https://github.com/docker-library/postgres).
+It refers to the following script:
+
+```bash
+#!/bin/bash
+set -e
+
+if [ "$1" = 'postgres' ]; then
+ chown -R postgres "$PGDATA"
+
+ if [ -z "$(ls -A "$PGDATA")" ]; then
+ gosu postgres initdb
+ fi
+
+ exec gosu postgres "$@"
+fi
+
+exec "$@"
+```
+
+That script then gets copied into the container and run via `ENTRYPOINT` on
+container startup:
+
+ COPY ./docker-entrypoint.sh /
+ ENTRYPOINT ["/docker-entrypoint.sh"]
+
+### [`VOLUME`](https://docs.docker.com/reference/builder/#volume)
+
+The `VOLUME` instruction should be used to expose any database storage area,
+configuration storage, or files/folders created by your docker container. You
+are strongly encouraged to use `VOLUME` for any mutable and/or user-serviceable
+parts of your image.
+
+### [`USER`](https://docs.docker.com/reference/builder/#user)
+
+If a service can run without privileges, use `USER` to change to a non-root
+user. Start by creating the user and group in the `Dockerfile` with something
+like `RUN groupadd -r postgres && useradd -r -g postgres postgres`.
+
+> **Note:** Users and groups in an image get a non-deterministic
+> UID/GID in that the “next” UID/GID gets assigned regardless of image
+> rebuilds. So, if it’s critical, you should assign an explicit UID/GID.
+
+You should avoid installing or using `sudo` since it has unpredictable TTY and
+signal-forwarding behavior that can cause more more problems than it solves. If
+you absolutely need functionality similar to `sudo` (e.g., initializing the
+daemon as root but running it as non-root), you may be able to use
+[“gosu”](https://github.com/tianon/gosu).
+
+Lastly, to reduce layers and complexity, avoid switching `USER` back
+and forth frequently.
+
+### [`WORKDIR`](https://docs.docker.com/reference/builder/#workdir)
+
+For clarity and reliability, you should always use absolute paths for your
+`WORKDIR`. Also, you should use `WORKDIR` instead of proliferating
+instructions like `RUN cd … && do-something`, which are hard to read,
+troubleshoot, and maintain.
+
+### [`ONBUILD`](https://docs.docker.com/reference/builder/#onbuild)
+
+`ONBUILD` is only useful for images that are going to be built `FROM` a given
+image. For example, you would use `ONBUILD` for a language stack image that
+builds arbitrary user software written in that language within the
+`Dockerfile`, as you can see in [Ruby’s `ONBUILD` variants](https://github.com/docker-library/ruby/blob/master/2.1/onbuild/Dockerfile).
+
+Images built from `ONBUILD` should get a separate tag, for example:
+`ruby:1.9-onbuild` or `ruby:2.0-onbuild`.
+
+Be careful when putting `ADD` or `COPY` in `ONBUILD`. The “onbuild” image will
+fail catastrophically if the new build's context is missing the resource being
+added. Adding a separate tag, as recommended above, will help mitigate this by
+allowing the `Dockerfile` author to make a choice.
+
+## Examples For Official Repositories
+
+These Official Repos have exemplary `Dockerfile`s:
+
+* [Go](https://registry.hub.docker.com/_/golang/)
+* [Perl](https://registry.hub.docker.com/_/perl/)
+* [Hy](https://registry.hub.docker.com/_/hylang/)
+* [Rails](https://registry.hub.docker.com/_/rails)
+
+## Additional Resources:
+
+* [Dockerfile Reference](https://docs.docker.com/reference/builder/#onbuild)
+* [More about Base Images](https://docs.docker.com/articles/baseimages/)
+* [More about Automated Builds](https://docs.docker.com/docker-hub/builds/)
+* [Guidelines for Creating Official
+Repositories](https://docs.docker.com/docker-hub/official_repos/)
diff --git a/docs/sources/articles/dsc.md b/docs/sources/articles/dsc.md
index 5e05c40c14..8d75b8f816 100644
--- a/docs/sources/articles/dsc.md
+++ b/docs/sources/articles/dsc.md
@@ -45,7 +45,7 @@ The Docker installation configuration is equivalent to running:
```
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys\
36A1D7869245C8950F966E92D8576A8BA88D21E9
-sh -c "echo deb https://get.docker.io/ubuntu docker main\
+sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
apt-get update
apt-get install lxc-docker
@@ -164,4 +164,4 @@ container:
```powershell
$containerProps = @{Name="web"; Image="node:latest"; Port="80:80"; `
Env="PORT=80"; Link="db:db"; Command="grunt"}
-```
\ No newline at end of file
+```
diff --git a/docs/sources/articles/host_integration.md b/docs/sources/articles/host_integration.md
index fa442620e5..53fc2890e8 100644
--- a/docs/sources/articles/host_integration.md
+++ b/docs/sources/articles/host_integration.md
@@ -15,7 +15,7 @@ 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 can then attach a process manager to manage it.
-When your run `docker start -a` docker will automatically attach to the
+When you run `docker start -a` docker will 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.
@@ -42,7 +42,7 @@ it:
Next, we have to configure docker so that it's run with the option
`-r=false`. Run the following command:
- $ sudo sh -c "echo 'DOCKER_OPTS=\"-r=false\"' > /etc/default/docker"
+ $ sudo sh -c "echo 'DOCKER_OPTS=\"-r=false\"' >> /etc/default/docker"
## Sample systemd Script
diff --git a/docs/sources/articles/https.md b/docs/sources/articles/https.md
index 739b724c84..c8873bcbe4 100644
--- a/docs/sources/articles/https.md
+++ b/docs/sources/articles/https.md
@@ -122,7 +122,7 @@ providing a certificate trusted by our CA:
To be able to connect to Docker and validate its certificate, you now
need to provide your client keys, certificates and trusted CA:
- $ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem \
+ $ sudo docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem \
-H=dns-name-of-docker-host:2376 version
> **Note**:
@@ -139,16 +139,18 @@ need to provide your client keys, certificates and trusted CA:
If you want to secure your Docker client connections by default, you can move
the files to the `.docker` directory in your home directory - and set the
-`DOCKER_HOST` variable as well.
+`DOCKER_HOST` and `DOCKER_TLS_VERIFY` variables as well (instead of passing
+`-H=tcp://:2376` and `--tlsverify` on every call).
$ cp ca.pem ~/.docker/ca.pem
$ cp cert.pem ~/.docker/cert.pem
$ cp key.pem ~/.docker/key.pem
$ export DOCKER_HOST=tcp://:2376
+ $ export DOCKER_TLS_VERIFY=1
-Then you can run Docker with the `--tlsverify` option.
+Docker will now connect securely by default:
- $ docker --tlsverify ps
+ $ sudo docker ps
## Other modes
@@ -175,4 +177,11 @@ if you want to store your keys in another location, you can specify that
location using the environment variable `DOCKER_CERT_PATH`.
$ export DOCKER_CERT_PATH=${HOME}/.docker/zone1/
- $ docker --tlsverify ps
+ $ sudo docker --tlsverify ps
+
+### Connecting to the Secure Docker port using `curl`
+
+To use `curl` to make test API requests, you need to use three extra command line
+flags:
+
+ $ curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://boot2docker:2376/images/json`
diff --git a/docs/sources/articles/networking.md b/docs/sources/articles/networking.md
index f9aa2d26d3..59673ecf6f 100644
--- a/docs/sources/articles/networking.md
+++ b/docs/sources/articles/networking.md
@@ -54,6 +54,9 @@ server when it starts up, and cannot be changed once it is running:
* `--bip=CIDR` — see
[Customizing docker0](#docker0)
+ * `--fixed-cidr` — see
+ [Customizing docker0](#docker0)
+
* `-H SOCKET...` or `--host=SOCKET...` —
This might sound like it would affect container networking,
but it actually faces in the other direction:
@@ -150,7 +153,10 @@ Four different options affect container domain name services.
`CONTAINER_NAME`. This lets processes inside the new container
connect to the hostname `ALIAS` without having to know its IP. The
`--link=` option is discussed in more detail below, in the section
- [Communication between containers](#between-containers).
+ [Communication between containers](#between-containers). Because
+ Docker may assign a different IP address to the linked containers
+ on restart, Docker updates the `ALIAS` entry in the `/etc/hosts` file
+ of the recipient containers.
* `--dns=IP_ADDRESS...` — sets the IP addresses added as `server`
lines to the container's `/etc/resolv.conf` file. Processes in the
@@ -307,13 +313,13 @@ page. There are two approaches.
First, you can supply `-P` or `--publish-all=true|false` to `docker run`
which is a blanket operation that identifies every port with an `EXPOSE`
line in the image's `Dockerfile` and maps it to a host port somewhere in
-the range 49000–49900. This tends to be a bit inconvenient, since you
+the range 49153–65535. This tends to be a bit inconvenient, since you
then have to run other `docker` sub-commands to learn which external
port a given service was mapped to.
More convenient is the `-p SPEC` or `--publish=SPEC` option which lets
you be explicit about exactly which external port on the Docker server —
-which can be any port at all, not just those in the 49000–49900 block —
+which can be any port at all, not just those in the 49153-65535 block —
you want mapped to which port in the container.
Either way, you should be able to peek at what Docker has accomplished
@@ -362,17 +368,25 @@ By default, the Docker server creates and configures the host system's
can pass packets back and forth between other physical or virtual
network interfaces so that they behave as a single Ethernet network.
-Docker configures `docker0` with an IP address and netmask so the host
-machine can both receive and send packets to containers connected to the
-bridge, and gives it an MTU — the *maximum transmission unit* or largest
-packet length that the interface will allow — of either 1,500 bytes or
-else a more specific value copied from the Docker host's interface that
-supports its default route. Both are configurable at server startup:
+Docker configures `docker0` with an IP address, netmask and IP
+allocation range. The host machine can both receive and send packets to
+containers connected to the bridge, and gives it an MTU — the *maximum
+transmission unit* or largest packet length that the interface will
+allow — of either 1,500 bytes or else a more specific value copied from
+the Docker host's interface that supports its default route. These
+options are configurable at server startup:
* `--bip=CIDR` — supply a specific IP address and netmask for the
`docker0` bridge, using standard CIDR notation like
`192.168.1.5/24`.
+ * `--fixed-cidr=CIDR` — restrict the IP range from the `docker0` subnet,
+ using the standard CIDR notation like `172.167.1.0/28`. This range must
+ be and IPv4 range for fixed IPs (ex: 10.20.0.0/16) and must be a subset
+ of the bridge IP range (`docker0` or set using `--bridge`). For example
+ with `--fixed-cidr=192.168.1.0/25`, IPs for your containers will be chosen
+ from the first half of `192.168.1.0/24` subnet.
+
* `--mtu=BYTES` — override the maximum packet length on `docker0`.
On Ubuntu you would add these to the `DOCKER_OPTS` setting in
@@ -435,7 +449,7 @@ If you want to take Docker out of the business of creating its own
Ethernet bridge entirely, you can set up your own bridge before starting
Docker and use `-b BRIDGE` or `--bridge=BRIDGE` to tell Docker to use
your bridge instead. If you already have Docker up and running with its
-old `bridge0` still configured, you will probably want to begin by
+old `docker0` still configured, you will probably want to begin by
stopping the service and removing the interface:
# Stopping Docker and removing docker0
diff --git a/docs/sources/articles/puppet.md b/docs/sources/articles/puppet.md
index 81ae05ba56..e664d35c97 100644
--- a/docs/sources/articles/puppet.md
+++ b/docs/sources/articles/puppet.md
@@ -47,7 +47,7 @@ defined type which can be used like so:
This is equivalent to running:
- $ docker pull ubuntu
+ $ sudo docker pull ubuntu
Note that it will only be downloaded if an image of that name does not
already exist. This is downloading a large binary so on first run can
@@ -71,7 +71,7 @@ managed by Docker.
This is equivalent to running the following command, but under upstart:
- $ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
+ $ sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
Run also contains a number of optional parameters:
diff --git a/docs/sources/articles/registry_mirror.md b/docs/sources/articles/registry_mirror.md
new file mode 100644
index 0000000000..6cb2b958c3
--- /dev/null
+++ b/docs/sources/articles/registry_mirror.md
@@ -0,0 +1,83 @@
+page_title: Run a local registry mirror
+page_description: How to set up and run a local registry mirror
+page_keywords: docker, registry, mirror, examples
+
+# Run a local registry mirror
+
+## Why?
+
+If you have multiple instances of Docker running in your environment
+(e.g., multiple physical or virtual machines, all running the Docker
+daemon), each time one of them requires an image that it doesn't have
+it will go out to the internet and fetch it from the public Docker
+registry. By running a local registry mirror, you can keep most of the
+image fetch traffic on your local network.
+
+## How does it work?
+
+The first time you request an image from your local registry mirror,
+it pulls the image from the public Docker registry and stores it locally
+before handing it back to you. On subsequent requests, the local registry
+mirror is able to serve the image from its own storage.
+
+## How do I set up a local registry mirror?
+
+There are two steps to set up and use a local registry mirror.
+
+### Step 1: Configure your Docker daemons to use the local registry mirror
+
+You will need to pass the `--registry-mirror` option to your Docker daemon on
+startup:
+
+ docker --registry-mirror=http:// -d
+
+For example, if your mirror is serving on `http://10.0.0.2:5000`, you would run:
+
+ docker --registry-mirror=http://10.0.0.2:5000 -d
+
+**NOTE:**
+Depending on your local host setup, you may be able to add the
+`--registry-mirror` options to the `DOCKER_OPTS` variable in
+`/etc/defaults/docker`.
+
+### Step 2: Run the local registry mirror
+
+You will need to start a local registry mirror service. The
+[`registry` image](https://registry.hub.docker.com/_/registry/) provides this
+functionality. For example, to run a local registry mirror that serves on
+port `5000` and mirrors the content at `registry-1.docker.io`:
+
+ docker run -p 5000:5000 \
+ -e STANDALONE=false \
+ -e MIRROR_SOURCE=https://registry-1.docker.io \
+ -e MIRROR_SOURCE_INDEX=https://index.docker.io registry
+
+## Test it out
+
+With your mirror running, pull an image that you haven't pulled before (using
+`time` to time it):
+
+ $ time docker pull node:latest
+ Pulling repository node
+ [...]
+
+ real 1m14.078s
+ user 0m0.176s
+ sys 0m0.120s
+
+Now, remove the image from your local machine:
+
+ $ sudo docker rmi node:latest
+
+Finally, re-pull the image:
+
+ $ time docker pull node:latest
+ Pulling repository node
+ [...]
+
+ real 0m51.376s
+ user 0m0.120s
+ sys 0m0.116s
+
+The second time around, the local registry mirror served the image from storage,
+avoiding a trip out to the internet to refetch it.
diff --git a/docs/sources/contributing/devenvironment.md b/docs/sources/contributing/devenvironment.md
index 25a80af4af..ee120a79c8 100644
--- a/docs/sources/contributing/devenvironment.md
+++ b/docs/sources/contributing/devenvironment.md
@@ -101,8 +101,6 @@ something like this
--- PASS: TestParseRepositoryTag (0.00 seconds)
=== RUN TestGetResolvConf
--- PASS: TestGetResolvConf (0.00 seconds)
- === RUN TestCheckLocalDns
- --- PASS: TestCheckLocalDns (0.00 seconds)
=== RUN TestParseRelease
--- PASS: TestParseRelease (0.00 seconds)
=== RUN TestDependencyGraphCircular
@@ -115,7 +113,7 @@ something like this
If $TESTFLAGS is set in the environment, it is passed as extra arguments
to `go test`. You can use this to select certain tests to run, e.g.,
- $ TESTFLAGS=`-run \^TestBuild\$` make test
+ $ TESTFLAGS='-test.run \^TestBuild\$' make test
If the output indicates "FAIL" and you see errors like this:
diff --git a/docs/sources/docker-hub/builds.md b/docs/sources/docker-hub/builds.md
index e3e2139f0a..7bf8b27eb2 100644
--- a/docs/sources/docker-hub/builds.md
+++ b/docs/sources/docker-hub/builds.md
@@ -198,7 +198,7 @@ It will also add it to the [Docker Hub](https://hub.docker.com) for the Docker
community (for public repos) or approved team members/orgs (for private repos)
to see on the repository page.
-## README.md
+### README.md
If you have a `README.md` file in your repository, it will be used as the
repository's full description.The build process will look for a
diff --git a/docs/sources/docker-hub/groups.png b/docs/sources/docker-hub/groups.png
index d2ede76137..0c6430efab 100644
Binary files a/docs/sources/docker-hub/groups.png and b/docs/sources/docker-hub/groups.png differ
diff --git a/docs/sources/docker-hub/hub-images/bb_hooks.png b/docs/sources/docker-hub/hub-images/bb_hooks.png
index d51cd03ac4..9efe4907f5 100644
Binary files a/docs/sources/docker-hub/hub-images/bb_hooks.png and b/docs/sources/docker-hub/hub-images/bb_hooks.png differ
diff --git a/docs/sources/docker-hub/hub-images/bb_menu.png b/docs/sources/docker-hub/hub-images/bb_menu.png
index 6f4a6813ef..fba1a03a5d 100644
Binary files a/docs/sources/docker-hub/hub-images/bb_menu.png and b/docs/sources/docker-hub/hub-images/bb_menu.png differ
diff --git a/docs/sources/docker-hub/hub-images/bb_post-hook.png b/docs/sources/docker-hub/hub-images/bb_post-hook.png
index 78c4730665..53100dbbce 100644
Binary files a/docs/sources/docker-hub/hub-images/bb_post-hook.png and b/docs/sources/docker-hub/hub-images/bb_post-hook.png differ
diff --git a/docs/sources/docker-hub/hub-images/deploy_key.png b/docs/sources/docker-hub/hub-images/deploy_key.png
index c4377bba9b..f1d8d92d22 100644
Binary files a/docs/sources/docker-hub/hub-images/deploy_key.png and b/docs/sources/docker-hub/hub-images/deploy_key.png differ
diff --git a/docs/sources/docker-hub/hub-images/gh_docker-service.png b/docs/sources/docker-hub/hub-images/gh_docker-service.png
index 0119b9e22a..7a84c81b7e 100644
Binary files a/docs/sources/docker-hub/hub-images/gh_docker-service.png and b/docs/sources/docker-hub/hub-images/gh_docker-service.png differ
diff --git a/docs/sources/docker-hub/hub-images/gh_menu.png b/docs/sources/docker-hub/hub-images/gh_menu.png
index d9c8d11996..84458a445f 100644
Binary files a/docs/sources/docker-hub/hub-images/gh_menu.png and b/docs/sources/docker-hub/hub-images/gh_menu.png differ
diff --git a/docs/sources/docker-hub/hub-images/gh_service_hook.png b/docs/sources/docker-hub/hub-images/gh_service_hook.png
index 9a00153bb1..c344c24afc 100644
Binary files a/docs/sources/docker-hub/hub-images/gh_service_hook.png and b/docs/sources/docker-hub/hub-images/gh_service_hook.png differ
diff --git a/docs/sources/docker-hub/hub-images/gh_settings.png b/docs/sources/docker-hub/hub-images/gh_settings.png
index efb1a3abf5..2af9cb5138 100644
Binary files a/docs/sources/docker-hub/hub-images/gh_settings.png and b/docs/sources/docker-hub/hub-images/gh_settings.png differ
diff --git a/docs/sources/docker-hub/hub-images/github_deploy_key.png b/docs/sources/docker-hub/hub-images/github_deploy_key.png
index bd69054b14..a0ec6a918f 100644
Binary files a/docs/sources/docker-hub/hub-images/github_deploy_key.png and b/docs/sources/docker-hub/hub-images/github_deploy_key.png differ
diff --git a/docs/sources/docker-hub/hub.png b/docs/sources/docker-hub/hub.png
index b260c5f62d..16840e0547 100644
Binary files a/docs/sources/docker-hub/hub.png and b/docs/sources/docker-hub/hub.png differ
diff --git a/docs/sources/docker-hub/official_repos.md b/docs/sources/docker-hub/official_repos.md
new file mode 100644
index 0000000000..5a948c6263
--- /dev/null
+++ b/docs/sources/docker-hub/official_repos.md
@@ -0,0 +1,189 @@
+page_title: Guidelines for Official Repositories on Docker Hub
+page_description: Guidelines for Official Repositories on Docker Hub
+page_keywords: Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, official, image, documentation
+
+# Guidelines for Creating and Documenting Official Repositories
+
+## Introduction
+
+You’ve been given the job of creating an image for an Official Repository
+hosted on [Docker Hub Registry](https://registry.hub.docker.com/). These are
+our guidelines for getting that task done. Even if you’re not
+planning to create an Official Repo, you can think of these guidelines as best
+practices for image creation generally.
+
+This document consists of two major sections:
+
+* A list of expected files, resources and supporting items for your image,
+along with best practices for creating those items
+* Examples embodying those practices
+
+## Expected Files & Resources
+
+### A Git repository
+
+Your image needs to live in a Git repository, preferably on GitHub. (If you’d
+like to use a different provider, please [contact us](mailto:feedback@docker.com)
+directly.) Docker **strongly** recommends that this repo be publicly
+accessible.
+
+If the repo is private or has otherwise limited access, you must provide a
+means of at least “read-only” access for both general users and for the
+docker-library maintainers, who need access for review and building purposes.
+
+### A Dockerfile
+
+Complete information on `Dockerfile`s can be found in the [Reference section](https://docs.docker.com/reference/builder/).
+We also have a page discussing [best practices for writing `Dockerfile`s](/articles/dockerfile_best-practices).
+Your `Dockerfile` should adhere to the following:
+
+* It must be written either by using `FROM scratch` or be based on another,
+established Official Image.
+* It must follow `Dockerfile` best practices. These are discussed on the
+[best practices page](/articles/dockerfile_best-practices). In addition,
+Docker engineer Michael Crosby has some good tips for `Dockerfiles` in
+this [blog post](http://crosbymichael.com/dockerfile-best-practices-take-2.html).
+
+While [`ONBUILD` triggers](https://docs.docker.com/reference/builder/#onbuild)
+are not required, if you choose to use them you should:
+
+* Build both `ONBUILD` and non-`ONBUILD` images, with the `ONBUILD` image
+built `FROM` the non-`ONBUILD` image.
+* The `ONBUILD` image should be specifically tagged, for example, `ruby:
+latest`and `ruby:onbuild`, or `ruby:2` and `ruby:2-onbuild`
+
+### A short description
+
+Include a brief description of your image (in plaintext). Only one description
+is required; you don’t need additional descriptions for each tag. The file
+should also:
+
+* Be named `README-short.txt`
+* Reside in the repo for the “latest” tag
+* Not exceed 200 characters
+
+### A logo
+
+Include a logo of your company or the product (png format preferred). Only one
+logo is required; you don’t need additional logo files for each tag. The logo
+file should have the following characteristics:
+
+* Be named `logo.png`
+* Should reside in the repo for the “latest” tag
+* Should fit inside a 200px square, maximized in one dimension (preferably the
+width)
+* Square or wide (landscape) is preferred over tall (portrait), but exceptions
+can be made based on the logo needed
+
+### A long description
+
+Include a comprehensive description of your image (in Markdown format, GitHub
+flavor preferred). Only one description is required; you don’t need additional
+descriptions for each tag. The file should also:
+
+* Be named `README.md`
+* Reside in the repo for the “latest” tag
+* Be no longer than absolutely necessary, while still addressing all the
+content requirements
+
+In terms of content, the long description must include the following sections:
+
+* Overview & links
+* How-to/usage
+* Issues & contributions
+
+#### Overview & links
+
+This section should provide:
+
+* an overview of the software contained in the image, similar to the
+introduction in a Wikipedia entry
+
+* a selection of links to outside resources that help to describe the software
+
+* a *mandatory* link to the `Dockerfile`
+
+#### How-to/usage
+
+A section that describes how to run and use the image, including common use
+cases and example `Dockerfile`s (if applicable). Try to provide clear, step-by-
+step instructions wherever possible.
+
+##### Issues & contributions
+
+In this section, point users to any resources that can help them contribute to
+the project. Include contribution guidelines and any specific instructions
+related to your development practices. Include a link to
+[Docker’s resources for contributors](https://docs.docker.com/contributing/contributing/).
+Be sure to include contact info, handles, etc. for official maintainers.
+
+Also include information letting users know where they can go for help and how
+they can file issues with the repo. Point them to any specific IRC channels,
+issue trackers, contacts, additional “how-to” information or other resources.
+
+### License
+
+Include a file, `LICENSE`, of any applicable license. Docker recommends using
+the license of the software contained in the image, provided it allows Docker,
+Inc. to legally build and distribute the image. Otherwise, Docker recommends
+adopting the [Expat license](http://directory.fsf.org/wiki/License:Expat)
+(a.k.a., the MIT or X11 license).
+
+## Examples
+
+Below are sample short and long description files for an imaginary image
+containing Ruby on Rails.
+
+### Short description
+
+`README-short.txt`
+
+`Ruby on Rails is an open-source application framework written in Ruby. It emphasizes best practices such as convention over configuration, active record pattern, and the model-view-controller pattern.`
+
+### Long description
+
+`README.md`
+
+```markdown
+# What is Ruby on Rails
+
+Ruby on Rails, often simply referred to as Rails, is an open source web application framework which runs via the Ruby programming language. It is a full-stack framework: it allows creating pages and applications that gather information from the web server, talk to or query the database, and render templates out of the box. As a result, Rails features a routing system that is independent of the web server.
+
+> [wikipedia.org/wiki/Ruby_on_Rails](https://en.wikipedia.org/wiki/Ruby_on_Rails)
+
+# How to use this image
+
+## Create a `Dockerfile` in your rails app project
+
+ FROM rails:onbuild
+
+Put this file in the root of your app, next to the `Gemfile`.
+
+This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `ADD . /usr/src/app`, `RUN bundle install`, `EXPOSE 3000`, and set the default command to `rails server`.
+
+Then build and run the Docker image.
+
+ docker build -t my-rails-app .
+ docker run --name some-rails-app -d my-rails-app
+
+Test it by visiting `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
+
+ docker run --name some-rails-app -p 8080:3000 -d my-rails-app
+
+Then go to `http://localhost:8080` or `http://host-ip:8080` in a browser.
+```
+
+For more examples, take a look at these repos:
+
+* [Go](https://github.com/docker-library/golang)
+* [PostgreSQL](https://github.com/docker-library/postgres)
+* [Buildpack-deps](https://github.com/docker-library/buildpack-deps)
+* ["Hello World" minimal container](https://github.com/docker-library/hello-world)
+* [Node](https://github.com/docker-library/node)
+
+## Submit your repo
+
+Once you've checked off everything in these guidelines, and are confident your
+image is ready for primetime, please contact us at
+[partners@docker.com](mailto:partners@docker.com) to have your project
+considered for the Official Repos program.
diff --git a/docs/sources/docker-hub/orgs.png b/docs/sources/docker-hub/orgs.png
index e6de3ddb42..f205d7f8fd 100644
Binary files a/docs/sources/docker-hub/orgs.png and b/docs/sources/docker-hub/orgs.png differ
diff --git a/docs/sources/docker-hub/repos.md b/docs/sources/docker-hub/repos.md
index 8d76d5a5df..42d97d8bf2 100644
--- a/docs/sources/docker-hub/repos.md
+++ b/docs/sources/docker-hub/repos.md
@@ -11,7 +11,7 @@ page_keywords: Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub
You can `search` for all the publicly available repositories and images using
Docker.
- $ docker search ubuntu
+ $ sudo docker search ubuntu
This will show you a list of the currently available repositories on the
Docker Hub which match the provided keyword.
diff --git a/docs/sources/docker-hub/repos.png b/docs/sources/docker-hub/repos.png
index c2d6bf4364..f25bb3a48d 100644
Binary files a/docs/sources/docker-hub/repos.png and b/docs/sources/docker-hub/repos.png differ
diff --git a/docs/sources/examples/nodejs_web_app.md b/docs/sources/examples/nodejs_web_app.md
index 5d69fd713b..d634251fb8 100644
--- a/docs/sources/examples/nodejs_web_app.md
+++ b/docs/sources/examples/nodejs_web_app.md
@@ -188,5 +188,4 @@ Now you can call your app using `curl` (install if needed via:
We hope this tutorial helped you get up and running with Node.js and
CentOS on Docker. You can get the full source code at
-[https://github.com/gasi/docker-node-hello](https://github.com/gasi/docker-node-hello).
-
+[https://github.com/enokd/docker-node-hello/](https://github.com/enokd/docker-node-hello/).
diff --git a/docs/sources/examples/postgresql_service.md b/docs/sources/examples/postgresql_service.md
index ffd122ed58..9a4c1816d7 100644
--- a/docs/sources/examples/postgresql_service.md
+++ b/docs/sources/examples/postgresql_service.md
@@ -104,7 +104,7 @@ host-mapped port to test as well. You need to use `docker ps`
to find out what local host port the container is mapped to
first:
- $ docker ps
+ $ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5e24362f27f6 eg_postgresql:latest /usr/lib/postgresql/ About an hour ago Up About an hour 0.0.0.0:49153->5432/tcp pg_test
$ psql -h localhost -p 49153 -d docker -U docker --password
@@ -135,7 +135,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
+ $ sudo 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/running_riak_service.md b/docs/sources/examples/running_riak_service.md
index c3d83bf663..0b53234046 100644
--- a/docs/sources/examples/running_riak_service.md
+++ b/docs/sources/examples/running_riak_service.md
@@ -101,7 +101,7 @@ Populate it with the following program definitions:
Now you should be able to build a Docker image for Riak:
- $ docker build -t "/riak" .
+ $ sudo docker build -t "/riak" .
## Next steps
diff --git a/docs/sources/examples/running_ssh_service.Dockerfile b/docs/sources/examples/running_ssh_service.Dockerfile
index 1b8ed02a8a..7aba7f6869 100644
--- a/docs/sources/examples/running_ssh_service.Dockerfile
+++ b/docs/sources/examples/running_ssh_service.Dockerfile
@@ -1,13 +1,20 @@
# sshd
#
-# VERSION 0.0.1
+# VERSION 0.0.2
-FROM ubuntu:12.04
-MAINTAINER Thatcher R. Peskens "thatcher@dotcloud.com"
+FROM ubuntu:14.04
+MAINTAINER Sven Dowideit
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
-RUN echo 'root:screencast' |chpasswd
+RUN echo 'root:screencast' | chpasswd
+RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
+
+# SSH login fix. Otherwise user is kicked off after login
+RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
+
+ENV NOTVISIBLE "in users profile"
+RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
-CMD ["/usr/sbin/sshd", "-D"]
+CMD ["/usr/sbin/sshd", "-D"]
diff --git a/docs/sources/examples/running_ssh_service.md b/docs/sources/examples/running_ssh_service.md
index 7140678e3b..9f87fb726d 100644
--- a/docs/sources/examples/running_ssh_service.md
+++ b/docs/sources/examples/running_ssh_service.md
@@ -4,28 +4,39 @@ page_keywords: docker, example, package installation, networking
# Dockerizing an SSH Daemon Service
+## Build an `eg_sshd` image
+
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
quick access to a test container.
# sshd
#
- # VERSION 0.0.1
+ # VERSION 0.0.2
- FROM ubuntu:12.04
- MAINTAINER Thatcher R. Peskens "thatcher@dotcloud.com"
+ FROM ubuntu:14.04
+ MAINTAINER Sven Dowideit
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
- RUN echo 'root:screencast' |chpasswd
+ RUN echo 'root:screencast' | chpasswd
+ RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
+
+ # SSH login fix. Otherwise user is kicked off after login
+ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
+
+ ENV NOTVISIBLE "in users profile"
+ RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
- CMD ["/usr/sbin/sshd", "-D"]
+ CMD ["/usr/sbin/sshd", "-D"]
Build the image using:
$ sudo docker build -t eg_sshd .
+## Run a `test_sshd` container
+
Then run it. You can then use `docker port` to find out what host port
the container's port 22 is mapped to:
@@ -33,13 +44,30 @@ the container's port 22 is mapped to:
$ sudo docker port test_sshd 22
0.0.0.0:49154
-And now you can ssh to port `49154` on the Docker daemon's host IP
-address (`ip address` or `ifconfig` can tell you that):
+And now you can ssh as `root` on the container's IP address (you can find it
+with `docker inspect`) or on port `49154` of the Docker daemon's host IP address
+(`ip address` or `ifconfig` can tell you that):
$ ssh root@192.168.1.2 -p 49154
# The password is ``screencast``.
$$
+## Environment variables
+
+Using the `sshd` daemon to spawn shells makes it complicated to pass environment
+variables to the user's shell via the simple Docker mechanisms, as `sshd` scrubs
+the environment before it starts the shell.
+
+If you're setting values in the Dockerfile using `ENV`, you'll need to push them
+to a shell initialisation file like the `/etc/profile` example in the Dockerfile
+above.
+
+If you need to pass`docker run -e ENV=value` values, you will need to write a
+short script to do the same before you start `sshd -D` - and then replace the
+`CMD` with that script.
+
+## Clean up
+
Finally, clean up after your test by stopping and removing the
container, and then removing the image.
diff --git a/docs/sources/http-routingtable.md b/docs/sources/http-routingtable.md
index 9fd78d03b5..4de7bcd3fa 100644
--- a/docs/sources/http-routingtable.md
+++ b/docs/sources/http-routingtable.md
@@ -44,6 +44,7 @@
[`POST /containers/(id)/wait`](../reference/api/docker_remote_api_v1.9/#post--containers-(id)-wait) **
[`POST /containers/create`](../reference/api/docker_remote_api_v1.9/#post--containers-create) **
[`GET /containers/json`](../reference/api/docker_remote_api_v1.9/#get--containers-json) **
+ [`GET /containers/resize`](../reference/api/docker_remote_api_v1.9/#get--containers-resize) **
**/events**
[`GET /events`](../reference/api/docker_remote_api_v1.9/#get--events) **
diff --git a/docs/sources/index.md b/docs/sources/index.md
index 5267557f38..7e60b0dc6d 100644
--- a/docs/sources/index.md
+++ b/docs/sources/index.md
@@ -83,51 +83,45 @@ Docker on a variety of platforms.
### Docker User Guide
-To learn about Docker in more detail and to answer questions about usage and implementation, check out the [Docker User Guide](/userguide/).
+To learn about Docker in more detail and to answer questions about usage and
+implementation, check out the [Docker User Guide](/userguide/).
## Release Notes
-Version 1.1.0
+**Version 1.3.0**
-### New Features
+This version fixes a number of bugs and issues and adds new functions and other
+improvements. These include:
-*`.dockerignore` support*
+*New command: `docker exec`*
-You can now add a `.dockerignore` file next to your `Dockerfile` and Docker will ignore files and directories specified in that file when sending the build context to the daemon.
-Example: https://github.com/docker/docker/blob/master/.dockerignore
+The new `docker exec` command lets you run a process in an existing, active
+container. The command has APIs for both the daemon and the client. With
+`docker exec`, you'll be able to do things like add or remove devices from running containers, debug running containers, and run commands that are not
+part of the container's static specification.
-*Pause containers during commit*
+*New command: `docker create`*
-Doing a commit on a running container was not recommended because you could end up with files in an inconsistent state (for example, if they were being written during the commit). Containers are now paused when a commit is made to them.
-You can disable this feature by doing a `docker commit --pause=false `
+Traditionally, the `docker run` command has been used to both create a
+container and spawn a process to run it. The new `docker create` command breaks
+this apart, letting you set up a container without actually starting it. This
+provides more control over management of the container lifecycle, giving you the
+ability to configure things like volumes or port mappings before the container
+is started. For example, in a rapid-response scaling situation, you could use
+`create` to prepare and stage ten containers in anticipation of heavy loads.
-*Tailing logs*
+*New provenance features*
-You can now tail the logs of a container. For example, you can get the last ten lines of a log by using `docker logs --tail 10 `. You can also follow the logs of a container without having to read the whole log file with `docker logs --tail 0 -f `.
-
-*Allow a tar file as context for docker build*
-
-You can now pass a tar archive to `docker build` as context. This can be used to automate docker builds, for example: `cat context.tar | docker build -` or `docker run builder_image | docker build -`
-
-*Bind mounting your whole filesystem in a container*
-
-`/` is now allowed as source of `--volumes`. This means you can bind-mount your whole system in a container if you need to. For example: `docker run -v /:/my_host ubuntu:ro ls /my_host`. However, it is now forbidden to mount to /.
+Official images are now signed by Docker, Inc. to improve your confidence and
+security. Look for the blue ribbons on the [Docker Hub](https://hub.docker.com/).
+The Docker Engine has been updated to automatically verify that a given Official
+Repo has a current, valid signature. If no valid signature is detected, Docker
+Engine will use a prior image.
-### Other Improvements & Changes
-
-* Port allocation has been improved. In the previous release, Docker could prevent you from starting a container with previously allocated ports which seemed to be in use when in fact they were not. This has been fixed.
-
-* A bug in `docker save` was introduced in the last release. The `docker save` command could produce images with invalid metadata. The command now produces images with correct metadata.
-
-* Running `docker inspect` in a container now returns which containers it is linked to.
-
-* Parsing of the `docker commit` flag has improved validation, to better prevent you from committing an image with a name such as `-m`. Image names with dashes in them potentially conflict with command line flags.
-
-* The API now has Improved status codes for `start` and `stop`. Trying to start a running container will now return a 304 error.
-
-* Performance has been improved overall. Starting the daemon is faster than in previous releases. The daemon’s performance has also been improved when it is working with large numbers of images and containers.
-
-* Fixed an issue with white-spaces and multi-lines in Dockerfiles.
+*Other improvements & changes*
+We've added a new security options flag that lets you set SELinux and AppArmor
+labels and profiles. This means you'll longer have to use `docker run
+--privileged on kernels that support SE Linux or AppArmor.
diff --git a/docs/sources/installation/amazon.md b/docs/sources/installation/amazon.md
index 86443147e7..3715d5c44f 100644
--- a/docs/sources/installation/amazon.md
+++ b/docs/sources/installation/amazon.md
@@ -32,7 +32,7 @@ course.**
- When you're on the "Configure Instance Details" step, expand the
"Advanced Details" section.
- Under "User data", select "As text".
- - Enter `#include https://get.docker.io` into
+ - Enter `#include https://get.docker.com` into
the instance *User Data*.
[CloudInit](https://help.ubuntu.com/community/CloudInit) is part
of the Ubuntu image you chose; it will bootstrap Docker by
@@ -46,7 +46,7 @@ Security Group to allow SSH.** By default all incoming ports to your new
instance will be blocked by the AWS Security Group, so you might just
get timeouts when you try to connect.
-Installing with `get.docker.io` (as above) will
+Installing with `get.docker.com` (as above) will
create a service named `lxc-docker`. It will also
set up a [*docker group*](../binaries/#dockergroup) and you may want to
add the *ubuntu* user to it so that you don't have to use
diff --git a/docs/sources/installation/binaries.md b/docs/sources/installation/binaries.md
index 8e35d98030..da2b195c0f 100644
--- a/docs/sources/installation/binaries.md
+++ b/docs/sources/installation/binaries.md
@@ -32,22 +32,28 @@ runtime:
Docker in daemon mode has specific kernel requirements. For details,
check your distribution in [*Installation*](../#installation-list).
-In general, a 3.8 Linux kernel (or higher) is preferred, as some of the
-prior versions have known issues that are triggered by Docker.
+In general, a 3.8 Linux kernel is the minimum requirement for Docker, as
+some of the prior versions have known issues that are triggered by Docker.
+Linux kernel versions older than 3.8 are known to cause kernel panics and
+to break Docker.
+
+The latest minor version (3.x.y) of the 3.10 (or a newer maintained version)
+Linux kernel is recommended. Keeping the kernel up to date with the latest
+minor version will ensure critical kernel bugs get fixed.
Note that Docker also has a client mode, which can run on virtually any
Linux kernel (it even builds on OS X!).
## Get the docker binary:
- $ wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O docker
+ $ wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O docker
$ chmod +x docker
> **Note**:
> If you have trouble downloading the binary, you can also get the smaller
> compressed release file:
-> [https://get.docker.io/builds/Linux/x86_64/docker-latest.tgz](
-> https://get.docker.io/builds/Linux/x86_64/docker-latest.tgz)
+> [https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz](
+> https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz)
## Run the docker daemon
diff --git a/docs/sources/installation/centos.md b/docs/sources/installation/centos.md
index b919ca5806..2f7d57d604 100644
--- a/docs/sources/installation/centos.md
+++ b/docs/sources/installation/centos.md
@@ -4,10 +4,12 @@ page_keywords: Docker, Docker documentation, requirements, linux, centos, epel,
# CentOS
-While the Docker package is provided by default as part of CentOS-7,
-it is provided by a community repository for CentOS-6. Please note that
-this changes the installation instructions slightly between versions.
-
+While the Docker package is provided by default as part of CentOS-7,
+it is provided by the EPEL repository for CentOS-6. Please note that
+this changes the installation instructions slightly between versions. If you
+need the latest version, you can always use the latest binary which works on
+kernel 3.8 and above.
+
These instructions work for CentOS 6 and later. They will likely work for
other binary compatible EL6 distributions such as Scientific Linux, but
they haven't been tested.
@@ -25,6 +27,30 @@ simply run the following command.
$ sudo yum install docker
+### Manual installation of latest version
+
+While using a package is the recommended way of installing Docker,
+the above package might not be the latest version. If you need the latest
+version, [you can install the binary directly](
+https://docs.docker.com/installation/binaries/).
+
+When installing the binary without a package, you may want
+to integrate Docker with systemd. For this, simply install the two unit files
+(service and socket) from [the github
+repository](https://github.com/docker/docker/tree/master/contrib/init/systemd)
+to `/etc/systemd/system`.
+
+### FirewallD
+
+CentOS-7 introduced firewalld, which is a wrapper around iptables and can
+conflict with Docker.
+
+When firewalld is started or restarted it will remove the `DOCKER` chain
+from iptables, preventing Docker from working properly.
+
+When using systemd, firewalld is started before Docker, but if you
+start or restart firewalld after Docker, you will have to restart the Docker daemon.
+
## Installing Docker - CentOS-6
Please note that this for CentOS-6, this package is part of [Extra Packages
for Enterprise Linux (EPEL)](https://fedoraproject.org/wiki/EPEL), a community effort
diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md
index 0da2f2f5d0..1db1609699 100644
--- a/docs/sources/installation/debian.md
+++ b/docs/sources/installation/debian.md
@@ -7,6 +7,7 @@ page_keywords: Docker, Docker documentation, installation, debian
Docker is supported on the following versions of Debian:
- [*Debian 8.0 Jessie (64-bit)*](#debian-jessie-8-64-bit)
+ - [*Debian 7.5 Wheezy (64-bit)*](#debian-wheezy-7-64-bit)
## Debian Jessie 8.0 (64-bit)
@@ -34,7 +35,35 @@ Which should download the `ubuntu` image, and then start `bash` in a container.
> If you want to enable memory and swap accounting see
> [this](/installation/ubuntulinux/#memory-and-swap-accounting).
-### Giving non-root access
+## Debian Wheezy/Stable 7.x (64-bit)
+
+Docker requires Kernel 3.8+, while Wheezy ships with Kernel 3.2 (for more details
+on why 3.8 is required, see discussion on
+[bug #407](https://github.com/docker/docker/issues/407%20kernel%20versions)).
+
+Fortunately, wheezy-backports currently has [Kernel 3.14
+](https://packages.debian.org/search?suite=wheezy-backports§ion=all&arch=any&searchon=names&keywords=linux-image-amd64),
+which is officially supported by Docker.
+
+### Installation
+
+1. Install Kernel 3.14 from wheezy-backports
+
+ Add the following line to your `/etc/apt/sources.list`
+
+ `deb http://http.debian.net/debian wheezy-backports main`
+
+ then install the `linux-image-amd64` package (note the use of
+ `-t wheezy-backports`)
+
+ $ sudo apt-get update
+ $ sudo apt-get install -t wheezy-backports linux-image-amd64
+
+2. Install Docker using the get.docker.com script:
+
+ `curl -sSL https://get.docker.com/ | sh`
+
+## Giving non-root access
The `docker` daemon always runs as the `root` user and the `docker`
daemon binds to a Unix socket instead of a TCP port. By default that
@@ -68,7 +97,7 @@ use the `-G` flag to specify an alternative group.
# Restart the Docker daemon.
$ sudo service docker restart
+
## What next?
Continue with the [User Guide](/userguide/).
-
diff --git a/docs/sources/installation/fedora.md b/docs/sources/installation/fedora.md
index 757b3e9c44..9101ef1356 100644
--- a/docs/sources/installation/fedora.md
+++ b/docs/sources/installation/fedora.md
@@ -48,6 +48,10 @@ Now let's verify that Docker is working.
$ sudo docker run -i -t fedora /bin/bash
+> Note: If you get a `Cannot start container` error mentioning SELinux
+> or permission denied, you may need to update the SELinux policies.
+> This can be done using `sudo yum upgrade selinux-policy` and then rebooting.
+
## Granting rights to users to use Docker
Fedora 19 and 20 shipped with Docker 0.11. The package has already been updated
diff --git a/docs/sources/installation/gentoolinux.md b/docs/sources/installation/gentoolinux.md
index ac92ad39c8..39333e63e6 100644
--- a/docs/sources/installation/gentoolinux.md
+++ b/docs/sources/installation/gentoolinux.md
@@ -4,53 +4,77 @@ page_keywords: gentoo linux, virtualization, docker, documentation, installation
# Gentoo
-Installing Docker on Gentoo Linux can be accomplished using one of two
-methods. The first and best way if you're looking for a stable
-experience is to use the official app-emulation/docker package directly
-in the portage tree.
+Installing Docker on Gentoo Linux can be accomplished using one of two ways: the **official** way and the `docker-overlay` way.
-If you're looking for a `-bin` ebuild, a live ebuild, or bleeding edge
-ebuild changes/fixes, the second installation method is to use the
-overlay provided at
-[https://github.com/tianon/docker-overlay](https://github.com/tianon/docker-overlay)
+Official project page of [Gentoo Docker](https://wiki.gentoo.org/wiki/Project:Docker) team.
+
+## Official way
+The first and recommended way if you are looking for a stable
+experience is to use the official `app-emulation/docker` package directly
+from the tree.
+
+If any issues arise from this ebuild including, missing kernel
+configuration flags or dependencies, open a bug
+on the Gentoo [Bugzilla](https://bugs.gentoo.org) assigned to `docker AT gentoo DOT org`
+or join and ask in the official
+[IRC](http://webchat.freenode.net?channels=%23gentoo-containers&uio=d4) channel on the Freenode network.
+
+## docker-overlay way
+
+If you're looking for a `-bin` ebuild, a live ebuild, or a bleeding edge
+ebuild, use the provided overlay, [docker-overlay](https://github.com/tianon/docker-overlay)
which can be added using `app-portage/layman`. The most accurate and
up-to-date documentation for properly installing and using the overlay
-can be found in [the overlay
-README](https://github.com/tianon/docker-overlay/blob/master/README.md#using-this-overlay).
+can be found in the [overlay](https://github.com/tianon/docker-overlay/blob/master/README.md#using-this-overlay).
-Note that sometimes there is a disparity between the latest version and
-what's in the overlay, and between the latest version in the overlay and
-what's in the portage tree. Please be patient, and the latest version
-should propagate shortly.
+If any issues arise from this ebuild or the resulting binary, including
+and especially missing kernel configuration flags or dependencies,
+open an [issue](https://github.com/tianon/docker-overlay/issues) on
+the `docker-overlay` repository or ping `tianon` directly in the `#docker`
+IRC channel on the Freenode network.
## Installation
+### Available USE flags
+
+| USE Flag | Default | Description |
+| ------------- |:-------:|:------------|
+| aufs | |Enables dependencies for the "aufs" graph driver, including necessary kernel flags.|
+| btrfs | |Enables dependencies for the "btrfs" graph driver, including necessary kernel flags.|
+| contrib | Yes |Install additional contributed scripts and components.|
+| device-mapper | Yes |Enables dependencies for the "devicemapper" graph driver, including necessary kernel flags.|
+| doc | |Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally.|
+| lxc | |Enables dependencies for the "lxc" execution driver.|
+| vim-syntax | |Pulls in related vim syntax scripts.|
+| zsh-completion| |Enable zsh completion support.|
+
+USE flags are described in detail on [tianon's
+blog](https://tianon.github.io/post/2014/05/17/docker-on-gentoo.html).
+
The package should properly pull in all the necessary dependencies and
-prompt for all necessary kernel options. The ebuilds for 0.7+ include
-use flags to pull in the proper dependencies of the major storage
-drivers, with the "device-mapper" use flag being enabled by default,
-since that is the simplest installation path.
+prompt for all necessary kernel options.
$ sudo emerge -av app-emulation/docker
-If any issues arise from this ebuild or the resulting binary, including
-and especially missing kernel configuration flags and/or dependencies,
-[open an issue on the docker-overlay repository](
-https://github.com/tianon/docker-overlay/issues) or ping
-tianon directly in the #docker IRC channel on the freenode network.
-
-Other use flags are described in detail on [tianon's
-blog](https://tianon.github.io/post/2014/05/17/docker-on-gentoo.html).
+>Note: Sometimes there is a disparity between the latest versions
+>in the official **Gentoo tree** and the **docker-overlay**.
+>Please be patient, and the latest version should propagate shortly.
## Starting Docker
Ensure that you are running a kernel that includes all the necessary
-modules and/or configuration for LXC (and optionally for device-mapper
-and/or AUFS, depending on the storage driver you`ve decided to use).
+modules and configuration (and optionally for device-mapper
+and AUFS or Btrfs, depending on the storage driver you've decided to use).
+To use Docker, the `docker` daemon must be running as **root**.
+To use Docker as a **non-root** user, add yourself to the **docker**
+group by running the following command:
+
+ $ sudo usermod -a -G docker user
+
### OpenRC
-To start the docker daemon:
+To start the `docker` daemon:
$ sudo /etc/init.d/docker start
@@ -60,10 +84,10 @@ To start on system boot:
### systemd
-To start the docker daemon:
+To start the `docker` daemon:
- $ sudo systemctl start docker.service
+ $ sudo systemctl start docker
To start on system boot:
- $ sudo systemctl enable docker.service
+ $ sudo systemctl enable docker
diff --git a/docs/sources/installation/google.md b/docs/sources/installation/google.md
index 23a9bfbfb8..cbd1f8b63a 100644
--- a/docs/sources/installation/google.md
+++ b/docs/sources/installation/google.md
@@ -20,7 +20,7 @@ page_keywords: Docker, Docker documentation, installation, google, Google Comput
(select a zone close to you and the desired instance size)
$ gcloud compute instances create docker-playground \
- --image container-vm-v20140730 \
+ --image container-vm-v20140925 \
--image-project google-containers \
--zone us-central1-a \
--machine-type f1-micro
@@ -28,7 +28,7 @@ page_keywords: Docker, Docker documentation, installation, google, Google Comput
4. Connect to the instance using SSH:
$ gcloud compute ssh --zone us-central1-a docker-playground
- $$ docker-playground:~$ sudo docker run hello-world
+ docker-playground:~$ sudo docker run hello-world
Hello from Docker.
This message shows that your installation appears to be working correctly.
...
diff --git a/docs/sources/installation/images/osx-installer.png b/docs/sources/installation/images/osx-installer.png
index dbb6bcd2d9..15eb40839f 100644
Binary files a/docs/sources/installation/images/osx-installer.png and b/docs/sources/installation/images/osx-installer.png differ
diff --git a/docs/sources/installation/images/windows-boot2docker-start.png b/docs/sources/installation/images/windows-boot2docker-start.png
index 189289638d..9d598d56bf 100644
Binary files a/docs/sources/installation/images/windows-boot2docker-start.png and b/docs/sources/installation/images/windows-boot2docker-start.png differ
diff --git a/docs/sources/installation/images/windows-installer.png b/docs/sources/installation/images/windows-installer.png
index 6305dcc6d9..ea1d3d2326 100644
Binary files a/docs/sources/installation/images/windows-installer.png and b/docs/sources/installation/images/windows-installer.png differ
diff --git a/docs/sources/installation/mac.md b/docs/sources/installation/mac.md
index da0e172892..0707c56b7b 100644
--- a/docs/sources/installation/mac.md
+++ b/docs/sources/installation/mac.md
@@ -34,7 +34,7 @@ VirtualBox VM, Docker itself, and the Boot2Docker management tool.
$ boot2docker init
$ boot2docker start
- $ export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
+ $ $(boot2docker shellinit)
A terminal window will open and you'll see the virtual machine starting up.
Once you have an initialized virtual machine, you can control it with `boot2docker stop`
@@ -46,7 +46,7 @@ and `boot2docker start`.
> `To connect the Docker client to the Docker daemon, please set: export
DOCKER_HOST=tcp://192.168.59.103:2375`
>
-you can safely set the evironment variable as instructed.
+you can safely set the environment variable as instructed.
View the
[Boot2Docker ReadMe](https://github.com/boot2docker/boot2docker/blob/master/README.md)
@@ -67,7 +67,8 @@ terminal window and run:
$ boot2docker download
$ boot2docker start
-This will download an .iso containing a fresh VM and start it up.
+This will download an .iso image containing a fresh VM and start it up. Your upgrade is
+complete. You can test it by following the directions below.
## Running Docker
diff --git a/docs/sources/installation/oracle.md b/docs/sources/installation/oracle.md
new file mode 100644
index 0000000000..05bb3d9808
--- /dev/null
+++ b/docs/sources/installation/oracle.md
@@ -0,0 +1,120 @@
+page_title: Installation on Oracle Linux
+page_description: Installation instructions for Docker on Oracle Linux.
+page_keywords: Docker, Docker documentation, requirements, linux, rhel, centos, oracle, ol
+
+# Oracle Linux 6 and 7
+
+You do not require an Oracle Linux Support subscription to install Docker on
+Oracle Linux.
+
+*For Oracle Linux customers with an active support subscription:*
+Docker is available in either the `ol6_x86_64_addons` or `ol7_x86_64_addons`
+channel for Oracle Linux 6 and Oracle Linux 7 on the [Unbreakable Linux Network
+(ULN)](https://linux.oracle.com).
+
+*For Oracle Linux users without an active support subscription:*
+Docker is available in the appropriate `ol6_addons` or `ol7_addons` repository
+on [Oracle Public Yum](http://public-yum.oracle.com).
+
+Docker requires the use of the Unbreakable Enterprise Kernel Release 3 (3.8.13)
+or higher on Oracle Linux. This kernel supports the Docker btrfs storage engine
+on both Oracle Linux 6 and 7.
+
+Due to current Docker limitations, Docker is only able to run only on the x86_64
+architecture.
+
+## To enable the *addons* channel via the Unbreakable Linux Network:
+
+1. Enable either the *ol6\_x86\_64\_addons* or *ol7\_x86\_64\_addons* channel
+via the ULN web interface.
+Consult the [Unbreakable Linux Network User's
+Guide](http://docs.oracle.com/cd/E52668_01/E39381/html/index.html) for
+documentation on subscribing to channels.
+
+## To enable the *addons* repository via Oracle Public Yum:
+
+The latest release of Oracle Linux 6 and 7 are automatically configured to use
+the Oracle Public Yum repositories during installation. However, the *addons*
+repository is not enabled by default.
+
+To enable the *addons* repository:
+
+1. Edit either `/etc/yum.repos.d/public-yum-ol6.repo` or
+`/etc/yum.repos.d/public-yum-ol7.repo`
+and set `enabled=1` in the `[ol6_addons]` or the `[ol7_addons]` stanza.
+
+## To install Docker:
+
+1. Ensure the appropriate *addons* channel or repository has been enabled.
+
+2. Use yum to install the Docker package:
+
+ $ sudo yum install docker
+
+## To start Docker:
+
+1. Now that it's installed, start the Docker daemon:
+
+ 1. On Oracle Linux 6:
+
+ $ sudo service docker start
+
+ 2. On Oracle Linux 7:
+
+ $ sudo systemctl start docker.service
+
+2. If you want the Docker daemon to start automatically at boot:
+
+ 1. On Oracle Linux 6:
+
+ $ sudo chkconfig docker on
+
+ 2. On Oracle Linux 7:
+
+ $ sudo systemctl enable docker.service
+
+**Done!**
+
+## Using the btrfs storage engine
+
+Docker on Oracle Linux 6 and 7 supports the use of the btrfs storage engine.
+Before enabling btrfs support, ensure that `/var/lib/docker` is stored on a
+btrfs-based filesystem. Review [Chapter
+5](http://docs.oracle.com/cd/E37670_01/E37355/html/ol_btrfs.html) of the [Oracle
+Linux Administrator's Solution
+Guide](http://docs.oracle.com/cd/E37670_01/E37355/html/index.html) for details
+on how to create and mount btrfs filesystems.
+
+To enable btrfs support on Oracle Linux:
+
+1. Ensure that `/var/lib/docker` is on a btrfs filesystem.
+1. Edit `/etc/sysconfig/docker` and add `-s btrfs` to the `OTHER_ARGS` field.
+2. Restart the Docker daemon:
+
+You can now continue with the [Docker User Guide](/userguide/).
+
+## Known issues
+
+### Docker unmounts btrfs filesystem on shutdown
+If you're running Docker using the btrfs storage engine and you stop the Docker
+service, it will unmount the btrfs filesystem during the shutdown process. You
+should ensure the filesystem is mounted properly prior to restarting the Docker
+service.
+
+On Oracle Linux 7, you can use a `systemd.mount` definition and modify the
+Docker `systemd.service` to depend on the btrfs mount defined in systemd.
+
+### SElinux Support on Oracle Linux 7
+SElinux must be set to `Permissive` or `Disabled` in `/etc/sysconfig/selinux` to
+use the btrfs storage engine on Oracle Linux 7.
+
+## Further issues?
+
+If you have a current Basic or Premier Support Subscription for Oracle Linux,
+you can report any issues you have with the installation of Docker via a Service
+Request at [My Oracle Support](http://support.oracle.com).
+
+If you do not have an Oracle Linux Support Subscription, you can use the [Oracle
+Linux
+Forum](https://community.oracle.com/community/server_%26_storage_systems/linux/
+oracle_linux) for community-based support.
diff --git a/docs/sources/installation/rhel.md b/docs/sources/installation/rhel.md
index a8b785acca..74a293b513 100644
--- a/docs/sources/installation/rhel.md
+++ b/docs/sources/installation/rhel.md
@@ -75,6 +75,10 @@ Now let's verify that Docker is working.
$ sudo docker run -i -t fedora /bin/bash
+> Note: If you get a `Cannot start container` error mentioning SELinux
+> or permission denied, you may need to update the SELinux policies.
+> This can be done using `sudo yum upgrade selinux-policy` and then rebooting.
+
**Done!**
Continue with the [User Guide](/userguide/).
diff --git a/docs/sources/installation/ubuntulinux.md b/docs/sources/installation/ubuntulinux.md
index 673ea18b0c..efeeeea2e1 100644
--- a/docs/sources/installation/ubuntulinux.md
+++ b/docs/sources/installation/ubuntulinux.md
@@ -31,6 +31,7 @@ To install the latest Ubuntu package (may not be the latest Docker release):
$ sudo apt-get install docker.io
$ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
$ sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
+ $ source /etc/bash_completion.d/docker.io
If you'd like to try the latest version of Docker:
@@ -54,7 +55,7 @@ the `lxc-docker` package.
*You may receive a warning that the package isn't trusted. Answer yes to
continue installation.*
- $ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\
+ $ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
@@ -63,7 +64,7 @@ continue installation.*
>
> There is also a simple `curl` script available to help with this process.
>
-> $ curl -sSL https://get.docker.io/ubuntu/ | sudo sh
+> $ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
To verify that everything has worked as expected:
@@ -87,9 +88,18 @@ VirtualBox guest additions. If you didn't install the headers for your
"precise" kernel, then you can skip these headers for the "raring"
kernel. But it is safer to include them if you're not sure.
+Please read the installation instructions for backported kernels at
+Ubuntu.org to understand why you also need to install the Xorg packages
+when running Docker on a machine with a graphical environment like Unity.
+[LTS Enablement Stack](https://wiki.ubuntu.com/Kernel/LTSEnablementStack) refer to note 5 under
+each version.
+
# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
+
+ # install the backported kernel and xorg if using Unity/Xorg
+ $ sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring
# reboot
$ sudo reboot
@@ -125,7 +135,7 @@ the `lxc-docker` package.
*You may receive a warning that the package isn't trusted. Answer yes to
continue installation.*
- $ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\
+ $ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
@@ -134,7 +144,7 @@ continue installation.*
>
> There is also a simple `curl` script available to help with this process.
>
-> $ curl -sSL https://get.docker.io/ubuntu/ | sudo sh
+> $ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
Now verify that the installation has worked by downloading the
`ubuntu` image and launching a container.
@@ -178,7 +188,7 @@ First add the Docker repository key to your local keychain.
Add the Docker repository to your apt sources list, update and install
the `lxc-docker` package.
- $ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
+ $ sudo sh -c "echo deb http://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
@@ -347,7 +357,7 @@ NetworkManager and Docker need to be restarted afterwards:
## Mirrors
-You should `ping get.docker.io` and compare the
+You should `ping get.docker.com` and compare the
latency to the following mirrors, and pick whichever one is best for
you.
@@ -356,7 +366,7 @@ you.
[Yandex](http://yandex.ru/) in Russia is mirroring the Docker Debian
packages, updating every 6 hours.
Substitute `http://mirror.yandex.ru/mirrors/docker/` for
-`http://get.docker.io/ubuntu` in the instructions above.
+`http://get.docker.com/ubuntu` in the instructions above.
For example:
$ sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\
diff --git a/docs/sources/introduction/understanding-docker.md b/docs/sources/introduction/understanding-docker.md
index 9448f68d8b..c561459e67 100644
--- a/docs/sources/introduction/understanding-docker.md
+++ b/docs/sources/introduction/understanding-docker.md
@@ -198,7 +198,7 @@ then run.
Either by using the `docker` binary or via the API, the Docker client tells the Docker
daemon to run a container.
- $ docker run -i -t ubuntu /bin/bash
+ $ sudo docker run -i -t ubuntu /bin/bash
Let's break down this command. The Docker client is launched using the `docker`
binary with the `run` option telling it to launch a new container. The bare
diff --git a/docs/sources/jsearch.md b/docs/sources/jsearch.md
index 0e2def2f70..4a00e74dc7 100644
--- a/docs/sources/jsearch.md
+++ b/docs/sources/jsearch.md
@@ -1,3 +1,8 @@
+page_title: Search the Docker documentation
+page_keywords: Docker, search documentation
+no_toc: true
+no_version_dropdown: true
+
# Search
+Sorry, page not found.
diff --git a/docs/sources/reference/api/_static/io_oauth_authorization_page.png b/docs/sources/reference/api/_static/io_oauth_authorization_page.png
index 798044ed04..455d631e17 100644
Binary files a/docs/sources/reference/api/_static/io_oauth_authorization_page.png and b/docs/sources/reference/api/_static/io_oauth_authorization_page.png differ
diff --git a/docs/sources/reference/api/docker-io_api.md b/docs/sources/reference/api/docker-io_api.md
index e34e43f3bf..c21781a42a 100644
--- a/docs/sources/reference/api/docker-io_api.md
+++ b/docs/sources/reference/api/docker-io_api.md
@@ -4,23 +4,21 @@ page_keywords: API, Docker, index, REST, documentation, Docker Hub, registry
# Docker Hub API
-## Introduction
-
- This is the REST API for [Docker Hub](https://hub.docker.com).
- Authorization is done with basic auth over SSL
- Not all commands require authentication, only those noted as such.
-## Repository
+# Repositories
-### Repositories
+## User Repository
-#### User Repo
+### Create a user repository
`PUT /v1/repositories/(namespace)/(repo_name)/`
Create a user repository with the given `namespace` and `repo_name`.
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foo/bar/ HTTP/1.1
Host: index.docker.io
@@ -31,12 +29,12 @@ Create a user repository with the given `namespace` and `repo_name`.
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -47,18 +45,20 @@ Create a user repository with the given `namespace` and `repo_name`.
""
- Status Codes:
+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 a user repository
`DELETE /v1/repositories/(namespace)/(repo_name)/`
Delete a user repository with the given `namespace` and `repo_name`.
- **Example Request**:
+**Example Request**:
DELETE /v1/repositories/foo/bar/ HTTP/1.1
Host: index.docker.io
@@ -69,12 +69,12 @@ Delete a user repository with the given `namespace` and `repo_name`.
""
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 202
Vary: Accept
@@ -85,25 +85,27 @@ Delete a user repository with the given `namespace` and `repo_name`.
""
- Status Codes:
+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 Repository
+
+### Create a library repository
`PUT /v1/repositories/(repo_name)/`
Create a library repository with the given `repo_name`.
This is a restricted feature only available to docker admins.
- When namespace is missing, it is assumed to be `library`
+> When namespace is missing, it is assumed to be `library`
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foobar/ HTTP/1.1
Host: index.docker.io
@@ -114,11 +116,11 @@ This is a restricted feature only available to docker admins.
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
- Parameters:
+Parameters:
- - **repo_name** – the library name for the repo
+- **repo_name** – the library name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -129,22 +131,24 @@ This is a restricted feature only available to docker admins.
""
- Status Codes:
+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 a library repository
`DELETE /v1/repositories/(repo_name)/`
-Delete a library repository with the given `repo_name`.
+Delete a library repository with the given `repo_name`.
This is a restricted feature only available to docker admins.
- When namespace is missing, it is assumed to be `library`
+> When namespace is missing, it is assumed to be `library`
- **Example Request**:
+**Example Request**:
DELETE /v1/repositories/foobar/ HTTP/1.1
Host: index.docker.io
@@ -155,11 +159,11 @@ This is a restricted feature only available to docker admins.
""
- Parameters:
+Parameters:
- - **repo_name** – the library name for the repo
+- **repo_name** – the library name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 202
Vary: Accept
@@ -170,23 +174,25 @@ This is a restricted feature only available to docker admins.
""
- Status Codes:
+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 Repository Images
+
+### Update user repository images
`PUT /v1/repositories/(namespace)/(repo_name)/images`
Update the images for a user repo.
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foo/bar/images HTTP/1.1
Host: index.docker.io
@@ -197,12 +203,12 @@ Update the images for a user repo.
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 204
Vary: Accept
@@ -210,29 +216,31 @@ Update the images for a user repo.
""
- Status Codes:
+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
+
+### List user repository images
`GET /v1/repositories/(namespace)/(repo_name)/images`
Get the images for a user repo.
- **Example Request**:
+**Example Request**:
GET /v1/repositories/foo/bar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -243,18 +251,20 @@ Get the images for a user repo.
{"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
"checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
- Status Codes:
+Status Codes:
- - **200** – OK
- - **404** – Not found
+- **200** – OK
+- **404** – Not found
-#### Library Repo Images
+## Library Repository Images
+
+### Update library repository images
`PUT /v1/repositories/(repo_name)/images`
Update the images for a library repo.
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foobar/images HTTP/1.1
Host: index.docker.io
@@ -265,11 +275,11 @@ Update the images for a library repo.
[{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
"checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
- Parameters:
+Parameters:
- - **repo_name** – the library name for the repo
+- **repo_name** – the library name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 204
Vary: Accept
@@ -277,28 +287,30 @@ Update the images for a library repo.
""
- Status Codes:
+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
+
+### List library repository images
`GET /v1/repositories/(repo_name)/images`
Get the images for a library repo.
- **Example Request**:
+**Example Request**:
GET /v1/repositories/foobar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
- Parameters:
+Parameters:
- - **repo_name** – the library name for the repo
+- **repo_name** – the library name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -309,31 +321,33 @@ Get the images for a library repo.
{"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
"checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
- Status Codes:
+Status Codes:
- - **200** – OK
- - **404** – Not found
+- **200** – OK
+- **404** – Not found
-### Repository Authorization
+# Repository Authorization
-#### Library Repo
+## Library Repository
+
+### Authorize a token for a library
`PUT /v1/repositories/(repo_name)/auth`
Authorize a token for a library repo
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foobar/auth HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Token signature=123abc,repository="library/foobar",access=write
- Parameters:
+Parameters:
- - **repo_name** – the library name for the repo
+- **repo_name** – the library name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -341,31 +355,33 @@ Authorize a token for a library repo
"OK"
- Status Codes:
+Status Codes:
- - **200** – OK
- - **403** – Permission denied
- - **404** – Not found
+- **200** – OK
+- **403** – Permission denied
+- **404** – Not found
-#### User Repo
+## User Repository
+
+### Authorize a token for a user repository
`PUT /v1/repositories/(namespace)/(repo_name)/auth`
Authorize a token for a user repo
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/foo/bar/auth HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Token signature=123abc,repository="foo/bar",access=write
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -373,28 +389,28 @@ Authorize a token for a user repo
"OK"
- Status Codes:
+Status Codes:
- - **200** – OK
- - **403** – Permission denied
- - **404** – Not found
+- **200** – OK
+- **403** – Permission denied
+- **404** – Not found
-### Users
+## Users
-#### User Login
+### User Login
-`GET /v1/users`
+`GET /v1/users/`
If you want to check your login, you can try this endpoint
- **Example Request**:
+**Example Request**:
- GET /v1/users HTTP/1.1
+ GET /v1/users/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Basic akmklmasadalkm==
- **Example Response**:
+**Example Response**:
HTTP/1.1 200 OK
Vary: Accept
@@ -402,21 +418,21 @@ If you want to check your login, you can try this endpoint
OK
- Status Codes:
+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 /v1/users`
+`POST /v1/users/`
Registering a new account.
- **Example request**:
+**Example request**:
- POST /v1/users HTTP/1.1
+ POST /v1/users/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
@@ -425,16 +441,14 @@ Registering a new account.
"password": "toto42",
"username": "foobar"}
- Json Parameters:
+Json Parameters:
-
-
- - **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**:
+**Example Response**:
HTTP/1.1 201 OK
Vary: Accept
@@ -442,25 +456,24 @@ Registering a new account.
"User Created"
- Status Codes:
+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 /v1/users/(username)/`
Change a password or email address for given user. If you pass in an
+email, it will add it to your account, it will not remove the old
+one. Passwords will be updated.
- email, it will add it to your account, it will not remove the old
- one. Passwords will be updated.
+It is up to the client to verify that that password that is sent is
+the one that they want. Common approach is to have them type it
+twice.
- It is up to the client to verify that that password that is sent is
- the one that they want. Common approach is to have them type it
- twice.
-
- **Example Request**:
+**Example Request**:
PUT /v1/users/fakeuser/ HTTP/1.1
Host: index.docker.io
@@ -471,11 +484,11 @@ Change a password or email address for given user. If you pass in an
{"email": "sam@docker.com",
"password": "toto42"}
- Parameters:
+Parameters:
- - **username** – username for the person you want to update
+- **username** – username for the person you want to update
- **Example Response**:
+**Example Response**:
HTTP/1.1 204
Vary: Accept
@@ -483,20 +496,18 @@ Change a password or email address for given user. If you pass in an
""
- Status Codes:
+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
If you need to search the index, this is the endpoint you would use.
-### Search
-
`GET /v1/search`
Search the Index given a search term. It accepts
@@ -504,13 +515,13 @@ Search the Index given a search term. It accepts
[GET](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3)
only.
- **Example request**:
+**Example request**:
GET /v1/search?q=search_term HTTP/1.1
- Host: example.com
+ Host: index.docker.io
Accept: application/json
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Vary: Accept
@@ -525,11 +536,11 @@ Search the Index given a search term. It accepts
]
}
- Query Parameters:
+Query Parameters:
- - **q** – what you want to search for
+- **q** – what you want to search for
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
diff --git a/docs/sources/reference/api/docker_io_accounts_api.md b/docs/sources/reference/api/docker_io_accounts_api.md
index b9f76ba92c..efb86eb33a 100644
--- a/docs/sources/reference/api/docker_io_accounts_api.md
+++ b/docs/sources/reference/api/docker_io_accounts_api.md
@@ -4,43 +4,39 @@ page_keywords: API, Docker, accounts, REST, documentation
# docker.io Accounts API
-## 1. Endpoints
-
-### 1.1 Get a single user
+## Get a single user
`GET /api/v1.1/users/:username/`
Get profile info for the specified user.
- Parameters:
+Parameters:
- - **username** – username of the user whose profile info is being
+- **username** – username of the user whose profile info is being
requested.
- Request Headers:
+Request Headers:
-
-
- - **Authorization** – required authentication credentials of
+- **Authorization** – required authentication credentials of
either type HTTP Basic or OAuth Bearer Token.
- Status Codes:
+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**:
+**Example request**:
GET /api/v1.1/users/janedoe/ HTTP/1.1
Host: www.docker.io
Accept: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -60,48 +56,44 @@ Get profile info for the specified user.
"is_active": true
}
-### 1.2 Update a single user
+## Update a single user
`PATCH /api/v1.1/users/:username/`
Update profile info for the specified user.
- Parameters:
+Parameters:
- - **username** – username of the user whose profile info is being
+- **username** – username of the user whose profile info is being
updated.
- Json Parameters:
+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:
+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:
+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**:
+**Example request**:
PATCH /api/v1.1/users/janedoe/ HTTP/1.1
Host: www.docker.io
@@ -114,7 +106,7 @@ Update profile info for the specified user.
"company": "Retired",
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -134,41 +126,39 @@ Update profile info for the specified user.
"is_active": true
}
-### 1.3 List email addresses for a user
+## List email addresses for a user
`GET /api/v1.1/users/:username/emails/`
List email info for the specified user.
- Parameters:
+Parameters:
- - **username** – username of the user whose profile info is being
+- **username** – username of the user whose profile info is being
updated.
- Request Headers:
+Request Headers:
-
-
- - **Authorization** – required authentication credentials of
+- **Authorization** – required authentication credentials of
either type HTTP Basic or OAuth Bearer Token
- Status Codes:
+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**:
+**Example request**:
GET /api/v1.1/users/janedoe/emails/ HTTP/1.1
Host: www.docker.io
Accept: application/json
Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -181,7 +171,7 @@ List email info for the specified user.
}
]
-### 1.4 Add email address for a user
+## Add email address for a user
`POST /api/v1.1/users/:username/emails/`
@@ -189,32 +179,28 @@ Add a new email address to the specified user's account. The email
address must be verified separately, a confirmation email is not
automatically sent.
- Json Parameters:
+Json Parameters:
-
+- **email** (*string*) – email address to be added.
- - **email** (*string*) – email address to be added.
+Request Headers:
- 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:
+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**:
+**Example request**:
POST /api/v1.1/users/janedoe/emails/ HTTP/1.1
Host: www.docker.io
@@ -226,7 +212,7 @@ automatically sent.
"email": "jane.doe+other@example.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 Created
Content-Type: application/json
@@ -237,40 +223,36 @@ automatically sent.
"primary": false
}
-### 1.5 Delete email address for a user
+## Delete email address for a user
`DELETE /api/v1.1/users/:username/emails/`
Delete an email address from the specified user's account. You
cannot delete a user's primary email address.
- Json Parameters:
+Json Parameters:
-
+- **email** (*string*) – email address to be deleted.
- - **email** (*string*) – email address to be deleted.
+Request Headers:
- 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:
+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**:
+**Example request**:
DELETE /api/v1.1/users/janedoe/emails/ HTTP/1.1
Host: www.docker.io
@@ -282,7 +264,7 @@ cannot delete a user's primary email address.
"email": "jane.doe+other@example.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 204 NO CONTENT
Content-Length: 0
diff --git a/docs/sources/reference/api/docker_remote_api.md b/docs/sources/reference/api/docker_remote_api.md
index e712f864f2..39c83743bf 100644
--- a/docs/sources/reference/api/docker_remote_api.md
+++ b/docs/sources/reference/api/docker_remote_api.md
@@ -4,9 +4,12 @@ page_keywords: API, Docker, rcli, REST, documentation
# Docker Remote API
- - 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 the Docker daemon is set to use an encrypted TCP socket (`--tls`,
+ or `--tlsverify`) as with Boot2Docker 1.3.0, then you need to add extra
+ parameters to `curl` when making test API requests:
+ `curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://boot2docker:2376/images/json`
- 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
@@ -15,16 +18,31 @@ page_keywords: API, Docker, rcli, REST, documentation
- Since API version 1.2, the auth configuration is now handled client
side, so the client has to send the `authConfig` as a `POST` in `/images/(name)/push`.
- authConfig, set as the `X-Registry-Auth` header, is currently a Base64
- encoded (JSON) string with credentials:
- `{'username': string, 'password': string, 'email': string, 'serveraddress' : string}`
+ encoded (JSON) string with the following structure:
+ `{"username": "string", "password": "string", "email": "string",
+ "serveraddress" : "string", "auth": ""}`. Notice that `auth` is to be left
+ empty, `serveraddress` is a domain/ip without protocol, and that double
+ quotes (instead of single ones) are required.
+ - The Remote API uses an open schema model. In this model, unknown
+ properties in incoming messages will be ignored.
+ Client applications need to take this into account to ensure
+ they will not break when talking to newer Docker daemons.
-The current version of the API is v1.14
+The current version of the API is v1.15
Calling `/info` is the same as calling
-`/v1.14/info`.
+`/v1.15/info`.
You can still call an old version of the API using
-`/v1.13/info`.
+`/v1.14/info`.
+
+## v1.15
+
+### Full Documentation
+
+[*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/)
+
+### What's new
## v1.14
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 197991de94..3d8eedacf7 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.0.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.0.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -62,24 +62,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -87,7 +85,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -114,9 +112,9 @@ Create a container
"VolumesFrom":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -124,18 +122,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -144,11 +140,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -199,11 +195,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -211,11 +207,11 @@ Return low-level information on the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -235,11 +231,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -247,22 +243,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -270,19 +266,19 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/start HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+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
@@ -290,25 +286,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -316,25 +310,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -342,19 +334,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -362,38 +354,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -401,22 +391,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -424,27 +414,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
## 2.2 Images
@@ -454,11 +442,11 @@ Remove the container `id` from the filesystem
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -478,11 +466,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -505,50 +493,46 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -556,27 +540,25 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- {{ STREAM }}
+ {{ TAR STREAM }}
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -584,11 +566,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -620,11 +602,11 @@ Return low-level information on the image `name`
}
}
- Status Codes:
+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
@@ -632,11 +614,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -654,11 +636,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -677,11 +659,11 @@ Push the image `name` on the registry
{{ STREAM }}
- Status Codes:
+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
@@ -689,27 +671,26 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -717,19 +698,19 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such image
- - **500** – server error
+- **204** – no error
+- **404** – no such image
+- **500** – server error
### Search images
@@ -737,11 +718,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -773,29 +754,27 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Get default username and email
@@ -803,11 +782,11 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
GET /auth HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -817,18 +796,18 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- Status Codes:
+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 i
`POST /auth`
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -839,15 +818,16 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -855,11 +835,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -874,10 +854,10 @@ Display system-wide information
"SwapLimit":false
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -885,11 +865,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -900,10 +880,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -921,50 +901,48 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+Status Codes:
- - **201** – no error
- - **404** – no such container
- - **500** – server error
+- **201** – no error
+- **404** – no such container
+- **500** – server error
# 3. Going further
## 3.1 Inside `docker run`
-Here are the steps of `docker run` :
+As an example, the `docker run` command line makes the following API calls:
- - 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 exist:
+ - 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
- stderr from the container's start) and stream=1
+- 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
+- If in detached mode or only stdin is attached:
+ - Display the container's
## 3.2 Hijacking
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 928e3210f2..705544bd9b 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.1.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.1.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -62,24 +62,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -87,7 +85,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -114,9 +112,9 @@ Create a container
"VolumesFrom":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -124,18 +122,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -144,11 +140,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -199,11 +195,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -211,11 +207,11 @@ Return low-level information on the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -235,11 +231,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -247,22 +243,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ STREAM }}
- Status Codes:
+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
@@ -270,19 +266,19 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/start HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+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
@@ -290,25 +286,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -316,25 +310,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -342,19 +334,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -362,38 +354,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -401,22 +391,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -424,27 +414,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
## 2.2 Images
@@ -454,11 +442,11 @@ Remove the container `id` from the filesystem
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -478,11 +466,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -505,30 +493,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -538,20 +524,18 @@ Create an image, either by pull it from the registry or by importing it
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -559,11 +543,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -573,17 +557,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -591,11 +573,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -627,11 +609,11 @@ Return low-level information on the image `name`
}
}
- Status Codes:
+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
@@ -639,11 +621,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -661,11 +643,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -687,11 +669,11 @@ Push the image `name` on the registry
{"error":"Invalid..."}
...
- Status Codes:
+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
@@ -699,28 +681,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -728,19 +709,19 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such image
- - **500** – server error
+- **204** – no error
+- **404** – no such image
+- **500** – server error
### Search images
@@ -748,11 +729,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -784,29 +765,29 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
{{ STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
{{ STREAM }}
- Query Parameters:
+Query Parameters:
- - **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:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Get default username and email
@@ -814,11 +795,11 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
GET /auth HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -828,18 +809,18 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- Status Codes:
+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 i
`POST /auth`
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -850,15 +831,16 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -866,11 +848,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -885,10 +867,10 @@ Display system-wide information
"SwapLimit":false
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -896,11 +878,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -911,10 +893,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -922,7 +904,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -932,29 +914,27 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+Status Codes:
- - **201** – no error
- - **404** – no such container
- - **500** – server error
+- **201** – no error
+- **404** – no such container
+- **500** – server error
# 3. Going further
@@ -964,7 +944,7 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -975,7 +955,7 @@ Here are the steps of `docker run` :
stderr from the container's start) and stream=1
- If in detached mode or only stdin is attached:
- - Display the container's
+ - Display the container's
## 3.2 Hijacking
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 6ffae3e07e..52bbe2e486 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.10.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.10.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +98,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -134,9 +130,9 @@ Create a container
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -144,25 +140,23 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
+
+- **config** – the container's configuration
+
+Query Parameters:
- - **config** – the container's configuration
-
- Query Parameters:
-
-
-
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -170,11 +164,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -241,11 +235,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -253,11 +247,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -282,17 +276,17 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
- - **ps\_args** – ps arguments to use (e.g., aux)
+- **ps\_args** – ps arguments to use (e.g., aux)
- Status Codes:
+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
@@ -300,11 +294,11 @@ List processes running inside the container `id`
Inspect changes on container `id` 's filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -324,11 +318,11 @@ Inspect changes on container `id` 's filesystem
}
]
- Status Codes:
+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
@@ -336,22 +330,22 @@ Inspect changes on container `id` 's filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -359,14 +353,14 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false
@@ -374,22 +368,22 @@ Start the container `id`
"VolumesFrom": ["parent", "other:ro"]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -397,25 +391,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -423,25 +415,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -449,24 +439,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+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
@@ -474,38 +464,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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**:
@@ -530,9 +518,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -558,51 +546,49 @@ Attach to the container `id`
Block until container `id` stops, then returns
the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
`DELETE /containers/(id*)
: Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **force** – 1/True/true or 0/False/false, Removes the container
even if it was running. Default false
- Status Codes:
+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
@@ -610,7 +596,7 @@ Block until container `id` stops, then returns
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -619,18 +605,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
### 2.2 Images
@@ -642,7 +628,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -677,13 +663,13 @@ Copy files or folders of container `id`
`POST /images/create`
Create an image, either by pull it from the registry or by importing
- it
+ i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -697,26 +683,22 @@ Create an image, either by pull it from the registry or by importing
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **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
@@ -725,11 +707,11 @@ Create an image, either by pull it from the registry or by importing
Insert a file from `url` in the image
`name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -739,17 +721,15 @@ Insert a file from `url` in the image
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -757,11 +737,11 @@ Insert a file from `url` in the image
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -793,11 +773,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -805,11 +785,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -827,11 +807,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -839,11 +819,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -854,32 +834,27 @@ Push the image `name` on the registry
...
If you wish to push an image on to a private registry, that image must already have been tagged
- into a repository which references that registry host name and port. This repository name should
+ into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
- **Example request**:
+**Example request**:
- POST /images/registry.acme.com:5000/test/push HTTP/1.1
-
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
- Query Parameters:
-
+Query Parameters:
- - **tag** – the tag to associate with the image on the registry, optional
+- **tag** – the tag to associate with the image on the registry, optional
- Request Headers:
+Request Headers:
-
+- **X-Registry-Auth** – include a base64-encoded AuthConfig object.
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
- object.
+Status Codes:
- 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
@@ -887,39 +862,38 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
`DELETE /images/(name*)
: Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -930,19 +904,17 @@ Tag the image `name` into a repository
{"Deleted":"53b4f83ac9"}
]
- Query Parameters:
+Query Parameters:
-
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 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:
- 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
@@ -954,11 +926,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -988,16 +960,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### 2.3 Misc
@@ -1007,13 +977,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1030,28 +1000,23 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **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
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1059,7 +1024,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1071,15 +1036,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1087,11 +1053,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1107,10 +1073,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1118,11 +1084,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1133,10 +1099,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1144,7 +1110,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1175,7 +1141,7 @@ Create a new image from a container's changes
}
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
@@ -1183,41 +1149,47 @@ Create a new image from a container's changes
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
- - **config** - the container's configuration
+- **config** - the container's configuration
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
- polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1227,16 +1199,14 @@ Get events from docker, either in real time via streaming, or via
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- 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
@@ -1245,21 +1215,23 @@ Get events from docker, either in real time via streaming, or via
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
@@ -1267,20 +1239,43 @@ Get a tarball containing all images and metadata for the repository
Load a set of images and tags into the docker repository.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
@@ -1290,7 +1285,7 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1311,6 +1306,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/docker_remote_api_v1.11.md b/docs/sources/reference/api/docker_remote_api_v1.11.md
index a0187dbdf6..2368daf4ec 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.11.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.11.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +98,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -135,9 +131,9 @@ Create a container
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -145,25 +141,21 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Query Parameters:
- Query Parameters:
-
-
-
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -172,11 +164,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -245,11 +237,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -257,11 +249,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -286,17 +278,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
### Get container logs
@@ -304,35 +294,35 @@ List processes running inside the container `id`
Get stdout and stderr logs from the container ``id``
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
- - **follow** – 1/True/true or 0/False/false, return stream.
+- **follow** – 1/True/true or 0/False/false, return stream.
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. 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. Default false
- - **timestamps** – 1/True/true or 0/False/false, if logs=true, print
+- **timestamps** – 1/True/true or 0/False/false, if logs=true, prin
timestamps for every log line. Default false
- Status Codes:
+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
@@ -340,11 +330,11 @@ Get stdout and stderr logs from the container ``id``
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -364,11 +354,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -376,22 +366,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -399,14 +389,14 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false,
@@ -414,22 +404,22 @@ Start the container `id`
"VolumesFrom": ["parent", "other:ro"]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -437,25 +427,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -463,25 +451,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -489,24 +475,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+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
@@ -514,38 +500,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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**:
@@ -570,9 +554,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -597,22 +581,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -620,29 +604,27 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **force** – 1/True/true or 0/False/false, Removes the container
even if it was running. Default false
- Status Codes:
+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
@@ -650,7 +632,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -659,18 +641,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -682,7 +664,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -716,13 +698,13 @@ Copy files or folders of container `id`
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -736,26 +718,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **X-Registry-Auth** – base64-encoded AuthConfig object
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -763,11 +741,11 @@ Create an image, either by pull it from the registry or by importing it
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -801,11 +779,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -813,11 +791,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -835,11 +813,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -847,11 +825,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -862,32 +840,27 @@ Push the image `name` on the registry
...
If you wish to push an image on to a private registry, that image must already have been tagged
- into a repository which references that registry host name and port. This repository name should
+ into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
- **Example request**:
+**Example request**:
- POST /images/registry.acme.com:5000/test/push HTTP/1.1
-
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
- Query Parameters:
-
+Query Parameters:
- - **tag** – the tag to associate with the image on the registry, optional
+- **tag** – the tag to associate with the image on the registry, optional
- Request Headers:
+Request Headers:
-
+- **X-Registry-Auth** – include a base64-encoded AuthConfig object.
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
- object.
+Status Codes:
- 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
@@ -895,28 +868,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -924,11 +896,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -939,19 +911,17 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Query Parameters:
+Query Parameters:
-
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 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:
- 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
@@ -963,11 +933,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -997,16 +967,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1016,13 +984,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1039,28 +1007,23 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **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
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1068,7 +1031,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1080,15 +1043,15 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1096,11 +1059,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1122,10 +1085,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1133,11 +1096,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1148,10 +1111,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Ping the docker server
@@ -1159,20 +1122,21 @@ Show the docker version information
Ping the docker server
- **Example request**:
+**Example request**:
GET /_ping HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
OK
- Status Codes:
+Status Codes:
- - **200** - no error
- - **500** - server error
+- **200** - no error
+- **500** - server error
### Create a new image from a container's changes
@@ -1180,7 +1144,7 @@ Ping the docker server
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1211,48 +1175,52 @@ Create a new image from a container's changes
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
- Content-Type: application/vnd.docker.raw-stream
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
+- **config** - the container's configuration
+Query Parameters:
- - **config** - the container's configuration
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Query Parameters:
+Status Codes:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "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
`GET /events`
-Get events from docker, either in real time via streaming, or
-via polling (using since)
+Get container events from docker, either in real time via streaming, or via
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1262,17 +1230,15 @@ via polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
+- **until** – timestamp used for polling
- - **since** – timestamp used for polling
- - **until** – timestamp used for polling
+Status Codes:
- 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
@@ -1281,21 +1247,23 @@ via polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
@@ -1303,30 +1271,53 @@ specified by `name`.
Load a set of images and tags into the docker repository.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
## 3.1 Inside `docker run`
-Here are the steps of `docker run`:
+As an example, the `docker run` command line makes the following API calls:
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1347,6 +1338,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/docker_remote_api_v1.12.md b/docs/sources/reference/api/docker_remote_api_v1.12.md
index 9ea83e2853..8b245f5e9c 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.12.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.12.md
@@ -8,8 +8,8 @@ page_keywords: API, Docker, rcli, REST, documentation
- The Remote API has replaced `rcli`.
- The daemon listens on `unix:///var/run/docker.sock` but you can
- [*Bind Docker to another host/port or a Unix socket*](
- /use/basics/#bind-docker).
+ [Bind Docker to another host/port or a Unix socket](
+ /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket).
- 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`.
@@ -24,11 +24,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -76,28 +76,26 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
-
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
+- **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
- - **filters** – a JSON encoded value of the filters (a map[string][]string)
+- **filters** – a JSON encoded value of the filters (a map[string][]string)
to process on the images list.
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -105,16 +103,19 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -131,15 +132,15 @@ Create a container
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -147,25 +148,23 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
+
+- **config** – the container's configuration
+
+Query Parameters:
- - **config** – the container's configuration
-
- Query Parameters:
-
-
-
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -174,11 +173,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -247,11 +246,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -259,11 +258,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -288,17 +287,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
### Get container logs
@@ -306,35 +303,35 @@ List processes running inside the container `id`
Get stdout and stderr logs from the container ``id``
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
- - **follow** – 1/True/true or 0/False/false, return stream.
+- **follow** – 1/True/true or 0/False/false, return stream.
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. 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. Default false
- - **timestamps** – 1/True/true or 0/False/false, if logs=true, print
+- **timestamps** – 1/True/true or 0/False/false, if logs=true, prin
timestamps for every log line. Default false
- Status Codes:
+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
@@ -342,11 +339,11 @@ Get stdout and stderr logs from the container ``id``
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -366,11 +363,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -378,22 +375,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -401,7 +398,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -409,7 +406,7 @@ Start the container `id`
{
"Binds":["/tmp:/tmp"],
"Links":["redis3:redis"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false,
@@ -417,22 +414,22 @@ Start the container `id`
"VolumesFrom": ["parent", "other:ro"]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -440,25 +437,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -466,25 +461,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -492,24 +485,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Pause a container
@@ -517,19 +510,19 @@ Kill the container `id`
Pause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/pause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Unpause a container
@@ -537,19 +530,19 @@ Pause the container `id`
Unpause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/unpause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -557,38 +550,34 @@ Unpause the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **logs** – 1/True/true or 0/False/false, return logs. Default false
+- **stream** – 1/True/true or 0/False/false, return stream. Default false
+- **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 log, if stream=true, attach to stdout. Default false
+- **stderr** – 1/True/true or 0/False/false, if logs=true, return
+ stderr log, if stream=true, attach to stderr. Default false
- - **logs** – 1/True/true or 0/False/false, return logs. Default
- false
- - **stream** – 1/True/true or 0/False/false, return stream.
- Default false
- - **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 log, if stream=true, attach to stdout. Default false
- - **stderr** – 1/True/true or 0/False/false, if logs=true, return
- stderr log, if stream=true, attach to stderr. Default false
+Status Codes:
- 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**:
@@ -613,9 +602,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -632,7 +621,7 @@ Attach to the container `id`
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
@@ -640,22 +629,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -663,29 +652,27 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **force** – 1/True/true or 0/False/false, Removes the container
even if it was running. Default false
- Status Codes:
+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
@@ -693,7 +680,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -702,18 +689,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -725,7 +712,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -756,12 +743,12 @@ Copy files or folders of container `id`
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, default false
- - **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list.
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list.
@@ -769,13 +756,13 @@ Copy files or folders of container `id`
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -789,26 +776,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **X-Registry-Auth** – base64-encoded AuthConfig object
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
@@ -818,11 +801,11 @@ Create an image, either by pull it from the registry or by importing it
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -856,11 +839,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -868,11 +851,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -890,11 +873,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -902,11 +885,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -917,32 +900,27 @@ Push the image `name` on the registry
...
If you wish to push an image on to a private registry, that image must already have been tagged
- into a repository which references that registry host name and port. This repository name should
+ into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
- **Example request**:
+**Example request**:
- POST /images/registry.acme.com:5000/test/push HTTP/1.1
-
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
- Query Parameters:
-
+Query Parameters:
- - **tag** – the tag to associate with the image on the registry, optional
+- **tag** – the tag to associate with the image on the registry, optional
- Request Headers:
+Request Headers:
-
+- **X-Registry-Auth** – include a base64-encoded AuthConfig object.
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
- object.
+Status Codes:
- 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
@@ -950,28 +928,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -979,11 +956,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -994,19 +971,17 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Query Parameters:
+Query Parameters:
-
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 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:
- 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
@@ -1018,11 +993,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1052,16 +1027,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1071,13 +1044,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1094,29 +1067,24 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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 (default behavior)
- - **forcerm - always remove intermediate containers (includes rm)
+- **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 (default behavior)
+- **forcerm - always remove intermediate containers (includes rm)
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1124,7 +1092,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1136,15 +1104,15 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1152,11 +1120,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1178,10 +1146,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1189,11 +1157,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1205,10 +1173,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Ping the docker server
@@ -1216,20 +1184,21 @@ Show the docker version information
Ping the docker server
- **Example request**:
+**Example request**:
GET /_ping HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
OK
- Status Codes:
+Status Codes:
- - **200** - no error
- - **500** - server error
+- **200** - no error
+- **500** - server error
### Create a new image from a container's changes
@@ -1237,16 +1206,19 @@ Ping the docker server
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -1262,54 +1234,58 @@ Create a new image from a container's changes
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
- Content-Type: application/vnd.docker.raw-stream
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
+- **config** - the container's configuration
+Query Parameters:
- - **config** - the container's configuration
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Query Parameters:
+Status Codes:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "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
`GET /events`
-Get events from docker, either in real time via streaming, or
-via polling (using since)
+Get container events from docker, either in real time via streaming, or via
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1319,17 +1295,15 @@ via polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
+- **until** – timestamp used for polling
- - **since** – timestamp used for polling
- - **until** – timestamp used for polling
+Status Codes:
- 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
@@ -1338,52 +1312,76 @@ via polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
`POST /images/load`
Load a set of images and tags into the docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
- **Example request**
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
## 3.1 Inside `docker run`
-Here are the steps of `docker run`:
+As an example, the `docker run` command line makes the following API calls:
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1404,6 +1402,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/docker_remote_api_v1.13.md b/docs/sources/reference/api/docker_remote_api_v1.13.md
index d782391476..1a25da18ae 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.13.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.13.md
@@ -8,8 +8,8 @@ page_keywords: API, Docker, rcli, REST, documentation
- The Remote API has replaced `rcli`.
- The daemon listens on `unix:///var/run/docker.sock` but you can
- [*Bind Docker to another host/port or a Unix socket*](
- /use/basics/#bind-docker).
+ [Bind Docker to another host/port or a Unix socket](
+ /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket).
- 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`.
@@ -24,11 +24,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -76,26 +76,20 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -103,16 +97,19 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -129,15 +126,15 @@ Create a container
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -145,25 +142,23 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
+
+- **config** – the container's configuration
+
+Query Parameters:
- - **config** – the container's configuration
-
- Query Parameters:
-
-
-
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -172,11 +167,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -245,11 +240,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -257,11 +252,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -286,17 +281,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
### Get container logs
@@ -304,33 +297,32 @@ List processes running inside the container `id`
Get stdout and stderr logs from the container ``id``
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **follow** – 1/True/true or 0/False/false, return stream. Default false
+- **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
+- **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for every
+ log line. Default false
+- **tail** – Output specified number of lines at the end of logs: `all` or
+ ``. Default all
- - **follow** – 1/True/true or 0/False/false, return stream. Default false
- - **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
- - **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
- - **timestamps** – 1/True/true or 0/False/false, print timestamps for
- every log line. Default false
- - **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all
+Status Codes:
- 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
@@ -338,11 +330,11 @@ Get stdout and stderr logs from the container ``id``
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -362,11 +354,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -374,22 +366,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -397,7 +389,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -405,7 +397,7 @@ Start the container `id`
{
"Binds":["/tmp:/tmp"],
"Links":["redis3:redis"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false,
@@ -413,23 +405,23 @@ Start the container `id`
"VolumesFrom": ["parent", "other:ro"]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+Status Codes:
- - **204** – no error
- - **304** – container already started
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
### Stop a container
@@ -437,26 +429,24 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- Status Codes:
-
- - **204** – no error
- - **304** – container already stopped
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
### Restart a container
@@ -464,25 +454,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -490,24 +478,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Pause a container
@@ -515,19 +503,19 @@ Kill the container `id`
Pause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/pause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Unpause a container
@@ -535,19 +523,19 @@ Pause the container `id`
Unpause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/unpause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -555,38 +543,34 @@ Unpause the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **logs** – 1/True/true or 0/False/false, return logs. Default false
+- **stream** – 1/True/true or 0/False/false, return stream. Default false
+- **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 log, if stream=true, attach to stdout. Default false
+- **stderr** – 1/True/true or 0/False/false, if logs=true, return
+ stderr log, if stream=true, attach to stderr. Default false
- - **logs** – 1/True/true or 0/False/false, return logs. Default
- false
- - **stream** – 1/True/true or 0/False/false, return stream.
- Default false
- - **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 log, if stream=true, attach to stdout. Default false
- - **stderr** – 1/True/true or 0/False/false, if logs=true, return
- stderr log, if stream=true, attach to stderr. Default false
+Status Codes:
- 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**:
@@ -611,9 +595,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -630,7 +614,7 @@ Attach to the container `id`
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
@@ -638,22 +622,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -661,29 +645,27 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **force** – 1/True/true or 0/False/false, Removes the container
even if it was running. Default false
- Status Codes:
+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
@@ -691,7 +673,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -700,18 +682,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -723,7 +705,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -754,26 +736,22 @@ Copy files or folders of container `id`
]
- Query Parameters:
-
-
-
- - **all** – 1/True/true or 0/False/false, default false
- - **filters** – a json encoded value of the filters (a map[string][]string) to process on the images list.
-
+Query Parameters:
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a json encoded value of the filters (a map[string][string]) to process on the images list.
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pulling it from the registry or by importing it
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -787,26 +765,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **X-Registry-Auth** – base64-encoded AuthConfig object
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
@@ -816,11 +790,11 @@ Create an image, either by pull it from the registry or by importing it
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -854,11 +828,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -866,11 +840,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -888,11 +862,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -900,11 +874,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -915,32 +889,27 @@ Push the image `name` on the registry
...
If you wish to push an image on to a private registry, that image must already have been tagged
- into a repository which references that registry host name and port. This repository name should
+ into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
- **Example request**:
+**Example request**:
- POST /images/registry.acme.com:5000/test/push HTTP/1.1
-
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
- Query Parameters:
-
+Query Parameters:
- - **tag** – the tag to associate with the image on the registry, optional
+- **tag** – the tag to associate with the image on the registry, optional
- Request Headers:
+Request Headers:
-
+- **X-Registry-Auth** – include a base64-encoded AuthConfig object.
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
- object.
+Status Codes:
- 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
@@ -948,28 +917,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -977,11 +945,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -992,19 +960,17 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Query Parameters:
+Query Parameters:
-
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 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:
- 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
@@ -1016,11 +982,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1050,16 +1016,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1069,13 +1033,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1092,29 +1056,24 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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 (default behavior)
- - **forcerm - always remove intermediate containers (includes rm)
+- **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 (default behavior)
+- **forcerm - always remove intermediate containers (includes rm)
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1122,7 +1081,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1134,15 +1093,15 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1150,11 +1109,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1176,10 +1135,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1187,11 +1146,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1203,10 +1162,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Ping the docker server
@@ -1214,20 +1173,21 @@ Show the docker version information
Ping the docker server
- **Example request**:
+**Example request**:
GET /_ping HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
OK
- Status Codes:
+Status Codes:
- - **200** - no error
- - **500** - server error
+- **200** - no error
+- **500** - server error
### Create a new image from a container's changes
@@ -1235,16 +1195,19 @@ Ping the docker server
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -1260,54 +1223,58 @@ Create a new image from a container's changes
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
- Content-Type: application/vnd.docker.raw-stream
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
+- **config** - the container's configuration
+Query Parameters:
- - **config** - the container's configuration
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Query Parameters:
+Status Codes:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "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
`GET /events`
-Get events from docker, either in real time via streaming, or
-via polling (using since)
+Get container events from docker, either in real time via streaming, or via
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1317,17 +1284,15 @@ via polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
+- **until** – timestamp used for polling
- - **since** – timestamp used for polling
- - **until** – timestamp used for polling
+Status Codes:
- 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
@@ -1336,21 +1301,23 @@ via polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
@@ -1358,30 +1325,53 @@ specified by `name`.
Load a set of images and tags into the docker repository.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
## 3.1 Inside `docker run`
-Here are the steps of `docker run`:
+As an example, the `docker run` command line makes the following API calls:
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1402,6 +1392,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/docker_remote_api_v1.14.md b/docs/sources/reference/api/docker_remote_api_v1.14.md
index 9a9c36e54b..0c806bdd2e 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.14.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.14.md
@@ -8,8 +8,8 @@ page_keywords: API, Docker, rcli, REST, documentation
- The Remote API has replaced `rcli`.
- The daemon listens on `unix:///var/run/docker.sock` but you can
- [*Bind Docker to another host/port or a Unix socket*](
- /use/basics/#bind-docker).
+ [Bind Docker to another host/port or a Unix socket](
+ /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket).
- 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`.
@@ -24,11 +24,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -76,26 +76,20 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -103,16 +97,19 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -129,15 +126,16 @@ Create a container
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
- }
+ },
+ "RestartPolicy": { "Name": "always" }
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -145,25 +143,26 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+- **config** – the container's configuration
- - **config** – the container's configuration
+Query Parameters:
- Query Parameters:
+- **name** – Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`.
-
+Status Codes:
- - **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
@@ -172,11 +171,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -247,11 +246,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -259,11 +258,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -288,17 +287,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
### Get container logs
@@ -306,33 +303,32 @@ List processes running inside the container `id`
Get stdout and stderr logs from the container ``id``
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **follow** – 1/True/true or 0/False/false, return stream. Default false
+- **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
+- **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for every
+ log line. Default false
+- **tail** – Output specified number of lines at the end of logs: `all` or
+ ``. Default all
- - **follow** – 1/True/true or 0/False/false, return stream. Default false
- - **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
- - **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
- - **timestamps** – 1/True/true or 0/False/false, print timestamps for
- every log line. Default false
- - **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all
+Status Codes:
- 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
@@ -340,11 +336,11 @@ Get stdout and stderr logs from the container ``id``
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -364,11 +360,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -376,22 +372,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -399,7 +395,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -407,33 +403,30 @@ Start the container `id`
{
"Binds":["/tmp:/tmp"],
"Links":["redis3:redis"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false,
"Dns": ["8.8.8.8"],
"VolumesFrom": ["parent", "other:ro"],
- "CapAdd: ["NET_ADMIN"],
- "CapDrop: ["MKNOD"]
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 204 No Content
- Content-Type: text/plain
- Json Parameters:
+Json Parameters:
-
+- **hostConfig** – the container's host configuration (optional)
- - **hostConfig** – the container's host configuration (optional)
+Status Codes:
- Status Codes:
-
- - **204** – no error
- - **304** – container already started
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
### Stop a container
@@ -441,26 +434,24 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- Status Codes:
-
- - **204** – no error
- - **304** – container already stopped
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
### Restart a container
@@ -468,25 +459,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -494,24 +483,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Pause a container
@@ -519,19 +508,19 @@ Kill the container `id`
Pause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/pause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+Status Codes:
- - **204** – no error
- - **404** – no such container
- - **500** – server error
+- **204** – no error
+- **404** – no such container
+- **500** – server error
### Unpause a container
@@ -539,19 +528,19 @@ Pause the container `id`
Unpause the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/unpause HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -559,38 +548,34 @@ Unpause the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
+- **logs** – 1/True/true or 0/False/false, return logs. Default false
+- **stream** – 1/True/true or 0/False/false, return stream. Default false
+- **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 log, if stream=true, attach to stdout. Default false
+- **stderr** – 1/True/true or 0/False/false, if logs=true, return
+ stderr log, if stream=true, attach to stderr. Default false
- - **logs** – 1/True/true or 0/False/false, return logs. Default
- false
- - **stream** – 1/True/true or 0/False/false, return stream.
- Default false
- - **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 log, if stream=true, attach to stdout. Default false
- - **stderr** – 1/True/true or 0/False/false, if logs=true, return
- stderr log, if stream=true, attach to stderr. Default false
+Status Codes:
- 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**:
@@ -615,9 +600,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -634,7 +619,7 @@ Attach to the container `id`
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
@@ -642,22 +627,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -665,29 +650,27 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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, Kill then remove the container.
+- **force** - 1/True/true or 0/False/false, Kill then remove the container.
Default false
- Status Codes:
+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
@@ -695,7 +678,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -704,18 +687,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -727,7 +710,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -758,26 +741,22 @@ Copy files or folders of container `id`
]
- Query Parameters:
-
-
-
- - **all** – 1/True/true or 0/False/false, default false
- - **filters** – a json encoded value of the filters (a map[string][]string) to process on the images list.
-
+Query Parameters:
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a json encoded value of the filters (a map[string][string]) to process on the images list.
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pulling it from the registry or by importing it
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -791,26 +770,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **X-Registry-Auth** – base64-encoded AuthConfig object
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
@@ -820,11 +795,11 @@ Create an image, either by pull it from the registry or by importing it
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -858,11 +833,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -870,11 +845,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -892,11 +867,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -904,11 +879,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -919,32 +894,27 @@ Push the image `name` on the registry
...
If you wish to push an image on to a private registry, that image must already have been tagged
- into a repository which references that registry host name and port. This repository name should
+ into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
- **Example request**:
+**Example request**:
- POST /images/registry.acme.com:5000/test/push HTTP/1.1
-
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
- Query Parameters:
-
+Query Parameters:
- - **tag** – the tag to associate with the image on the registry, optional
+- **tag** – the tag to associate with the image on the registry, optional
- Request Headers:
+Request Headers:
-
+- **X-Registry-Auth** – include a base64-encoded AuthConfig object.
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
- object.
+Status Codes:
- 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
@@ -952,28 +922,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -981,11 +950,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -996,19 +965,17 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Query Parameters:
+Query Parameters:
-
+- **force** – 1/True/true or 0/False/false, default false
+- **noprune** – 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:
- 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
@@ -1020,11 +987,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1054,16 +1021,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1073,13 +1038,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1096,29 +1061,24 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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 (default behavior)
- - **forcerm - always remove intermediate containers (includes rm)
+- **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 (default behavior)
+- **forcerm - always remove intermediate containers (includes rm)
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1126,7 +1086,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1138,15 +1098,15 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1154,11 +1114,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1180,10 +1140,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1191,11 +1151,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1207,10 +1167,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Ping the docker server
@@ -1218,20 +1178,21 @@ Show the docker version information
Ping the docker server
- **Example request**:
+**Example request**:
GET /_ping HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
OK
- Status Codes:
+Status Codes:
- - **200** - no error
- - **500** - server error
+- **200** - no error
+- **500** - server error
### Create a new image from a container's changes
@@ -1239,16 +1200,19 @@ Ping the docker server
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
{
"Hostname":"",
+ "Domainname": "",
"User":"",
"Memory":0,
"MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
"AttachStdin":false,
"AttachStdout":true,
"AttachStderr":true,
@@ -1264,54 +1228,58 @@ Create a new image from a container's changes
"/tmp": {}
},
"WorkingDir":"",
- "DisableNetwork": false,
+ "NetworkDisabled": false,
"ExposedPorts":{
"22/tcp": {}
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
- Content-Type: application/vnd.docker.raw-stream
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
+- **config** - the container's configuration
+Query Parameters:
- - **config** - the container's configuration
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Query Parameters:
+Status Codes:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "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
`GET /events`
-Get events from docker, either in real time via streaming, or
-via polling (using since)
+Get container events from docker, either in real time via streaming, or via
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1321,17 +1289,15 @@ via polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
+- **until** – timestamp used for polling
- - **since** – timestamp used for polling
- - **until** – timestamp used for polling
+Status Codes:
- 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
@@ -1340,52 +1306,76 @@ via polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
`POST /images/load`
Load a set of images and tags into the docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
- **Example request**
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
## 3.1 Inside `docker run`
-Here are the steps of `docker run`:
+As an example, the `docker run` command line makes the following API calls:
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1406,6 +1396,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/docker_remote_api_v1.15.md b/docs/sources/reference/api/docker_remote_api_v1.15.md
new file mode 100644
index 0000000000..e23fa0ff30
--- /dev/null
+++ b/docs/sources/reference/api/docker_remote_api_v1.15.md
@@ -0,0 +1,1573 @@
+page_title: Remote API v1.15
+page_description: API Documentation for Docker
+page_keywords: API, Docker, rcli, REST, documentation
+
+# Docker Remote API v1.15
+
+## 1. Brief introduction
+
+ - The Remote API has replaced `rcli`.
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
+ [Bind Docker to another host/port or a Unix socket](
+ /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket).
+ - 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`.
+
+# 2. Endpoints
+
+## 2.1 Containers
+
+### List containers
+
+`GET /containers/json`
+
+List containers
+
+**Example request**:
+
+ GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id": "8dfafdbc3a40",
+ "Image": "base:latest",
+ "Command": "echo 1",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "9cd87474be90",
+ "Image": "base:latest",
+ "Command": "echo 222222",
+ "Created": 1367854155,
+ "Status": "Exit 0",
+ "Ports":[],
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "3176a2479c92",
+ "Image": "base:latest",
+ "Command": "echo 3333333333333333",
+ "Created": 1367854154,
+ "Status": "Exit 0",
+ "Ports":[],
+ "SizeRw":12288,
+ "SizeRootFs":0
+ },
+ {
+ "Id": "4cb07b47f9fb",
+ "Image": "base:latest",
+ "Command": "echo 444444444444444444444444444444444",
+ "Created": 1367854152,
+ "Status": "Exit 0",
+ "Ports":[],
+ "SizeRw":12288,
+ "SizeRootFs":0
+ }
+ ]
+
+Query Parameters:
+
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created
+ containers, include non-running ones.
+- **since** – Show only containers created since Id, include
+ non-running ones.
+- **before** – Show only containers created before Id, include
+ non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers
+ sizes
+
+Status Codes:
+
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
+
+### Create a container
+
+`POST /containers/create`
+
+Create a container
+
+**Example request**:
+
+ POST /containers/create HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname":"",
+ "Domainname": "",
+ "User":"",
+ "Memory":0,
+ "MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
+ "AttachStdin":false,
+ "AttachStdout":true,
+ "AttachStderr":true,
+ "PortSpecs":null,
+ "Tty":false,
+ "OpenStdin":false,
+ "StdinOnce":false,
+ "Env":null,
+ "Cmd":[
+ "date"
+ ],
+ "Image":"base",
+ "Volumes":{
+ "/tmp": {}
+ },
+ "WorkingDir":"",
+ "NetworkDisabled": false,
+ "ExposedPorts":{
+ "22/tcp": {}
+ },
+ "RestartPolicy": { "Name": "always" }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/json
+
+ {
+ "Id":"e90e34656806"
+ "Warnings":[]
+ }
+
+Json Parameters:
+
+- **RestartPolicy** – The behavior to apply when the container exits. The
+ value is an object with a `Name` property of either `"always"` to
+ always restart or `"on-failure"` to restart only when the container
+ exit code is non-zero. If `on-failure` is used, `MaximumRetryCount`
+ controls the number of times to retry before giving up.
+ The default is not to restart. (optional)
+- **Volumes** – An object mapping mountpoint paths (strings) inside the
+ container to empty objects.
+- **config** – the container's configuration
+
+Query Parameters:
+
+- **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
+
+### Inspect a container
+
+`GET /containers/(id)/json`
+
+Return low-level information on the container `id`
+
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
+ "Created": "2013-05-07T14:51:42.041847+02:00",
+ "Path": "date",
+ "Args": [],
+ "Config": {
+ "Hostname": "4fa6e0f0c678",
+ "User": "",
+ "Memory": 0,
+ "MemorySwap": 0,
+ "AttachStdin": false,
+ "AttachStdout": true,
+ "AttachStderr": true,
+ "PortSpecs": null,
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": null,
+ "Cmd": [
+ "date"
+ ],
+ "Dns": null,
+ "Image": "base",
+ "Volumes": {},
+ "VolumesFrom": "",
+ "WorkingDir":""
+
+ },
+ "State": {
+ "Running": false,
+ "Pid": 0,
+ "ExitCode": 0,
+ "StartedAt": "2013-05-07T14:51:42.087658+02:01360",
+ "Ghost": false
+ },
+ "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "NetworkSettings": {
+ "IpAddress": "",
+ "IpPrefixLen": 0,
+ "Gateway": "",
+ "Bridge": "",
+ "PortMapping": null
+ },
+ "SysInitPath": "/home/kitty/go/src/github.com/docker/docker/bin/docker",
+ "ResolvConfPath": "/etc/resolv.conf",
+ "Volumes": {},
+ "HostConfig": {
+ "Binds": null,
+ "ContainerIDFile": "",
+ "LxcConf": [],
+ "Privileged": false,
+ "PortBindings": {
+ "80/tcp": [
+ {
+ "HostIp": "0.0.0.0",
+ "HostPort": "49153"
+ }
+ ]
+ },
+ "Links": ["/name:alias"],
+ "PublishAllPorts": false,
+ "CapAdd: ["NET_ADMIN"],
+ "CapDrop: ["MKNOD"]
+ }
+ }
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### List processes running inside a container
+
+`GET /containers/(id)/top`
+
+List processes running inside the container `id`
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/top HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Titles":[
+ "USER",
+ "PID",
+ "%CPU",
+ "%MEM",
+ "VSZ",
+ "RSS",
+ "TTY",
+ "STAT",
+ "START",
+ "TIME",
+ "COMMAND"
+ ],
+ "Processes":[
+ ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
+ ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
+ ]
+ }
+
+Query Parameters:
+
+- **ps_args** – ps arguments to use (e.g., aux)
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Get container logs
+
+`GET /containers/(id)/logs`
+
+Get stdout and stderr logs from the container ``id``
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {{ STREAM }}
+
+Query Parameters:
+
+- **follow** – 1/True/true or 0/False/false, return stream. Default false
+- **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
+- **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
+- **timestamps** – 1/True/true or 0/False/false, print timestamps for
+ every log line. Default false
+- **tail** – Output specified number of lines at the end of logs: `all` or ``. Default all
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Inspect changes on a container's filesystem
+
+`GET /containers/(id)/changes`
+
+Inspect changes on container `id`'s filesystem
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/changes HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Path":"/dev",
+ "Kind":0
+ },
+ {
+ "Path":"/dev/kmsg",
+ "Kind":1
+ },
+ {
+ "Path":"/test",
+ "Kind":1
+ }
+ ]
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Export a container
+
+`GET /containers/(id)/export`
+
+Export the contents of container `id`
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/export HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/octet-stream
+
+ {{ TAR STREAM }}
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Resize a container TTY
+
+`GET /containers/(id)/resize?h=&w=`
+
+Resize the TTY of container `id`
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+Status Codes:
+
+- **200** – no error
+- **404** – No such container
+- **500** – bad file descriptor
+
+### Start a container
+
+`POST /containers/(id)/start`
+
+Start the container `id`
+
+**Example request**:
+
+ POST /containers/(id)/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Binds":["/tmp:/tmp"],
+ "Links":["redis3:redis"],
+ "LxcConf":{"lxc.utsname":"docker"},
+ "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
+ "PublishAllPorts":false,
+ "Privileged":false,
+ "Dns": ["8.8.8.8"],
+ "VolumesFrom": ["parent", "other:ro"],
+ "CapAdd": ["NET_ADMIN"],
+ "CapDrop": ["MKNOD"]
+ }
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Json Parameters:
+
+- **Binds** – A list of volume bindings for this container. Each volume
+ binding is a string of the form `container_path` (to create a new
+ volume for the container), `host_path:container_path` (to bind-mount
+ a host path into the container), or `host_path:container_path:ro`
+ (to make the bind-mount read-only inside the container).
+- **hostConfig** – the container's host configuration (optional)
+
+Status Codes:
+
+- **204** – no error
+- **304** – container already started
+- **404** – no such container
+- **500** – server error
+
+### Stop a container
+
+`POST /containers/(id)/stop`
+
+Stop the container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/stop?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Query Parameters:
+
+- **t** – number of seconds to wait before killing the container
+
+Status Codes:
+
+- **204** – no error
+- **304** – container already stopped
+- **404** – no such container
+- **500** – server error
+
+### Restart a container
+
+`POST /containers/(id)/restart`
+
+Restart the container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/restart?t=5 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Query Parameters:
+
+- **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
+
+`POST /containers/(id)/kill`
+
+Kill the container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/kill HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Query Parameters
+
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ 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
+
+### Pause a container
+
+`POST /containers/(id)/pause`
+
+Pause the container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/pause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Status Codes:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+### Unpause a container
+
+`POST /containers/(id)/unpause`
+
+Unpause the container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/unpause HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Status Codes:
+
+- **204** – no error
+- **404** – no such container
+- **500** – server error
+
+### Attach to a container
+
+`POST /containers/(id)/attach`
+
+Attach to the container `id`
+
+**Example request**:
+
+ POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/vnd.docker.raw-stream
+
+ {{ STREAM }}
+
+Query Parameters:
+
+- **logs** – 1/True/true or 0/False/false, return logs. Default false
+- **stream** – 1/True/true or 0/False/false, return stream.
+ Default false
+- **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 log, if stream=true, attach to stdout. Default false
+- **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
+
+ **Stream details**:
+
+ When using the TTY setting is enabled in
+ [`POST /containers/create`
+ ](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
+ the stream is the raw data from the process PTY and client's stdin.
+ When the TTY is disabled, then the stream is multiplexed to separate
+ stdout and stderr.
+
+ The format is a **Header** and a **Payload** (frame).
+
+ **HEADER**
+
+ The header will contain the information on which stream write the
+ stream (stdout or stderr). It also contain the size of the
+ associated frame encoded on the last 4 bytes (uint32).
+
+ It is encoded on the first 8 bytes like this:
+
+ header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
+
+ `STREAM_TYPE` can be:
+
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
+
+ `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
+ the uint32 size encoded as big endian.
+
+ **PAYLOAD**
+
+ The payload is the raw stream.
+
+ **IMPLEMENTATION**
+
+ The simplest way to implement the Attach protocol is the following:
+
+ 1. Read 8 bytes
+ 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
+
+### Wait a container
+
+`POST /containers/(id)/wait`
+
+Block until container `id` stops, then returns the exit code
+
+**Example request**:
+
+ POST /containers/16253994b7c4/wait HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"StatusCode":0}
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Remove a container
+
+`DELETE /containers/(id)`
+
+Remove the container `id` from the filesystem
+
+**Example request**:
+
+ DELETE /containers/16253994b7c4?v=1 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 204 No Content
+
+Query Parameters:
+
+- **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, Kill then remove the container.
+ Default false
+
+Status Codes:
+
+- **204** – no error
+- **400** – bad parameter
+- **404** – no such container
+- **500** – server error
+
+### Copy files or folders from a container
+
+`POST /containers/(id)/copy`
+
+Copy files or folders of container `id`
+
+**Example request**:
+
+ POST /containers/4fa6e0f0c678/copy HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Resource":"test.txt"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ {{ TAR STREAM }}
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+## 2.2 Images
+
+### List Images
+
+`GET /images/json`
+
+**Example request**:
+
+ GET /images/json?all=0 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "RepoTags": [
+ "ubuntu:12.04",
+ "ubuntu:precise",
+ "ubuntu:latest"
+ ],
+ "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
+ "Created": 1365714795,
+ "Size": 131506275,
+ "VirtualSize": 131506275
+ },
+ {
+ "RepoTags": [
+ "ubuntu:12.10",
+ "ubuntu:quantal"
+ ],
+ "ParentId": "27cf784147099545",
+ "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Created": 1364102658,
+ "Size": 24653,
+ "VirtualSize": 180116135
+ }
+ ]
+
+
+Query Parameters:
+
+- **all** – 1/True/true or 0/False/false, default false
+- **filters** – a json encoded value of the filters (a map[string][]string) to process on the images list.
+
+### Create an image
+
+`POST /images/create`
+
+Create an image, either by pulling it from the registry or by importing it
+
+**Example request**:
+
+ POST /images/create?fromImage=base HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status":"Pulling..."}
+ {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
+ {"error":"Invalid..."}
+ ...
+
+ When using this endpoint to pull an image from the registry, the
+ `X-Registry-Auth` header can be used to include
+ a base64-encoded AuthConfig object.
+
+Query Parameters:
+
+- **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
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+
+
+### Inspect an image
+
+`GET /images/(name)/json`
+
+Return low-level information on the image `name`
+
+**Example request**:
+
+ GET /images/base/json HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Created":"2013-03-23T22:24:18.818426-07:00",
+ "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
+ "ContainerConfig":
+ {
+ "Hostname":"",
+ "User":"",
+ "Memory":0,
+ "MemorySwap":0,
+ "AttachStdin":false,
+ "AttachStdout":false,
+ "AttachStderr":false,
+ "PortSpecs":null,
+ "Tty":true,
+ "OpenStdin":true,
+ "StdinOnce":false,
+ "Env":null,
+ "Cmd": ["/bin/bash"],
+ "Dns":null,
+ "Image":"base",
+ "Volumes":null,
+ "VolumesFrom":"",
+ "WorkingDir":""
+ },
+ "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
+ "Parent":"27cf784147099545",
+ "Size": 6824592
+ }
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+### Get the history of an image
+
+`GET /images/(name)/history`
+
+Return the history of the image `name`
+
+**Example request**:
+
+ GET /images/base/history HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "Id":"b750fe79269d",
+ "Created":1364102658,
+ "CreatedBy":"/bin/bash"
+ },
+ {
+ "Id":"27cf78414709",
+ "Created":1364068391,
+ "CreatedBy":""
+ }
+ ]
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+### Push an image on the registry
+
+`POST /images/(name)/push`
+
+Push the image `name` on the registry
+
+**Example request**:
+
+ POST /images/test/push HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status":"Pushing..."}
+ {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
+ {"error":"Invalid..."}
+ ...
+
+ If you wish to push an image on to a private registry, that image must already have been tagged
+ into a repository which references that registry host name and port. This repository name should
+ then be used in the URL. This mirrors the flow of the CLI.
+
+**Example request**:
+
+ POST /images/registry.acme.com:5000/test/push HTTP/1.1
+
+
+Query Parameters:
+
+- **tag** – the tag to associate with the image on the registry, optional
+
+Request Headers:
+
+- **X-Registry-Auth** – include a base64-encoded AuthConfig
+ object.
+
+Status Codes:
+
+- **200** – no error
+- **404** – no such image
+- **500** – server error
+
+### Tag an image into a repository
+
+`POST /images/(name)/tag`
+
+Tag the image `name` into a repository
+
+**Example request**:
+
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 201 OK
+
+Query Parameters:
+
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
+
+Status Codes:
+
+- **201** – no error
+- **400** – bad parameter
+- **404** – no such image
+- **409** – conflict
+- **500** – server error
+
+### Remove an image
+
+`DELETE /images/(name)`
+
+Remove the image `name` from the filesystem
+
+**Example request**:
+
+ DELETE /images/test HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-type: application/json
+
+ [
+ {"Untagged":"3e2f21a89f"},
+ {"Deleted":"3e2f21a89f"},
+ {"Deleted":"53b4f83ac9"}
+ ]
+
+Query Parameters:
+
+- **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
+
+### Search images
+
+`GET /images/search`
+
+Search for an image on [Docker Hub](https://hub.docker.com).
+
+> **Note**:
+> The response keys have changed from API v1.6 to reflect the JSON
+> sent by the registry server to the docker daemon's request.
+
+**Example request**:
+
+ GET /images/search?term=sshd HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ [
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "wma55/u1210sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "jdswinbank/sshd",
+ "star_count": 0
+ },
+ {
+ "description": "",
+ "is_official": false,
+ "is_automated": false,
+ "name": "vgauthier/sshd",
+ "star_count": 0
+ }
+ ...
+ ]
+
+Query Parameters:
+
+- **term** – term to search
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+## 2.3 Misc
+
+### Build an image from Dockerfile via stdin
+
+`POST /build`
+
+Build an image from Dockerfile via stdin
+
+**Example request**:
+
+ POST /build HTTP/1.1
+
+ {{ TAR STREAM }}
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"stream":"Step 1..."}
+ {"stream":"..."}
+ {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
+
+ The stream must be a tar archive compressed with one of the
+ following algorithms: identity (no compression), gzip, bzip2, xz.
+
+ The archive must include a file called `Dockerfile`
+ at its root. It may include any number of other files,
+ which will be accessible in the build context (See the [*ADD build
+ command*](/reference/builder/#dockerbuilder)).
+
+Query Parameters:
+
+- **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 (default behavior)
+- **forcerm - always remove intermediate containers (includes rm)
+
+ Request Headers:
+
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Check auth configuration
+
+`POST /auth`
+
+Get the default username and email
+
+**Example request**:
+
+ POST /auth HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "username":"hannibal",
+ "password:"xxxx",
+ "email":"hannibal@a-team.com",
+ "serveraddress":"https://index.docker.io/v1/"
+ }
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+Status Codes:
+
+- **200** – no error
+- **204** – no error
+- **500** – server error
+
+### Display system-wide information
+
+`GET /info`
+
+Display system-wide information
+
+**Example request**:
+
+ GET /info HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "Containers":11,
+ "Images":16,
+ "Driver":"btrfs",
+ "ExecutionDriver":"native-0.1",
+ "KernelVersion":"3.12.0-1-amd64"
+ "Debug":false,
+ "NFd": 11,
+ "NGoroutines":21,
+ "NEventsListener":0,
+ "InitPath":"/usr/bin/docker",
+ "IndexServerAddress":["https://index.docker.io/v1/"],
+ "MemoryLimit":true,
+ "SwapLimit":false,
+ "IPv4Forwarding":true
+ }
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Show the docker version information
+
+`GET /version`
+
+Show the docker version information
+
+**Example request**:
+
+ GET /version HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "ApiVersion":"1.12",
+ "Version":"0.2.2",
+ "GitCommit":"5a2a5cc+CHANGES",
+ "GoVersion":"go1.0.3"
+ }
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Ping the docker server
+
+`GET /_ping`
+
+Ping the docker server
+
+**Example request**:
+
+ GET /_ping HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: text/plain
+
+ OK
+
+Status Codes:
+
+- **200** - no error
+- **500** - server error
+
+### Create a new image from a container's changes
+
+`POST /commit`
+
+Create a new image from a container's changes
+
+**Example request**:
+
+ POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Hostname":"",
+ "Domainname": "",
+ "User":"",
+ "Memory":0,
+ "MemorySwap":0,
+ "CpuShares": 512,
+ "Cpuset": "0,1",
+ "AttachStdin":false,
+ "AttachStdout":true,
+ "AttachStderr":true,
+ "PortSpecs":null,
+ "Tty":false,
+ "OpenStdin":false,
+ "StdinOnce":false,
+ "Env":null,
+ "Cmd":[
+ "date"
+ ],
+ "Volumes":{
+ "/tmp": {}
+ },
+ "WorkingDir":"",
+ "NetworkDisabled": false,
+ "ExposedPorts":{
+ "22/tcp": {}
+ }
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
+
+ {"Id":"596069db4bf5"}
+
+Json Parameters:
+
+- **config** - the container's configuration
+
+Query Parameters:
+
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
+
+Status Codes:
+
+- **201** – no error
+- **404** – no such container
+- **500** – server error
+
+### Monitor Docker's events
+
+`GET /events`
+
+Get container events from docker, either in real time via streaming, or via
+polling (using since).
+
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
+
+ GET /events?since=1374067924
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
+ {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
+ {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
+ {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
+
+Query Parameters:
+
+- **since** – timestamp used for polling
+- **until** – timestamp used for polling
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Get a tarball containing all images in a repository
+
+`GET /images/(name)/get`
+
+Get a tarball containing all images and metadata for the repository specified
+by `name`.
+
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
+(and its parents) are returned. If `name` is an image ID, similarly only tha
+image (and its parents) are returned, but with the exclusion of the
+'repositories' file in the tarball, as there were no image names referenced.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /images/ubuntu/get
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Get a tarball containing all images.
+
+`GET /images/get`
+
+Get a tarball containing all images and metadata for one or more repositories.
+
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
+ubuntu:latest), then only that image (and its parents) are returned; if it is
+an image ID, similarly only that image (and its parents) are returned and there
+would be no names referenced in the 'repositories' file for this image ID.
+
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Type: application/x-tar
+
+ Binary data stream
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Load a tarball with a set of images and tags into docker
+
+`POST /images/load`
+
+Load a set of images and tags into the docker repository.
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
+
+ POST /images/load
+
+ Tarball in body
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+
+Status Codes:
+
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
+
+### Exec Create
+
+`POST /containers/(id)/exec`
+
+Sets up an exec instance in a running container `id`
+
+**Example request**:
+
+ POST /containers/e90e34656806/exec HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "AttachStdin":false,
+ "AttachStdout":true,
+ "AttachStderr":true,
+ "Tty":false,
+ "Cmd":[
+ "date"
+ ],
+ "Container":"e90e34656806",
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 OK
+ Content-Type: application/json
+
+ {
+ "Id":"f90e34656806"
+ }
+
+Json Parameters:
+
+- **execConfig** ? exec configuration.
+
+Status Codes:
+
+- **201** – no error
+- **404** – no such container
+
+### Exec Start
+
+`POST /exec/(id)/start`
+
+Starts a previously set up exec instance `id`. If `detach` is true, this API returns after
+starting the `exec` command. Otherwise, this API sets up an interactive session with the `exec` command.
+
+**Example request**:
+
+ POST /exec/e90e34656806/start HTTP/1.1
+ Content-Type: application/json
+
+ {
+ "Detach":false,
+ "Tty":false,
+ }
+
+**Example response**:
+
+ HTTP/1.1 201 OK
+ Content-Type: application/json
+
+ {{ STREAM }}
+
+Json Parameters:
+
+- **execConfig** ? exec configuration.
+
+Status Codes:
+
+- **201** – no error
+- **404** – no such exec instance
+
+ **Stream details**:
+ Similar to the stream behavior of `POST /container/(id)/attach` API
+
+### Exec Resize
+
+`POST /exec/(id)/resize`
+
+Resizes the tty session used by the exec command `id`.
+This API is valid only if `tty` was specified as part of creating and starting the exec command.
+
+**Example request**:
+
+ POST /exec/e90e34656806/resize HTTP/1.1
+ Content-Type: plain/text
+
+**Example response**:
+
+ HTTP/1.1 201 OK
+ Content-Type: plain/text
+
+Query Parameters:
+
+- **h** – height of tty session
+- **w** – width
+
+Status Codes:
+
+- **201** – no error
+- **404** – no such exec instance
+
+# 3. Going further
+
+## 3.1 Inside `docker run`
+
+As an example, the `docker run` command line makes the following API calls:
+
+- Create the container
+
+- If the status code is 404, it means the image doesn't exist:
+ - 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 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
+
+## 3.2 Hijacking
+
+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.
+
+## 3.3 CORS Requests
+
+To enable cross origin requests to the remote api add the flag
+"--api-enable-cors" when running docker in daemon mode.
+
+ $ docker -d -H="192.168.1.9:2375" --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 2530fb90ae..8da486cf94 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.2.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.2.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -74,24 +74,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -99,7 +97,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -126,9 +124,9 @@ Create a container
"VolumesFrom":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -136,18 +134,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -156,11 +152,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -211,11 +207,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -223,11 +219,11 @@ Return low-level information on the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -247,11 +243,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -259,22 +255,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -282,19 +278,19 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/start HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+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
@@ -302,25 +298,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -328,25 +322,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -354,19 +346,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -374,38 +366,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -413,22 +403,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -436,27 +426,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
## 2.2 Images
@@ -466,11 +454,11 @@ Remove the container `id` from the filesystem
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -494,11 +482,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -521,30 +509,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -554,20 +540,18 @@ Create an image, either by pull it from the registry or by importing it
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -575,11 +559,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -589,17 +573,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -607,11 +589,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -644,11 +626,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -656,11 +638,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -679,11 +661,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -706,11 +688,11 @@ Push the image `name` on the registry
{"error":"Invalid..."}
...
- Status Codes:
+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
@@ -718,28 +700,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -747,11 +728,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -762,12 +743,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -775,11 +756,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -811,30 +792,29 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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.
@@ -845,7 +825,7 @@ HTTP Hijack method in order to stream.
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -856,7 +836,7 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -865,13 +845,13 @@ Get the default username and email
"Status": "Login Succeeded"
}
- Status Codes:
+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
@@ -879,11 +859,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -898,10 +878,10 @@ Display system-wide information
"SwapLimit":false
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -909,11 +889,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -924,10 +904,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -935,7 +915,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -945,29 +925,27 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+Status Codes:
- - **201** – no error
- - **404** – no such container
- - **500** – server error
+- **201** – no error
+- **404** – no such container
+- **500** – server error
# 3. Going further
@@ -977,7 +955,7 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -988,7 +966,7 @@ Here are the steps of `docker run` :
stderr from the container's start) and stream=1
- If in detached mode or only stdin is attached:
- - Display the container's
+ - Display the container's
## 3.2 Hijacking
@@ -998,7 +976,7 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375](tcp://192.168.1.9:2375)"
> –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 ff6fcac944..087262d7c8 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.3.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.3.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -74,26 +74,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -101,7 +97,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -128,9 +124,9 @@ Create a container
"VolumesFrom":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -138,18 +134,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -158,11 +152,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -213,11 +207,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -225,11 +219,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -249,11 +243,11 @@ List processes running inside the container `id`
}
]
- Status Codes:
+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
@@ -261,11 +255,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -285,11 +279,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -297,22 +291,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -320,7 +314,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -329,22 +323,22 @@ Start the container `id`
"Binds":["/tmp:/tmp"]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -352,25 +346,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -378,25 +370,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -404,19 +394,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -424,38 +414,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -463,22 +451,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -486,27 +474,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
## 2.2 Images
@@ -516,11 +502,11 @@ Remove the container `id` from the filesystem
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -544,11 +530,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -571,30 +557,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -604,20 +588,18 @@ Create an image, either by pull it from the registry or by importing it
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -625,11 +607,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -639,17 +621,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -657,11 +637,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -694,11 +674,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -706,11 +686,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -728,11 +708,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -755,11 +735,11 @@ Push the image `name` on the registry
{"error":"Invalid..."}
...
- Status Codes:
+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
@@ -767,28 +747,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -796,11 +775,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -811,12 +790,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -824,11 +803,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -860,13 +839,13 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
@@ -874,24 +853,22 @@ Build an image from Dockerfile via stdin
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
- The archive must include a file called Dockerfile at its root. It
+ The archive must include a file called Dockerfile at its root. I
may include any number of other files, which will be accessible in
the build context (See the ADD build command).
The Content-type header should be set to "application/tar".
- Query Parameters:
+Query Parameters:
-
+- **t** – repository name (and optionally a tag) to be applied to
+ the resulting image in case of success
+- **q** – suppress verbose build output
- - **t** – repository name (and optionally a tag) to be applied to
- the resulting image in case of success
- - **q** – suppress verbose build output
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -899,7 +876,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -910,15 +887,16 @@ Get the default username and email
"email":"hannibal@a-team.com"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -926,11 +904,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -948,10 +926,10 @@ Display system-wide information
"KernelVersion":"3.8.0-19-generic"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -959,11 +937,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -974,10 +952,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -985,7 +963,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -995,42 +973,48 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1040,16 +1024,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
# 3. Going further
@@ -1059,7 +1041,7 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1080,6 +1062,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" –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 77d8e15504..bfd739f8df 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.4.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.4.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -74,26 +74,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -101,7 +97,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -131,9 +127,9 @@ Create a container
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -141,18 +137,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -161,11 +155,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -218,12 +212,12 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -231,11 +225,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -260,17 +254,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -278,11 +270,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -302,11 +294,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -314,22 +306,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -337,7 +329,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -347,22 +339,22 @@ Start the container `id`
"LxcConf":[{"Key":"lxc.utsname","Value":"docker"}]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -370,25 +362,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -396,25 +386,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -422,19 +410,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -442,38 +430,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -481,22 +467,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -504,27 +490,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -532,7 +516,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -541,18 +525,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -562,11 +546,11 @@ Copy files or folders of container `id`
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -590,11 +574,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -617,30 +601,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -650,20 +632,18 @@ Create an image, either by pull it from the registry or by importing it
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -671,11 +651,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -685,17 +665,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -703,11 +681,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -741,12 +719,12 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -754,11 +732,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -776,11 +754,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -788,12 +766,12 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
{{ authConfig }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -801,9 +779,9 @@ Push the image `name` on the registry
{"status":"Pushing..."} {"status":"Pushing", "progress":"1/? (n/a)"}
{"error":"Invalid..."} ...
- Status Codes:
+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
@@ -812,28 +790,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -841,11 +818,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -856,12 +833,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -869,11 +846,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -905,13 +882,13 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
@@ -919,25 +896,23 @@ Build an image from Dockerfile via stdin
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
- The archive must include a file called Dockerfile at its root. It
+ The archive must include a file called Dockerfile at its root. I
may include any number of other files, which will be accessible in
the build context (See the ADD build command).
The Content-type header should be set to "application/tar".
- Query Parameters:
+Query Parameters:
-
+- **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
- - **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
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -945,7 +920,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -957,15 +932,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -973,11 +949,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -993,10 +969,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1004,26 +980,26 @@ Display system-wide information
Show the docker version information
-
- **Example request**:
-
+
+**Example request**:
+
GET /version HTTP/1.1
-
- **Example response**:
-
+
+**Example response**:
+
HTTP/1.1 200 OK
Content-Type: application/json
-
+
{
"Version":"0.2.2",
"GitCommit":"5a2a5cc+CHANGES",
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1031,7 +1007,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1041,42 +1017,48 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1086,16 +1068,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"ubuntu:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"ubuntu:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
# 3. Going further
@@ -1105,7 +1085,7 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1126,6 +1106,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --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 abf6e3397a..1c6b15df70 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.5.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.5.md
@@ -22,11 +22,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -74,26 +74,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -101,7 +97,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -130,9 +126,9 @@ Create a container
"WorkingDir":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -140,18 +136,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -160,11 +154,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -216,11 +210,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -228,11 +222,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -257,17 +251,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -275,11 +267,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -299,11 +291,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -311,22 +303,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -334,7 +326,7 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
@@ -344,22 +336,22 @@ Start the container `id`
"LxcConf":[{"Key":"lxc.utsname","Value":"docker"}]
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -367,25 +359,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -393,25 +383,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -419,19 +407,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -439,38 +427,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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
@@ -478,22 +464,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -501,27 +487,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -529,7 +513,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -538,18 +522,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -559,11 +543,11 @@ Copy files or folders of container `id`
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -587,11 +571,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -614,30 +598,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=ubuntu HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -651,20 +633,18 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -672,11 +652,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -686,17 +666,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -704,11 +682,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/centos/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -742,11 +720,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -754,11 +732,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/fedora/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -776,11 +754,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -788,11 +766,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -805,11 +783,11 @@ Push the image `name` on the registry
The `X-Registry-Auth` header can be used to
include a base64-encoded AuthConfig object.
- Status Codes:
+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
@@ -817,28 +795,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -846,11 +823,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -861,12 +838,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -874,11 +851,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -898,16 +875,14 @@ Search for an image on [Docker Hub](https://hub.docker.com)
}
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -917,13 +892,13 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
@@ -931,26 +906,24 @@ Build an image from Dockerfile via stdin
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
- The archive must include a file called Dockerfile at its root. It
+ The archive must include a file called Dockerfile at its root. I
may include any number of other files, which will be accessible in
the build context (See the ADD build command).
The Content-type header should be set to "application/tar".
- Query Parameters:
+Query Parameters:
-
+- **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
- - **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
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -958,7 +931,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -970,15 +943,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -986,11 +960,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1006,10 +980,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1017,11 +991,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1032,10 +1006,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1043,7 +1017,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1053,42 +1027,48 @@ Create a new image from a container's changes
"PortSpecs":["22"]
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1098,16 +1078,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"ubuntu:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"ubuntu:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
# 3. Going further
@@ -1116,7 +1094,7 @@ polling (using since)
Here are the steps of `docker run`:
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
Try to pull it - Then retry to create the container
- Start the container
- If you are not in detached mode:
@@ -1133,6 +1111,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --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 11dd45229c..39d87f38f6 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.6.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.6.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +98,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -130,9 +126,9 @@ Create a container
"WorkingDir":""
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -140,27 +136,25 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
+
+- **config** – the container's configuration
+
+Query Parameters:
- - **config** – the container's configuration
+- **name** – container name to use
- Query Parameters:
+Status Codes:
-
-
- - **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
+ expose a Private Port, which can be bound back to a Public Port a
startup**:
POST /containers/create HTTP/1.1
@@ -174,7 +168,7 @@ Create a container
"ExposedPorts":{"22/tcp":{}}
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/json
@@ -184,7 +178,7 @@ Create a container
"Warnings":[]
}
- **Second, start (using the ID returned above) the image we just
+ **Second, start (using the ID returned above) the image we jus
created, mapping the ssh port 22 to something on the host**:
POST /containers/e90e34656806/start HTTP/1.1
@@ -194,9 +188,9 @@ Create a container
"PortBindings": { "22/tcp": [{ "HostPort": "11022" }]}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain; charset=utf-8
Content-Length: 0
@@ -209,11 +203,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -266,11 +260,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -278,11 +272,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -307,17 +301,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -325,11 +317,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -349,11 +341,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -361,22 +353,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -384,14 +376,14 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"ContainerIDFile": "",
"Privileged": false,
"PortBindings": {"22/tcp": [{HostIp:"", HostPort:""}]},
@@ -399,22 +391,22 @@ Start the container `id`
"PublishAllPorts": false
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **hostConfig** – the container's host configuration (optional)
+- **hostConfig** – the container's host configuration (optional)
- Status Codes:
+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
@@ -422,25 +414,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -448,25 +438,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -474,27 +462,27 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
- - **signal** – Signal to send to the container (integer). When not
+- **signal** – Signal to send to the container (integer). When no
set, SIGKILL is assumed and the call will waits for the
container to exit.
- Status Codes:
+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
@@ -502,38 +490,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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**:
@@ -558,9 +544,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -585,22 +571,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -608,27 +594,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -636,7 +620,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -645,18 +629,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -666,11 +650,11 @@ Copy files or folders of container `id`
List images `format` could be json or viz (json default)
- **Example request**:
+**Example request**:
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -694,11 +678,11 @@ List images `format` could be json or viz (json default)
}
]
- **Example request**:
+**Example request**:
GET /images/viz HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: text/plain
@@ -721,30 +705,28 @@ List images `format` could be json or viz (json default)
base [style=invisible]
}
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by defaul
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create an image
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -758,20 +740,18 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Insert a file in an image
@@ -779,11 +759,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -793,17 +773,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -811,11 +789,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -849,11 +827,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -861,11 +839,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -883,11 +861,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -895,11 +873,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -910,9 +888,9 @@ Push the image `name` on the registry
> The `X-Registry-Auth` header can be used to
> include a base64-encoded AuthConfig object.
- Status Codes:
+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
@@ -921,28 +899,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -950,11 +927,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -965,12 +942,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -978,11 +955,11 @@ Remove the image `name` from the filesystem
Search for an image on [Docker Hub](https://hub.docker.com)
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1014,13 +991,13 @@ Search for an image on [Docker Hub](https://hub.docker.com)
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
@@ -1028,25 +1005,23 @@ Build an image from Dockerfile via stdin
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
- The archive must include a file called Dockerfile at its root. It
+ The archive must include a file called Dockerfile at its root. I
may include any number of other files, which will be accessible in
the build context (See the ADD build command).
The Content-type header should be set to "application/tar".
- Query Parameters:
+Query Parameters:
-
+- **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
- - **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
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1054,7 +1029,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1066,15 +1041,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1082,11 +1058,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1102,10 +1078,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1113,11 +1089,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1128,10 +1104,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1139,7 +1115,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1149,42 +1125,48 @@ Create a new image from a container's changes
"ExposedPorts":{"22/tcp":{}}
}
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
<[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Status Codes:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1194,16 +1176,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
# 3. Going further
@@ -1213,7 +1193,7 @@ Here are the steps of `docker run` :
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1234,6 +1214,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --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 10ff841799..6e5387a80e 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.7.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.7.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,20 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
-
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +96,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -135,9 +129,9 @@ Create a container
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -145,18 +139,16 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
-
+- **config** – the container's configuration
- - **config** – the container's configuration
+Status Codes:
- 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
@@ -165,11 +157,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -222,11 +214,11 @@ Return low-level information on the container `id`
"Volumes": {}
}
- Status Codes:
+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
@@ -234,11 +226,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -263,17 +255,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -281,11 +271,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -305,11 +295,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -317,22 +307,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -340,14 +330,14 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"Privileged":false,
"PublishAllPorts":false
@@ -356,22 +346,20 @@ Start the container `id`
Binds need to reference Volumes that were defined during container
creation.
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
-
+- **hostConfig** – the container's host configuration (optional)
- - **hostConfig** – the container's host configuration (optional)
+Status Codes:
- 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
@@ -379,25 +367,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -405,25 +391,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -431,19 +415,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -451,38 +435,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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**:
@@ -507,9 +489,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -534,22 +516,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -557,27 +539,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -585,7 +565,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -594,18 +574,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -617,7 +597,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -651,13 +631,13 @@ Copy files or folders of container `id`
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -671,26 +651,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **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
@@ -698,11 +674,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -712,17 +688,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -730,11 +704,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -768,11 +742,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -780,11 +754,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -802,11 +776,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -814,11 +788,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -832,14 +806,14 @@ Push the image `name` on the registry
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
+- **X-Registry-Auth** – include a base64-encoded AuthConfig
object.
- Status Codes:
+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
@@ -847,28 +821,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -876,11 +849,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -891,12 +864,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -908,11 +881,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -942,16 +915,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -961,13 +932,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -982,26 +953,24 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **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
Request Headers:
- - **Content-type** – should be set to
+- **Content-type** – should be set to
`"application/tar"`.
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1009,7 +978,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1021,15 +990,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1037,11 +1007,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1057,10 +1027,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1068,11 +1038,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1083,10 +1053,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1094,48 +1064,54 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "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:
+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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1145,16 +1121,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- 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
@@ -1163,11 +1137,11 @@ polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
- **Example request**
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
.. sourcecode:: http
@@ -1184,7 +1158,7 @@ specified by `name`.
Load a set of images and tags into the docker repository.
- **Example request**
+**Example request**
POST /images/load
@@ -1207,7 +1181,7 @@ Here are the steps of `docker run` :
- Create the container
-- If the status code is 404, it means the image doesn't exists:
+- If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1228,6 +1202,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --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 b8bc0087c8..36c92a4aee 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.8.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.8.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,22 @@ List containers
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +98,7 @@ List containers
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -136,9 +132,9 @@ Create a container
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -146,38 +142,38 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
- - **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:
+Query Parameters:
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -185,11 +181,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -258,11 +254,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -270,11 +266,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -299,17 +295,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -317,11 +311,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -341,11 +335,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -353,22 +347,22 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+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
@@ -376,44 +370,44 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **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:
+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
@@ -421,25 +415,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -447,25 +439,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -473,19 +463,19 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Status Codes:
+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
@@ -493,38 +483,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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 +537,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -576,22 +564,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -599,27 +587,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -627,7 +613,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -636,18 +622,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -659,7 +645,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -693,13 +679,13 @@ Copy files or folders of container `id`
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -713,26 +699,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **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
@@ -740,11 +722,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -754,17 +736,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -772,11 +752,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -810,11 +790,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -822,11 +802,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -844,11 +824,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -856,11 +836,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -874,14 +854,14 @@ Push the image `name` on the registry
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
+- **X-Registry-Auth** – include a base64-encoded AuthConfig
object.
- Status Codes:
+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
@@ -889,28 +869,27 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
@@ -918,11 +897,11 @@ Tag the image `name` into a repository
Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -933,12 +912,12 @@ Remove the image `name` from the filesystem
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -950,11 +929,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -984,16 +963,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1003,13 +980,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile via stdin
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1026,27 +1003,25 @@ Build an image from Dockerfile via stdin
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **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
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 objec
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1054,7 +1029,7 @@ Build an image from Dockerfile via stdin
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1066,15 +1041,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1082,11 +1058,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1102,10 +1078,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1113,11 +1089,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1128,10 +1104,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1139,48 +1115,54 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Query Parameters:
+Query Parameters:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "John Hannibal Smith
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "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:
+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
`GET /events`
Get events from docker, either in real time via streaming,
-or via polling (using since)
+or via polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1190,16 +1172,14 @@ or via polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- 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
@@ -1207,22 +1187,23 @@ or via polling (using since)
Get a tarball containing all images and metadata for the repository
specified by `name`.
+See the [image tarball format](#image-tarball-format) for more details.
- **Example request**
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
@@ -1230,20 +1211,43 @@ specified by `name`.
Load a set of images and tags into the docker repository.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
@@ -1253,7 +1257,7 @@ Here are the steps of `docker run`:
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- Try to pull it
- Then retry to create the container
@@ -1274,6 +1278,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --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 38f4ca8f54..7cac380109 100644
--- a/docs/sources/reference/api/docker_remote_api_v1.9.md
+++ b/docs/sources/reference/api/docker_remote_api_v1.9.md
@@ -23,11 +23,11 @@ page_keywords: API, Docker, rcli, REST, documentation
List containers.
- **Example request**:
+**Example request**:
GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -75,26 +75,22 @@ List containers.
}
]
- Query Parameters:
+Query Parameters:
- - **all** – 1/True/true or 0/False/false, Show all containers.
- Only running containers are shown by default
- - **limit** – Show `limit` last created
- containers, include non-running ones.
- - **since** – Show only containers created since Id, include
- non-running ones.
- - **before** – Show only containers created before Id, include
- non-running ones.
- - **size** – 1/True/true or 0/False/false, Show the containers
- sizes
+- **all** – 1/True/true or 0/False/false, Show all containers.
+ Only running containers are shown by default (i.e., this defaults to false)
+- **limit** – Show `limit` last created containers, include non-running ones.
+- **since** – Show only containers created since Id, include non-running ones.
+- **before** – Show only containers created before Id, include non-running ones.
+- **size** – 1/True/true or 0/False/false, Show the containers sizes
- Status Codes:
+Status Codes:
- - **200** – no error
- - **400** – bad parameter
- - **500** – server error
+- **200** – no error
+- **400** – bad parameter
+- **500** – server error
### Create a container
@@ -102,7 +98,7 @@ List containers.
Create a container
- **Example request**:
+**Example request**:
POST /containers/create HTTP/1.1
Content-Type: application/json
@@ -136,9 +132,9 @@ Create a container
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
+ HTTP/1.1 201 Created
Content-Type: application/json
{
@@ -146,38 +142,38 @@ Create a container
"Warnings":[]
}
- Json Parameters:
+Json Parameters:
- - **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:
+Query Parameters:
- - **name** – Assign the specified name to the container. Must
+- **name** – Assign the specified name to the container. Mus
match `/?[a-zA-Z0-9_-]+`.
- Status Codes:
+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
@@ -185,11 +181,11 @@ Create a container
Return low-level information on the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -258,11 +254,11 @@ Return low-level information on the container `id`
}
}
- Status Codes:
+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
@@ -270,11 +266,11 @@ Return low-level information on the container `id`
List processes running inside the container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/top HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -299,17 +295,15 @@ List processes running inside the container `id`
]
}
- Query Parameters:
+Query Parameters:
-
+- **ps_args** – ps arguments to use (e.g., aux)
- - **ps_args** – ps arguments to use (e.g., aux)
+Status Codes:
- 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
@@ -317,11 +311,11 @@ List processes running inside the container `id`
Inspect changes on container `id`'s filesystem
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/changes HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -341,11 +335,11 @@ Inspect changes on container `id`'s filesystem
}
]
- Status Codes:
+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
@@ -353,22 +347,44 @@ Inspect changes on container `id`'s filesystem
Export the contents of container `id`
- **Example request**:
+**Example request**:
GET /containers/4fa6e0f0c678/export HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
+
+### Resize a container TTY
+
+`GET /containers/(id)/resize?h=&w=`
+
+Resize the TTY of container `id`
+
+**Example request**:
+
+ GET /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
+
+**Example response**:
+
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ Content-Type: text/plain; charset=utf-8
+
+Status Codes:
+
+- **200** – no error
+- **404** – No such container
+- **500** – bad file descriptor
### Start a container
@@ -376,44 +392,44 @@ Export the contents of container `id`
Start the container `id`
- **Example request**:
+**Example request**:
POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
"Binds":["/tmp:/tmp"],
- "LxcConf":{"lxc.utsname":"docker"},
+ "LxcConf":[{"Key":"lxc.utsname","Value":"docker"}],
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false,
"Privileged":false
}
- **Example response**:
+**Example response**:
- HTTP/1.1 204 No Content
+ HTTP/1.1 204 No Conten
Content-Type: text/plain
- Json Parameters:
+Json Parameters:
- - **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:
+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
@@ -421,25 +437,23 @@ Start the container `id`
Stop the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/stop?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 204 OK
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -447,25 +461,23 @@ Stop the container `id`
Restart the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/restart?t=5 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
+- **t** – number of seconds to wait before killing the container
- - **t** – number of seconds to wait before killing the container
+Status Codes:
- 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
@@ -473,24 +485,24 @@ Restart the container `id`
Kill the container `id`
- **Example request**:
+**Example request**:
POST /containers/e90e34656806/kill HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters
+Query Parameters
- - **signal** - Signal to send to the container: integer or string like "SIGINT".
- When not set, SIGKILL is assumed and the call will waits for the container to exit.
+- **signal** - Signal to send to the container: integer or string like "SIGINT".
+ When not set, SIGKILL is assumed and the call will wait for the container to exit.
- Status Codes:
+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
@@ -498,38 +510,36 @@ Kill the container `id`
Attach to the container `id`
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
- Query Parameters:
+Query Parameters:
-
-
- - **logs** – 1/True/true or 0/False/false, return logs. Default
+- **logs** – 1/True/true or 0/False/false, return logs. Defaul
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:
+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**:
@@ -553,9 +563,9 @@ Attach to the container `id`
`STREAM_TYPE` can be:
- - 0: stdin (will be written on stdout)
- - 1: stdout
- - 2: stderr
+- 0: stdin (will be written on stdout)
+- 1: stdou
+- 2: stderr
`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
the uint32 size encoded as big endian.
@@ -580,22 +590,22 @@ Attach to the container `id`
Block until container `id` stops, then returns the exit code
- **Example request**:
+**Example request**:
POST /containers/16253994b7c4/wait HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
{"StatusCode":0}
- Status Codes:
+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
@@ -603,27 +613,25 @@ Block until container `id` stops, then returns the exit code
Remove the container `id` from the filesystem
- **Example request**:
+**Example request**:
DELETE /containers/16253994b7c4?v=1 HTTP/1.1
- **Example response**:
+**Example response**:
- HTTP/1.1 204 OK
+ HTTP/1.1 204 No Content
- Query Parameters:
+Query Parameters:
-
-
- - **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:
+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
@@ -631,7 +639,7 @@ Remove the container `id` from the filesystem
Copy files or folders of container `id`
- **Example request**:
+**Example request**:
POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
@@ -640,18 +648,18 @@ Copy files or folders of container `id`
"Resource":"test.txt"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
- {{ STREAM }}
+ {{ TAR STREAM }}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **404** – no such container
- - **500** – server error
+- **200** – no error
+- **404** – no such container
+- **500** – server error
## 2.2 Images
@@ -663,7 +671,7 @@ Copy files or folders of container `id`
GET /images/json?all=0 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -697,13 +705,13 @@ Copy files or folders of container `id`
`POST /images/create`
-Create an image, either by pull it from the registry or by importing it
+Create an image, either by pull it from the registry or by importing i
- **Example request**:
+**Example request**:
POST /images/create?fromImage=base HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -717,26 +725,22 @@ Create an image, either by pull it from the registry or by importing it
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
- Query Parameters:
+Query Parameters:
-
+- **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:
- Request Headers:
+- **X-Registry-Auth** – base64-encoded AuthConfig object
-
+Status Codes:
- - **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
@@ -744,11 +748,11 @@ Create an image, either by pull it from the registry or by importing it
Insert a file from `url` in the image `name` at `path`
- **Example request**:
+**Example request**:
POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -758,17 +762,15 @@ Insert a file from `url` in the image `name` at `path`
{"error":"Invalid..."}
...
- Query Parameters:
+Query Parameters:
+- **url** – The url from where the file is taken
+- **path** – The path where the file is stored
+Status Codes:
- - **url** – The url from where the file is taken
- - **path** – The path where the file is stored
-
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Inspect an image
@@ -776,11 +778,11 @@ Insert a file from `url` in the image `name` at `path`
Return low-level information on the image `name`
- **Example request**:
+**Example request**:
GET /images/base/json HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -814,11 +816,11 @@ Return low-level information on the image `name`
"Size": 6824592
}
- Status Codes:
+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
@@ -826,11 +828,11 @@ Return low-level information on the image `name`
Return the history of the image `name`
- **Example request**:
+**Example request**:
GET /images/base/history HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -848,11 +850,11 @@ Return the history of the image `name`
}
]
- Status Codes:
+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
@@ -860,11 +862,11 @@ Return the history of the image `name`
Push the image `name` on the registry
- **Example request**:
+**Example request**:
POST /images/test/push HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -878,14 +880,14 @@ Push the image `name` on the registry
- - **X-Registry-Auth** – include a base64-encoded AuthConfig
+- **X-Registry-Auth** – include a base64-encoded AuthConfig
object.
- Status Codes:
+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
@@ -893,39 +895,38 @@ Push the image `name` on the registry
Tag the image `name` into a repository
- **Example request**:
+**Example request**:
- POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
+ POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 201 OK
- Query Parameters:
+Query Parameters:
-
+- **repo** – The repository to tag in
+- **force** – 1/True/true or 0/False/false, default false
+- **tag** - The new tag name
- - **repo** – The repository to tag in
- - **force** – 1/True/true or 0/False/false, default false
+Status Codes:
- 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
`DELETE /images/(name*)
: Remove the image `name` from the filesystem
- **Example request**:
+**Example request**:
DELETE /images/test HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-type: application/json
@@ -936,12 +937,12 @@ Tag the image `name` into a repository
{"Deleted":"53b4f83ac9"}
]
- Status Codes:
+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
@@ -953,11 +954,11 @@ Search for an image on [Docker Hub](https://hub.docker.com).
> The response keys have changed from API v1.6 to reflect the JSON
> sent by the registry server to the docker daemon's request.
- **Example request**:
+**Example request**:
GET /images/search?term=sshd HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -987,16 +988,14 @@ Search for an image on [Docker Hub](https://hub.docker.com).
...
]
- Query Parameters:
+Query Parameters:
-
+- **term** – term to search
- - **term** – term to search
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
## 2.3 Misc
@@ -1006,13 +1005,13 @@ Search for an image on [Docker Hub](https://hub.docker.com).
Build an image from Dockerfile using a POST body.
- **Example request**:
+**Example request**:
POST /build HTTP/1.1
- {{ STREAM }}
+ {{ TAR STREAM }}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1029,28 +1028,23 @@ Build an image from Dockerfile using a POST body.
which will be accessible in the build context (See the [*ADD build
command*](/reference/builder/#dockerbuilder)).
- Query Parameters:
+Query Parameters:
-
-
- - **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
+- **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
Request Headers:
-
+- **Content-type** – should be set to `"application/tar"`.
+- **X-Registry-Config** – base64-encoded ConfigFile objec
- - **Content-type** – should be set to
- `"application/tar"`.
- - **X-Registry-Config** – base64-encoded ConfigFile object
+Status Codes:
- Status Codes:
-
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Check auth configuration
@@ -1058,7 +1052,7 @@ Build an image from Dockerfile using a POST body.
Get the default username and email
- **Example request**:
+**Example request**:
POST /auth HTTP/1.1
Content-Type: application/json
@@ -1070,15 +1064,16 @@ Get the default username and email
"serveraddress":"https://index.docker.io/v1/"
}
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
+ Content-Type: text/plain
- Status Codes:
+Status Codes:
- - **200** – no error
- - **204** – no error
- - **500** – server error
+- **200** – no error
+- **204** – no error
+- **500** – server error
### Display system-wide information
@@ -1086,11 +1081,11 @@ Get the default username and email
Display system-wide information
- **Example request**:
+**Example request**:
GET /info HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1106,10 +1101,10 @@ Display system-wide information
"IPv4Forwarding":true
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Show the docker version information
@@ -1117,11 +1112,11 @@ Display system-wide information
Show the docker version information
- **Example request**:
+**Example request**:
GET /version HTTP/1.1
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1132,10 +1127,10 @@ Show the docker version information
"GoVersion":"go1.0.3"
}
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
### Create a new image from a container's changes
@@ -1143,7 +1138,7 @@ Show the docker version information
Create a new image from a container's changes
- **Example request**:
+**Example request**:
POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
Content-Type: application/json
@@ -1174,48 +1169,52 @@ Create a new image from a container's changes
}
}
- **Example response**:
+**Example response**:
- HTTP/1.1 201 OK
- Content-Type: application/vnd.docker.raw-stream
+ HTTP/1.1 201 Created
+ Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"}
- Json Parameters:
+Json Parameters:
+- **config** - the container's configuration
+Query Parameters:
- - **config** - the container's configuration
+- **container** – source container
+- **repo** – repository
+- **tag** – tag
+- **m** – commit message
+- **author** – author (e.g., "John Hannibal Smith
+ <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
- Query Parameters:
+Status Codes:
-
-
- - **container** – source container
- - **repo** – repository
- - **tag** – tag
- - **m** – commit message
- - **author** – author (e.g., "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
`GET /events`
Get events from docker, either in real time via streaming, or via
-polling (using since)
+polling (using since).
- **Example request**:
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+**Example request**:
GET /events?since=1374067924
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/json
@@ -1225,16 +1224,14 @@ polling (using since)
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
- Query Parameters:
+Query Parameters:
-
+- **since** – timestamp used for polling
- - **since** – timestamp used for polling
+Status Codes:
- 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
@@ -1242,21 +1239,23 @@ polling (using since)
Get a tarball containing all images and metadata for the repository specified by `name`.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
GET /images/ubuntu/get
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
- Status Codes:
+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
@@ -1264,20 +1263,43 @@ Get a tarball containing all images and metadata for the repository specified by
Load a set of images and tags into the docker repository.
- **Example request**
+See the [image tarball format](#image-tarball-format) for more details.
+
+**Example request**
POST /images/load
Tarball in body
- **Example response**:
+**Example response**:
HTTP/1.1 200 OK
- Status Codes:
+Status Codes:
- - **200** – no error
- - **500** – server error
+- **200** – no error
+- **500** – server error
+
+### Image tarball format
+
+An image tarball contains one directory per image layer (named using its long ID),
+each containing three files:
+
+1. `VERSION`: currently `1.0` - the file format version
+2. `json`: detailed layer information, similar to `docker inspect layer_id`
+3. `layer.tar`: A tarfile containing the filesystem changes in this layer
+
+The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
+for storing attribute changes and deletions.
+
+If the tarball defines a repository, there will also be a `repositories` file at
+the root that contains a list of repository and tag names mapped to layer IDs.
+
+```
+{"hello-world":
+ {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
+}
+```
# 3. Going further
@@ -1287,21 +1309,21 @@ Here are the steps of `docker run` :
- Create the container
- - If the status code is 404, it means the image doesn't exists:
+ - If the status code is 404, it means the image doesn't exist:
- - Try to pull it
- - Then retry to create the container
+- 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 logs=1 (to have stdout and
- - stderr from the container's start) and stream=1
+- 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
+- Display the container's id
## 3.2 Hijacking
@@ -1311,6 +1333,6 @@ stdout and stderr on the same socket. This might change in the future.
## 3.3 CORS Requests
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:2375" --api-enable-cors
diff --git a/docs/sources/reference/api/hub_registry_spec.md b/docs/sources/reference/api/hub_registry_spec.md
index b2d29ab4af..ee15277a44 100644
--- a/docs/sources/reference/api/hub_registry_spec.md
+++ b/docs/sources/reference/api/hub_registry_spec.md
@@ -111,7 +111,7 @@ supports:
It's possible to run:
- $ docker pull https:///repositories/samalba/busybox
+ $ sudo docker pull https:///repositories/samalba/busybox
In this case, Docker bypasses the Docker Hub. However the security is not
guaranteed (in case Registry A is corrupted) because there won't be any
@@ -133,52 +133,61 @@ and for an active account.
1. (Docker -> Docker Hub) GET /v1/repositories/foo/bar/images:
- **Headers**:
+**Headers**:
+
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
X-Docker-Token: true
-
- **Action**:
+
+**Action**:
+
(looking up the foo/bar in db and gets images and checksums
for that repo (all if no tag is specified, if tag, only
checksums for those tags) see part 4.4.1)
2. (Docker Hub -> Docker) HTTP 200 OK
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
X-Docker-Endpoints: registry.docker.io [,registry2.docker.io]
-
- **Body**:
+
+**Body**:
+
Jsonified checksums (see part 4.4.1)
3. (Docker -> Registry) GET /v1/repositories/foo/bar/tags/latest
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
4. (Registry -> Docker Hub) GET /v1/repositories/foo/bar/images
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=read
-
- **Body**:
+
+**Body**:
+
-
- **Action**:
+
+**Action**:
+
(Lookup token see if they have access to pull.)
-
+
If good:
HTTP 200 OK Docker Hub will invalidate the token
-
+
If bad:
HTTP 401 Unauthorized
5. (Docker -> Registry) GET /v1/images/928374982374/ancestry
- **Action**:
+**Action**:
+
(for each image id returned in the registry, fetch /json + /layer)
> **Note**:
@@ -220,92 +229,108 @@ the end).
1. (Docker -> Docker Hub) PUT /v1/repositories/foo/bar/
- **Headers**:
+**Headers**:
+
Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
true
- **Action**:
- - in Docker Hub, we allocated a new repository, and set to
- initialized
+**Action**:
- **Body**:
- (The body contains the list of images that are going to be
- pushed, with empty checksums. The checksums will be set at
- the end of the push):
+- in Docker Hub, we allocated a new repository, and set to
+ initialized
+
+**Body**:
+
+(The body contains the list of images that are going to be
+pushed, with empty checksums. The checksums will be set at
+the end of the push):
[{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”}]
2. (Docker Hub -> Docker) 200 Created
- **Headers**:
- - WWW-Authenticate: Token
+**Headers**:
+
+ WWW-Authenticate: Token
signature=123abc,repository=”foo/bar”,access=write
- - X-Docker-Endpoints: registry.docker.io [,
- registry2.docker.io]
+ X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
3. (Docker -> Registry) PUT /v1/images/98765432_parent/json
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
4. (Registry->Docker Hub) GET /v1/repositories/foo/bar/images
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
- **Action**:
- - Docker Hub:
- will invalidate the token.
- - Registry:
- grants a session (if token is approved) and fetches
- the images id
+**Action**:
+
+- Docker Hub:
+ will invalidate the token.
+- 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
+**Headers**:
+
+ 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**:
- - Cookie: (Cookie provided by the Registry)
+**Headers**:
+
+ Cookie: (Cookie provided by the Registry)
7. (Docker -> Registry) PUT /v1/images/98765432_parent/layer
- **Headers**:
- - Cookie: (Cookie provided by the Registry)
+**Headers**:
+
+ Cookie: (Cookie provided by the Registry)
8. (Docker -> Registry) PUT /v1/images/98765432/layer
- **Headers**:
+**Headers**:
+
X-Docker-Checksum: sha256:436745873465fdjkhdfjkgh
9. (Docker -> Registry) PUT /v1/repositories/foo/bar/tags/latest
- **Headers**:
- - Cookie: (Cookie provided by the Registry)
+**Headers**:
+
+ Cookie: (Cookie provided by the Registry)
+
+**Body**:
- **Body**:
“98765432”
10. (Docker -> Docker Hub) PUT /v1/repositories/foo/bar/images
- **Headers**:
+**Headers**:
+
Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
registry1.docker.io (no validation on this right now)
- **Body**:
+**Body**:
+
(The image, id`s, tags and checksums)
[{“id”:
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
“checksum”:
“b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}]
- **Return**: HTTP 204
+**Return**:
+
+ HTTP 204
> **Note:** If push fails and they need to start again, what happens in the Docker Hub,
> there will already be a record for the namespace/name, but it will be
@@ -344,43 +369,49 @@ nice clean way to do that. Here is the workflow.
1. (Docker -> Docker Hub) DELETE /v1/repositories/foo/bar/
- **Headers**:
+**Headers**:
+
Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
true
- **Action**:
- - in Docker Hub, we make sure it is a valid repository, and set
- to deleted (logically)
+**Action**:
+
+- in Docker Hub, we make sure it is a valid repository, and set
+ to deleted (logically)
+
+**Body**:
- **Body**:
Empty
2. (Docker Hub -> Docker) 202 Accepted
- **Headers**:
- - WWW-Authenticate: Token
+**Headers**:
+
+ WWW-Authenticate: Token
signature=123abc,repository=”foo/bar”,access=delete
- - X-Docker-Endpoints: registry.docker.io [,
- registry2.docker.io]
+ X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
# list of endpoints where this repo lives.
3. (Docker -> Registry) DELETE /v1/repositories/foo/bar/
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=delete
4. (Registry->Docker Hub) PUT /v1/repositories/foo/bar/auth
- **Headers**:
+**Headers**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=delete
- **Action**:
- - Docker Hub:
- will invalidate the token.
- - Registry:
- deletes the repository (if token is approved)
+**Action**:
+
+- Docker Hub:
+ will invalidate the token.
+- Registry:
+ deletes the repository (if token is approved)
5. (Registry -> Docker) 200 OK
@@ -389,14 +420,18 @@ nice clean way to do that. Here is the workflow.
6. (Docker -> Docker Hub) DELETE /v1/repositories/foo/bar/
- **Headers**:
+**Headers**:
+
Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
registry-1.docker.io (no validation on this right now)
-
- **Body**:
+
+**Body**:
+
Empty
-
- **Return**: HTTP 200
+
+**Return**:
+
+ HTTP 200
## How to use the Registry in standalone mode
@@ -412,7 +447,7 @@ The Docker Hub has two main purposes (along with its fancy social features):
- Authenticate a user as a repos owner (for a central referenced
repository)
-### Without an Docker Hub
+### Without a Docker Hub
Using the Registry without the Docker Hub can be useful to store the images
on a private network without having to rely on an external entity
@@ -433,7 +468,7 @@ 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 Docker Hub
+### With a Docker Hub
The Docker Hub data needed by the Registry are simple:
@@ -478,16 +513,20 @@ file is empty.
POST /v1/users:
- **Body**:
+**Body**:
+
{"email": "[sam@docker.com](mailto:sam%40docker.com)",
"password": "toto42", "username": "foobar"`}
- **Validation**:
- - **username**: min 4 character, max 30 characters, must match the
- regular expression [a-z0-9_].
- - **password**: min 5 characters
+**Validation**:
- **Valid**: return HTTP 200
+- **username**: min 4 character, max 30 characters, must match the
+ regular expression [a-z0-9_].
+- **password**: min 5 characters
+
+**Valid**:
+
+ return HTTP 201
Errors: HTTP 400 (we should create error codes for possible errors) -
invalid json - missing field - wrong format (username, password, email,
@@ -501,7 +540,8 @@ etc) - forbidden name - name already exists
PUT /v1/users/
- **Body**:
+**Body**:
+
{"password": "toto"}
> **Note**:
@@ -515,10 +555,10 @@ 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
+**Return**:
+- Valid: HTTP 200
+- Invalid login: HTTP 401
+- Account inactive: HTTP 403 Account is not Active
### Tags (Registry)
@@ -543,14 +583,15 @@ GET /v1/repositories///tags
“0.1.1”:
“b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087” }
- **4.3.2 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**:
+**Return**:
+
"9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
- **4.3.3 Delete a tag (registry):**
+**4.3.3 Delete a tag (registry):**
DELETE /v1/repositories///tags/
@@ -577,14 +618,17 @@ You always add images, you never remove them.
PUT /v1/repositories///images
- **Body**:
+**Body**:
+
[ {“id”:
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
“checksum”:
“sha256:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}
]
- **Return**: 204
+**Return**:
+
+ 204
### Repositories
@@ -640,28 +684,32 @@ You have 3 options:
1. Provide user credentials and ask for a token
- **Header**:
- - 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
- signature=123abc,repository=”foo/bar”,access=read
-
+**Header**:
+
+ 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
+ signature=123abc,repository=”foo/bar”,access=read
+
2. Provide user credentials only
- **Header**:
+**Header**:
+
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
3. Provide Token
- **Header**:
+**Header**:
+
Authorization: Token
signature=123abc,repository=”foo/bar”,access=read
diff --git a/docs/sources/reference/api/registry_api.md b/docs/sources/reference/api/registry_api.md
index 49776b9b18..1ae37dba6d 100644
--- a/docs/sources/reference/api/registry_api.md
+++ b/docs/sources/reference/api/registry_api.md
@@ -73,13 +73,13 @@ The default namespace for a private repository is `library`.
## Images
-### Layer
+### Get image layer
`GET /v1/images/(image_id)/layer`
Get image layer for a given `image_id`
- **Example Request**:
+**Example Request**:
GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1
Host: registry-1.docker.io
@@ -87,11 +87,11 @@ Get image layer for a given `image_id`
Content-Type: application/json
Authorization: Token signature=123abc,repository="foo/bar",access=read
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -100,17 +100,19 @@ Get image layer for a given `image_id`
{layer binary data stream}
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Image not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Image not found
+
+### Put image layer
`PUT /v1/images/(image_id)/layer`
Put image layer for a given `image_id`
- **Example Request**:
+**Example Request**:
PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1
Host: registry-1.docker.io
@@ -119,11 +121,11 @@ Put image layer for a given `image_id`
{layer binary data stream}
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -132,19 +134,21 @@ Put image layer for a given `image_id`
""
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Image not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Image not found
## Image
+### Put image layer
+
`PUT /v1/images/(image_id)/json`
Put image for a given `image_id`
- **Example Request**:
+**Example Request**:
PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/json HTTP/1.1
Host: registry-1.docker.io
@@ -183,11 +187,11 @@ Put image for a given `image_id`
docker_version: "0.1.7"
}
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -196,16 +200,18 @@ Put image for a given `image_id`
""
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
+- **200** – OK
+- **401** – Requires authorization
+
+### Get image layer
`GET /v1/images/(image_id)/json`
Get image for a given `image_id`
- **Example Request**:
+**Example Request**:
GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/json HTTP/1.1
Host: registry-1.docker.io
@@ -213,11 +219,11 @@ Get image for a given `image_id`
Content-Type: application/json
Cookie: (Cookie provided by the Registry)
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -257,19 +263,21 @@ Get image for a given `image_id`
docker_version: "0.1.7"
}
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Image not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Image not found
## Ancestry
+### Get image ancestry
+
`GET /v1/images/(image_id)/ancestry`
Get ancestry for an image given an `image_id`
- **Example Request**:
+**Example Request**:
GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry HTTP/1.1
Host: registry-1.docker.io
@@ -277,11 +285,11 @@ Get ancestry for an image given an `image_id`
Content-Type: application/json
Cookie: (Cookie provided by the Registry)
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -293,19 +301,21 @@ Get ancestry for an image given an `image_id`
"bfa4c5326bc764280b0863b46a4b20d940bc1897ef9c1dfec060604bdc383280",
"6ab5893c6927c15a15665191f2c6cf751f5056d8b95ceee32e43c5e8a3648544"]
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Image not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Image not found
## Tags
+### List repository tags
+
`GET /v1/repositories/(namespace)/(repository)/tags`
Get all of the tags for the given repo.
- **Example Request**:
+**Example Request**:
GET /v1/repositories/reynholm/help-system-server/tags HTTP/1.1
Host: registry-1.docker.io
@@ -314,12 +324,12 @@ Get all of the tags for the given repo.
X-Docker-Registry-Version: 0.6.0
Cookie: (Cookie provided by the Registry)
- Parameters:
+Parameters:
- - **namespace** – namespace for the repo
- - **repository** – name for the repo
+- **namespace** – namespace for the repo
+- **repository** – name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -331,17 +341,19 @@ Get all of the tags for the given repo.
"0.1.1": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"
}
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Repository not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Repository not found
+
+### Get image id for a particular tag
`GET /v1/repositories/(namespace)/(repository)/tags/(tag*)`
Get a tag for the given repo.
- **Example Request**:
+**Example Request**:
GET /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
Host: registry-1.docker.io
@@ -350,13 +362,13 @@ Get a tag for the given repo.
X-Docker-Registry-Version: 0.6.0
Cookie: (Cookie provided by the Registry)
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -365,17 +377,19 @@ Get a tag for the given repo.
"9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Tag not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Tag not found
+
+### Delete a repository tag
`DELETE /v1/repositories/(namespace)/(repository)/tags/(tag*)`
Delete the tag for the repo
- **Example Request**:
+**Example Request**:
DELETE /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
Host: registry-1.docker.io
@@ -383,13 +397,13 @@ Delete the tag for the repo
Content-Type: application/json
Cookie: (Cookie provided by the Registry)
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -398,17 +412,19 @@ Delete the tag for the repo
""
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Tag not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Tag not found
+
+### Set a tag for a specified image id
`PUT /v1/repositories/(namespace)/(repository)/tags/(tag*)`
Put a tag for the given repo.
- **Example Request**:
+**Example Request**:
PUT /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
Host: registry-1.docker.io
@@ -418,13 +434,13 @@ Put a tag for the given repo.
"9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
- Parameters:
+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**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -433,20 +449,22 @@ Put a tag for the given repo.
""
- Status Codes:
+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
+### Delete a repository
+
`DELETE /v1/repositories/(namespace)/(repository)/`
Delete a repository
- **Example Request**:
+**Example Request**:
DELETE /v1/repositories/reynholm/help-system-server/ HTTP/1.1
Host: registry-1.docker.io
@@ -456,12 +474,12 @@ Delete a repository
""
- Parameters:
+Parameters:
- - **namespace** – namespace for the repo
- - **repository** – name for the repo
+- **namespace** – namespace for the repo
+- **repository** – name for the repo
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -470,20 +488,22 @@ Delete a repository
""
- Status Codes:
+Status Codes:
- - **200** – OK
- - **401** – Requires authorization
- - **404** – Repository not found
+- **200** – OK
+- **401** – Requires authorization
+- **404** – Repository not found
## Status
+### Status check for registry
+
`GET /v1/_ping`
Check status of the registry. This endpoint is also used to
determine if the registry supports SSL.
- **Example Request**:
+**Example Request**:
GET /v1/_ping HTTP/1.1
Host: registry-1.docker.io
@@ -492,7 +512,7 @@ determine if the registry supports SSL.
""
- **Example Response**:
+**Example Response**:
HTTP/1.1 200
Vary: Accept
@@ -501,13 +521,12 @@ determine if the registry supports SSL.
""
- Status Codes:
+Status Codes:
- - **200** – OK
+- **200** – OK
## Authorization
This is where we describe the authorization process, including the
tokens and cookies.
-TODO: add more info.
diff --git a/docs/sources/reference/api/registry_api_client_libraries.md b/docs/sources/reference/api/registry_api_client_libraries.md
new file mode 100644
index 0000000000..7fe986204a
--- /dev/null
+++ b/docs/sources/reference/api/registry_api_client_libraries.md
@@ -0,0 +1,35 @@
+page_title: Registry API Client Libraries
+page_description: Various client libraries available to use with the Docker registry API
+page_keywords: API, Docker, index, registry, REST, documentation, clients, C#, Erlang, Go, Groovy, Java, JavaScript, Perl, PHP, Python, Ruby, Rust, Scala
+
+# Docker Registry API Client Libraries
+
+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.
+
+
+
diff --git a/docs/sources/reference/api/remote_api_client_libraries.md b/docs/sources/reference/api/remote_api_client_libraries.md
index 8f50804368..71bd2ebfc1 100644
--- a/docs/sources/reference/api/remote_api_client_libraries.md
+++ b/docs/sources/reference/api/remote_api_client_libraries.md
@@ -1,10 +1,10 @@
page_title: Remote API Client Libraries
page_description: Various client libraries available to use with the Docker remote API
-page_keywords: API, Docker, index, registry, REST, documentation, clients, Python, Ruby, JavaScript, Erlang, Go
+page_keywords: API, Docker, index, registry, REST, documentation, clients, C#, Erlang, Go, Groovy, Java, JavaScript, Perl, PHP, Python, Ruby, Rust, Scala
# Docker Remote API Client Libraries
-These libraries have not been tested by the Docker Maintainers for
+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.
@@ -25,59 +25,9 @@ will add the libraries here.
diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md
index 796d07d98e..2678a87a19 100644
--- a/docs/sources/reference/builder.md
+++ b/docs/sources/reference/builder.md
@@ -11,6 +11,11 @@ Docker image. By calling `docker build` from your terminal, you can have
Docker build your image step by step, executing the instructions
successively.
+This page discusses the specifics of all the instructions you can use in your
+`Dockerfile`. To further help you write a clear, readable, maintainable
+`Dockerfile`, we've also written a [`Dockerfile` Best Practices
+guide](/articles/dockerfile_best-practices).
+
## Usage
To [*build*](../commandline/cli/#cli-build) an image from a source repository,
@@ -55,9 +60,11 @@ to be created - so `RUN cd /tmp` will not have any effect on the next
instructions.
Whenever possible, Docker will re-use the intermediate images,
-accelerating `docker build` significantly (indicated by `Using cache`):
+accelerating `docker build` significantly (indicated by `Using cache` -
+see the [`Dockerfile` Best Practices
+guide](/articles/dockerfile_best-practices/#build-cache) for more information):
- $ docker build -t SvenDowideit/ambassador .
+ $ sudo docker build -t SvenDowideit/ambassador .
Uploading context 10.24 kB
Uploading context
Step 1 : FROM docker-ut
@@ -109,7 +116,7 @@ The following example shows the use of the `.dockerignore` file to exclude the
`.git` directory from the context. Its effect can be seen in the changed size of
the uploaded context.
- $ docker build .
+ $ sudo docker build .
Uploading context 18.829 MB
Uploading context
Step 0 : FROM busybox
@@ -119,7 +126,7 @@ the uploaded context.
---> 99cc1ad10469
Successfully built 99cc1ad10469
$ echo ".git" > .dockerignore
- $ docker build .
+ $ sudo docker build .
Uploading context 6.76 MB
Uploading context
Step 0 : FROM busybox
@@ -163,7 +170,7 @@ generated images.
RUN has 2 forms:
-- `RUN ` (the command is run in a shell - `/bin/sh -c`)
+- `RUN ` (the command is run in a shell - `/bin/sh -c` - *shell* form)
- `RUN ["executable", "param1", "param2"]` (*exec* form)
The `RUN` instruction will execute any commands in a new layer on top of the
@@ -182,11 +189,25 @@ commands using a base image that does not contain `/bin/sh`.
> passing in the desired shell. For example,
> `RUN ["/bin/bash", "-c", "echo hello"]`
+> **Note**:
+> The *exec* form is parsed as a JSON array, which means that
+> you must use double-quotes (") around words not single-quotes (').
+
+> **Note**:
+> Unlike the *shell* form, the *exec* form does not invoke a command shell.
+> This means that normal shell processing does not happen. For example,
+> `CMD [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
+> If you want shell processing then either use the *shell* form or execute
+> a shell directly, for example: `CMD [ "sh", "-c", "echo", "$HOME" ]`.
+
The cache for `RUN` instructions isn't invalidated automatically during
-the next build. The cache for an instruction like `RUN apt-get
-dist-upgrade -y` will be reused during the next build. The cache for
-`RUN` instructions can be invalidated by using the `--no-cache` flag,
-for example `docker build --no-cache`.
+the next build. The cache for an instruction like
+`RUN apt-get dist-upgrade -y` will be reused during the next build. The
+cache for `RUN` instructions can be invalidated by using the `--no-cache`
+flag, for example `docker build --no-cache`.
+
+See the [`Dockerfile` Best Practices
+guide](/articles/dockerfile_best-practices/#build-cache) for more information.
The cache for `RUN` instructions can be invalidated by `ADD` instructions. See
[below](#add) for details.
@@ -202,9 +223,9 @@ The cache for `RUN` instructions can be invalidated by `ADD` instructions. See
The `CMD` instruction has three forms:
-- `CMD ["executable","param1","param2"]` (like an *exec*, this is the preferred form)
+- `CMD ["executable","param1","param2"]` (*exec* form, this is the preferred form)
- `CMD ["param1","param2"]` (as *default parameters to ENTRYPOINT*)
-- `CMD command param1 param2` (as a *shell*)
+- `CMD command param1 param2` (*shell* form)
There can only be one `CMD` instruction in a `Dockerfile`. If you list more than one `CMD`
then only the last `CMD` will take effect.
@@ -219,6 +240,17 @@ instruction as well.
> instruction, both the `CMD` and `ENTRYPOINT` instructions should be specified
> with the JSON array format.
+> **Note**:
+> The *exec* form is parsed as a JSON array, which means that
+> you must use double-quotes (") around words not single-quotes (').
+
+> **Note**:
+> Unlike the *shell* form, the *exec* form does not invoke a command shell.
+> This means that normal shell processing does not happen. For example,
+> `CMD [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
+> If you want shell processing then either use the *shell* form or execute
+> a shell directly, for example: `CMD [ "sh", "-c", "echo", "$HOME" ]`.
+
When used in the shell or exec formats, the `CMD` instruction sets the command
to be executed when running the image.
@@ -255,7 +287,10 @@ default specified in `CMD`.
The `EXPOSE` instructions informs Docker that the container will listen on the
specified network ports at runtime. Docker uses this information to interconnect
containers using links (see the [Docker User
-Guide](/userguide/dockerlinks)).
+Guide](/userguide/dockerlinks)). Note that `EXPOSE` only works for
+inter-container links. It doesn't make ports accessible from the host. To
+expose ports to the host, at runtime,
+[use the `-p` flag](/userguide/dockerlinks).
## ENV
@@ -276,15 +311,24 @@ change them using `docker run --env =`.
## ADD
- ADD
+ ADD ...
-The `ADD` instruction will copy new files from `` and add them to the
-container's filesystem at path ``.
+The `ADD` instruction copies new files,directories or remote file URLs to
+the filesystem of the container from `` and add them to the at
+path ``.
-`` must be the path to a file or directory relative to the source directory
-being built (also called the *context* of the build) or a remote file URL.
+Multiple `` resource may be specified but if they are files or
+directories then they must be relative to the source directory that is
+being built (the context of the build).
-`` is the absolute path to which the source will be copied inside the
+Each `` may contain wildcards and matching will be done using Go's
+[filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
+For most command line uses this should act as expected, for example:
+
+ ADD hom* /mydir/ # adds all files starting with "hom"
+ ADD hom?.txt /mydir/ # ? is replaced with any single character
+
+The `` is the absolute path to which the source will be copied inside the
destination container.
All new files and directories are created with a UID and GID of 0.
@@ -310,6 +354,9 @@ have permissions of 600.
> The first encountered `ADD` instruction will invalidate the cache for all
> following instructions from the Dockerfile if the contents of `` have
> changed. This includes invalidating the cache for `RUN` instructions.
+> See the [`Dockerfile` Best Practices
+guide](/articles/dockerfile_best-practices/#build-cache) for more information.
+
The copy obeys the following rules:
@@ -345,6 +392,10 @@ The copy obeys the following rules:
will be considered a directory and the contents of `` will be written
at `/base()`.
+- If multiple `` resources are specified, either directly or due to the
+ use of a wildcard, then `` must be a directory, and it must end with
+ a slash `/`.
+
- If `` does not end with a trailing slash, it will be considered a
regular file and the contents of `` will be written at ``.
@@ -353,15 +404,24 @@ The copy obeys the following rules:
## COPY
- COPY
+ COPY ...
-The `COPY` instruction will copy new files from `` and add them to the
-container's filesystem at path ``.
+The `COPY` instruction copies new files,directories or remote file URLs to
+the filesystem of the container from `` and add them to the at
+path ``.
-`` must be the path to a file or directory relative to the source directory
-being built (also called the *context* of the build).
+Multiple `` resource may be specified but if they are files or
+directories then they must be relative to the source directory that is being
+built (the context of the build).
-`` is the absolute path to which the source will be copied inside the
+Each `` may contain wildcards and matching will be done using Go's
+[filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
+For most command line uses this should act as expected, for example:
+
+ COPY hom* /mydir/ # adds all files starting with "hom"
+ COPY hom?.txt /mydir/ # ? is replaced with any single character
+
+The `` is the absolute path to which the source will be copied inside the
destination container.
All new files and directories are created with a UID and GID of 0.
@@ -385,6 +445,10 @@ The copy obeys the following rules:
will be considered a directory and the contents of `` will be written
at `/base()`.
+- If multiple `` resources are specified, either directly or due to the
+ use of a wildcard, then `` must be a directory, and it must end with
+ a slash `/`.
+
- If `` does not end with a trailing slash, it will be considered a
regular file and the contents of `` will be written at ``.
@@ -396,9 +460,9 @@ The copy obeys the following rules:
ENTRYPOINT has two forms:
- `ENTRYPOINT ["executable", "param1", "param2"]`
- (like an *exec*, the preferred form)
+ (*exec* form, the preferred form)
- `ENTRYPOINT command param1 param2`
- (as a *shell*)
+ (*shell* form)
There can only be one `ENTRYPOINT` in a `Dockerfile`. If you have more
than one `ENTRYPOINT`, then only the last one in the `Dockerfile` will
@@ -434,6 +498,17 @@ optional but default, you could use a `CMD` instruction:
CMD ["-l"]
ENTRYPOINT ["ls"]
+> **Note**:
+> The *exec* form is parsed as a JSON array, which means that
+> you must use double-quotes (") around words not single-quotes (').
+
+> **Note**:
+> Unlike the *shell* form, the *exec* form does not invoke a command shell.
+> This means that normal shell processing does not happen. For example,
+> `CMD [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
+> If you want shell processing then either use the *shell* form or execute
+> a shell directly, for example: `CMD [ "sh", "-c", "echo", "$HOME" ]`.
+
> **Note**:
> It is preferable to use the JSON array format for specifying
> `ENTRYPOINT` instructions.
@@ -445,9 +520,14 @@ optional but default, you could use a `CMD` instruction:
The `VOLUME` instruction will create a mount point with the specified name
and mark it as holding externally mounted volumes from native host or other
containers. The value can be a JSON array, `VOLUME ["/var/log/"]`, or a plain
-string, `VOLUME /var/log`. For more information/examples and mounting
-instructions via the Docker client, refer to [*Share Directories via Volumes*](
-/userguide/dockervolumes/#volume-def) documentation.
+string with multiple arguments, such as `VOLUME /var/log` or `VOLUME /var/log
+/var/db`. For more information/examples and mounting instructions via the
+Docker client, refer to [*Share Directories via Volumes*](/userguide/dockervolumes/#volume-def)
+documentation.
+
+> **Note**:
+> The list is parsed a JSON array, which means that
+> you must use double-quotes (") around words not single-quotes (').
## USER
@@ -472,9 +552,19 @@ instruction. For example:
WORKDIR c
RUN pwd
-The output of the final `pwd` command in this Dockerfile would be
+The output of the final `pwd` command in this `Dockerfile` would be
`/a/b/c`.
+The `WORKDIR` instruction can resolve environment variables previously set using
+`ENV`. You can only use environment variables explicitly set in the `Dockerfile`.
+For example:
+
+ ENV DIRPATH /path
+ WORKDIR $DIRPATH/$DIRNAME
+
+The output of the final `pwd` command in this `Dockerfile` would be
+`/path/$DIRNAME`
+
## ONBUILD
ONBUILD [INSTRUCTION]
diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md
index 7b9e2ab610..86f02b6cf1 100644
--- a/docs/sources/reference/commandline/cli.md
+++ b/docs/sources/reference/commandline/cli.md
@@ -35,11 +35,11 @@ will set the value to the opposite of the default value.
Options like `-a=[]` indicate they can be specified multiple times:
- $ docker run -a stdin -a stdout -a stderr -i -t ubuntu /bin/bash
+ $ sudo docker run -a stdin -a stdout -a stderr -i -t ubuntu /bin/bash
Sometimes this can use a more complex value string, as for `-v`:
- $ docker run -v /host:/container example/mysql
+ $ sudo docker run -v /host:/container example/mysql
### Strings and Integers
@@ -49,7 +49,11 @@ expect an integer, and they can only be specified once.
## daemon
- Usage of docker:
+ Usage: docker [OPTIONS] COMMAND [arg...]
+
+ A self-sufficient runtime for linux containers.
+
+ Options:
--api-enable-cors=false Enable CORS headers in the remote API
-b, --bridge="" Attach containers to a pre-existing network bridge
use 'none' to disable container networking
@@ -59,18 +63,21 @@ expect an integer, and they can only be specified once.
--dns=[] Force Docker to use specific DNS servers
--dns-search=[] Force Docker to use specific DNS search domains
-e, --exec-driver="native" Force the Docker runtime to use a specific exec driver
+ --fixed-cidr="" IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)
+ this subnet must be nested in the bridge subnet (which is defined by -b or --bip)
-G, --group="docker" Group to assign the unix socket specified by -H when running in daemon mode
use '' (the empty string) to disable setting of a group
-g, --graph="/var/lib/docker" Path to use as the root of the Docker runtime
- -H, --host=[] The socket(s) to bind to in daemon mode
- specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
+ -H, --host=[] The socket(s) to bind to in daemon mode or connect to in client mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
--icc=true Enable inter-container communication
--ip=0.0.0.0 Default IP address to use when binding container ports
--ip-forward=true Enable net.ipv4.ip_forward
+ --ip-masq=true Enable IP masquerading for bridge's IP range
--iptables=true Enable Docker's addition of iptables rules
--mtu=0 Set the containers network MTU
if no value is provided: default to the default route MTU or 1500 if no default route is available
-p, --pidfile="/var/run/docker.pid" Path to use for daemon PID file
+ --registry-mirror=[] Specify a preferred Docker registry mirror
-s, --storage-driver="" Force the Docker runtime to use a specific storage driver
--selinux-enabled=false Enable selinux support. SELinux does not presently support the BTRFS storage driver
--storage-opt=[] Set storage driver options
@@ -87,36 +94,106 @@ The Docker daemon is the persistent process that manages containers.
Docker uses the same binary for both the daemon and client. To run the
daemon you provide the `-d` flag.
-To force Docker to use devicemapper as the storage driver, use
+
+To run the daemon with debug output, use `docker -d -D`.
+
+### Daemon socket option
+
+The Docker daemon can listen for [Docker Remote API](reference/api/docker_remote_api/)
+requests via three different types of Socket: `unix`, `tcp`, and `fd`.
+
+By default, a `unix` domain socket (or IPC socket) is created at `/var/run/docker.sock`,
+requiring either `root` permission, or `docker` group membership.
+
+If you need to access the Docker daemon remotely, you need to enable the `tcp`
+Socket. Beware that the default setup provides un-encrypted and un-authenticated
+direct access to the Docker daemon - and should be secured either using the
+[built in https encrypted socket](/articles/https/), or by putting a secure web
+proxy in front of it. You can listen on port `2375` on all network interfaces
+with `-H tcp://0.0.0.0:2375`, or on a particular network interface using its IP
+address: `-H tcp://192.168.59.103:2375`.
+
+On Systemd based systems, you can communicate with the daemon via
+[systemd socket activation](http://0pointer.de/blog/projects/socket-activation.html), use
+`docker -d -H fd://`. Using `fd://` will work perfectly for most setups but
+you can also specify individual sockets: `docker -d -H fd://3`. If the
+specified socket activated files aren't found, then Docker will exit. You
+can find examples of using Systemd socket activation with Docker and
+Systemd in the [Docker source tree](
+https://github.com/docker/docker/tree/master/contrib/init/systemd/).
+
+You can configure the Docker daemon to listen to multiple sockets at the same
+time using multiple `-H` options:
+
+ # listen using the default unix socket, and on 2 specific IP addresses on this host.
+ docker -d -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
+
+The Docker client will honor the `DOCKER_HOST` environment variable to set
+the `-H` flag for the client.
+
+ $ sudo docker -H tcp://0.0.0.0:2375 ps
+ # or
+ $ export DOCKER_HOST="tcp://0.0.0.0:2375"
+ $ sudo docker ps
+ # both are equal
+
+Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than the empty
+string is equivalent to setting the `--tlsverify` flag. The following are equivalent:
+
+ $ sudo docker --tlsverify ps
+ # or
+ $ export DOCKER_TLS_VERIFY=1
+ $ sudo docker ps
+
+### Daemon storage-driver option
+
+The Docker daemon has support for three different image layer storage drivers: `aufs`,
+`devicemapper`, and `btrfs`.
+
+The `aufs` driver is the oldest, but is based on a Linux kernel patch-set that
+is unlikely to be merged into the main kernel. These are also known to cause some
+serious kernel crashes. However, `aufs` is also the only storage driver that allows
+containers to share executable and shared library memory, so is a useful choice
+when running thousands of containers with the same program or libraries.
+
+The `devicemapper` driver uses thin provisioning and Copy on Write (CoW) snapshots.
+This driver will create a 100GB sparse file containing all your images and
+containers. Each container will be limited to a 10 GB thin volume, and either of
+these will require tuning - see [~jpetazzo/Resizing Docker containers with the
+Device Mapper plugin]( http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/)
+To tell the Docker daemon to use `devicemapper`, use
`docker -d -s devicemapper`.
+The `btrfs` driver is very fast for `docker build` - but like `devicemapper` does not
+share executable memory between devices. Use `docker -d -s btrfs -g /mnt/btrfs_partition`.
+
+
+### Docker exec-driver option
+
+The Docker daemon uses a specifically built `libcontainer` execution driver as its
+interface to the Linux kernel `namespaces`, `cgroups`, and `SELinux`.
+
+There is still legacy support for the original [LXC userspace tools](
+https://linuxcontainers.org/) via the `lxc` execution driver, however, this is
+not where the primary development of new functionality is taking place.
+Add `-e lxc` to the daemon flags to use the `lxc` execution driver.
+
+
+### Daemon DNS options
+
To set the DNS server for all Docker containers, use
`docker -d --dns 8.8.8.8`.
To set the DNS search domain for all Docker containers, use
`docker -d --dns-search example.com`.
-To run the daemon with debug output, use `docker -d -D`.
+### Miscellaneous options
-To use lxc as the execution driver, use `docker -d -e lxc`.
+IP masquerading uses address translation to allow containers without a public IP to talk
+to other machines on the Internet. This may interfere with some network topologies and
+can be disabled with --ip-masq=false.
-The docker client will also honor the `DOCKER_HOST` environment variable to set
-the `-H` flag for the client.
- $ docker -H tcp://0.0.0.0:2375 ps
- # or
- $ export DOCKER_HOST="tcp://0.0.0.0:2375"
- $ docker ps
- # both are equal
-
-To run the daemon with [systemd socket activation](
-http://0pointer.de/blog/projects/socket-activation.html), use
-`docker -d -H fd://`. Using `fd://` will work perfectly for most setups but
-you can also specify individual sockets too `docker -d -H fd://3`. If the
-specified socket activated files aren't found then docker will exit. You
-can find examples of using systemd socket activation with docker and
-systemd in the [docker source tree](
-https://github.com/docker/docker/blob/master/contrib/init/systemd/socket-activation/).
Docker supports softlinks for the Docker data directory
(`/var/lib/docker`) and for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be set like this:
@@ -126,6 +203,7 @@ Docker supports softlinks for the Docker data directory
export DOCKER_TMPDIR=/mnt/disk2/tmp
/usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// > /var/lib/boot2docker/docker.log 2>&1
+
## attach
Usage: docker attach [OPTIONS] CONTAINER
@@ -135,23 +213,26 @@ Docker supports softlinks for the Docker data directory
--no-stdin=false Do not attach STDIN
--sig-proxy=true Proxy all received signals to the process (even in non-TTY mode). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.
-The `attach` command will allow you to view or
-interact with any running container, detached (`-d`)
-or interactive (`-i`). You can attach to the same
-container at the same time - screen sharing style, or quickly view the
-progress of your daemonized process.
+The `attach` command lets you view or interact with any running container's
+primary process (`pid 1`).
+
+You can attach to the same contained process multiple times simultaneously, screen
+sharing style, or quickly view the progress of your daemonized process.
+
+> **Note:** This command is not for running a new process in a container.
+> See: [`docker exec`](#exec).
You can detach from the container again (and leave it running) with
-`CTRL-C` (for a quiet exit) or `CTRL-\`
-to get a stacktrace of the Docker client when it quits. When
-you detach from the container's process the exit code will be returned
-to the client.
+`CTRL-p CTRL-q` (for a quiet exit), or `CTRL-c` which will send a
+SIGKILL to the container, or `CTRL-\` to get a stacktrace of the
+Docker client when it quits. When you detach from the container's
+process the exit code will be returned to the client.
To stop a container, use `docker stop`.
To kill the container, use `docker kill`.
-### Examples:
+#### Examples
$ ID=$(sudo docker run -d ubuntu /usr/bin/top -b)
$ sudo docker attach $ID
@@ -207,8 +288,8 @@ When a single Dockerfile is given as `URL` or is piped through `STDIN`
(`docker build - < Dockerfile`), then no context is set.
When a Git repository is set as `URL`, then the repository is used as
-the context. The Git repository is cloned with its submodules (`git
-clone -recursive`). A fresh `git clone` occurs in a temporary directory
+the context. The Git repository is cloned with its submodules
+(`git clone -recursive`). A fresh `git clone` occurs in a temporary directory
on your local host, and then this is sent to the Docker daemon as the
context. This way, your local user credentials and VPN's etc can be
used to access private repositories.
@@ -219,11 +300,33 @@ Exclusion patterns match files or directories relative to `PATH` that
will be excluded from the context. Globbing is done using Go's
[filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
+Please note that `.dockerignore` files in other subdirectories are
+considered as normal files. Filepaths in .dockerignore are absolute with
+the current directory as the root. Wildcards are allowed but the search
+is not recursive.
+
+#### Example .dockerignore file
+ */temp*
+ */*/temp*
+ temp?
+
+The first line above `*/temp*`, would ignore all files with names starting with
+`temp` from any subdirectory below the root directory. For example, a file named
+`/somedir/temporary.txt` would be ignored. The second line `*/*/temp*`, will
+ignore files starting with name `temp` from any subdirectory that is two levels
+below the root directory. For example, the file `/somedir/subdir/temporary.txt`
+would get ignored in this case. The last line in the above example `temp?`
+will ignore the files that match the pattern from the root directory.
+For example, the files `tempa`, `tempb` are ignored from the root directory.
+Currently there is no support for regular expressions. Formats
+like `[^temp*]` are ignored.
+
+
See also:
[*Dockerfile Reference*](/reference/builder).
-### Examples:
+#### Examples
$ sudo docker build .
Uploading context 10240 bytes
@@ -270,7 +373,7 @@ If you wish to keep the intermediate containers after the build is
complete, you must use `--rm=false`. This does not
affect the build cache.
- $ docker build .
+ $ sudo docker build .
Uploading context 18.829 MB
Uploading context
Step 0 : FROM busybox
@@ -280,7 +383,7 @@ affect the build cache.
---> 99cc1ad10469
Successfully built 99cc1ad10469
$ echo ".git" > .dockerignore
- $ docker build .
+ $ sudo docker build .
Uploading context 6.76 MB
Uploading context
Step 0 : FROM busybox
@@ -348,15 +451,15 @@ while the image is committed. This reduces the likelihood of
encountering data corruption during the process of creating the commit.
If this behavior is undesired, set the 'p' option to false.
-### Commit an existing container
+#### Commit an existing container
$ sudo docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours
- $ docker commit c3f279d17e0a SvenDowideit/testimage:version3
+ $ sudo docker commit c3f279d17e0a SvenDowideit/testimage:version3
f5283438590d
- $ docker images | head
+ $ sudo docker images | head
REPOSITORY TAG ID CREATED VIRTUAL SIZE
SvenDowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
@@ -369,6 +472,68 @@ path. Paths are relative to the root of the filesystem.
Copy files/folders from the PATH to the HOSTPATH
+## create
+
+Creates a new container.
+
+ Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
+
+ Create a new container
+
+ -a, --attach=[] Attach to STDIN, STDOUT or STDERR.
+ --add-host=[] Add a custom host-to-IP mapping (host:ip)
+ -c, --cpu-shares=0 CPU shares (relative weight)
+ --cap-add=[] Add Linux capabilities
+ --cap-drop=[] Drop Linux capabilities
+ --cidfile="" Write the container ID to the file
+ --cpuset="" CPUs in which to allow execution (0-3, 0,1)
+ --device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc)
+ --dns=[] Set custom DNS servers
+ --dns-search=[] Set custom DNS search domains
+ -e, --env=[] Set environment variables
+ --entrypoint="" Overwrite the default ENTRYPOINT of the image
+ --env-file=[] Read in a line delimited file of environment variables
+ --expose=[] Expose a port from the container without publishing it to your host
+ -h, --hostname="" Container host name
+ -i, --interactive=false Keep STDIN open even if not attached
+ --link=[] Add link to another container in the form of name:alias
+ --lxc-conf=[] (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
+ -m, --memory="" Memory limit (format: , where unit = b, k, m or g)
+ --name="" Assign a name to the container
+ --net="bridge" Set the Network mode for the container
+ 'bridge': creates a new network stack for the container on the docker bridge
+ 'none': no networking for this container
+ 'container:': reuses another container network stack
+ 'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
+ -P, --publish-all=false Publish all exposed ports to the host interfaces
+ -p, --publish=[] Publish a container's port to the host
+ format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
+ (use 'docker port' to see the actual mapping)
+ --privileged=false Give extended privileges to this container
+ --restart="" Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
+ -t, --tty=false Allocate a pseudo-TTY
+ -u, --user="" Username or UID
+ -v, --volume=[] Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
+ --volumes-from=[] Mount volumes from the specified container(s)
+ -w, --workdir="" Working directory inside the container
+
+The `docker create` command creates a writeable container layer over
+the specified image and prepares it for running the specified command.
+The container ID is then printed to `STDOUT`.
+This is similar to `docker run -d` except the container is never started.
+You can then use the `docker start ` command to start the
+container at any point.
+
+This is useful when you want to set up a container configuration ahead
+of time so that it is ready to start when you need it.
+
+#### Example
+
+ $ sudo docker create -t -i fedora bash
+ 6d8af538ec541dd581ebc2a24153a28329acb5268abe5ef868c1f1a261221752
+ $ sudo docker start -a -i 6d8af538ec5
+ bash-4.2#
+
## diff
List the changed files and directories in a container᾿s filesystem
@@ -408,7 +573,15 @@ For example:
--since="" Show all events created since timestamp
--until="" Stream events until this timestamp
-### Examples
+Docker containers will report the following events:
+
+ create, destroy, die, export, kill, pause, restart, start, stop, unpause
+
+and Docker images will report:
+
+ untag, delete
+
+#### Examples
You'll need two shells for this example.
@@ -442,6 +615,35 @@ You'll need two shells for this example.
2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from 12de384bfb10) die
2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from 12de384bfb10) stop
+## exec
+
+ Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
+
+ Run a command in an existing container
+
+ -d, --detach=false Detached mode: run command in the background
+ -i, --interactive=false Keep STDIN open even if not attached
+ -t, --tty=false Allocate a pseudo-TTY
+
+The `docker exec` command runs a new command in a running container.
+
+The `docker exec` command will typically be used after `docker run` or `docker start`.
+
+#### Examples
+
+ $ sudo docker run --name ubuntu_bash --rm -i -t ubuntu bash
+
+This will create a container named `ubuntu_bash` and start a Bash session.
+
+ $ sudo docker exec -d ubuntu_bash touch /tmp/execWorks
+
+This will create a new file `/tmp/execWorks` inside the running container
+`ubuntu_bash`, in the background.
+
+ $ sudo docker exec ubuntu_bash -it bash
+
+This will create a new Bash session in the container `ubuntu_bash`.
+
## export
Usage: docker export CONTAINER
@@ -463,7 +665,7 @@ For example:
To see how the `docker:latest` image was built:
- $ docker history docker
+ $ sudo docker history docker
IMAGE CREATED CREATED BY SIZE
3e23a5875458790b7a806f95f7ec0d0b2a5c1659bfc899c89f939f6d5b8f7094 8 days ago /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8 0 B
8578938dd17054dce7993d21de79e96a037400e8d28e15e7290fea4f65128a36 8 days ago /bin/sh -c dpkg-reconfigure locales && locale-gen C.UTF-8 && /usr/sbin/update-locale LANG=C.UTF-8 1.245 MB
@@ -491,7 +693,7 @@ decrease disk usage, and speed up `docker build` by
allowing each step to be cached. These intermediate layers are not shown
by default.
-### Listing the most recently created images
+#### Listing the most recently created images
$ sudo docker images | head
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
@@ -505,7 +707,7 @@ by default.
tryout latest 2629d1fa0b81 23 hours ago 131.5 MB
5ed6274db6ce 24 hours ago 1.089 GB
-### Listing the full length image IDs
+#### Listing the full length image IDs
$ sudo docker images --no-trunc | head
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
@@ -519,7 +721,7 @@ by default.
tryout latest 2629d1fa0b81b222fca63371ca16cbf6a0772d07759ff80e8d1369b926940074 23 hours ago 131.5 MB
5ed6274db6ceb2397844896966ea239290555e74ef307030ebb01ff91b1914df 24 hours ago 1.089 GB
-### Filtering
+#### Filtering
The filtering flag (`-f` or `--filter`) format is of "key=value". If there are more
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
@@ -527,7 +729,7 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
Current filters:
* dangling (boolean - true or false)
-#### untagged images
+##### Untagged images
$ sudo docker images --filter "dangling=true"
@@ -541,7 +743,7 @@ Current filters:
This will display untagged images, that are the leaves of the images tree (not
intermediary layers). These images occur when a new build of an image takes the
-repo:tag away from the IMAGE ID, leaving it untagged. A warning will be issued
+`repo:tag` away from the image ID, leaving it untagged. A warning will be issued
if trying to remove an image when a container is presently using it.
By having this flag it allows for batch cleanup.
@@ -558,7 +760,6 @@ Ready for use by `docker rmi ...`, like:
NOTE: Docker will warn you if any containers exist that are using these untagged images.
-
## import
Usage: docker import URL|- [REPOSITORY[:TAG]]
@@ -570,7 +771,7 @@ URLs must start with `http` and point to a single file archive (.tar,
you would like to import from a local directory or archive, you can use
the `-` parameter to take the data from `STDIN`.
-### Examples
+#### Examples
**Import from a remote location:**
@@ -618,14 +819,14 @@ For example:
Username: svendowideit
Registry: [https://index.docker.io/v1/]
-The global `-D` option tells all `docker` comands to output debug information.
+The global `-D` option tells all `docker` commands to output debug information.
When sending issue reports, please use `docker version` and `docker -D info` to
ensure we know how your setup is configured.
## inspect
- Usage: docker inspect CONTAINER|IMAGE [CONTAINER|IMAGE...]
+ Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]
Return low-level information on a container or image
@@ -637,9 +838,9 @@ specified, the given template will be executed for each result.
Go's [text/template](http://golang.org/pkg/text/template/) package
describes all the details of the format.
-### Examples
+#### Examples
-**Get an instance'sIP Address:**
+**Get an instance's IP address:**
For the most part, you can pick out any field from the JSON in a fairly
straightforward manner.
@@ -655,25 +856,22 @@ output:
**Find a Specific Port Mapping:**
-The `.Field` syntax doesn't work when the field name
-begins with a number, but the template language's `index`
-function does. The `.NetworkSettings.Ports`
-section contains a map of the internal port mappings to a list
-of external address/port objects, so to grab just the numeric public
-port, you use `index` to find the specific port map,
-and then `index` 0 contains first object inside of
-that. Then we ask for the `HostPort` field to get
-the public address.
+The `.Field` syntax doesn't work when the field name begins with a
+number, but the template language's `index` function does. The
+`.NetworkSettings.Ports` section contains a map of the internal port
+mappings to a list of external address/port objects, so to grab just the
+numeric public port, you use `index` to find the specific port map, and
+then `index` 0 contains the first object inside of that. Then we ask for
+the `HostPort` field to get the public address.
$ sudo docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
**Get config:**
-The `.Field` syntax doesn't work when the field
-contains JSON data, but the template language's custom `json`
-function does. The `.config` section
-contains complex json object, so to grab it as JSON, you use
-`json` to convert config object into JSON
+The `.Field` syntax doesn't work when the field contains JSON data, but
+the template language's custom `json` function does. The `.config`
+section contains complex JSON object, so to grab it as JSON, you use
+`json` to convert the configuration object into JSON.
$ sudo docker inspect --format='{{json .config}}' $INSTANCE_ID
@@ -690,7 +888,7 @@ signal specified with option `--signal`.
## load
- Usage: docker load
+ Usage: docker load [OPTIONS]
Load an image from a tar archive on STDIN
@@ -724,11 +922,11 @@ Restores both images and tags.
-p, --password="" Password
-u, --username="" Username
-If you want to login to a self-hosted registry you can
-specify this by adding the server name.
+If you want to login to a self-hosted registry you can specify this by
+adding the server name.
example:
- $ docker login localhost:8080
+ $ sudo docker login localhost:8080
## logout
@@ -738,11 +936,11 @@ specify this by adding the server name.
For example:
- $ docker logout localhost:8080
+ $ sudo docker logout localhost:8080
## logs
- Usage: docker logs CONTAINER
+ Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
@@ -759,14 +957,31 @@ Passing a negative number or a non-integer to `--tail` is invalid and the
value is set to `all` in that case. This behavior may change in the future.
The `docker logs --timestamp` commands will add an RFC3339Nano
-timestamp, for example `2014-05-10T17:42:14.999999999Z07:00`, to each
-log entry.
+timestamp, for example `2014-09-16T06:17:46.000000000Z`, to each
+log entry. To ensure that the timestamps for are aligned the
+nano-second part of the timestamp will be padded with zero when necessary.
## port
- Usage: docker port CONTAINER PRIVATE_PORT
+ Usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]
- Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
+ List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
+
+You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
+just a specific mapping:
+
+ $ sudo docker ps test
+ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+ b650456536c7 busybox:latest top 54 minutes ago Up 54 minutes 0.0.0.0:1234->9876/tcp, 0.0.0.0:4321->7890/tcp test
+ $ sudo docker port test
+ 7890/tcp -> 0.0.0.0:4321
+ 9876/tcp -> 0.0.0.0:1234
+ $ sudo docker port test 7890/tcp
+ 0.0.0.0:4321
+ $ sudo docker port test 7890/udp
+ 2014/06/24 11:53:36 Error: No public port '7890/udp' published for test
+ $ sudo docker port test 7890
+ 0.0.0.0:4321
## pause
@@ -780,9 +995,9 @@ used, which is observable by the process being suspended. With the cgroups freez
the process is unaware, and unable to capture, that it is being suspended,
and subsequently resumed.
-See the [cgroups freezer documentation]
-(https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt) for
-further details.
+See the
+[cgroups freezer documentation](https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt)
+for further details.
## ps
@@ -794,6 +1009,7 @@ further details.
--before="" Show only container created before Id or Name, include non-running ones.
-f, --filter=[] Provide filter values. Valid filters:
exited= - containers with exit code of
+ status=(restarting|running|paused|exited)
-l, --latest=false Show only the latest created container, include non-running ones.
-n=-1 Show n last created containers, include non-running ones.
--no-trunc=false Don't truncate output
@@ -803,7 +1019,7 @@ further details.
Running `docker ps` showing 2 linked containers.
- $ docker ps
+ $ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4c01db0b339c ubuntu:12.04 bash 17 seconds ago Up 16 seconds webapp
d7886598dbe2 crosbymichael/redis:latest /redis-server --dir 33 minutes ago Up 33 minutes 6379/tcp redis,webapp/db
@@ -811,16 +1027,15 @@ Running `docker ps` showing 2 linked containers.
`docker ps` will show only running containers by default. To see all containers:
`docker ps -a`
-### Filtering
+#### Filtering
-The filtering flag (-f or --filter) format is a "key=value" pair. If there is more
+The filtering flag (`-f` or `--filter)` format is a `key=value` pair. If there is more
than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`)
Current filters:
* exited (int - the code of exited containers. Only useful with '--all')
-
-#### Successfully exited containers
+##### Successfully exited containers
$ sudo docker ps -a --filter 'exited=0'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
@@ -832,10 +1047,12 @@ This shows all the containers that have exited with status of '0'
## pull
- Usage: docker pull NAME[:TAG]
+ Usage: docker pull [OPTIONS] NAME[:TAG]
Pull an image or a repository from the registry
+ -a, --all-tags=false Download all tagged images in the repository
+
Most of your images will be created on top of a base image from the
[Docker Hub](https://hub.docker.com) registry.
@@ -845,18 +1062,23 @@ can `pull` and try without needing to define and configure your own.
It is also possible to manually specify the path of a registry to pull from.
For example, if you have set up a local registry, you can specify its path to
pull from it. A repository path is similar to a URL, but does not contain
-a protocol specifier (https://, for example).
+a protocol specifier (`https://`, for example).
To download a particular image, or set of images (i.e., a repository),
use `docker pull`:
- $ docker pull debian
- # will pull all the images in the debian repository
- $ docker pull debian:testing
- # will pull only the image named debian:testing and any intermediate layers
- # it is based on. (Typically the empty `scratch` image, a MAINTAINERs layer,
+ $ sudo docker pull debian
+ # will pull the debian:latest image, its intermediate layers
+ # and any aliases of the same id
+ $ sudo docker pull debian:testing
+ # will pull the image named ubuntu:trusty, ubuntu:14.04
+ # which is an alias of the same image
+ # and any intermediate layers it is based on.
+ # (Typically the empty `scratch` image, a MAINTAINER layer,
# and the un-tarred base).
- $ docker pull registry.hub.docker.com/debian
+ $ sudo docker pull --all-tags centos
+ # will pull all the images from the centos repository
+ $ sudo docker pull registry.hub.docker.com/debian
# manually specifies the path to the default Docker registry. This could
# be replaced with the path to a local registry to pull from another source.
@@ -887,13 +1109,7 @@ registry or to a self-hosted one.
-l, --link=false Remove the specified link and not the underlying container
-v, --volumes=false Remove the volumes associated with the container
-### Known Issues (rm)
-
-- [Issue 197](https://github.com/docker/docker/issues/197) indicates
- that `docker kill` may leave directories behind
- and make it difficult to remove the container.
-
-### Examples:
+#### Examples
$ sudo docker rm /redis
/redis
@@ -904,34 +1120,32 @@ This will remove the container referenced under the link
$ sudo docker rm --link /webapp/redis
/webapp/redis
-This will remove the underlying link between `/webapp`
-and the `/redis` containers removing all
-network communication.
+This will remove the underlying link between `/webapp` and the `/redis`
+containers removing all network communication.
$ sudo docker rm --force redis
redis
The main process inside the container referenced under the link `/redis` will receive
-SIGKILL, then the container will be removed.
+`SIGKILL`, then the container will be removed.
-
-This command will delete all stopped containers. The command
-`docker ps -a -q` will return all existing container
-IDs and pass them to the `rm` command which will
-delete them. Any running containers will not be deleted.
+This command will delete all stopped containers. The command `docker ps
+-a -q` will return all existing container IDs and pass them to the `rm`
+command which will delete them. Any running containers will not be
+deleted.
## rmi
- Usage: docker rmi IMAGE [IMAGE...]
+ Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
-f, --force=false Force removal of the image
--no-prune=false Do not delete untagged parents
-### Removing tagged images
+#### Removing tagged images
-Images can be removed either by their short or long ID`s, or their image
+Images can be removed either by their short or long IDs, or their image
names. If an image has more than one name, each of them needs to be
removed before the image is removed.
@@ -964,12 +1178,13 @@ removed before the image is removed.
Run a command in a new container
-a, --attach=[] Attach to STDIN, STDOUT or STDERR.
+ --add-host=[] Add a custom host-to-IP mapping (host:ip)
-c, --cpu-shares=0 CPU shares (relative weight)
--cap-add=[] Add Linux capabilities
--cap-drop=[] Drop Linux capabilities
--cidfile="" Write the container ID to the file
--cpuset="" CPUs in which to allow execution (0-3, 0,1)
- -d, --detach=false Detached mode: run container in the background and print new container ID
+ -d, --detach=false Detached mode: run the container in the background and print the new container ID
--device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc)
--dns=[] Set custom DNS servers
--dns-search=[] Set custom DNS search domains
@@ -990,10 +1205,10 @@ removed before the image is removed.
'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
-P, --publish-all=false Publish all exposed ports to the host interfaces
-p, --publish=[] Publish a container's port to the host
- format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
+ format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
(use 'docker port' to see the actual mapping)
--privileged=false Give extended privileges to this container
- --restart="" Restart policy to apply when a container exits (no, on-failure, always)
+ --restart="" Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
--rm=false Automatically remove the container when it exits (incompatible with -d)
--sig-proxy=true Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
-t, --tty=false Allocate a pseudo-TTY
@@ -1016,14 +1231,7 @@ See the [Docker User Guide](/userguide/dockerlinks/) for more detailed
information about the `--expose`, `-p`, `-P` and `--link` parameters,
and linking containers.
-### Known Issues (run –volumes-from)
-
-- [Issue 2702](https://github.com/docker/docker/issues/2702):
- "lxc-start: Permission denied - failed to mount" could indicate a
- permissions problem with AppArmor. Please see the issue for a
- workaround.
-
-### Examples:
+#### Examples
$ sudo docker run --cidfile /tmp/docker_test.cid ubuntu echo "test"
@@ -1074,9 +1282,9 @@ folder before starting your container.
$ sudo docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v ./static-docker:/usr/bin/docker busybox sh
By bind-mounting the docker unix socket and statically linked docker
-binary (such as that provided by [https://get.docker.io](
-https://get.docker.io)), you give the container the full access to create and
-manipulate the host's docker daemon.
+binary (such as that provided by [https://get.docker.com](
+https://get.docker.com)), you give the container the full access to create and
+manipulate the host's Docker daemon.
$ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash
@@ -1096,7 +1304,7 @@ ports in Docker.
This sets environmental variables in the container. For illustration all three
flags are shown here. Where `-e`, `--env` take an environment variable and
value, or if no "=" is provided, then that variable's current value is passed
-through (i.e. $MYVAR1 from the host is set to $MYVAR1 in the container). All
+through (i.e. `$MYVAR1` from the host is set to `$MYVAR1` in the container). All
three flags, `-e`, `--env` and `--env-file` can be repeated.
Regardless of the order of these three flags, the `--env-file` are processed
@@ -1109,7 +1317,7 @@ override variables as needed.
TEST_FOO=This is a test
The `--env-file` flag takes a filename as an argument and expects each line
-to be in the VAR=VAL format, mimicking the argument passed to `--env`. Comment
+to be in the `VAR=VAL` format, mimicking the argument passed to `--env`. Comment
lines need only be prefixed with `#`
An example of a file passed with `--env-file`
@@ -1181,14 +1389,13 @@ retrieve the container's ID once the container has finished running.
brw-rw---- 1 root disk 8, 3 Feb 9 16:05 /dev/sdd
crw-rw-rw- 1 root root 1, 5 Feb 9 16:05 /dev/nulo
-It is often necessary to directly expose devices to a container. ``--device``
+It is often necessary to directly expose devices to a container. The `--device`
option enables that. For example, a specific block storage device or loop
device or audio device can be added to an otherwise unprivileged container
-(without the ``--privileged`` flag) and have the application directly access it.
+(without the `--privileged` flag) and have the application directly access it.
-** Security note: **
-
-``--device`` cannot be safely used with ephemeral devices. Block devices that may be removed should not be added to untrusted containers with ``--device``!
+**Note:**
+> `--device` cannot be safely used with ephemeral devices. Block devices that may be removed should not be added to untrusted containers with `--device`.
**A complete example:**
@@ -1198,7 +1405,7 @@ device or audio device can be added to an otherwise unprivileged container
$ sudo docker run -d -p 1443:443 --dns=10.0.0.1 --dns-search=dev.org -v /var/log/httpd --volumes-from static --link riak --link app -h www.sven.dev.org --name web webserver
$ sudo docker run -t -i --rm --volumes-from web -w /var/log/httpd busybox tail -f access.log
-This example shows 5 containers that might be set up to test a web
+This example shows five containers that might be set up to test a web
application change:
1. Start a pre-prepared volume image `static-web-files` (in the background)
@@ -1230,10 +1437,11 @@ how a container should or should not be restarted on exit.
** on-failure ** - Restart the container only if it exits with a non zero exit status.
-** always ** - Always restart the container reguardless of the exit status.
+** always ** - Always restart the container regardless of the exit status.
-You can also specify the maximum amount of times Docker will try to restart the
-container when using the ** on-failure ** policy. The default is that Docker will try forever to restart the container.
+You can also specify the maximum amount of times Docker will try to
+restart the container when using the ** on-failure ** policy. The
+default is that Docker will try forever to restart the container.
$ sudo docker run --restart=always redis
@@ -1242,23 +1450,25 @@ the container exits, Docker will restart it.
$ sudo docker run --restart=on-failure:10 redis
-This will run the `redis` container with a restart policy of ** on-failure ** and a
-maximum restart count of 10. If the `redis` container exits with a non-zero exit
-status more than 10 times in a row Docker will abort trying to restart the container.
+This will run the `redis` container with a restart policy of **
+on-failure ** and a maximum restart count of 10. If the `redis`
+container exits with a non-zero exit status more than 10 times in a row
+Docker will abort trying to restart the container. Providing a maximum
+restart limit is only valid for the ** on-failure ** policy.
## save
- Usage: docker save IMAGE
+ Usage: docker save [OPTIONS] IMAGE [IMAGE...]
- Save an image to a tar archive (streamed to STDOUT by default)
+ Save an image(s) to a tar archive (streamed to STDOUT by default)
- -o, --output="" Write to an file, instead of STDOUT
+ -o, --output="" Write to a file, instead of STDOUT
-Produces a tarred repository to the standard output stream. Contains all
-parent layers, and all tags + versions, or specified repo:tag.
+Produces a tarred repository to the standard output stream.
+Contains all parent layers, and all tags + versions, or specified `repo:tag`, for
+each argument provided.
-It is used to create a backup that can then be used with
-`docker load`
+It is used to create a backup that can then be used with `docker load`
$ sudo docker save busybox > busybox.tar
$ ls -sh busybox.tar
@@ -1269,11 +1479,15 @@ It is used to create a backup that can then be used with
$ sudo docker save -o fedora-all.tar fedora
$ sudo docker save -o fedora-latest.tar fedora:latest
+It is even useful to cherry-pick particular tags of an image repository
+
+ $ sudo docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
+
## search
Search [Docker Hub](https://hub.docker.com) for images
- Usage: docker search TERM
+ Usage: docker search [OPTIONS] TERM
Search the Docker Hub for images
@@ -1287,12 +1501,12 @@ more details on finding shared images from the command line.
## start
- Usage: docker start CONTAINER [CONTAINER...]
+ Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]
Restart a stopped container
- -a, --attach=false Attach container's STDOUT and STDERR and forward all signals to the process
- -i, --interactive=false Attach container's STDIN
+ -a, --attach=false Attach container's `STDOUT` and `STDERR` and forward all signals to the process
+ -i, --interactive=false Attach container's `STDIN`
When run on a container that has already been started,
takes no action and succeeds unconditionally.
@@ -1301,12 +1515,12 @@ takes no action and succeeds unconditionally.
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
- Stop a running container by sending SIGTERM and then SIGKILL after a grace period
+ Stop a running container by sending `SIGTERM` and then `SIGKILL` after a grace period
-t, --time=10 Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
-The main process inside the container will receive SIGTERM, and after a
-grace period, SIGKILL
+The main process inside the container will receive `SIGTERM`, and after a
+grace period, `SIGKILL`.
## tag
@@ -1335,9 +1549,9 @@ them to [*Share Images via Repositories*](
The `docker unpause` command uses the cgroups freezer to un-suspend all
processes in a container.
-See the [cgroups freezer documentation]
-(https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt) for
-further details.
+See the
+[cgroups freezer documentation](https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt)
+for further details.
## version
diff --git a/docs/sources/reference/run.md b/docs/sources/reference/run.md
index a933a32bea..67007ccff7 100644
--- a/docs/sources/reference/run.md
+++ b/docs/sources/reference/run.md
@@ -18,7 +18,7 @@ other `docker` command.
The basic `docker run` command takes this form:
- $ docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
+ $ sudo docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
To learn how to interpret the types of `[OPTIONS]`,
see [*Option types*](/reference/commandline/cli/#option-types).
@@ -91,7 +91,7 @@ streams]( https://github.com/docker/docker/blob/
specify to which of the three standard streams (`STDIN`, `STDOUT`,
`STDERR`) you'd like to connect instead, as in:
- $ docker run -a stdin -a stdout -i -t ubuntu /bin/bash
+ $ sudo docker run -a stdin -a stdout -i -t ubuntu /bin/bash
For interactive processes (like a shell) you will typically want a tty
as well as persistent standard input (`STDIN`), so you'll use `-i -t`
@@ -139,6 +139,7 @@ example, `docker run ubuntu:14.04`.
'none': no networking for this container
'container:': reuses another container network stack
'host': use the host network stack inside the container
+ --add-host="" : Add a line to /etc/hosts (host:IP)
By default, all containers have networking enabled and they can make any
outgoing connections. The operator can completely disable networking
@@ -192,9 +193,25 @@ Example running a Redis container with Redis binding to `localhost` then
running the `redis-cli` command and connecting to the Redis server over the
`localhost` interface.
- $ docker run -d --name redis example/redis --bind 127.0.0.1
+ $ sudo docker run -d --name redis example/redis --bind 127.0.0.1
$ # use the redis container's network stack to access localhost
- $ docker run --rm -ti --net container:redis example/redis-cli -h 127.0.0.1
+ $ sudo docker run --rm -ti --net container:redis example/redis-cli -h 127.0.0.1
+
+### Managing /etc/hosts
+
+Your container will have lines in `/etc/hosts` which define the hostname of the
+container itself as well as `localhost` and a few other common things. The
+`--add-host` flag can be used to add additional lines to `/etc/hosts`.
+
+ $ /docker run -ti --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
+ 172.17.0.22 09d03f76bf2c
+ fe00::0 ip6-localnet
+ ff00::0 ip6-mcastprefix
+ ff02::1 ip6-allnodes
+ ff02::2 ip6-allrouters
+ 127.0.0.1 localhost
+ ::1 localhost ip6-localhost ip6-loopback
+ 86.75.30.9 db-static
## Clean Up (–-rm)
@@ -208,6 +225,42 @@ the container exits**, you can add the `--rm` flag:
--rm=false: Automatically remove the container when it exits (incompatible with -d)
+## Security Configuration
+ --security-opt="label:user:USER" : Set the label user for the container
+ --security-opt="label:role:ROLE" : Set the label role for the container
+ --security-opt="label:type:TYPE" : Set the label type for the container
+ --security-opt="label:level:LEVEL" : Set the label level for the container
+ --security-opt="label:disable" : Turn off label confinement for the container
+ --secutity-opt="apparmor:PROFILE" : Set the apparmor profile to be applied
+ to the container
+
+You can override the default labeling scheme for each container by specifying
+the `--security-opt` flag. For example, you can specify the MCS/MLS level, a
+requirement for MLS systems. Specifying the level in the following command
+allows you to share the same content between containers.
+
+ # docker run --security-opt label:level:s0:c100,c200 -i -t fedora bash
+
+An MLS example might be:
+
+ # docker run --security-opt label:level:TopSecret -i -t rhel7 bash
+
+To disable the security labeling for this container versus running with the
+`--permissive` flag, use the following command:
+
+ # docker run --security-opt label:disable -i -t fedora bash
+
+If you want a tighter security policy on the processes within a container,
+you can specify an alternate type for the container. You could run a container
+that is only allowed to listen on Apache ports by executing the following
+command:
+
+ # docker run --security-opt label:type:svirt_apache_t -i -t centos bash
+
+Note:
+
+You would have to write policy defining a `svirt_apache_t` type.
+
## Runtime Constraints on CPU and Memory
The operator can also adjust the performance parameters of the
@@ -231,6 +284,7 @@ them via Docker.
--cap-add: Add Linux capabilities
--cap-drop: Drop Linux capabilities
--privileged=false: Give extended privileges to this container
+ --device=[]: Allows you to run devices inside the container without the --privileged flag.
--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
@@ -243,17 +297,23 @@ 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
+in AppArmor or SELinux 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.com/2013/09/docker-can-now-run-within-docker/).
+If you want to limit access to a specific device or devices you can use
+the `--device` flag. It allows you to specify one or more devices that
+will be accessible within the container.
+
+ $ sudo docker run --device=/dev/snd:/dev/snd ...
+
In addition to `--privileged`, the operator can have fine grain control over the
capabilities using `--cap-add` and `--cap-drop`. By default, Docker has a default
list of capabilities that are kept. Both flags support the value `all`, so if the
operator wants to have all capabilities but `MKNOD` they could use:
- $ docker run --cap-add=ALL --cap-drop=MKNOD ...
+ $ sudo docker run --cap-add=ALL --cap-drop=MKNOD ...
For interacting with the network stack, instead of using `--privileged` they
should use `--cap-add=NET_ADMIN` to modify the network interfaces.
@@ -292,7 +352,7 @@ Dockerfile instruction and how the operator can override that setting.
Recall the optional `COMMAND` in the Docker
commandline:
- $ docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
+ $ sudo docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
This command is optional because the person who created the `IMAGE` may
have already provided a default `COMMAND` using the Dockerfile `CMD`
@@ -319,12 +379,12 @@ runtime by using a string to specify 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
+ $ sudo 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
+ $ sudo docker run -i -t --entrypoint /bin/bash example/redis -c ls -l
+ $ sudo docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help
## EXPOSE (Incoming Ports)
@@ -338,7 +398,7 @@ or override the Dockerfile's exposed defaults:
-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)
+ hostPort:containerPort | containerPort)
(use 'docker port' to see the actual mapping)
--link="" : Add link to another container (name:alias)
@@ -357,8 +417,9 @@ with `-P` or `-p,` or start the client container with `--link`.
If the operator uses `-P` or `-p` then Docker will make the exposed port
accessible on the host 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`)
+that can reach the host. When using `-P`, Docker will bind the exposed
+ports to a random port on the host between 49153 and 65535. To find the
+mapping between the host ports and the exposed ports, use `docker port`.
If the operator uses `--link` when starting the new client container,
then the client container can access the exposed port via a private
@@ -367,11 +428,50 @@ client container to help indicate which interface and port to use.
## ENV (Environment Variables)
-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 Dockerfile `ENV`:
+When a new container is created, Docker will set the following environment
+variables automatically:
- $ docker run -e "deep=purple" --rm ubuntu /bin/bash -c export
+
+
+
Variable
+
Value
+
+
+
HOME
+
+ Set based on the value of USER
+
+
+
+
HOSTNAME
+
+ The hostname associated with the container
+
+
+
+
PATH
+
+ Includes popular directories, such as :
+ /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+
+
TERM
+
+ xterm if the container is allocated a psuedo-TTY
+
+
+
+
+The container may also include environment variables defined
+as a result of the container being linked with another container. See
+the [*Container Links*](/userguide/dockerlinks/#container-linking)
+section for more details.
+
+Additionally, the operator can **set any environment variable** in the
+container by using one or more `-e` flags, even overriding those mentioned
+above, or already defined by the developer with a Dockerfile `ENV`:
+
+ $ sudo docker run -e "deep=purple" --rm ubuntu /bin/bash -c export
declare -x HOME="/"
declare -x HOSTNAME="85bc26a0e200"
declare -x OLDPWD
@@ -389,23 +489,23 @@ 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
+ $ sudo docker run -d --name redis-name dockerfiles/redis
4241164edf6f5aca5b0e9e4c9eccd899b0b8080c64c0cd26efe02166c73208f3
# The redis-name container exposed port 6379
- $ docker ps
+ $ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4241164edf6f $ dockerfiles/redis:latest /redis-stable/src/re 5 seconds ago Up 4 seconds 6379/tcp redis-name
# Note that there are no public ports exposed since we didn᾿t use -p or -P
- $ docker port 4241164edf6f 6379
+ $ sudo docker port 4241164edf6f 6379
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!
- $ docker run --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c export
+ $ sudo 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
@@ -422,15 +522,18 @@ valid 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'
+ $ sudo 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>
Docker will also map the private IP address to the alias of a linked
container by inserting an entry into `/etc/hosts`. You can use this
mechanism to communicate with a linked container by its alias:
- $ docker run -d --name servicename busybox sleep 30
- $ docker run -i -t --link servicename:servicealias busybox ping -c 1 servicealias
+ $ sudo docker run -d --name servicename busybox sleep 30
+ $ sudo docker run -i -t --link servicename:servicealias busybox ping -c 1 servicealias
+
+If you restart the source container (`servicename` in this case), the recipient
+container's `/etc/hosts` entry will be automatically updated.
## VOLUME (Shared Filesystems)
diff --git a/docs/sources/robots.txt b/docs/sources/robots.txt
deleted file mode 100644
index c2a49f4fb8..0000000000
--- a/docs/sources/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Allow: /
diff --git a/docs/sources/static_files/docker_pull_chart.png b/docs/sources/static_files/docker_pull_chart.png
index 73a145239c..57d3f68dbd 100644
Binary files a/docs/sources/static_files/docker_pull_chart.png and b/docs/sources/static_files/docker_pull_chart.png differ
diff --git a/docs/sources/static_files/docker_push_chart.png b/docs/sources/static_files/docker_push_chart.png
index 6486355e91..34b37073db 100644
Binary files a/docs/sources/static_files/docker_push_chart.png and b/docs/sources/static_files/docker_push_chart.png differ
diff --git a/docs/sources/static_files/dockerlogo-v.png b/docs/sources/static_files/dockerlogo-v.png
index 591e770d27..69ae685172 100644
Binary files a/docs/sources/static_files/dockerlogo-v.png and b/docs/sources/static_files/dockerlogo-v.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-busyboxrw.png b/docs/sources/terms/images/docker-filesystems-busyboxrw.png
index 9ff8487b89..5f046cbc0a 100644
Binary files a/docs/sources/terms/images/docker-filesystems-busyboxrw.png and b/docs/sources/terms/images/docker-filesystems-busyboxrw.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-debian.png b/docs/sources/terms/images/docker-filesystems-debian.png
index 61e5ddb2e3..3502b38460 100644
Binary files a/docs/sources/terms/images/docker-filesystems-debian.png and b/docs/sources/terms/images/docker-filesystems-debian.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-debianrw.png b/docs/sources/terms/images/docker-filesystems-debianrw.png
index cacba4947b..387c9eb763 100644
Binary files a/docs/sources/terms/images/docker-filesystems-debianrw.png and b/docs/sources/terms/images/docker-filesystems-debianrw.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-generic.png b/docs/sources/terms/images/docker-filesystems-generic.png
index ae54b72e88..e24dce635b 100644
Binary files a/docs/sources/terms/images/docker-filesystems-generic.png and b/docs/sources/terms/images/docker-filesystems-generic.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-multilayer.png b/docs/sources/terms/images/docker-filesystems-multilayer.png
index daedebe9c1..632aa41cca 100644
Binary files a/docs/sources/terms/images/docker-filesystems-multilayer.png and b/docs/sources/terms/images/docker-filesystems-multilayer.png differ
diff --git a/docs/sources/terms/images/docker-filesystems-multiroot.png b/docs/sources/terms/images/docker-filesystems-multiroot.png
index 65b61d94f1..f9bcc38ff9 100644
Binary files a/docs/sources/terms/images/docker-filesystems-multiroot.png and b/docs/sources/terms/images/docker-filesystems-multiroot.png differ
diff --git a/docs/sources/userguide/dockerimages.md b/docs/sources/userguide/dockerimages.md
index e6583a0f82..a0a30408c6 100644
--- a/docs/sources/userguide/dockerimages.md
+++ b/docs/sources/userguide/dockerimages.md
@@ -93,6 +93,8 @@ download the `centos` image.
ef52fb1fe610: Download complete
. . .
+ Status: Downloaded newer image for centos
+
We can see that each layer of the image has been pulled down and now we
can run a container from this image and we won't have to wait to
download the image.
@@ -166,6 +168,8 @@ update and create images.
1. We can update a container created from an image and commit the results to an image.
2. We can use a `Dockerfile` to specify instructions to create an image.
+To learn more, check out the [Dockerfile tutorial](/userguide/level1).
+
### Updating and committing an image
To update an image we first need to create a container from the image
@@ -468,11 +472,17 @@ We can then create a container from our new image.
root@8196968dac35:/#
> **Note:**
-> This is just the briefest introduction to creating images. We've
+> This is just a brief introduction to creating images. We've
> skipped a whole bunch of other instructions that you can use. We'll see more of
> those instructions in later sections of the Guide or you can refer to the
> [`Dockerfile`](/reference/builder/) reference for a
> detailed description and examples of every instruction.
+> To help you write a clear, readable, maintainable `Dockerfile`, we've also
+> written a [`Dockerfile` Best Practices guide](/articles/dockerfile_best-practices).
+
+### More
+
+To learn more, check out the [Dockerfile tutorial](/userguide/level1).
## Setting tags on an image
@@ -531,3 +541,4 @@ by linking together multiple Docker containers.
Go to [Linking Containers Together](/userguide/dockerlinks).
+
diff --git a/docs/sources/userguide/dockerizing.md b/docs/sources/userguide/dockerizing.md
index 02ac90306b..9da4890bfa 100644
--- a/docs/sources/userguide/dockerizing.md
+++ b/docs/sources/userguide/dockerizing.md
@@ -81,7 +81,7 @@ of the root directory which shows us what looks like a typical Linux
file system.
You can play around inside this container and when you're done you can
-use the `exit` command to finish.
+use the `exit` command or enter Ctrl-D to finish.
root@af8bae53bdd3:/# exit
diff --git a/docs/sources/userguide/dockerlinks.md b/docs/sources/userguide/dockerlinks.md
index 3624bf72c3..ce14bfa12a 100644
--- a/docs/sources/userguide/dockerlinks.md
+++ b/docs/sources/userguide/dockerlinks.md
@@ -26,8 +26,8 @@ container that ran a Python Flask application:
> information on Docker networking [here](/articles/networking/).
When that container was created, the `-P` flag was used to automatically map any
-network ports inside it to a random high port from the range 49000
-to 49900 on our Docker host. Next, when `docker ps` was run, you saw that
+network ports inside it to a random high port from the range 49153
+to 65535 on our Docker host. Next, when `docker ps` was run, you saw that
port 5000 in the container was bound to port 49155 on the host.
$ sudo docker ps nostalgic_morse
@@ -66,7 +66,7 @@ current port bindings. This is also useful for showing you specific port
configurations. For example, if you've bound the container port to the
`localhost` on the host machine, then the `docker port` output will reflect that.
- $ docker port nostalgic_morse 5000
+ $ sudo docker port nostalgic_morse 5000
127.0.0.1:49155
> **Note:**
@@ -137,7 +137,7 @@ image, which contains a PostgreSQL database.
Now, you need to delete the `web` container you created previously so you can replace it
with a linked one:
- $ docker rm -f web
+ $ sudo docker rm -f web
Now, create a new `web` container and link it with your `db` container.
@@ -151,12 +151,13 @@ earlier. The `--link` flag takes the form:
Where `name` is the name of the container we're linking to and `alias` is an
alias for the link name. You'll see how that alias gets used shortly.
-Next, look at your linked containers using `docker ps`.
+Next, look at the names of your linked containers by filtering the full output of
+`docker ps` to the last column (NAMES) using `docker ps --no-trunc | awk '{print $NF}'`.
- $ docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 349169744e49 training/postgres:latest su postgres -c '/usr About a minute ago Up About a minute 5432/tcp db, web/db
- aed84ee21bde training/webapp:latest python app.py 16 hours ago Up 2 minutes 0.0.0.0:49154->5000/tcp web
+ $ sudo docker ps --no-trunc | awk '{print $NF}'
+ NAMES
+ db, web/db
+ web
You can see your named containers, `db` and `web`, and you can see that the `db`
container also shows `web/db` in the `NAMES` column. This tells you that the
@@ -178,7 +179,45 @@ recipient container in two ways:
* Environment variables,
* Updating the `/etc/hosts` file.
-Docker can set a number of environment variables. You run the `env`
+### Environment Variables
+
+When two containers are linked, Docker will set some environment variables
+in the target container to enable programmatic discovery of information
+related to the source container.
+
+First, Docker will set an `_NAME` environment variable specifying the
+alias of each target container that was given in a `--link` parameter. So,
+for example, if a new container called `web` is being linked to a database
+container called `db` via `--link db:webdb` then in the `web` container
+would be `WEBDB_NAME=/web/webdb`.
+
+Docker will then also define a set of environment variables for each
+port that is exposed by the source container. The pattern followed is:
+
+* `_PORT__` will contain a URL reference to the
+port. Where `` is the alias name specified in the `--link` parameter
+(e.g. `webdb`), `` is the port number being exposed, and ``
+is either `TCP` or `UDP`. The format of the URL will be:
+`://:`
+(e.g. `tcp://172.17.0.82:8080`). This URL will then be
+split into the following 3 environment variables for convinience:
+* `_PORT___ADDR` will contain just the IP address
+from the URL (e.g. `WEBDB_PORT_8080_TCP_ADDR=172.17.0.82`).
+* `_PORT___PORT` will contain just the port number
+from the URL (e.g. `WEBDB_PORT_8080_TCP_PORT=8080`).
+* `_PORT___PROTO` will contain just the protocol
+from the URL (e.g. `WEBDB_PORT_8080_TCP_PROTO=tcp`).
+
+If there are multiple ports exposed then the above set of environment
+variables will be defined for each one.
+
+Finally, there will be an environment variable called `_PORT` that will
+contain the URL of the first exposed port of the source container.
+For example, `WEBDB_PORT=tcp://172.17.0.82:8080`. In this case, 'first'
+is defined as the lowest numbered port that is exposed. If that port is
+used for both tcp and udp, then the tcp one will be specified.
+
+Returning back to our database example, you can run the `env`
command to list the specified container's environment variables.
```
@@ -186,10 +225,10 @@ command to list the specified container's environment variables.
. . .
DB_NAME=/web2/db
DB_PORT=tcp://172.17.0.5:5432
- DB_PORT_5000_TCP=tcp://172.17.0.5:5432
- DB_PORT_5000_TCP_PROTO=tcp
- DB_PORT_5000_TCP_PORT=5432
- DB_PORT_5000_TCP_ADDR=172.17.0.5
+ DB_PORT_5432_TCP=tcp://172.17.0.5:5432
+ DB_PORT_5432_TCP_PROTO=tcp
+ DB_PORT_5432_TCP_PORT=5432
+ DB_PORT_5432_TCP_ADDR=172.17.0.5
. . .
```
@@ -206,6 +245,8 @@ environment variables to configure your applications to connect to the database
on the `db` container. The connection will be secure and private; only the
linked `web` container will be able to talk to the `db` container.
+### Updating the `/etc/hosts` file
+
In addition to the environment variables, Docker adds a host entry for the
source container to the `/etc/hosts` file. Here's an entry for the `web`
container:
@@ -241,6 +282,16 @@ to make use of your `db` container.
> example, you could have multiple (differently named) web containers attached to your
>`db` container.
+If you restart the source container, the linked containers `/etc/hosts` files
+will be automatically updated with the source container's new IP address,
+allowing linked communication to continue.
+
+ $ sudo docker restart db
+ root@aed84ee21bde:/opt/webapp# cat /etc/hosts
+ 172.17.0.7 aed84ee21bde
+ . . .
+ 172.17.0.9 db
+
# Next step
Now that you know how to link Docker containers together, the next step is
diff --git a/docs/sources/userguide/dockerrepos.md b/docs/sources/userguide/dockerrepos.md
index a73c4b7834..967ed0d8cf 100644
--- a/docs/sources/userguide/dockerrepos.md
+++ b/docs/sources/userguide/dockerrepos.md
@@ -67,6 +67,8 @@ Once you've found the image you want, you can download it with `docker pull Back
+
+# Dockerfile Tutorial
+
+## Test your Dockerfile knowledge - Level 1
+
+### Questions
+
+
+ What is the Dockerfile instruction to specify the base image ?
+
+
The right answer was FROM
+
+ What is the Dockerfile instruction to execute any commands on the current image and commit the results?
+
+
The right answer was RUN
+
+ What is the Dockerfile instruction to specify the maintainer of the Dockerfile?
+
+
The right answer was MAINTAINER
+
+ What is the character used to add comment in Dockerfiles?
+
+
The right answer was #
+
+
Congratulations, you made no mistake!
+ Tell the world Tweet
+ And try the next challenge: Fill the Dockerfile
+
+
Your Dockerfile skills are not yet perfect, try to take the time to read this tutorial again.
+
You're almost there! Read carefully the sections corresponding to your errors, and take the test again!
+
+
+
+
+### Fill the Dockerfile
+Your best friend Eric Bardin sent you a Dockerfile, but some parts were lost in the ocean. Can you find the missing parts?
+
+
+# This is a Dockerfile to create an image with Memcached and Emacs installed.
+# VERSION 1.0
+# use the ubuntu base image provided by dotCloud
+ ub
+ E B, eric.bardin@dotcloud.com
+# make sure the package repository is up to date
+ echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
+ apt-get update
+# install memcached
+RUN apt-get install -y
+# install emacs
+ apt-get install -y emacs23
+
+
+
+
Congratulations, you successfully restored Eric's Dockerfile! You are ready to containerize the world!.
+Tell the world! Tweet
+
+
Wooops, there are one or more errors in the Dockerfile. Try again.
+
+
+
+## What's next?
+
+
In the next level, we will go into more detail about how to specify which command should be executed when the container starts,
+which user to use, and how expose a particular port.
+
+Back
+Go to the next level
\ No newline at end of file
diff --git a/docs/sources/userguide/level2.md b/docs/sources/userguide/level2.md
new file mode 100644
index 0000000000..c4f2a2802c
--- /dev/null
+++ b/docs/sources/userguide/level2.md
@@ -0,0 +1,97 @@
+page_title: Docker Images Test
+page_description: How to work with Docker images.
+page_keywords: documentation, docs, the docker guide, docker guide, docker, docker platform, virtualization framework, docker.io, Docker images, Docker image, image management, Docker repos, Docker repositories, docker, docker tag, docker tags, Docker Hub, collaboration
+
+Back
+
+#Dockerfile Tutorial
+
+## Test your Dockerfile knowledge - Level 2
+
+### Questions:
+
+
+What is the Dockerfile instruction to specify the base image?
+
+
The right answer was FROM
+ Which Dockerfile instruction sets the default command for your image?
+
+
The right answer was ENTRYPOINT or CMD
+ What is the character used to add comments in Dockerfiles?
+
+
The right answer was #
+ Which Dockerfile instruction sets the username to use when running the image?
+
+
The right answer was USER
+ What is the Dockerfile instruction to execute any command on the current image and commit the results?
+
+
The right answer was RUN
+ Which Dockerfile instruction sets ports to be exposed when running the image?
+
+
The right answer was EXPOSE
+ What is the Dockerfile instruction to specify the maintainer of the Dockerfile?
+
+
The right answer was MAINTAINER
+ Which Dockerfile instruction lets you trigger a command as soon as the container starts?
+
+
The right answer was ENTRYPOINT or CMD
+
+
+
Congratulations, you made no mistake!
+ Tell the world Tweet
+ And try the next challenge: Fill the Dockerfile
+
+
Your Dockerfile skills are not yet perfect, try to take the time to read this tutorial again.
+
You're almost there! Read carefully the sections corresponding to your errors, and take the test again!
+
+
+
+
+### Fill the Dockerfile
+
+Your best friend Roberto Hashioka sent you a Dockerfile, but some parts were lost in the ocean. Can you find the missing parts?
+
+
+# Redis
+#
+# VERSION 0.42
+#
+# use the ubuntu base image provided by dotCloud
+ ub
+MAINT Ro Ha roberto.hashioka@dotcloud.com
+# make sure the package repository is up to date
+ echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
+ apt-get update
+# install wget (required for redis installation)
+ apt-get install -y wget
+# install make (required for redis installation)
+ apt-get install -y make
+# install gcc (required for redis installation)
+RUN apt-get install -y
+# install apache2
+ wget http://download.redis.io/redis-stable.tar.gz
+tar xvzf redis-stable.tar.gz
+cd redis-stable && make && make install
+# launch redis when starting the image
+ ["redis-server"]
+# run as user dameon
+ daemon
+# expose port 6379
+ 6379
+
+
Congratulations, you successfully restored Roberto's Dockerfile! You are ready to containerize the world!.
+ Tell the world! Tweet
+
+
Wooops, there are one or more errors in the Dockerfile. Try again.
+
+
+
+
+## What's next?
+
+Thanks for going through our tutorial! We will be posting Level 3 shortly. Follow us on twitter
+Follow @docker
+
+
+
In the meantime, check out this blog post by Michael Crosby that describes Dockerfile Best Practices.
+Back to the Docs!
\ No newline at end of file
diff --git a/docs/sources/userguide/login-web.png b/docs/sources/userguide/login-web.png
index e9d26b5e80..353705ba5e 100644
Binary files a/docs/sources/userguide/login-web.png and b/docs/sources/userguide/login-web.png differ
diff --git a/docs/sources/userguide/register-web.png b/docs/sources/userguide/register-web.png
index 6c549f8fd3..709badc6d5 100644
Binary files a/docs/sources/userguide/register-web.png and b/docs/sources/userguide/register-web.png differ
diff --git a/docs/sources/userguide/search.png b/docs/sources/userguide/search.png
index ded0d0d2d3..187b8d9ed8 100644
Binary files a/docs/sources/userguide/search.png and b/docs/sources/userguide/search.png differ
diff --git a/docs/sources/userguide/usingdocker.md b/docs/sources/userguide/usingdocker.md
index a882a79c7d..e64db0bc2e 100644
--- a/docs/sources/userguide/usingdocker.md
+++ b/docs/sources/userguide/usingdocker.md
@@ -27,7 +27,7 @@ flags and arguments.
# Usage: [sudo] docker [flags] [command] [arguments] ..
# Example:
- $ docker run -i -t ubuntu /bin/bash
+ $ sudo docker run -i -t ubuntu /bin/bash
Let's see this in action by using the `docker version` command to return
version information on the currently installed Docker client and daemon.
@@ -114,8 +114,7 @@ We've specified an image: `training/webapp`. This image is a
pre-built image we've created that contains a simple Python Flask web
application.
-Lastly, we've specified a command for our container to run: `python
-app.py`. This launches our web application.
+Lastly, we've specified a command for our container to run: `python app.py`. This launches our web application.
> **Note:**
> You can see more detail on the `docker run` command in the [command
@@ -156,9 +155,9 @@ In this case Docker has exposed port 5000 (the default Python Flask
port) on port 49155.
Network port bindings are very configurable in Docker. In our last
-example the `-P` flag is a shortcut for `-p 5000` that makes port 5000
-inside the container to a high port (from the range 49000 to 49900) on
-the local Docker host. We can also bind Docker container's to specific
+example the `-P` flag is a shortcut for `-p 5000` that maps port 5000
+inside the container to a high port (from the range 49153 to 65535) on
+the local Docker host. We can also bind Docker containers to specific
ports using the `-p` flag, for example:
$ sudo docker run -d -p 5000:5000 training/webapp python app.py
diff --git a/docs/sources/userguide/webapp1.png b/docs/sources/userguide/webapp1.png
index 5653497f17..b92cc87d65 100644
Binary files a/docs/sources/userguide/webapp1.png and b/docs/sources/userguide/webapp1.png differ
diff --git a/docs/theme/mkdocs/autoindex.html b/docs/theme/mkdocs/autoindex.html
index cc4a41ec94..df1cc3eb09 100644
--- a/docs/theme/mkdocs/autoindex.html
+++ b/docs/theme/mkdocs/autoindex.html
@@ -1,3 +1,6 @@
+no_edit: true
+auto_scroll_to_path: true
+
# Table of Contents
{% for nav_item in nav %}
diff --git a/docs/theme/mkdocs/base.html b/docs/theme/mkdocs/base.html
index 2f518b5d59..4f669677b0 100644
--- a/docs/theme/mkdocs/base.html
+++ b/docs/theme/mkdocs/base.html
@@ -16,9 +16,10 @@
{% if canonical_url %}{% endif %}
-
+
+
{% if page_title != '**HIDDEN** - '+site_name %}{{ page_title }}{% else %}{{ site_name }}{% endif %}
@@ -47,29 +48,8 @@
- {% include "breadcrumbs.html" %}
-
- {% include "version.html" %}
- {{ content }}
-
-
-
-
-
+{# need to find an unobtrusive way to add this back
{% include "prev_next.html" %}
#}
{% include "footer.html" %}
-
+
+
+
+
@@ -134,16 +121,34 @@ piCId = '1482';