Oracle linux docker compose

Установка Docker на Oracle Linux

Контейнеризация – это упрошенная форма виртуализации на уровне операционной системы. В данном посте описано понятие виртуализации. Контейнеризация позволяет запускать приложение в изолированной области, называемой контейнером. Каждый контейнер содержит все необходимые компоненты для запуска приложения. Контейнер представляет собой исполняемый пакет программного обеспечения, работающий поверх операционной системы. Одним из наиболее популярных инструментов управления виртуальными контейнерами является Docker. Он решает множество задач, связанных с созданием контейнеров, размещением в них приложений, управлением процессами, а также тестированием программного обеспечения и его отдельных компонентов.

Далее рассматривается установка Docker в среде Linux (дистрибутив Oracle Linux 7). Для этого, необходимо выполнить следующие шаги:

1. Настроить открытый консольный менеджер пакетов yum в дистрибутиве Oracle Linux.

Необходимо включить репозитории ol7_latest, ol7_uekr4, ol7_optional_latest и ol7_addons. Для этого надо в директорию /etc/yum.repos.d/ скачать файл репозитория public-yum-ol7.repo. Делается это следующими командами под пользователем root (операционная система должна иметь доступ к интернету):

Хотелось бы коротко написать, что репозитории это сервера в интернете или в локальной сети, которые настроены для хранения и предоставления доступа к файлам пакетов приложений Linux. Другими словами, пользователи из репозиторий могут скачать или обновить свои приложения для Linux.

Проверяется файл public-yum-ol7.repo на наличие блоков ol7_latest, ol7_uekr4, ol7_optional_latest и ol7_addons. В случае отсутствия, необходимо добавить нижеследующие строки в файл public-yum-ol7.repo. Надо убедиться, что значение для параметра enabled равняется 1.

После того, как репозитории настроены, необходимо перезагрузить операционную систему.

2. Запускается установка docker под пользователем root.

Здесь надо подтвердить установку и обновление путем нажатия y

Для установки необходимо нажатие y

Лог установки показывает, что установка Docker успешно завершена (Complete!).

3. После успешного завершения установки надо запустить сервис docker.

Установка Docker завершена. Можно начать использовать Docker для создания новых контейнеров.

Источник

Docker : Docker Compose — Defining Multi-Container Applications

This article describes how to use Docker Compose to create multi-container applications.

Installation

Docker Compose can be downloaded from GitHub and the general installation instructions can be found here. Always use the latest release.

When we were setting up a non-root user for Docker (here) we did the following sudo and profile setup.

We can do a similar setup for Docker Compose too.

Defining Services

Services are typically defined using YAML in a «docker-compose.yml» file, though JSON files can also be used. The compose file reference, explains how the file is defined. Once you have manually run a couple of containers you will recognise most of the pieces. This file contains a definition of how to start each of the containers that make up the multi-container application, with their associated dependencies, networks and volumes etc.

Читайте также:  Blur download windows 10

As an example, check out this docker-compose.yml file, which builds a 12cR2 database container and an ORDS container, allowing you to run APEX applications.

You should navigate to the directory containing the «docker-compose.yml» file before running the following commands.

Starting Services

You can start a service by using the run , start or up commands, but you will typically use the docker-compose up command. By default it doesn’t release the screen, but it can be detached using the «-d» option.

When you are using the «-d» option, you don’t see the log, but this can be displayed using the following command.

Stopping Services

If you haven’t used the «-d» option, you can use CTRL+C to gracefully stop the containers. If you did use the «-d» option, you will need to use the docker-compose stop command.

You could also remove the services with the stop option, described below.

Removing Services

Services are removed using the docker-compose rm command. It will remove any stopped containers associated with a service.

Источник

Docker : Install Docker on Oracle Linux 7 (OL7)

This article demonstrates how to install Docker on Oracle Linux 7 (OL7) using a BTRFS file system.

Assumptions

This article makes the following assumptions.

  • You have a server (physical or virtual) with Oracle Linux 7 (OL7) 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.

Install Docker and BTRFS.

Configure BTRFS

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, preferably using BTRFS as the file system.

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. These responses will create a new partition using the whole of the disk («n», «p», «return», «return», «return», «w»).

Make the BTRFS file system on the «sdb1» partition. The Oracle Linux 7 Configuring Docker Storage manual describes how to use the docker-storage-config utility to do this with a single command.

We can see the file system is added to the «/etc/fstab» file and has been mounted under «/var/lib/docker» by the utility.

If we didn’t have access to the docker-storage-config utility we could have used the following commands.

Finish Docker Setup

Enable and start the Docker service.

Читайте также:  Windows installer error codes 1642

You can get information about docker using the following commands.

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.

Experimental Features

If you want to try the experimental features, you will need to enable them for the Docker engine. To do this on Oracle Linux edit the «/etc/sysconfig/docker» file and append «—experimental=true» to the OPTIONS setting.

Then restart the Docker service.

Troubleshooting

The first time you attempt the pull down a new image you may see the following type of error.

Assuming you have a valid internet connection, the problem will probably be fixed by restarting the Docker service.

Источник

AWX Installation on Oracle Linux 7 (OL7) Using the Docker-Compose Method

This article describes how to install AWX, the upstream project for Ansible Tower, on Oracle Linux 7 (OL7) using the Docker-Compose method.

There is a Vagrant build that allows you to complete this whole installation, including Docker and AWX, in a single command available here.

Assumptions

  • You have a clean installation of Oracle Linux 7.
  • You have at least one spare disk (real or virtual) to act as the «/var/lib/docker» mount point using BTRFS.
  • You have a location called «/u01», which is either on a separate disk, or under the «/» mount point. Preferable not the latter.
  • All actions performed as the «root» user.

Install Docker

The installation of Docker on Oracle Linux is described in full here. To keep things simple I’ve abbreviated it here. Some of these actions are destructive, so if in doubt read the related article.

Make sure the relevant repositories are enabled.

Install the Docker engine OS packages.

Complete the Docker installation. This assumes the disk used for the docker images is «/dev/sdc».

Install AWX

Install the required Ansible, PIP and Git packages.

Make sure the Python libraries are present for Docker and Docker-Compose.

Clone the AWX repository and switch to the installer directory.

Amend the contents of the «./inventory» file as you see fit. It includes an assortment of paths and credentials. You could do the run without amending any of these and it will work, but for anything other than a playground it’s worth making some changes. Here are some of the obvious things you may want to change.

Читайте также:  Windows server 2019 добавить домен

In my Vagrant build I use the following sed commands to make changes based on environment variable values. It will give you an idea of what you should be considering amending.

You are now in a position to install AWX. Issue the following command to run the installation playbook.

Use It

Once the installation is complete, you should have a running AWX environment. The web interface is available from the following URLs by default.

In my vagrant build I use port forwarding to make them available from the following URLs on my host machine.

Источник

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.

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..

Finish Docker Setup

Enable and start the Docker service.

You can get information about docker using the following commands.

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.

Источник

Оцените статью