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

     1  <!--[metadata]>
     2  +++
     3  aliases = [ "/engine/installation/oracle/"]
     4  title = "Installation on Oracle Linux"
     5  description = "Installation instructions for Docker on Oracle Linux."
     6  keywords = ["Docker, Docker documentation, requirements, linux, rhel, centos, oracle,  ol"]
     7  [menu.main]
     8  parent = "engine_linux"
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Oracle Linux
    13  
    14  Docker is supported Oracle Linux 6 and 7. You do not require an Oracle Linux
    15  Support subscription to install Docker on Oracle Linux.
    16  
    17  ## Prerequisites
    18  
    19  Due to current Docker limitations, Docker is only able to run only on the x86_64
    20  architecture. Docker requires the use of the Unbreakable Enterprise Kernel
    21  Release 4 (4.1.12) or higher on Oracle Linux. This kernel supports the Docker
    22  btrfs storage engine on both Oracle Linux 6 and 7.
    23  
    24  ## Install
    25  
    26  
    27  > **Note**: The procedure below installs binaries built by Docker. These binaries
    28  > are not covered by Oracle Linux support. To ensure Oracle Linux support, please
    29  > follow the installation instructions provided in the
    30  > [Oracle Linux documentation](https://docs.oracle.com/en/operating-systems/?tab=2).
    31  >
    32  > The installation instructions for Oracle Linux 6 can be found in [Chapter 10 of
    33  > the Administrator&apos;s
    34  > Solutions Guide](https://docs.oracle.com/cd/E37670_01/E37355/html/ol_docker.html)
    35  >
    36  > The installation instructions for Oracle Linux 7 can be found in [Chapter 29 of
    37  > the Administrator&apos;s
    38  > Guide](https://docs.oracle.com/cd/E52668_01/E54669/html/ol7-docker.html)
    39  
    40  
    41  1. Log into your machine as a user with `sudo` or `root` privileges.
    42  
    43  2. Make sure your existing yum packages are up-to-date.
    44  
    45          $ sudo yum update
    46  
    47  3. Add the yum repo yourself.
    48  
    49      For version 6:
    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/oraclelinux/6
    55          enabled=1
    56          gpgcheck=1
    57          gpgkey=https://yum.dockerproject.org/gpg
    58          EOF
    59  
    60      For version 7:
    61  
    62          $ cat >/etc/yum.repos.d/docker.repo <<-EOF
    63          [dockerrepo]
    64          name=Docker Repository
    65          baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/7
    66          enabled=1
    67          gpgcheck=1
    68          gpgkey=https://yum.dockerproject.org/gpg
    69          EOF
    70  
    71  4. Install the Docker package.
    72  
    73          $ sudo yum install docker-engine
    74  
    75  5. Start the Docker daemon.
    76  
    77       On Oracle Linux 6:
    78  
    79          $ sudo service docker start
    80  
    81       On Oracle Linux 7:
    82  
    83          $ sudo systemctl start docker.service
    84  
    85  6. Verify `docker` is installed correctly by running a test image in a container.
    86  
    87          $ sudo docker run hello-world
    88  
    89  ## Optional configurations
    90  
    91  This section contains optional procedures for configuring your Oracle Linux to work
    92  better with Docker.
    93  
    94  * [Create a docker group](#create-a-docker-group)
    95  * [Configure Docker to start on boot](#configure-docker-to-start-on-boot)
    96  * [Use the btrfs storage engine](#use-the-btrfs-storage-engine)
    97  
    98  ### Create a Docker group		
    99  
   100  The `docker` daemon binds to a Unix socket instead of a TCP port. By default
   101  that Unix socket is owned by the user `root` and other users can access it with
   102  `sudo`. For this reason, `docker` daemon always runs as the `root` user.
   103  
   104  To avoid having to use `sudo` when you use the `docker` command, create a Unix
   105  group called `docker` and add users to it. When the `docker` daemon starts, it
   106  makes the ownership of the Unix socket read/writable by the `docker` group.
   107  
   108  >**Warning**: The `docker` group is equivalent to the `root` user; For details
   109  >on how this impacts security in your system, see [*Docker Daemon Attack
   110  >Surface*](../../security/security.md#docker-daemon-attack-surface) for details.
   111  
   112  To create the `docker` group and add your user:
   113  
   114  1. Log into Oracle Linux as a user with `sudo` privileges.
   115  
   116  2. Create the `docker` group.
   117  
   118          sudo groupadd docker
   119  
   120  3. Add your user to `docker` group.
   121  
   122          sudo usermod -aG docker username
   123  
   124  4. Log out and log back in.
   125  
   126      This ensures your user is running with the correct permissions.
   127  
   128  5. Verify your work by running `docker` without `sudo`.
   129  
   130          $ docker run hello-world
   131  
   132  	If this fails with a message similar to this:
   133  
   134  		Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?
   135  
   136  	Check that the `DOCKER_HOST` environment variable is not set for your shell.
   137  	If it is, unset it.
   138  
   139  ### Configure Docker to start on boot
   140  
   141  You can configure the  Docker daemon to start automatically at boot.
   142  
   143  On Oracle Linux 6:
   144  
   145  ```
   146  $ sudo chkconfig docker on
   147  ```
   148  
   149  On Oracle Linux 7:
   150  
   151  ```
   152  $ sudo systemctl enable docker.service
   153  ```
   154  
   155  If you need to add an HTTP Proxy, set a different directory or partition for the
   156  Docker runtime files, or make other customizations, read our systemd article to
   157  learn how to [customize your systemd Docker daemon options](../../admin/systemd.md).
   158  
   159  ### Use the btrfs storage engine
   160  
   161  Docker on Oracle Linux 6 and 7 supports the use of the btrfs storage engine.
   162  Before enabling btrfs support, ensure that `/var/lib/docker` is stored on a
   163  btrfs-based filesystem. Review [Chapter
   164  5](http://docs.oracle.com/cd/E37670_01/E37355/html/ol_btrfs.html) of the [Oracle
   165  Linux Administrator's Solution
   166  Guide](http://docs.oracle.com/cd/E37670_01/E37355/html/index.html) for details
   167  on how to create and mount btrfs filesystems.
   168  
   169  To enable btrfs support on Oracle Linux:
   170  
   171  1. Ensure that `/var/lib/docker` is on a btrfs filesystem.
   172  
   173  2. Edit `/etc/sysconfig/docker` and add `-s btrfs` to the `OTHER_ARGS` field.
   174  
   175  3. Restart the Docker daemon:
   176  
   177  ## Uninstallation
   178  
   179  To uninstall the Docker package:
   180  
   181      $ sudo yum -y remove docker-engine
   182  
   183  The above command will not remove images, containers, volumes, or user created
   184  configuration files on your host. If you wish to delete all images, containers,
   185  and volumes run the following command:
   186  
   187      $ rm -rf /var/lib/docker
   188  
   189  You must delete the user created configuration files manually.
   190  
   191  ## Known issues
   192  
   193  ### Docker unmounts btrfs filesystem on shutdown
   194  If you're running Docker using the btrfs storage engine and you stop the Docker
   195  service, it will unmount the btrfs filesystem during the shutdown process. You
   196  should ensure the filesystem is mounted properly prior to restarting the Docker
   197  service.
   198  
   199  On Oracle Linux 7, you can use a `systemd.mount` definition and modify the
   200  Docker `systemd.service` to depend on the btrfs mount defined in systemd.
   201  
   202  ### SElinux support on Oracle Linux 7
   203  SElinux must be set to `Permissive` or `Disabled` in `/etc/sysconfig/selinux` to
   204  use the btrfs storage engine on Oracle Linux 7.
   205  
   206  ## Further issues?
   207  
   208  If you have a current Basic or Premier Support Subscription for Oracle Linux,
   209  you can report any issues you have with the installation of Docker via a Service
   210  Request at [My Oracle Support](http://support.oracle.com).
   211  
   212  If you do not have an Oracle Linux Support Subscription, you can use the [Oracle
   213  Linux
   214  Forum](https://community.oracle.com/community/server_%26_storage_systems/linux/oracle_linux) for community-based support.