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