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