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