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