github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/installation/linux/fedora.md (about)

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