github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/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. Add the new `gpg` key.
    53  
    54           $ apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    55  
    56   5. Open the `/etc/apt/sources.list.d/docker.list` file in your favorite editor.
    57  
    58       If the file doesn't exist, create it.
    59  
    60   6. Remove any existing entries.
    61  
    62   7. Add an entry for your Debian operating system.
    63  
    64       The possible entries are:
    65  
    66      - On Debian Wheezy
    67  
    68              deb https://apt.dockerproject.org/repo debian-wheezy main
    69  
    70      - On Debian Jessie
    71  
    72              deb https://apt.dockerproject.org/repo debian-jessie main
    73  
    74      - On Debian Stretch/Sid
    75  
    76              deb https://apt.dockerproject.org/repo debian-stretch main
    77  
    78      > **Note**: Docker does not provide packages for all architectures. To install docker on
    79      > a multi-architecture system, add an `[arch=...]` clause to the entry. Refer to the
    80      > [Debian Multiarch wiki](https://wiki.debian.org/Multiarch/HOWTO#Setting_up_apt_sources)
    81      > for details.
    82  
    83   8. Save and close the file.
    84  
    85   9. Update the `apt` package index.
    86  
    87           $ apt-get update
    88  
    89   10. Verify that `apt` is pulling from the right repository.
    90  
    91           $ apt-cache policy docker-engine
    92  
    93       From now on when you run `apt-get upgrade`, `apt` pulls from the new apt repository.  
    94  
    95  ## Install Docker
    96  
    97  Before installing Docker, make sure you have set your `apt` repository correctly as described in the prerequisites.
    98  
    99  1. Update the `apt` package index.
   100  
   101          $ sudo apt-get update
   102  
   103  2. Install Docker.
   104  
   105          $ sudo apt-get install docker-engine
   106  
   107  5. Start the `docker` daemon.
   108  
   109          $ sudo service docker start
   110  
   111  6. Verify `docker` is installed correctly.
   112  
   113          $ sudo docker run hello-world
   114  
   115      This command downloads a test image and runs it in a container. When the
   116      container runs, it prints an informational message. Then, it exits.
   117  
   118  
   119  ## Giving non-root access
   120  
   121  The `docker` daemon always runs as the `root` user and the `docker`
   122  daemon binds to a Unix socket instead of a TCP port. By default that
   123  Unix socket is owned by the user `root`, and so, by default, you can
   124  access it with `sudo`.
   125  
   126  If you (or your Docker installer) create a Unix group called `docker`
   127  and add users to it, then the `docker` daemon will make the ownership of
   128  the Unix socket read/writable by the `docker` group when the daemon
   129  starts. The `docker` daemon must always run as the root user, but if you
   130  run the `docker` client as a user in the `docker` group then you don't
   131  need to add `sudo` to all the client commands. From Docker 0.9.0 you can
   132  use the `-G` flag to specify an alternative group.
   133  
   134  > **Warning**:
   135  > The `docker` group (or the group specified with the `-G` flag) is
   136  > `root`-equivalent; see [*Docker Daemon Attack Surface*](../articles/security.md#docker-daemon-attack-surface) details.
   137  
   138  **Example:**
   139  
   140      # Add the docker group if it doesn't already exist.
   141      $ sudo groupadd docker
   142  
   143      # Add the connected user "${USER}" to the docker group.
   144      # Change the user name to match your preferred user.
   145      # You may have to logout and log back in again for
   146      # this to take effect.
   147      $ sudo gpasswd -a ${USER} docker
   148  
   149      # Restart the Docker daemon.
   150      $ sudo service docker restart
   151  
   152  ## Upgrade Docker
   153  
   154  To install the latest version of Docker with `apt-get`:
   155  
   156      $ apt-get upgrade docker-engine
   157  
   158  ## Uninstall
   159  
   160  To uninstall the Docker package:
   161  
   162      $ sudo apt-get purge docker-engine
   163  
   164  To uninstall the Docker package and dependencies that are no longer needed:
   165  
   166      $ sudo apt-get autoremove --purge docker-engine
   167  
   168  The above commands will not remove images, containers, volumes, or user created
   169  configuration files on your host. If you wish to delete all images, containers,
   170  and volumes run the following command:
   171  
   172      $ rm -rf /var/lib/docker
   173  
   174  You must delete the user created configuration files manually.
   175  
   176  ## What next?
   177  
   178  Continue with the [User Guide](../userguide/index.md).