github.com/vincentwoo/docker@v0.7.3-0.20160116130405-82401a4b13c0/docs/installation/debian.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Installation on Debian"
     4  description = "Instructions for installing Docker on Debian."
     5  keywords = ["Docker, Docker documentation, installation,  debian"]
     6  [menu.main]
     7  parent = "smn_linux"
     8  weight=-2
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Debian
    13  
    14  Docker is supported on the following versions of Debian:
    15  
    16   - [*Debian testing stretch (64-bit)*](#debian-wheezy-stable-7-x-64-bit)
    17   - [*Debian 8.0 Jessie (64-bit)*](#debian-jessie-80-64-bit)
    18   - [*Debian 7.7 Wheezy (64-bit)*](#debian-wheezy-stable-7-x-64-bit)
    19  
    20   >**Note**: If you previously installed Docker using `APT`, make sure you update
    21   your `APT` sources to the new `APT` repository.
    22  
    23  ## Prerequisites
    24  
    25   Docker requires a 64-bit installation regardless of your Debian version.
    26   Additionally, your kernel must be 3.10 at minimum. The latest 3.10 minor
    27   version or a newer maintained version are also acceptable.
    28  
    29   Kernels older than 3.10 lack some of the features required to run Docker
    30   containers. These older versions are known to have bugs which cause data loss
    31   and frequently panic under certain conditions.
    32  
    33   To check your current kernel version, open a terminal and use `uname -r` to
    34   display your kernel version:
    35  
    36       $ uname -r
    37  
    38  ### Update your apt repository
    39  
    40  Docker's `APT` repository contains Docker 1.7.1 and higher. To set `APT` to use
    41  from the new repository:
    42  
    43   1. If you haven't already done so, log into your machine as a user with `sudo` or `root` privileges.
    44  
    45   2. Open a terminal window.
    46  
    47   3. Purge any older repositories.
    48  
    49           $ apt-get purge lxc-docker*
    50           $ apt-get purge docker.io*
    51  
    52   4. Update package information, ensure that APT works with the `https` method, and that CA certificates are installed.
    53  
    54           $ apt-get update
    55           $ apt-get install apt-transport-https ca-certificates
    56  
    57   5. Add the new `GPG` key.
    58  
    59           $ apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    60  
    61   6. Open the `/etc/apt/sources.list.d/docker.list` file in your favorite editor.
    62  
    63       If the file doesn't exist, create it.
    64  
    65   7. Remove any existing entries.
    66  
    67   8. Add an entry for your Debian operating system.
    68  
    69       The possible entries are:
    70  
    71      - On Debian Wheezy
    72  
    73              deb https://apt.dockerproject.org/repo debian-wheezy main
    74  
    75      - On Debian Jessie
    76  
    77              deb https://apt.dockerproject.org/repo debian-jessie main
    78  
    79      - On Debian Stretch/Sid
    80  
    81              deb https://apt.dockerproject.org/repo debian-stretch main
    82  
    83      > **Note**: Docker does not provide packages for all architectures. To install docker on
    84      > a multi-architecture system, add an `[arch=...]` clause to the entry. Refer to the
    85      > [Debian Multiarch wiki](https://wiki.debian.org/Multiarch/HOWTO#Setting_up_apt_sources)
    86      > for details.
    87  
    88   9. Save and close the file.
    89  
    90   10. Update the `APT` package index.
    91  
    92           $ apt-get update
    93  
    94   11. Verify that `APT` is pulling from the right repository.
    95  
    96           $ apt-cache policy docker-engine
    97  
    98       From now on when you run `apt-get upgrade`, `APT` pulls from the new apt repository.
    99  
   100  ## Install Docker
   101  
   102  Before installing Docker, make sure you have set your `APT` repository correctly as described in the prerequisites.
   103  
   104  1. Update the `APT` package index.
   105  
   106          $ sudo apt-get update
   107  
   108  2. Install Docker.
   109  
   110          $ sudo apt-get install docker-engine
   111  
   112  5. Start the `docker` daemon.
   113  
   114          $ sudo service docker start
   115  
   116  6. Verify `docker` is installed correctly.
   117  
   118          $ sudo docker run hello-world
   119  
   120      This command downloads a test image and runs it in a container. When the
   121      container runs, it prints an informational message. Then, it exits.
   122  
   123  
   124  ## Giving non-root access
   125  
   126  The `docker` daemon always runs as the `root` user and the `docker`
   127  daemon binds to a Unix socket instead of a TCP port. By default that
   128  Unix socket is owned by the user `root`, and so, by default, you can
   129  access it with `sudo`.
   130  
   131  If you (or your Docker installer) create a Unix group called `docker`
   132  and add users to it, then the `docker` daemon will make the ownership of
   133  the Unix socket read/writable by the `docker` group when the daemon
   134  starts. The `docker` daemon must always run as the root user, but if you
   135  run the `docker` client as a user in the `docker` group then you don't
   136  need to add `sudo` to all the client commands. From Docker 0.9.0 you can
   137  use the `-G` flag to specify an alternative group.
   138  
   139  > **Warning**:
   140  > The `docker` group (or the group specified with the `-G` flag) is
   141  > `root`-equivalent; see [*Docker Daemon Attack Surface*](../security/security.md#docker-daemon-attack-surface) details.
   142  
   143  **Example:**
   144  
   145      # Add the docker group if it doesn't already exist.
   146      $ sudo groupadd docker
   147  
   148      # Add the connected user "${USER}" to the docker group.
   149      # Change the user name to match your preferred user.
   150      # You may have to logout and log back in again for
   151      # this to take effect.
   152      $ sudo gpasswd -a ${USER} docker
   153  
   154      # Restart the Docker daemon.
   155      $ sudo service docker restart
   156  
   157  ## Upgrade Docker
   158  
   159  To install the latest version of Docker with `apt-get`:
   160  
   161      $ apt-get upgrade docker-engine
   162  
   163  ## Uninstall
   164  
   165  To uninstall the Docker package:
   166  
   167      $ sudo apt-get purge docker-engine
   168  
   169  To uninstall the Docker package and dependencies that are no longer needed:
   170  
   171      $ sudo apt-get autoremove --purge docker-engine
   172  
   173  The above commands will not remove images, containers, volumes, or user created
   174  configuration files on your host. If you wish to delete all images, containers,
   175  and volumes run the following command:
   176  
   177      $ rm -rf /var/lib/docker
   178  
   179  You must delete the user created configuration files manually.
   180  
   181  ## What next?
   182  
   183  Continue with the [User Guide](../userguide/index.md).