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