github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/installation/linux/rhel.md (about) 1 <!--[metadata]> 2 +++ 3 aliases = [ "/engine/installation/rhel/"] 4 title = "Installation on Red Hat Enterprise Linux" 5 description = "Instructions for installing Docker on Red Hat Enterprise Linux." 6 keywords = ["Docker, Docker documentation, requirements, linux, rhel"] 7 [menu.main] 8 parent = "engine_linux" 9 weight = -5 10 +++ 11 <![end-metadata]--> 12 13 # Red Hat Enterprise Linux 14 15 Docker is supported on Red Hat Enterprise Linux 7. These instructions install 16 Docker using release packages and installation mechanisms managed by Docker, 17 to be sure that you get the latest version of Docker. If you wish to install 18 using Red Hat-managed packages, consult your Red Hat release documentation. 19 20 ## Prerequisites 21 22 Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. 23 24 To check your current kernel version, open a terminal and use `uname -r` to 25 display your kernel version: 26 27 ```bash 28 $ uname -r 29 3.10.0-229.el7.x86_64 30 ``` 31 32 Finally, it is recommended that you fully update your system. Keep in mind 33 that your system should be fully patched to fix any potential kernel bugs. 34 Any reported kernel bugs may have already been fixed on the latest kernel 35 packages. 36 37 ## Install Docker Engine 38 39 There are two ways to install Docker Engine. You can [install using the `yum` 40 package manager](#install-with-yum). Or you can use `curl` with the [`get.docker.com` 41 site](#install-with-the-script). This second method runs an installation script 42 which also installs via the `yum` package manager. 43 44 ### Install with yum 45 46 1. Log into your machine as a user with `sudo` or `root` privileges. 47 48 2. Make sure your existing packages are up-to-date. 49 50 ```bash 51 $ sudo yum update 52 ``` 53 54 3. Add the `yum` repo. 55 56 ```bash 57 $ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' 58 [dockerrepo] 59 name=Docker Repository 60 baseurl=https://yum.dockerproject.org/repo/main/centos/7/ 61 enabled=1 62 gpgcheck=1 63 gpgkey=https://yum.dockerproject.org/gpg 64 EOF 65 ``` 66 67 4. Install the Docker package. 68 69 ```bash 70 $ sudo yum install docker-engine 71 ``` 72 73 5. Enable the service. 74 75 ```bash 76 $ sudo systemctl enable docker.service 77 ``` 78 79 6. Start the Docker daemon. 80 81 ```bash 82 $ sudo systemctl start docker 83 ``` 84 85 7. Verify `docker` is installed correctly by running a test image in a container. 86 87 $ sudo docker run --rm hello-world 88 89 Unable to find image 'hello-world:latest' locally 90 latest: Pulling from library/hello-world 91 c04b14da8d14: Pull complete 92 Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 93 Status: Downloaded newer image for hello-world:latest 94 95 Hello from Docker! 96 This message shows that your installation appears to be working correctly. 97 98 To generate this message, Docker took the following steps: 99 1. The Docker client contacted the Docker daemon. 100 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 101 3. The Docker daemon created a new container from that image which runs the 102 executable that produces the output you are currently reading. 103 4. The Docker daemon streamed that output to the Docker client, which sent it 104 to your terminal. 105 106 To try something more ambitious, you can run an Ubuntu container with: 107 $ docker run -it ubuntu bash 108 109 Share images, automate workflows, and more with a free Docker Hub account: 110 https://hub.docker.com 111 112 For more examples and ideas, visit: 113 https://docs.docker.com/engine/userguide/ 114 115 If you need to add an HTTP Proxy, set a different directory or partition for the 116 Docker runtime files, or make other customizations, read our Systemd article to 117 learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). 118 119 ### Install with the script 120 121 1. Log into your machine as a user with `sudo` or `root` privileges. 122 123 2. Make sure your existing packages are up-to-date. 124 125 ```bash 126 $ sudo yum update 127 ``` 128 129 3. Run the Docker installation script. 130 131 ```bash 132 $ curl -fsSL https://get.docker.com/ | sh 133 ``` 134 135 This script adds the `docker.repo` repository and installs Docker. 136 137 4. Enable the service. 138 139 ```bash 140 $ sudo systemctl enable docker.service 141 ``` 142 143 5. Start the Docker daemon. 144 145 ```bash 146 $ sudo systemctl start docker 147 ``` 148 149 6. Verify `docker` is installed correctly by running a test image in a container. 150 151 ```bash 152 $ sudo docker run hello-world 153 ``` 154 155 If you need to add an HTTP Proxy, set a different directory or partition for the 156 Docker runtime files, or make other customizations, read our Systemd article to 157 learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md). 158 159 ## Create a docker group 160 161 The `docker` daemon binds to a Unix socket instead of a TCP port. By default 162 that Unix socket is owned by the user `root` and other users can access it with 163 `sudo`. For this reason, `docker` daemon always runs as the `root` user. 164 165 To avoid having to use `sudo` when you use the `docker` command, create a Unix 166 group called `docker` and add users to it. When the `docker` daemon starts, it 167 makes the ownership of the Unix socket read/writable by the `docker` group. 168 169 >**Warning**: The `docker` group is equivalent to the `root` user; For details 170 >on how this impacts security in your system, see [*Docker Daemon Attack 171 >Surface*](../../security/security.md#docker-daemon-attack-surface) for details. 172 173 To create the `docker` group and add your user: 174 175 1. Log into your machine as a user with `sudo` or `root` privileges. 176 177 2. Create the `docker` group. 178 179 ```bash 180 $ sudo groupadd docker 181 ``` 182 183 3. Add your user to `docker` group. 184 185 ```bash 186 $ sudo usermod -aG docker your_username` 187 ``` 188 189 4. Log out and log back in. 190 191 This ensures your user is running with the correct permissions. 192 193 5. Verify that your user is in the docker group by running `docker` without `sudo`. 194 195 ```bash 196 $ docker run hello-world 197 ``` 198 199 ## Start the docker daemon at boot 200 201 Configure the Docker daemon to start automatically when the host starts: 202 203 ```bash 204 $ sudo systemctl enable docker 205 ``` 206 207 ## Uninstall 208 209 You can uninstall the Docker software with `yum`. 210 211 1. List the installed Docker packages. 212 213 ```bash 214 $ yum list installed | grep docker 215 216 docker-engine.x86_64 1.7.1-0.1.el7@/docker-engine-1.7.1-0.1.el7.x86_64 217 ``` 218 219 2. Remove the package. 220 221 ```bash 222 $ sudo yum -y remove docker-engine.x86_64 223 ``` 224 225 This command does not remove images, containers, volumes, or user-created 226 configuration files on your host. 227 228 3. To delete all images, containers, and volumes, run the following command: 229 230 ```bash 231 $ rm -rf /var/lib/docker 232 ``` 233 234 4. Locate and delete any user-created configuration files.