github.com/nf/docker@v1.8.1/docs/installation/rhel.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Installation on Red Hat Enterprise Linux"
     4  description = "Instructions for installing Docker on Red Hat Enterprise Linux."
     5  keywords = ["Docker, Docker documentation, requirements, linux,  rhel"]
     6  [menu.main]
     7  parent = "smn_linux"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Red Hat Enterprise Linux
    12  
    13  Docker is supported on the following versions of RHEL:
    14  
    15  - Red Hat Enterprise Linux 7
    16  
    17  This page instructs you to install using Docker-managed release packages and
    18  installation mechanisms. Using these packages ensures you get the latest release
    19  of Docker. If you wish to install using Red Hat-managed packages, consult your
    20  Red Hat release documentation for information on Red Hat's Docker support.
    21  
    22  ## Prerequisites
    23  
    24  Docker requires a 64-bit installation regardless of your Red Hat version. Docker
    25  requires that your kernel must be 3.10 at minimum, which Red Hat 7 runs.
    26  
    27  To check your current kernel version, open a terminal and use `uname -r` to
    28  display your kernel version:
    29  
    30      $ uname -r 
    31      3.10.0-229.el7.x86_64
    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.
    35  Any reported kernel bugs may have already been fixed on the latest kernel
    36  packages.
    37  
    38  ## Install Docker Engine
    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  You use the same installation procedure for all versions of CentOS.
    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  4. Start the Docker daemon.
    57  
    58  		$ sudo service docker start
    59  
    60  5. Verify `docker` is installed correctly by running a test image in a container.
    61  
    62  		$ sudo docker run hello-world
    63  		Unable to find image 'hello-world:latest' locally
    64  		latest: Pulling from hello-world
    65  		a8219747be10: Pull complete 
    66  		91c95931e552: Already exists 
    67  		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.
    68  		Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d
    69  		Status: Downloaded newer image for hello-world:latest
    70  		Hello from Docker.
    71  		This message shows that your installation appears to be working correctly.
    72  
    73  		To generate this message, Docker took the following steps:
    74  		 1. The Docker client contacted the Docker daemon.
    75  		 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    76  				(Assuming it was not already locally available.)
    77  		 3. The Docker daemon created a new container from that image which runs the
    78  				executable that produces the output you are currently reading.
    79  		 4. The Docker daemon streamed that output to the Docker client, which sent it
    80  				to your terminal.
    81  
    82  		To try something more ambitious, you can run an Ubuntu container with:
    83  		 $ docker run -it ubuntu bash
    84  
    85  		For more examples and ideas, visit:
    86  		 http://docs.docker.com/userguide/
    87  		 
    88  ### Install without the script
    89  
    90  1. Log into your machine as a user with `sudo` or `root` privileges.
    91  
    92  2. Make sure your existing yum packages are up-to-date.
    93  
    94  		$ sudo yum update
    95      
    96  3. Add the yum repo yourself.
    97  
    98      For RHEL 7 run:
    99  
   100  		$ cat >/etc/yum.repos.d/docker.repo <<-EOF
   101          [dockerrepo]
   102          name=Docker Repository
   103          baseurl=https://yum.dockerproject.org/repo/main/centos/7
   104          enabled=1
   105          gpgcheck=1
   106          gpgkey=https://yum.dockerproject.org/gpg
   107          EOF
   108  
   109  4. Install the Docker package.
   110  
   111          $ sudo yum install docker-engine
   112          
   113  5. Start the Docker daemon.
   114  
   115  		$ sudo service docker start
   116  
   117  6. Verify `docker` is installed correctly by running a test image in a container.
   118  
   119  		$ sudo docker run hello-world
   120   
   121  ## Create a docker group		
   122  
   123  The `docker` daemon binds to a Unix socket instead of a TCP port. By default
   124  that Unix socket is owned by the user `root` and other users can access it with
   125  `sudo`. For this reason, `docker` daemon always runs as the `root` user.
   126  
   127  To avoid having to use `sudo` when you use the `docker` command, create a Unix
   128  group called `docker` and add users to it. When the `docker` daemon starts, it
   129  makes the ownership of the Unix socket read/writable by the `docker` group.
   130  
   131  >**Warning**: The `docker` group is equivalent to the `root` user; For details
   132  >on how this impacts security in your system, see [*Docker Daemon Attack
   133  >Surface*](/articles/security/#docker-daemon-attack-surface) for details.
   134  
   135  To create the `docker` group and add your user:
   136  
   137  1. Log into your machine as a user with `sudo` or `root` privileges.
   138  
   139  2. Create the `docker` group and add your user.
   140  
   141      `sudo usermod -aG docker your_username`
   142  
   143  3. Log out and log back in.
   144  
   145      This ensures your user is running with the correct permissions.
   146  
   147  4. Verify your work by running `docker` without `sudo`.
   148  
   149  			$ docker run hello-world
   150   
   151  ## Start the docker daemon at boot
   152  
   153  To ensure Docker starts when you boot your system, do the following:
   154  
   155      $ sudo chkconfig docker on
   156  
   157  If you need to add an HTTP Proxy, set a different directory or partition for the
   158  Docker runtime files, or make other customizations, read our Systemd article to
   159  learn how to [customize your Systemd Docker daemon options](/articles/systemd/).
   160  
   161  
   162  ## Uninstall
   163  
   164  You can uninstall the Docker software with `yum`.  
   165  
   166  1. List the package you have installed.
   167  
   168  		$ yum list installed | grep docker
   169  		yum list installed | grep docker
   170  		docker-engine.x86_64                1.7.1-0.1.el7
   171  																																					 @/docker-engine-1.7.1-0.1.el7.x86_64
   172  
   173  2. Remove the package.
   174  
   175  		$ sudo yum -y remove docker-engine.x86_64 
   176  
   177  	This command does not remove images, containers, volumes, or user created
   178  	configuration files on your host. 
   179  
   180  3. To delete all images, containers, and volumes run the following command:
   181  
   182  		$ rm -rf /var/lib/docker
   183  
   184  4. Locate and delete any user-created configuration files.