github.com/circular-dark/docker@v1.7.0/docs/installation/centos.md (about) 1 <!--[metadata]> 2 +++ 3 title = "Installation on CentOS" 4 description = "Instructions for installing Docker on CentOS" 5 keywords = ["Docker, Docker documentation, requirements, linux, centos, epel, docker.io, docker-io"] 6 [menu.main] 7 parent = "smn_linux" 8 +++ 9 <![end-metadata]--> 10 11 # CentOS 12 13 Docker is supported on the following versions of CentOS: 14 15 * CentOS 7.X 16 * CentOS 6.5 or higher 17 18 Installation on other binary compatible EL6/EL7 distributions such as Scientific 19 Linux might succeed, but Docker does not test or support Docker on these 20 distributions. 21 22 This page instructs you to install using Docker-managed release packages and 23 installation mechanisms. Using these packages ensures you get the latest release 24 of Docker. If you wish to install using CentOS-managed packages, consult your 25 CentOS documentation. 26 27 ## Prerequisites 28 29 Docker requires a 64-bit installation regardless of your CentOS version. Also, 30 your kernel must be 3.10 at minimum. CentOS 7 runs the 3.10 kernel, 6.5 does 31 not. We make an exception for CentOS 6.5. To run Docker on 32 [CentOS-6.5](https://www.centos.org) or later, you need kernel 2.6.32-431 or 33 higher. 34 35 To check your current kernel version, open a terminal and use `uname -r` to 36 display your kernel version: 37 38 $ uname -r 39 2.6.32-431.el6.x86_64 40 41 Finally, is it recommended that you fully update your system. Please keep in 42 mind that CentOS 6 should be fully patched to fix any potential kernel bugs. Any 43 reported kernel bugs may have already been fixed on the latest kernel packages 44 45 ## Install 46 47 You use the same installation procedure for all versions of CentOS, 48 only the package you install differs. There are two packages to choose from: 49 50 <table> 51 <tr> 52 <th>Version</th> 53 <th>Package name</th> 54 </tr> 55 <tr> 56 <td>6.5 and higher</td> 57 <td> 58 <p> 59 <a href="https://get.docker.com/rpm/1.7.0/centos-6/RPMS/x86_64/docker-engine-1.7.0-1.el6.x86_64.rpm"> 60 https://get.docker.com/rpm/1.7.0/centos-6/RPMS/x86_64/docker-engine-1.7.0-1.el6.x86_64.rpm</a> 61 <p> 62 <a href="https://get.docker.com/rpm/1.7.0/centos-6/SRPMS/docker-engine-1.7.0-1.el6.src.rpm"> 63 https://get.docker.com/rpm/1.7.0/centos-6/SRPMS/docker-engine-1.7.0-1.el6.src.rpm</a> 64 <p> 65 </p> 66 </td> 67 </tr> 68 <tr> 69 <td>7.X</td> 70 <td> 71 <p> 72 <a href="https://get.docker.com/rpm/1.7.0/centos-7/RPMS/x86_64/docker-engine-1.7.0-1.el7.centos.x86_64.rpm"> 73 https://get.docker.com/rpm/1.7.0/centos-7/RPMS/x86_64/docker-engine-1.7.0-1.el7.centos.x86_64.rpm</a> 74 </p> 75 <p> 76 <a href="https://get.docker.com/rpm/1.7.0/centos-7/SRPMS/docker-engine-1.7.0-1.el7.centos.src.rpm"> 77 https://get.docker.com/rpm/1.7.0/centos-7/SRPMS/docker-engine-1.7.0-1.el7.centos.src.rpm</a> 78 </p> 79 </td> 80 </tr> 81 </table> 82 83 84 This procedure depicts an installation on version 6.5. If you are installing on 85 7.X, substitute that package for your installation. 86 87 1. Log into your machine as a user with `sudo` or `root` privileges. 88 89 2. Make sure your existing packages are up-to-date. 90 91 $ sudo yum update 92 93 3. Download the Docker RPM to the current directory. 94 95 $ curl -O -sSL https://get.docker.com/rpm/1.7.0/centos-6/RPMS/x86_64/docker-engine-1.7.0-1.el6.x86_64.rpm 96 97 4. Use `yum` to install the package. 98 99 $ sudo yum localinstall --nogpgcheck docker-engine-1.7.0-1.el6.x86_64.rpm 100 101 5. Start the Docker daemon. 102 103 $ sudo service docker start 104 105 6. Verify `docker` is installed correctly by running a test image in a container. 106 107 $ sudo docker run hello-world 108 Unable to find image 'hello-world:latest' locally 109 latest: Pulling from hello-world 110 a8219747be10: Pull complete 111 91c95931e552: Already exists 112 hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. 113 Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.0cf5daeb82aab55838d 114 Status: Downloaded newer image for hello-world:latest 115 Hello from Docker. 116 This message shows that your installation appears to be working correctly. 117 118 To generate this message, Docker took the following steps: 119 1. The Docker client contacted the Docker daemon. 120 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 121 (Assuming it was not already locally available.) 122 3. The Docker daemon created a new container from that image which runs the 123 executable that produces the output you are currently reading. 124 4. The Docker daemon streamed that output to the Docker client, which sent it 125 to your terminal. 126 127 To try something more ambitious, you can run an Ubuntu container with: 128 $ docker run -it ubuntu bash 129 130 For more examples and ideas, visit: 131 http://docs.docker.com/userguide/ 132 133 ## Create a docker group 134 135 The `docker` daemon binds to a Unix socket instead of a TCP port. By default 136 that Unix socket is owned by the user `root` and other users can access it with 137 `sudo`. For this reason, `docker` daemon always runs as the `root` user. 138 139 To avoid having to use `sudo` when you use the `docker` command, create a Unix 140 group called `docker` and add users to it. When the `docker` daemon starts, it 141 makes the ownership of the Unix socket read/writable by the `docker` group. 142 143 >**Warning**: The `docker` group is equivalent to the `root` user; For details 144 >on how this impacts security in your system, see [*Docker Daemon Attack 145 >Surface*](/articles/security/#docker-daemon-attack-surface) for details. 146 147 To create the `docker` group and add your user: 148 149 1. Log into Centos as a user with `sudo` privileges. 150 151 2. Create the `docker` group and add your user. 152 153 `sudo usermod -aG docker your_username` 154 155 3. Log out and log back in. 156 157 This ensures your user is running with the correct permissions. 158 159 4. Verify your work by running `docker` without `sudo`. 160 161 $ docker run hello-world 162 163 ## Start the docker daemon at boot 164 165 To ensure Docker starts when you boot your system, do the following: 166 167 $ sudo chkconfig docker on 168 169 If you need to add an HTTP Proxy, set a different directory or partition for the 170 Docker runtime files, or make other customizations, read our Systemd article to 171 learn how to [customize your Systemd Docker daemon options](/articles/systemd/). 172 173 174 ## Uninstall 175 176 You can uninstall the Docker software with `yum`. 177 178 1. List the package you have installed. 179 180 $ yum list installed | grep docker 181 yum list installed | grep docker 182 docker-engine.x86_64 1.7.0-1.el6 183 @/docker-engine-1.7.0-1.el6.x86_64.rpm 184 185 2. Remove the package. 186 187 $ sudo yum -y remove docker-engine.x86_64 188 189 This command does not remove images, containers, volumes, or user-created 190 configuration files on your host. 191 192 3. To delete all images, containers, and volumes, run the following command: 193 194 $ rm -rf /var/lib/docker 195 196 4. Locate and delete any user-created configuration files.