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