github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/docs/installation/linux/rhel.md (about)

     1  <!--[metadata]>
     2  +++
     3  aliases = [ "/engine/installation/rhel/"]
     4  title = "Installation on Red Hat Enterprise Linux"
     5  description = "Instructions for installing Docker on Red Hat Enterprise Linux."
     6  keywords = ["Docker, Docker documentation, requirements, linux,  rhel"]
     7  [menu.main]
     8  parent = "engine_linux"
     9  weight = -5
    10  +++
    11  <![end-metadata]-->
    12  
    13  # Red Hat Enterprise Linux
    14  
    15  Docker is supported on Red Hat Enterprise Linux 7. This page instructs you to
    16  install using Docker-managed release packages and installation mechanisms. Using
    17  these packages ensures you get the latest release of Docker. If you wish to
    18  install using Red Hat-managed packages, consult your Red Hat release
    19  documentation for information on Red Hat's Docker support.
    20  
    21  ## Prerequisites
    22  
    23  Docker requires a 64-bit installation regardless of your Red Hat version. Docker
    24  requires that your kernel must be 3.10 at minimum, which Red Hat 7 runs.
    25  
    26  To check your current kernel version, open a terminal and use `uname -r` to
    27  display your kernel version:
    28  
    29      $ uname -r
    30      3.10.0-229.el7.x86_64
    31  
    32  Finally, is it recommended that you fully update your system. Please keep in
    33  mind that your system should be fully patched to fix any potential kernel bugs.
    34  Any reported kernel bugs may have already been fixed on the latest kernel
    35  packages.
    36  
    37  ## Install Docker Engine
    38  
    39  There are two ways to install Docker Engine.  You can install with the `yum` package manager directly yourself. Or you can use `curl` with the  `get.docker.com` site. This second method runs an installation script which installs via the `yum` package manager.
    40  
    41  ### Install with yum
    42  
    43  1. Log into your machine as a user with `sudo` or `root` privileges.
    44  
    45  2. Make sure your existing yum packages are up-to-date.
    46  
    47    		$ sudo yum update
    48  
    49  3. Add the yum repo yourself.
    50  
    51          $ sudo tee /etc/yum.repos.d/docker.repo <<-EOF
    52          [dockerrepo]
    53          name=Docker Repository
    54          baseurl=https://yum.dockerproject.org/repo/main/centos/7
    55          enabled=1
    56          gpgcheck=1
    57          gpgkey=https://yum.dockerproject.org/gpg
    58          EOF
    59  
    60  4. Install the Docker package.
    61  
    62          $ sudo yum install docker-engine
    63  
    64  5. Start the Docker daemon.
    65  
    66  		$ sudo service docker start
    67  
    68  6. Verify `docker` is installed correctly by running a test image in a container.
    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  ### Install with the script
    97  
    98  You use the same installation procedure for all versions of CentOS.
    99  
   100  1. Log into your machine as a user with `sudo` or `root` privileges.
   101  
   102  2. Make sure your existing yum packages are up-to-date.
   103  
   104  		$ sudo yum update
   105  
   106  3. Run the Docker installation script.
   107  
   108  		$ curl -fsSL https://get.docker.com/ | sh
   109  
   110  4. Start the Docker daemon.
   111  
   112  		$ sudo service docker start
   113  
   114  5. Verify `docker` is installed correctly by running a test image in a container.
   115  
   116  		$ sudo docker run hello-world
   117  
   118  ## Create a docker group		
   119  
   120  The `docker` daemon binds to a Unix socket instead of a TCP port. By default
   121  that Unix socket is owned by the user `root` and other users can access it with
   122  `sudo`. For this reason, `docker` daemon always runs as the `root` user.
   123  
   124  To avoid having to use `sudo` when you use the `docker` command, create a Unix
   125  group called `docker` and add users to it. When the `docker` daemon starts, it
   126  makes the ownership of the Unix socket read/writable by the `docker` group.
   127  
   128  >**Warning**: The `docker` group is equivalent to the `root` user; For details
   129  >on how this impacts security in your system, see [*Docker Daemon Attack
   130  >Surface*](../../security/security.md#docker-daemon-attack-surface) for details.
   131  
   132  To create the `docker` group and add your user:
   133  
   134  1. Log into your machine as a user with `sudo` or `root` privileges.
   135  
   136  2. Create the `docker` group.
   137  
   138      `sudo groupadd docker`
   139  
   140  3. Add your user to `docker` group.
   141  
   142      `sudo usermod -aG docker your_username`
   143  
   144  4. Log out and log back in.
   145  
   146      This ensures your user is running with the correct permissions.
   147  
   148  5. Verify your work by running `docker` without `sudo`.
   149  
   150  			$ docker run hello-world
   151  
   152  ## Start the docker daemon at boot
   153  
   154  To ensure Docker starts when you boot your system, do the following:
   155  
   156      $ sudo chkconfig docker on
   157  
   158  If you need to add an HTTP Proxy, set a different directory or partition for the
   159  Docker runtime files, or make other customizations, read our Systemd article to
   160  learn how to [customize your Systemd Docker daemon options](../../admin/systemd.md).
   161  
   162  
   163  ## Uninstall
   164  
   165  You can uninstall the Docker software with `yum`.  
   166  
   167  1. List the package you have installed.
   168  
   169  		$ yum list installed | grep docker
   170  		yum list installed | grep docker
   171  		docker-engine.x86_64                1.7.1-0.1.el7@/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.