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