Install Docker on Oracle Linux

Spread the love
  1. Log into your machine as a user with sudo or root
  2. Make sure your existing yum packages are up-to-date.
  1. $ sudo yum update
  2. Add the yum repo yourself.

For version 6:

$ sudo tee /etc/yum.repos.d/docker.repo <<-EOF

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/6

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

EOF

For version 7:

$ cat >/etc/yum.repos.d/docker.repo <<-EOF

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/7

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

EOF

  1. Install the Docker package.
  1. $ sudo yum install docker-engine
  1. Start the Docker daemon.

On Oracle Linux 6:

$ sudo service docker start

On Oracle Linux 7:

$ sudo systemctl start docker.service

  1. Verify docker is installed correctly by running a test image in a container.
  2. $ sudo docker run hello-world

To create the docker group and add your user:

  1. Log into Oracle Linux as a user with sudo
  2. Create the docker
  3. $ sudo groupadd docker
  4. Add your user to docker
  1. $ sudo usermod -aG docker username
  1. Log out and log back in.

This ensures your user is running with the correct permissions.

  1. Verify your work by running docker without sudo.
  2. $ docker run hello-world

If this fails with a message similar to this:

Cannot connect to the Docker daemon. Is ‘docker daemon’ running on this host?


Check that the DOCKER_HOST environment variable is not set for your shell. If it is, unset it.

Configure Docker to start on boot

You can configure the Docker daemon to start automatically at boot.

On Oracle Linux 6:

$ sudo chkconfig docker on

On Oracle Linux 7:

$ sudo systemctl enable docker.service

Use the btrfs storage engine

Docker on Oracle Linux 6 and 7 supports the use of the btrfs storage engine. Before enabling btrfs support, ensure that /var/lib/docker is stored on a btrfs-based filesystem. Review Chapter 5 of the Oracle Linux Administrator’s Solution Guide for details on how to create and mount btrfs filesystems.

To enable btrfs support on Oracle Linux:

  1. Ensure that /var/lib/docker is on a btrfs filesystem.
  2. Edit /etc/sysconfig/docker and add -s btrfs to the OTHER_ARGS
  3. Restart the Docker daemon:

Uninstallation

To uninstall the Docker package:

$ sudo yum -y remove docker-engine

The above command will not remove images, containers, volumes, or user created configuration files on your host. If you wish to delete all images, containers, and volumes run the following command:

$ rm -rf /var/lib/docker

You must delete the user created configuration files manually.

Leave a Reply

Your email address will not be published. Required fields are marked *