- Install Docker (Compose) on Oracle Linux 8
- Installing Docker Engine
- Installing Docker Compose
- Install docker & docker-compose on Oracle Linux
- Install Docker Engine
- Install docker-compose
- Docker : Install Docker on Oracle Linux 8 (OL8)
- Assumptions
- Install Docker
- Configure Disk (Optional)
- Finish Docker Setup
- Docker Commands as Non-Root User
- Install Docker (Compose) on Oracle Linux 8
- Installing Docker Engine
- Installing Docker Compose
Install Docker (Compose) on Oracle Linux 8
Welcome! I couldn’t find a simple, straightforward tutorial on how to do this. Everything written here is a summation of the Docker documentation on CentOS, as that is what OL is built upon. I will be using Oracle Linux 8 build 2020.12.17-0, for reference. Now, on to the tutorial!
Installing Docker Engine
sudo yum install -y yum-utils
sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo docker run hello-world
Installing Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Now, everything should work. Run docker-compose —version to confirm. And that’s it! Easy, right? Thank you for joining me on this adventure and I hope this was some help!
Install docker & docker-compose on Oracle Linux
By default on the new Enterprise Linux distributions, docker engine has been replaced by podman, a docker compliant engine. In order to install docker and docker-compose , you can follow this simple tutorial.
Install Docker Engine
To install docker engine we’ll add first the docker repository:
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Code language: JavaScript (javascript)
And now we can proceed to install docker:
sudo dnf install -y docker-ce docker-ce-cli containerd.io
Code language: CSS (css)
And we can start docker with systemctl
sudo systemctl start docker
Install docker-compose
First let’s download docker-compose to /usr/local/bin
sudo curl -L "sudo curl -L "https://github.com/docker/compose/releases/download/v2.19.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Code language: JavaScript (javascript)
chmod +x /usr/local/bin/docker-compose
Finally, let’s add a link to docker-compose to /usr/bin (this step is not needed if you have /usr/local/bin in your PATH).
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Et voilá, everything is set. You can check if docker-compose is working by running docker-compose —version
Docker : Install Docker on Oracle Linux 8 (OL8)
This article demonstrates how to install Docker on Oracle Linux 8 (OL8). RHEL8, and therefore OL8, have switched their focus from Docker and on to Podman (here) for containers, so this installation uses the Docker CE installation from the Docker repository.
Assumptions
This article makes the following assumptions.
- You have a server (physical or virtual) with Oracle Linux 8 (OL8) installed. This is described here.
- You have a separate partition to hold the images and containers. In this article we have a separate virtual disk.
Install Docker
Enable all the required repositories. To do this you are going to need the yum-utils package.
dnf install -y dnf-utils zip unzip dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf remove -y runc dnf install -y docker-ce --nobest
Configure Disk (Optional)
By default the containers are created under the «/var/lib/docker», so you really need to house this on a separate disk or in a separate partition.
I have a second LUN with a device named «/dev/sdb». I could build the file system on this disk directly, but I prefer to partition the disks with a single partition using fdisk..
MOUNT_POINT=/var/lib/docker DISK_DEVICE=/dev/sdb # New partition for the whole disk. echo -e «n\np\n1\n\n\nw» | fdisk $ # Add file system. mkfs.xfs -f $1 # Mount it using the UUID of the VirtualBox virtual disk. # rm -Rf /var/lib/docker # mkdir /var/lib/docker UUID=`blkid -o export $1 | grep UUID | grep -v PARTUUID` mkdir $ echo «$ $ xfs defaults 1 2» >> /etc/fstab mount $
Finish Docker Setup
Enable and start the Docker service.
# systemctl enable docker.service # systemctl start docker.service
You can get information about docker using the following commands.
# systemctl status docker.service # docker info # docker version
You are now ready to start using Docker!
Docker Commands as Non-Root User
Docker commands run as the «root» user. You have three choices when if comes to running docker commands.
- Run the docker commands from the root user.
- Allow another user to perform «sudo» on the docker command, so all commands are run using «sudo docker . «.
- Create a group called docker and assign that to the user you want to run docker commands from. The documentation says, «Warning: The docker group grants privileges equivalent to the root user», so we should avoid this.
In this case we want to run the docker commands from a user called «docker_user», so we add an entry in the «/etc/sudoers» file and use an alias in the user’s «.bash_profile» file so we don’t have to keep typing the «sudo» command.
# useradd docker_user # echo "docker_user ALL=(ALL) NOPASSWD: /usr/bin/docker" >> /etc/sudoers # echo "alias docker=\"sudo /usr/bin/docker\"" >> /home/docker_user/.bash_profile # su - docker_user $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $
Hope this helps. Regards Tim.
Created: 2020-05-10 Updated: 2021-03-01
Install Docker (Compose) on Oracle Linux 8
Welcome! I couldn’t find a simple, straightforward tutorial on how to do this. Everything written here is a summation of the Docker documentation on CentOS, as that is what OL is built upon. I will be using Oracle Linux 8 build 2020.12.17-0, for reference. Now, on to the tutorial!
Installing Docker Engine
sudo yum install -y yum-utils
Next, we add the Docker repository
sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
Now, we can install Docker. Answer y for all prompts.
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
Optionally, run the hello-world image to make sure everything works
sudo docker run hello-world
Installing Docker Compose
First, download Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Add execution perms to the download
sudo chmod +x /usr/local/bin/docker-compose
Lastly, we need to link to the docker-compose command
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Now, everything should work. Run docker-compose —version to confirm.
Thank you for joining me on this adventure and I hope this was some help!